All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Fix sea-orm-cli error
- Fix sea-orm cannot build without
with-json
- Update ActiveModel by JSON by @billy1624 in SeaQL#492
- Supports
time
crate by @billy1624 SeaQL#602 - Allow for creation of indexes for PostgreSQL and SQLite @nickb937 SeaQL#593
- Added
delete_by_id
@ShouvikGhosh2048 SeaQL#590 - Implement
PaginatorTrait
forSelectorRaw
@shinbunbun SeaQL#617
- Added axum graphql example by @aaronleopold in SeaQL#587
- Add example for integrate with jsonrpsee by @hunjixin SeaQL#632
- Codegen add serde derives to enums, if specified by @BenJeau SeaQL#463
- Codegen Unsigned Integer by @billy1624 SeaQL#397
- Add
Send
bound toQueryStream
andTransactionStream
by @sebpuetz SeaQL#471 - Add
Send
toStreamTrait
by @nappa85 SeaQL#622 sea
as an alternative bin name tosea-orm-cli
by @ZhangHanDong SeaQL#558
- Fix codegen with Enum in expanded format by @billy1624 SeaQL#624
- Fixing and testing into_json of various field types by @billy1624 SeaQL#539
- Exclude
mock
from default features by @billy1624 SeaQL#562 create_table_from_entity
will no longer create index for MySQL, please use the new methodcreate_index_from_entity
- Describe default value of ActiveValue on document by @Ken-Miura in SeaQL#556
- community: add axum-book-management by @lz1998 in SeaQL#564
- Add Backpack to project showcase by @JSH32 in SeaQL#567
- Add mediarepo to showcase by @Trivernis in SeaQL#569
- COMMUNITY: add a link to Svix to showcase by @tasn in SeaQL#537
- Update COMMUNITY.md by @naryand in SeaQL#570
- Update COMMUNITY.md by @BobAnkh in SeaQL#568
- Update COMMUNITY.md by @KaniyaSimeji in SeaQL#566
- Update COMMUNITY.md by @aaronleopold in SeaQL#565
- Update COMMUNITY.md by @gudaoxuri in SeaQL#572
- Update Wikijump's entry in COMMUNITY.md by @ammongit in SeaQL#573
- Update COMMUNITY.md by @koopa1338 in SeaQL#574
- Update COMMUNITY.md by @gengteng in SeaQL#580
- Update COMMUNITY.md by @Yama-Tomo in SeaQL#582
- add oura-postgres-sink to COMMUNITY.md by @rvcas in SeaQL#594
- Add rust-example-caster-api to COMMUNITY.md by @bkonkle in SeaQL#623
- orm-cli generated incorrect type for #[sea_orm(primary_key)]. Should be u64. Was i64. SeaQL#295
- how to update dynamicly from json value SeaQL#346
- Make
DatabaseConnection
Clone
with the default features enabled SeaQL#438 - Updating mutiple fields in a Model by passing a reference SeaQL#460
- SeaORM CLI not adding serde derives to Enums SeaQL#461
- sea-orm-cli generates wrong datatype for nullable blob SeaQL#490
- Support the time crate in addition (instead of?) chrono SeaQL#499
- PaginatorTrait for SelectorRaw SeaQL#500
- sea_orm::DatabaseConnection should implement
Clone
by default SeaQL#517 - How do you seed data in migrations using ActiveModels? SeaQL#522
- Datetime fields are not serialized by
.into_json()
on queries SeaQL#530 - Update / Delete by id SeaQL#552
#[sea_orm(indexed)]
only works for MySQL SeaQL#554sea-orm-cli generate --with-serde
does not work on Postegresql custom type SeaQL#581sea-orm-cli generate --expanded-format
panic when postgres table contains enum type SeaQL#614- UUID fields are not serialized by
.into_json()
on queries SeaQL#619
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.6.0...0.7.0
- Migration Support by @billy1624 in SeaQL#335
- Support
DateTime<Utc>
&DateTime<Local>
by @billy1624 in SeaQL#489 - Add
max_lifetime
connection option by @billy1624 in SeaQL#493
- Model with Generics by @billy1624 in SeaQL#400
- Add Poem example by @sunli829 in SeaQL#446
- Codegen
column_name
proc_macro attribute by @billy1624 in SeaQL#433 - Easy joins with MockDatabase #447 by @cemoktra in SeaQL#455
- CLI allow generate entity with url without password by @billy1624 in SeaQL#436
- Support up to 6-ary composite primary key by @billy1624 in SeaQL#423
- Fix FromQueryResult when Result is redefined by @tasn in SeaQL#495
- Remove
r#
prefix when derivingFromQueryResult
by @smrtrfszm in SeaQL#494
- Name conflict of foreign key constraints when two entities have more than one foreign keys by @billy1624 in SeaQL#417
- Is it possible to have 4 values Composite Key? SeaQL#352
- Support
DateTime<Utc>
&DateTime<Local>
SeaQL#381 - Codegen
column_name
proc_macro attribute if column name isn't in snake case SeaQL#395 - Model with Generics SeaQL#402
- Foreign key constraint collision when multiple keys exist between the same two tables SeaQL#405
- sea-orm-cli passwordless database user causes "No password was found in the database url" error SeaQL#435
- Testing joins with MockDatabase SeaQL#447
- Surface max_lifetime connection option SeaQL#475
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.5.0...0.6.0
- Why insert, update, etc return a ActiveModel instead of Model? SeaQL#289
- Rework
ActiveValue
SeaQL#321 - Some missing ActiveEnum utilities SeaQL#338
- First metric and tracing implementation by @nappa85 in SeaQL#373
- Update sea-orm to depends on SeaQL/sea-query#202 by @billy1624 in SeaQL#370
- Codegen ActiveEnum & Create Enum From ActiveEnum by @billy1624 in SeaQL#348
- Axum example: update to Axum v0.4.2 by @ttys3 in SeaQL#383
- Fix rocket version by @Gabriel-Paulucci in SeaQL#384
- Insert & Update Return
Model
by @billy1624 in SeaQL#339 - Rework
ActiveValue
by @billy1624 in SeaQL#340 - Add wrapper method
ModelTrait::delete
by @billy1624 in SeaQL#396 - Add docker create script for contributors to setup databases locally by @billy1624 in SeaQL#378
- Log with tracing-subscriber by @billy1624 in SeaQL#399
- Codegen SQLite by @billy1624 in SeaQL#386
- PR without clippy warmings in file changed tab by @billy1624 in SeaQL#401
- Rename
sea-strum
lib back tostrum
by @billy1624 in SeaQL#361
ActiveModel::insert
andActiveModel::update
returnModel
instead ofActiveModel
- Method
ActiveModelBehavior::after_save
takesModel
as input instead ofActiveModel
- Rename method
sea_orm::unchanged_active_value_not_intended_for_public_use
tosea_orm::Unchanged
- Rename method
ActiveValue::unset
toActiveValue::not_set
- Rename method
ActiveValue::is_unset
toActiveValue::is_not_set
PartialEq
ofActiveValue
will also check the equality of state instead of just checking the equality of value
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.2...0.5.0
- Delete::many() doesn't work when schema_name is defined SeaQL#362
- find_with_related panic SeaQL#374
- How to define rust type of TIMESTAMP? SeaQL#344
- Add Table on the generated Column enum SeaQL#356
Delete::many()
withTableRef
by @billy1624 in SeaQL#363- Fix related & linked with enum columns by @billy1624 in SeaQL#376
- Temporary Fix: Handling MySQL & SQLite timestamp columns by @billy1624 in SeaQL#379
- Add feature to generate table Iden by @Sytten in SeaQL#360
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.1...0.4.2
- Is it possible to have 4 values Composite Key? SeaQL#352
- [sea-orm-cli] Better handling of relation generations SeaQL#239
- Add TryFromU64 trait for
DateTime<FixedOffset>
. by @kev0960 in SeaQL#331 - add offset and limit by @lz1998 in SeaQL#351
- For some reason the
axum_example
fail to compile by @billy1624 in SeaQL#355 - Support Up to 6 Values Composite Primary Key by @billy1624 in SeaQL#353
- Codegen Handle Self Referencing & Multiple Relations to the Same Related Entity by @billy1624 in SeaQL#347
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.0...0.4.1
- Disable SQLx query logging SeaQL#290
- Code generated by
sea-orm-cli
cannot pass clippy SeaQL#296 - Should return detailed error message for connection failure SeaQL#310
DateTimeWithTimeZone
does not implementSerialize
andDeserialize
SeaQL#319- Support returning clause to avoid database hits SeaQL#183
- chore: update to Rust 2021 Edition by @sno2 in SeaQL#273
- Enumeration - 3 by @billy1624 in SeaQL#274
- Enumeration - 2 by @billy1624 in SeaQL#261
- Codegen fix clippy warnings by @billy1624 in SeaQL#303
- Add axum example by @YoshieraHuang in SeaQL#297
- Enumeration by @billy1624 in SeaQL#258
- Add
PaginatorTrait
andCountTrait
for more constrains by @YoshieraHuang in SeaQL#306 - Continue
PaginatorTrait
by @billy1624 in SeaQL#307 - Refactor
Schema
by @billy1624 in SeaQL#309 - Detailed connection errors by @billy1624 in SeaQL#312
- Suppress
ouroboros
missing docs warnings by @billy1624 in SeaQL#288 with-json
feature requireschrono/serde
by @billy1624 in SeaQL#320- Pass the argument
entity.table_ref()
instead of justentity
. by @josh-codes in SeaQL#318 - Unknown types could be a newtypes instead of
ActiveEnum
by @billy1624 in SeaQL#324 - Returning by @billy1624 in SeaQL#292
- Refactor
paginate()
&count()
utilities intoPaginatorTrait
. You can use the paginator as usual but you might need to importPaginatorTrait
manually when upgrading from 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
statement 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
- Support for BYTEA Postgres primary keys SeaQL#286
- Documentation for sea-orm by @charleschege in SeaQL#280
- Support
Vec<u8>
primary key by @billy1624 in SeaQL#287
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.3.1...0.3.2
(We are changing our Changelog format from now on)
- Align case trasforms across derive macros SeaQL#262
- Added
is_null
andis_not_null
toColumnTrait
SeaQL#267
(The following is generated by GitHub)
- Changed manual url parsing to use Url crate by @AngelOnFira in SeaQL#253
- Test self referencing relation by @billy1624 in SeaQL#256
- Unify case-transform using the same crate by @billy1624 in SeaQL#264
- CI cleaning by @AngelOnFira in SeaQL#263
- CI install sea-orm-cli in debug mode by @billy1624 in SeaQL#265
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.3.0...0.3.1
https://www.sea-ql.org/SeaORM/blog/2021-10-15-whats-new-in-0.3.0
- Built-in Rocket support
ConnectOptions
let mut opt = ConnectOptions::new("protocol://username:password@host/database".to_owned());
opt.max_connections(100)
.min_connections(5)
.connect_timeout(Duration::from_secs(8))
.idle_timeout(Duration::from_secs(8));
let db = Database::connect(opt).await?;
- [#211] Throw error if none of the db rows are affected
assert_eq!(
Update::one(cake::ActiveModel {
name: Set("Cheese Cake".to_owned()),
..model.into_active_model()
})
.exec(&db)
.await,
Err(DbErr::RecordNotFound(
"None of the database rows are affected".to_owned()
))
);
// update many remains the same
assert_eq!(
Update::many(cake::Entity)
.col_expr(cake::Column::Name, Expr::value("Cheese Cake".to_owned()))
.filter(cake::Column::Id.eq(2))
.exec(&db)
.await,
Ok(UpdateResult { rows_affected: 0 })
);
- [#223]
ActiveValue::take()
&ActiveValue::into_value()
withoutunwrap()
- [#205] Drop
Default
trait bound ofPrimaryKeyTrait::ValueType
- [#222] Transaction & streaming
- [#210] Update
ActiveModelBehavior
API - [#240] Add derive
DeriveIntoActiveModel
andIntoActiveValue
trait - [#237] Introduce optional serde support for model code generation
- [#246] Add
#[automatically_derived]
to all derived implementations
- [#224] [sea-orm-cli] Date & Time column type mapping
- Escape rust keywords with
r#
raw identifier
- [#227] Resolve "Inserting actual none value of Option results in panic"
- [#219] [sea-orm-cli] Add
--tables
option - [#189] Add
debug_query
anddebug_query_stmt
macro
https://www.sea-ql.org/SeaORM/blog/2021-10-01-whats-new-in-0.2.4
- [#186] [sea-orm-cli] Foreign key handling
- [#191] [sea-orm-cli] Unique key handling
- [#182]
find_linked
join with alias - [#202] Accept both
postgres://
andpostgresql://
- [#208] Support feteching T, (T, U), (T, U, P) etc
- [#209] Rename column name & column enum variant
- [#207] Support
chrono::NaiveDate
&chrono::NaiveTime
- Support
Condition::not
(from sea-query)
- [#152] DatabaseConnection impl
Clone
- [#175] Impl
TryGetableMany
for diffrent types of generics - Codegen
TimestampWithTimeZone
fixup
- [#105] Compact entity format
- [#132] Add ActiveModel
insert
&update
- [#129] Add
set
method toUpdateMany
- [#118] Initial lock support
- [#167] Add
FromQueryResult::find_by_statement
- Update dependencies
- [#37] Rocket example
- [#114]
log
crate andenv-logger
- [#103]
InsertResult
to return the primary key's type - [#89] Represent several relations between same types by
Linked
- [#59] Transforming an Entity into
TableCreateStatement
- [#108] Remove impl TryGetable for Option
- [#68] Added
DateTimeWithTimeZone
as supported attribute type - [#70] Generate arbitrary named entity
- [#80] Custom column name
- [#81] Support join on multiple columns
- [#99] Implement FromStr for ColumnTrait
- Early release of SeaORM