SeaORM v0.4.0 Release Notes
Release Date: 2021-11-19 // over 2 years ago-
🛠 Fixed Issues
- 🌲 Disable SQLx query logging https://github.com/SeaQL/sea-orm/issues/290
- Code generated by
sea-orm-cli
cannot pass clippy https://github.com/SeaQL/sea-orm/issues/296 - Should return detailed error message for connection failure https://github.com/SeaQL/sea-orm/issues/310
DateTimeWithTimeZone
does not implementSerialize
andDeserialize
https://github.com/SeaQL/sea-orm/issues/319- 👌 Support returning clause to avoid database hits https://github.com/SeaQL/sea-orm/issues/183
🔀 Merged PRs
- ⚡️ chore: update to Rust 2021 Edition by @sno2 in https://github.com/SeaQL/sea-orm/pull/273
- Enumeration - 3 by @billy1624 in https://github.com/SeaQL/sea-orm/pull/274
- Enumeration - 2 by @billy1624 in https://github.com/SeaQL/sea-orm/pull/261
- ⚠ Codegen fix clippy warnings by @billy1624 in https://github.com/SeaQL/sea-orm/pull/303
- ➕ Add axum example by @YoshieraHuang in https://github.com/SeaQL/sea-orm/pull/297
- Enumeration by @billy1624 in https://github.com/SeaQL/sea-orm/pull/258
- ➕ Add
PaginatorTrait
andCountTrait
for more constraints by @YoshieraHuang in https://github.com/SeaQL/sea-orm/pull/306 - Continue
PaginatorTrait
by @billy1624 in https://github.com/SeaQL/sea-orm/pull/307 - 🔨 Refactor
Schema
by @billy1624 in https://github.com/SeaQL/sea-orm/pull/309 - Detailed connection errors by @billy1624 in https://github.com/SeaQL/sea-orm/pull/312
- ⚠ Suppress
ouroboros
missing docs warnings by @billy1624 in https://github.com/SeaQL/sea-orm/pull/288 with-json
feature requireschrono/serde
by @billy1624 in https://github.com/SeaQL/sea-orm/pull/320- Pass the argument
entity.table_ref()
instead of justentity
. by @josh-codes in https://github.com/SeaQL/sea-orm/pull/318 - Unknown types could be a newtypes instead of
ActiveEnum
by @billy1624 in https://github.com/SeaQL/sea-orm/pull/324 - Returning by @billy1624 in https://github.com/SeaQL/sea-orm/pull/292
💥 Breaking Changes
🔨 Refactor
paginate()
&count()
utilities intoPaginatorTrait
. You can use the paginator as usual but you might need to importPaginatorTrait
manually when upgrading from the previous version.use futures::TryStreamExt; use sea_orm::{entity::*, query::*, tests_cfg::cake}; let mut cake_stream = cake::Entity::find() .order_by_asc(cake::Column::Id) .paginate(db, 50) .into_stream(); while let Some(cakes) = cake_stream.try_next().await? { // Do something on cakes: Vec<cake::Model> }
The helper struct
Schema
convertingEntityTrait
into differentsea-query
statements now has to be initialized withDbBackend
.use sea_orm::{tests_cfg::*, DbBackend, Schema}; use sea_orm::sea_query::TableCreateStatement; // 0.3.x let _: TableCreateStatement = Schema::create_table_from_entity(cake::Entity); // 0.4.x let schema: Schema = Schema::new(DbBackend::MySql); let _: TableCreateStatement = schema.create_table_from_entity(cake::Entity);
⚡️ When performing insert or update operation on
ActiveModel
against PostgreSQL,RETURNING
clause will be used to perform select in a single SQL statement.// For PostgreSQL cake::ActiveModel { name: Set("Apple Pie".to_owned()), ..Default::default() } .insert(&postgres_db) .await?; assert_eq!( postgres_db.into_transaction_log(), vec![Transaction::from_sql_and_values( DbBackend::Postgres, r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id", "name""#, vec!["Apple Pie".into()] )]);
// For MySQL & SQLite cake::ActiveModel { name: Set("Apple Pie".to_owned()), ..Default::default() } .insert(&other_db) .await?; assert_eq!( other_db.into_transaction_log(), vec![ Transaction::from_sql_and_values( DbBackend::MySql, r#"INSERT INTO `cake` (`name`) VALUES (?)"#, vec!["Apple Pie".into()] ), Transaction::from_sql_and_values( DbBackend::MySql, r#"SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = ? LIMIT ?"#, vec![15.into(), 1u64.into()] )]);
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.3.2...0.4.0