SeaORM v2.0.0-rc.38 Release Notes
Release Date: 2026-04-09 // about 2 months ago-
๐ Release Notes: SeaORM 2.0.0-rc.38
(since 2.0.0-rc.37)
๐ New Features
find_both_related()โ required inner join loader (#2997)A new
find_both_related()method returnsVec<(E::Model, F::Model)>(both sides non-optional), as a counterpart to the existingfind_also_related()which returnsVec<(E::Model, Option<F::Model>)>. Use this when you know the relation is always populated and want to avoid theOptionunwrap:letresults:Vec\<(Order,LineItem)\>=Order::find().find\_both\_related(LineItem).all(db).await?;set_ne/set_ne_andaliases onActiveValue(#3040)Shorter aliases for
set_if_not_equalsandset_if_not_equals_and. The long-form names are kept as compatibility aliases:// Beforeactive_model.name.set\_if\_not\_equals("Alice");// Afteractive_model.name.set\_ne("Alice");map_sqlx_*_pool_optsonConnectOptions(#2770)Three new methods to customise the underlying
sqlx::pool::PoolOptionsbefore the connection pool is created โ one per driver:ConnectOptions::new(DATABASE\_URL).map\_sqlx\_postgres\_pool\_opts(|opts| opts.max\_connections(20).min\_connections(5)).to\_owned()๐
BTreeMap/HashMapsupport inTryGetableFromJson(#3009)Map types can now be used directly as model fields when the column holds a JSON object:
pubstructModel{pubid:i32,pubmetadata:HashMap\<String,serde_json::Value\>,}Inherited visibility in derive macros (#3029)
DeriveEntityModel,DeriveActiveModel,DeriveModel, and related macros now inherit thepub(crate)/pub(super)/ private visibility of the struct they are applied to, instead of always emittingpubitems.๐ Bug Fixes
๐ Schema sync: drop unique constraint on PostgreSQL (#2994)
๐
DROP INDEXfails on PostgreSQL for unique indexes created via column-levelUNIQUEbecause they are backed by a named constraint, not a standalone index. Schema sync now usesALTER TABLE โฆ DROP CONSTRAINTon PostgreSQL and falls back toDROP INDEXon other backends.๐ Schema sync: tables in non-default schemas now discovered (#3016)
sync()previously ran schema discovery only againstCURRENT_SCHEMA(). Entities with#[sea_orm(schema_name = "other")]were never found, causing every sync to attempt a redundantCREATE TABLE. Discovery now collects all schemas referenced by registered entities and queries each one.Nested
PartialModelnull detection for optional fields (#3039)A nested
Option<PartialModel>loaded via a left join could incorrectly fail withMissing value for column 'id'when the nested model itself containedOption<T>fields. The null check now correctly handles arbitraryOptionnesting depth.use_transactionper-migration config was ignored (#3002)exec_with_connectionunconditionally wrapped all PostgreSQL migration operations in a transaction, overriding the per-migrationuse_transactionsetting. The macro has been removed and each call site now uses the correct connection type.Proc macros failed on long type paths with newlines (#3031)
DeriveActiveModelExand other derive macros used.replace(' ', "")to strip whitespace, which missed newlines in formatted type paths longer than ~50 characters. Replaced with.split_whitespace().collect().TIMESTAMPTZconversion in the Postgres proxy driver (#3004)from_sqlx_postgres_row_to_proxy_rownow correctly convertsTIMESTAMPTZcolumns, fixing a panic when using the proxy driver with timestamptz fields.โก๏ธ Dependency Updates
Previous changes from v2.0.0-rc.37
-
๐ New Features
ER Diagram Generation (
sea-orm-cli generate entity --er-diagram)sea-orm-clican now generate a Mermaid ER diagram alongside the entity files. Pass--er-diagramto writeentities.mermaidinto the output directory:sea-orm-cli generate entity -u postgres://... -o src/entity --er-diagramThe diagram annotates columns with
PK,FK, andUKmarkers and renders all relations โ including many-to-many via junction tables โ as MermaiderDiagramsyntax. Example output:โฑ PostgreSQL Statement Timeout (
ConnectOptions::statement_timeout)โฑ
ConnectOptionsnow accepts astatement_timeoutfor PostgreSQL connections. The timeout is set via the connection options at connect time (no extra round-trip) and causes the server to abort any statement that exceeds the duration:ConnectOptions::new(DATABASE\_URL).statement\_timeout(Duration::from\_secs(30)).to\_owned()Has no effect on MySQL or SQLite connections.
๐ SQLite
?mode=URL Parameter Support (#2987)๐ The rusqlite driver now parses the
?mode=query parameter from SQLite connection URLs, matching the behaviour of the sqlx SQLite driver:Mode Behaviour 0๏ธโฃ rwc(default)rwRead-write, must exist roRead-only memoryIn-memory database // Open an existing database read-onlyletdb =Database::connect("sqlite:./data.db?mode=ro").await?;๐ Unsupported parameters or unknown mode values return a
DbErr::Connerror.๐ Bug Fixes
0๏ธโฃ
no-default-featurescompile errors withmac_addressandproxy(#2992)- โ
with-mac_addressfeature: added missingTryGetableimpls,try_from_u64impl, postgres array support, andwith-jsonserde flag - ๐
proxyfeature: removed an accidental hard dependency onserde_json(now only activated viawith-json) - ๐ Fixed
cfgguards on JSON/JSONB proxy row handling to requirewith-json
- โ
