SeaORM 2.0.4
(since 2.0.3)
Enhancements
-
Add
select_exceptto select all columns except the given ones #3211select_exceptprovides the inverse ofselect_only/column——selecting all columns except the specified ones.These methods replace the current selection, so the last one called takes effect.
#[derive(DerivePartialModel)] #[sea_orm(entity = "post::Entity")] struct PostPreview { id: i32, title: String, } let posts = post::Entity::find() .select_except([post::Column::Body]) .into_model::<PostPreview>() .all(db) .await?;
Bug Fixes
-
Fix chained
left_join_linkedusing the wrong alias for links with multiple relations #3199When
left_join_linkedwas called more than once, later joins in a multi-relation link could refer to aliases belonging to the first call. The query remained valid but could return incorrect rows.cake::Entity::find() .left_join_linked(CakeToFilling) .left_join_linked(CakeToFillingVendor)
-- before LEFT JOIN `filling` AS `r3` ON `r0`.`filling_id` = `r3`.`id` -- after LEFT JOIN `filling` AS `r3` ON `r2`.`filling_id` = `r3`.`id`
-
Respect
condition_typein linked joins #3203left_join_linkedandfind_linkedalways combined the relation condition andon_conditionwithAND, even whenConditionType::Anywas specified.They now follow
condition_type, matching regularjoin().cake::Relation::Fruit .def() .condition_type(ConditionType::Any) .on_condition(|_left, right| { Expr::col((right, fruit::Column::Name)) .like("%tropical%") .into_condition() })
-- before LEFT JOIN `fruit` AS `r0` ON `cake`.`id` = `r0`.`cake_id` AND `r0`.`name` LIKE '%tropical%' -- after LEFT JOIN `fruit` AS `r0` ON `cake`.`id` = `r0`.`cake_id` OR `r0`.`name` LIKE '%tropical%'
-
Fix
save_asnot being applied to array values ineq_any/ne_all#3208#[sea_orm(column_type = r#"custom("citext")"#, save_as = "citext")] pub email: String, Entity::find().filter(Column::Email.eq_any(["a@x.com".to_owned(), "B@x.com".to_owned()]))
-- before: text[], case-sensitive WHERE "user"."email" = ANY(ARRAY ['a@x.com','B@x.com']) -- after WHERE "user"."email" = ANY(CAST(ARRAY ['a@x.com','B@x.com'] AS citext[]))
-
Fix schema sync failing to drop a stale unique index on MySQL #3202
Removing
#[sea_orm(unique)]from a column could make the next schema sync fail with MySQL error 1064.
Upgrades
-
Upgrade
arrowto 60 (sea-orm-arrow2.0.0-rc.5)with-arrownow builds against arrow 60. Arrow types passed to SeaORM, such as aRecordBatchforfrom_arrow, must come from arrow 60 too, so crates likeparquetneed the matching version.arrow = "60" parquet = "60"