Skip to content

Commit 23f5477

Browse files
committed
Changelog
1 parent 219d4d0 commit 23f5477

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ let user = user::ActiveModel::builder()
463463

464464
* [sea-orm-cli] Added `--column-extra-derives` https://github.com/SeaQL/sea-orm/pull/2212
465465
* [sea-orm-cli] Added `--big-integer-type=i32` to use i32 for bigint (for SQLite)
466+
* [sea-orm-cli] Fix codegen to not generate relations to filtered entities https://github.com/SeaQL/sea-orm/pull/2913
466467
* Added `Model::try_set`
467468
* Added new error variant `BackendNotSupported`. Previously, it panics with e.g. "Database backend doesn't support RETURNING" https://github.com/SeaQL/sea-orm/pull/2630
468469
```rust
@@ -610,6 +611,45 @@ impl std::str::FromStr for Tag3 {
610611
}
611612
}
612613
```
614+
* Fix `DeriveIntoActiveModel` on `Option<T>` fields https://github.com/SeaQL/sea-orm/pull/2926
615+
```rust
616+
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
617+
#[sea_orm(table_name = "fruit")]
618+
pub struct Model {
619+
#[sea_orm(primary_key)]
620+
pub id: i32,
621+
pub name: String,
622+
pub cake_id: Option<i32>,
623+
}
624+
625+
#[derive(DeriveIntoActiveModel)]
626+
#[sea_orm(active_model = "<fruit::Entity as EntityTrait>::ActiveModel")]
627+
struct PartialFruit {
628+
cake_id: Option<i32>,
629+
}
630+
631+
assert_eq!(
632+
PartialFruit { cake_id: Some(1) }.into_active_model(),
633+
fruit::ActiveModel { id: NotSet, name: NotSet, cake_id: Set(Some(1)) }
634+
);
635+
636+
assert_eq!(
637+
PartialFruit { cake_id: None }.into_active_model(),
638+
fruit::ActiveModel { id: NotSet, name: NotSet, cake_id: NotSet }
639+
);
640+
```
641+
* `FromQueryResult` now supports nullable nested model https://github.com/SeaQL/sea-orm/pull/2845
642+
```rust
643+
#[derive(FromQueryResult)]
644+
struct CakeWithOptionalBakeryModel {
645+
#[sea_orm(alias = "cake_id")]
646+
id: i32,
647+
#[sea_orm(alias = "cake_name")]
648+
name: String,
649+
#[sea_orm(nested)]
650+
bakery: Option<bakery::Model>, // can be null
651+
}
652+
```
613653

614654
### Breaking Changes
615655

0 commit comments

Comments
 (0)