Release Notes: SeaORM 2.0.0-rc.42
(since 2.0.0-rc.41)
New Features
Typed value arrays via try_getable_array (#3108, #2967)
DeriveValueType wrappers backed by a Vec<_> now round-trip as native
PostgreSQL arrays: the derive generates a try_getable_array implementation, so
a newtype over Vec<i32> reads and writes as INTEGER[] without a manual
TryGetable impl.
#[derive(Clone, Debug, PartialEq, DeriveValueType)]
pub struct Tags(Vec<String>);Replace and delete a nested HasOne (#3110, #3060, #3061)
The active has-one type (ActiveHasOne) gains a Delete variant plus generated
delete_<field> / set_<field>_option builders. Setting a populated has-one now
replaces the existing linked record (deleting or orphaning the old one) instead
of erroring, and Delete removes it on save.
let mut user = user::Entity::load().filter_by_id(1).with(profile::Entity).one(db).await?.unwrap();
user.delete_profile().save(db).await?; // remove the linked profileTryFrom<&str> for active enums (#3111)
DeriveActiveEnum now generates a TryFrom<&str> implementation, so a string
value can be parsed straight into the enum by its database string representation.
let color = Color::try_from("Black")?;Enhancements
ActiveHasOne / ActiveHasMany (renamed)
The active/write-side companions to HasOne / HasMany are renamed from
HasOneModel / HasManyModel to ActiveHasOne / ActiveHasMany, so the names
read as active-model values rather than loaded models. The read-side HasOne /
HasMany types are unchanged.
Documented SqlErr and DbErr::sql_err() (#2940)
DbErr::sql_err() and the SqlErr variants are documented, including how to reach
the raw driver error for backend-specific handling.
if let Some(SqlErr::UniqueConstraintViolation(_)) = err.sql_err() { /* ... */ }Schema sync warns on column-type divergence (#3106)
SchemaBuilder::sync() logs a warning when a live column's type diverges from the
entity definition instead of silently ignoring the difference.
Bug Fixes
Codegen ColumnType coverage (#3092)
Entity generation emits compiling code for Year, Bit, VarBit, MacAddr,
LTree, and Interval columns, and for Money columns carrying precision and
scale — previously these produced non-compiling ColumnType expressions.
Skip generated columns in entity generation (#3094)
sea-orm-cli generate entity skips database-generated columns, which cannot be
inserted or updated, instead of emitting them as ordinary fields.
SchemaBuilder::sync() returns a Send future (#3100)
Regression fix: sync() no longer returns a non-Send future, so it can be used
across .await points on multi-threaded runtimes. Released together with
sea-schema 0.18.1.
sea-orm-sync generation fixes (#3112)
The make-sync transform correctly handles futures_util usage in the mock
driver, keeping the blocking sea-orm-sync crate in sync with the async source.
Compatibility Notes
HasOneModel/HasManyModelare renamed toActiveHasOne/ActiveHasMany.
Update references; the read-sideHasOne/HasManyare unaffected.DbErr,UpdateResult,DeleteResult,ActiveHasOne, andActiveHasManyare
now#[non_exhaustive]; downstreammatches need a wildcard arm.- Schema sync and nested-ActiveModel relation mutation are marked unstable
(semver-exempt) while their APIs settle. - Prebuilt
sea-orm-clibinaries no longer include the Intel macOS
(x86_64-apple-darwin) target.