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.
- Supports for partial select of
Option<T>
model field. ANone
value will be filled when the select result does not contain theOption<T>
field without throwing an error. SeaQL/sea-orm#1513
customer::ActiveModel {
name: Set("Alice".to_owned()),
notes: Set(Some("Want to communicate with Bob".to_owned())),
..Default::default()
}
.save(db)
.await?;
// The `notes` field was intentionally leaved out
let customer = Customer::find()
.select_only()
.column(customer::Column::Id)
.column(customer::Column::Name)
.one(db)
.await
.unwrap();
// The select result does not contain `notes` field.
// Since it's of type `Option<String>`, it'll be `None` and no error will be thrown.
assert_eq!(customers.notes, None);
- Added
Migration::name()
andMigration::status()
getters for the name and status ofsea_orm_migration::Migration
SeaQL/sea-orm#1519
let migrations = Migrator::get_pending_migrations(db).await?;
assert_eq!(migrations.len(), 5);
let migration = migrations.get(0).unwrap();
assert_eq!(migration.name(), "m20220118_000002_create_fruit_table");
assert_eq!(migration.status(), MigrationStatus::Pending);
- Upgrade
heck
dependency insea-orm-macros
andsea-orm-codegen
to 0.4 SeaQL/sea-orm#1520, SeaQL/sea-orm#1544
- Supports for partial select of
Option<T>
model field. ANone
value will be filled when the select result does not contain theOption<T>
field without throwing an error. SeaQL/sea-orm#1513
- Enable required
syn
features SeaQL/sea-orm#1556 - Re-export
sea_query::BlobSize
insea_orm::entity::prelude
SeaQL/sea-orm#1548
- Fixes
DeriveActiveEnum
(by qualifyingColumnTypeTrait::def
) SeaQL/sea-orm#1478 - The CLI command
sea-orm-cli generate entity -u '<DB-URL>'
will now generate the following code for eachBinary
orVarBinary
columns in compact format SeaQL/sea-orm#1529
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "binary")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
#[sea_orm(column_type = "Binary(BlobSize::Blob(None))")]
pub binary: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(Some(10)))")]
pub binary_10: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Tiny)")]
pub binary_tiny: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Medium)")]
pub binary_medium: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Long)")]
pub binary_long: Vec<u8>,
#[sea_orm(column_type = "VarBinary(10)")]
pub var_binary: Vec<u8>,
}
- The CLI command
sea-orm-cli generate entity -u '<DB-URL>' --expanded-format
will now generate the following code for eachBinary
orVarBinary
columns in expanded format SeaQL/sea-orm#1529
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Binary => ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(None)).def(),
Self::Binary10 => {
ColumnType::Binary(sea_orm::sea_query::BlobSize::Blob(Some(10u32))).def()
}
Self::BinaryTiny => ColumnType::Binary(sea_orm::sea_query::BlobSize::Tiny).def(),
Self::BinaryMedium => ColumnType::Binary(sea_orm::sea_query::BlobSize::Medium).def(),
Self::BinaryLong => ColumnType::Binary(sea_orm::sea_query::BlobSize::Long).def(),
Self::VarBinary => ColumnType::VarBinary(10u32).def(),
}
}
}
- Fix missing documentation on type generated by derive macros SeaQL/sea-orm#1522, SeaQL/sea-orm#1531
- 2023-02-02:
0.11.0-rc.1
- 2023-02-04:
0.11.0-rc.2
- Simple data loader SeaQL/sea-orm#1238, SeaQL/sea-orm#1443
- Transactions Isolation level and Access mode SeaQL/sea-orm#1230
- Support various UUID formats that are available in
uuid::fmt
module SeaQL/sea-orm#1325 - Support Vector of enum for Postgres SeaQL/sea-orm#1210
- Support
ActiveEnum
field as primary key SeaQL/sea-orm#1414 - Casting columns as a different data type on select, insert and update SeaQL/sea-orm#1304
- Methods of
ActiveModelBehavior
receive db connection as a parameter SeaQL/sea-orm#1145, SeaQL/sea-orm#1328 - Added
execute_unprepared
method toDatabaseConnection
andDatabaseTransaction
SeaQL/sea-orm#1327 - Added
Select::into_tuple
to select rows as tuples (instead of defining a custom Model) SeaQL/sea-orm#1311
- Generate
#[serde(skip_deserializing)]
for primary key columns SeaQL/sea-orm#846, SeaQL/sea-orm#1186, SeaQL/sea-orm#1318 - Generate
#[serde(skip)]
for hidden columns SeaQL/sea-orm#1171, SeaQL/sea-orm#1320 - Generate entity with extra derives and attributes for model struct SeaQL/sea-orm#1124, SeaQL/sea-orm#1321
- Migrations are now performed inside a transaction for Postgres SeaQL/sea-orm#1379
- Refactor schema module to expose functions for database alteration SeaQL/sea-orm#1256
- Generate compact entity with
#[sea_orm(column_type = "JsonBinary")]
macro attribute SeaQL/sea-orm#1346 MockDatabase::append_exec_results()
,MockDatabase::append_query_results()
,MockDatabase::append_exec_errors()
andMockDatabase::append_query_errors()
take any types implementedIntoIterator
trait SeaQL/sea-orm#1367find_by_id
anddelete_by_id
take anyInto
primary key value SeaQL/sea-orm#1362QuerySelect::offset
andQuerySelect::limit
takes inInto<Option<u64>>
whereNone
would reset them SeaQL/sea-orm#1410- Added
DatabaseConnection::close
SeaQL/sea-orm#1236 - Added
is_null
getter forColumnDef
SeaQL/sea-orm#1381 - Added
ActiveValue::reset
to convertUnchanged
intoSet
SeaQL/sea-orm#1177 - Added
QueryTrait::apply_if
to optionally apply a filter SeaQL/sea-orm#1415 - Added the
sea-orm-internal
feature flag to expose some SQLx types- Added
DatabaseConnection::get_*_connection_pool()
for accessing the inner SQLx connection pool SeaQL/sea-orm#1297 - Re-exporting SQLx errors SeaQL/sea-orm#1434
- Added
- Upgrade
axum
to0.6.1
SeaQL/sea-orm#1285 - Upgrade
sea-query
to0.28
SeaQL/sea-orm#1366 - Upgrade
sea-query-binder
to0.3
SeaQL/sea-orm#1366 - Upgrade
sea-schema
to0.11
SeaQL/sea-orm#1366
- Fixed all clippy warnings as of
1.67.0
SeaQL/sea-orm#1426 - Removed dependency where not needed SeaQL/sea-orm#1213
- Disabled default features and enabled only the needed ones SeaQL/sea-orm#1300
- Cleanup panic and unwrap SeaQL/sea-orm#1231
- Cleanup the use of
vec!
macro SeaQL/sea-orm#1367
- [sea-orm-cli] Propagate error on the spawned child processes SeaQL/sea-orm#1402
- Fixes sea-orm-cli errors exit with error code 0 SeaQL/sea-orm#1342
- Fixes
DeriveColumn
(by qualifyingIdenStatic::as_str
) SeaQL/sea-orm#1280 - Prevent returning connections to pool with a positive transaction depth SeaQL/sea-orm#1283
- Postgres insert many will throw
RecordNotInserted
error if non of them are being inserted SeaQL/sea-orm#1021- Fixes inserting active models by
insert_many
withon_conflict
anddo_nothing
panics if no rows are inserted on Postgres SeaQL/sea-orm#899
- Fixes inserting active models by
- Don't call
last_insert_id
if not needed SeaQL/sea-orm#1403- Fixes hitting 'negative last_insert_rowid' panic with Sqlite SeaQL/sea-orm#1357
- Noop when update without providing any values SeaQL/sea-orm#1384
- Fixes Syntax Error when saving active model that sets nothing SeaQL/sea-orm#1376
- [sea-orm-cli] Enable --universal-time by default SeaQL/sea-orm#1420
- Added
RecordNotInserted
andRecordNotUpdated
toDbErr
- Added
ConnectionTrait::execute_unprepared
method SeaQL/sea-orm#1327 - As part of SeaQL/sea-orm#1311, the required method of
TryGetable
changed:
// then
fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result<Self, TryGetError>;
// now; ColIdx can be `&str` or `usize`
fn try_get_by<I: ColIdx>(res: &QueryResult, index: I) -> Result<Self, TryGetError>;
So if you implemented it yourself:
impl TryGetable for XXX {
- fn try_get(res: &QueryResult, pre: &str, col: &str) -> Result<Self, TryGetError> {
+ fn try_get_by<I: sea_orm::ColIdx>(res: &QueryResult, idx: I) -> Result<Self, TryGetError> {
- let value: YYY = res.try_get(pre, col).map_err(TryGetError::DbErr)?;
+ let value: YYY = res.try_get_by(idx).map_err(TryGetError::DbErr)?;
..
}
}
- The
ActiveModelBehavior
trait becomes async trait SeaQL/sea-orm#1328. If you overridden the defaultActiveModelBehavior
implementation:
#[async_trait::async_trait]
impl ActiveModelBehavior for ActiveModel {
async fn before_save<C>(self, db: &C, insert: bool) -> Result<Self, DbErr>
where
C: ConnectionTrait,
{
// ...
}
// ...
}
DbErr::RecordNotFound("None of the database rows are affected")
is moved to a dedicated error variantDbErr::RecordNotUpdated
SeaQL/sea-orm#1425
let res = Update::one(cake::ActiveModel {
name: Set("Cheese Cake".to_owned()),
..model.into_active_model()
})
.exec(&db)
.await;
// then
assert_eq!(
res,
Err(DbErr::RecordNotFound(
"None of the database rows are affected".to_owned()
))
);
// now
assert_eq!(res, Err(DbErr::RecordNotUpdated));
sea_orm::ColumnType
was replaced bysea_query::ColumnType
SeaQL/sea-orm#1395- Method
ColumnType::def
was moved toColumnTypeTrait
ColumnType::Binary
becomes a tuple variant which takes in additional optionsea_query::BlobSize
ColumnType::Custom
takes asea_query::DynIden
instead ofString
and thus a new methodcustom
is added (note the lowercase)
- Method
// Compact Entity
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "fruit")]
pub struct Model {
- #[sea_orm(column_type = r#"Custom("citext".to_owned())"#)]
+ #[sea_orm(column_type = r#"custom("citext")"#)]
pub column: String,
}
// Expanded Entity
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
- Self::Column => ColumnType::Custom("citext".to_owned()).def(),
+ Self::Column => ColumnType::custom("citext").def(),
}
}
}
- Fixed a small typo SeaQL/sea-orm#1391
axum
example should use tokio runtime SeaQL/sea-orm#1428
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.10.0...0.11.0
- Inserting active models by
insert_many
withon_conflict
anddo_nothing
panics if no rows are inserted on Postgres SeaQL/sea-orm#899 - Hitting 'negative last_insert_rowid' panic with Sqlite SeaQL/sea-orm#1357
- Cast enum values when constructing update many query SeaQL/sea-orm#1178
- Fixes
DeriveColumn
(by qualifyingIdenStatic::as_str
) SeaQL/sea-orm#1280 - Prevent returning connections to pool with a positive transaction depth SeaQL/sea-orm#1283
- [sea-orm-codegen] Skip implementing Related if the same related entity is being referenced by a conjunct relation SeaQL/sea-orm#1298
- [sea-orm-cli] CLI depends on codegen of the same version SeaQL/sea-orm#1299
- Add
QuerySelect::columns
method - select multiple columns SeaQL/sea-orm#1264 - Transactions Isolation level and Access mode SeaQL/sea-orm#1230
DeriveEntityModel
derive macro: when parsing field type, always treat field withOption<T>
as nullable column SeaQL/sea-orm#1257
- [sea-orm-cli] Generate
Related
implementation for many-to-many relation with extra columns SeaQL/sea-orm#1260 - Optimize the default implementation of
TryGetableFromJson::try_get_from_json()
- deserializing intoSelf
directly without the need of a intermediateserde_json::Value
SeaQL/sea-orm#1249
- Fix DeriveActiveEnum expand enum variant starts with number SeaQL/sea-orm#1219
- [sea-orm-cli] Generate entity file for specified tables only SeaQL/sea-orm#1245
- Support appending
DbErr
toMockDatabase
SeaQL/sea-orm#1241
- Filter rows with
IS IN
enum values expression SeaQL/sea-orm#1183 - [sea-orm-cli] Generate entity with relation variant order by name of reference table SeaQL/sea-orm#1229
- [sea-orm-cli] Set search path when initializing Postgres connection for CLI generate entity SeaQL/sea-orm#1212
- [sea-orm-cli] Generate
_
prefix to enum variant starts with number SeaQL/sea-orm#1211 - Fix composite key cursor pagination SeaQL/sea-orm#1216
- The logic for single-column primary key was correct, but for composite keys the logic was incorrect
- Added
Insert::exec_without_returning
SeaQL/sea-orm#1208
- Remove dependency when not needed SeaQL/sea-orm#1207
- [sea-orm-rocket] added
sqlx_logging
toConfig
SeaQL/sea-orm#1192 - Collecting metrics for
query_one/all
SeaQL/sea-orm#1165 - Use GAT to elide
StreamTrait
lifetime SeaQL/sea-orm#1161
- corrected the error name
UpdateGetPrimaryKey
SeaQL/sea-orm#1180
- Update MSRV to 1.65
- [sea-orm-cli] Escape module name defined with Rust keywords SeaQL/sea-orm#1052
- [sea-orm-cli] Check to make sure migration name doesn't contain hyphen
-
in it SeaQL/sea-orm#879, SeaQL/sea-orm#1155 - Support
time
crate for SQLite SeaQL/sea-orm#995
- [sea-orm-cli] Generate
Related
for m-to-n relation SeaQL/sea-orm#1075 - [sea-orm-cli] Generate model entity with Postgres Enum field SeaQL/sea-orm#1153
- [sea-orm-cli] Migrate up command apply all pending migrations SeaQL/sea-orm#1010
- [sea-orm-cli] Conflicting short flag
-u
when executingmigrate generate
command SeaQL/sea-orm#1157 - Prefix the usage of types with
sea_orm::
insideDeriveActiveEnum
derive macros SeaQL/sea-orm#1146, SeaQL/sea-orm#1154 - [sea-orm-cli] Generate model with
Vec<f32>
orVec<f64>
should not deriveEq
on the model struct SeaQL/sea-orm#1158
- [sea-orm-cli] [sea-orm-migration] Add
cli
feature to optionally include dependencies that are required by the CLI SeaQL/sea-orm#978
- Upgrade
sea-schema
to 0.10.2 SeaQL/sea-orm#1153
- Better error types (carrying SQLx Error) SeaQL/sea-orm#1002
- Support array datatype in PostgreSQL SeaQL/sea-orm#1132
- [sea-orm-cli] Generate entity files as a library or module SeaQL/sea-orm#953
- [sea-orm-cli] Generate a new migration template with name prefix of unix timestamp SeaQL/sea-orm#947
- [sea-orm-cli] Generate migration in modules SeaQL/sea-orm#933
- [sea-orm-cli] Generate
DeriveRelation
on emptyRelation
enum SeaQL/sea-orm#1019 - [sea-orm-cli] Generate entity derive
Eq
if possible SeaQL/sea-orm#988 - [sea-orm-cli] Run migration on any PostgreSQL schema SeaQL/sea-orm#1056
- Support
distinct
&distinct_on
expression SeaQL/sea-orm#902 fn column()
also handle enum type SeaQL/sea-orm#973- Added
acquire_timeout
onConnectOptions
SeaQL/sea-orm#897 - [sea-orm-cli]
migrate fresh
command will drop all PostgreSQL types SeaQL/sea-orm#864, SeaQL/sea-orm#991 - Better compile error for entity without primary key SeaQL/sea-orm#1020
- Added blanket implementations of
IntoActiveValue
forOption
values SeaQL/sea-orm#833 - Added
into_model
&into_json
toCursor
SeaQL/sea-orm#1112 - Added
set_schema_search_path
method toConnectOptions
for setting schema search path of PostgreSQL connection SeaQL/sea-orm#1056 - Serialize
time
types asserde_json::Value
SeaQL/sea-orm#1042 - Implements
fmt::Display
forActiveEnum
SeaQL/sea-orm#986 - Implements
TryFrom<ActiveModel>
forModel
SeaQL/sea-orm#990
- Trim spaces when paginating raw SQL SeaQL/sea-orm#1094
- Replaced
usize
withu64
inPaginatorTrait
SeaQL/sea-orm#789 - Type signature of
DbErr
changed as a result of SeaQL/sea-orm#1002 ColumnType::Enum
structure changed:
enum ColumnType {
// then
Enum(String, Vec<String>)
// now
Enum {
/// Name of enum
name: DynIden,
/// Variants of enum
variants: Vec<DynIden>,
}
...
}
// example
#[derive(Iden)]
enum TeaEnum {
#[iden = "tea"]
Enum,
#[iden = "EverydayTea"]
EverydayTea,
#[iden = "BreakfastTea"]
BreakfastTea,
}
// then
ColumnDef::new(active_enum_child::Column::Tea)
.enumeration("tea", vec!["EverydayTea", "BreakfastTea"])
// now
ColumnDef::new(active_enum_child::Column::Tea)
.enumeration(TeaEnum::Enum, [TeaEnum::EverydayTea, TeaEnum::BreakfastTea])
- A new method
array_type
was added toValueType
:
impl sea_orm::sea_query::ValueType for MyType {
fn array_type() -> sea_orm::sea_query::ArrayType {
sea_orm::sea_query::ArrayType::TypeName
}
...
}
ActiveEnum::name()
changed return type toDynIden
:
#[derive(Debug, Iden)]
#[iden = "category"]
pub struct CategoryEnum;
impl ActiveEnum for Category {
// then
fn name() -> String {
"category".to_owned()
}
// now
fn name() -> DynIden {
SeaRc::new(CategoryEnum)
}
...
}
- Documentation grammar fixes SeaQL/sea-orm#1050
- Replace
dotenv
withdotenvy
in examples SeaQL/sea-orm#1085 - Exclude test_cfg module from SeaORM SeaQL/sea-orm#1077
- Support
rocket_okapi
SeaQL/sea-orm#1071
- Upgrade
sea-query
to 0.26 SeaQL/sea-orm#985
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.9.0...0.10.0
fn column()
also handle enum type SeaQL/sea-orm#973- Generate migration in modules SeaQL/sea-orm#933
- Generate
DeriveRelation
on emptyRelation
enum SeaQL/sea-orm#1019 - Documentation grammar fixes SeaQL/sea-orm#1050
- Implement
IntoActiveValue
fortime
types SeaQL/sea-orm#1041 - Fixed module import for
FromJsonQueryResult
derive macro SeaQL/sea-orm#1081
- [sea-orm-cli] Migrator CLI handles init and generate commands SeaQL/sea-orm#931
- [sea-orm-cli] added
with-copy-enums
flag to conditional deriveCopy
onActiveEnum
SeaQL/sea-orm#936
- Exclude
chrono
default features SeaQL/sea-orm#950 - Set minimal rustc version to
1.60
SeaQL/sea-orm#938 - Update
sea-query
to0.26.3
In this minor release, we removed time
v0.1 from the dependency graph
- [sea-orm-cli] Codegen support for
VarBinary
column type SeaQL/sea-orm#746 - [sea-orm-cli] Generate entity for SYSTEM VERSIONED tables on MariaDB SeaQL/sea-orm#876
RelationDef
&RelationBuilder
should beSend
&Sync
SeaQL/sea-orm#898
- Remove unnecessary
async_trait
SeaQL/sea-orm#737
- Cursor pagination SeaQL/sea-orm#822
- Custom join on conditions SeaQL/sea-orm#793
DeriveMigrationName
andsea_orm_migration::util::get_file_stem
SeaQL/sea-orm#736FromJsonQueryResult
for deserializingJson
from query result SeaQL/sea-orm#794
- Added
sqlx_logging_level
toConnectOptions
SeaQL/sea-orm#800 - Added
num_items_and_pages
toPaginator
SeaQL/sea-orm#768 - Added
TryFromU64
fortime
SeaQL/sea-orm#849 - Added
Insert::on_conflict
SeaQL/sea-orm#791 - Added
QuerySelect::join_as
andQuerySelect::join_as_rev
SeaQL/sea-orm#852 - Include column name in
TryGetError::Null
SeaQL/sea-orm#853 - [sea-orm-cli] Improve logging SeaQL/sea-orm#735
- [sea-orm-cli] Generate enum with numeric like variants SeaQL/sea-orm#588
- [sea-orm-cli] Allow old pending migration to be applied SeaQL/sea-orm#755
- [sea-orm-cli] Skip generating entity for ignored tables SeaQL/sea-orm#837
- [sea-orm-cli] Generate code for
time
crate SeaQL/sea-orm#724 - [sea-orm-cli] Add various blob column types SeaQL/sea-orm#850
- [sea-orm-cli] Generate entity files with Postgres's schema name SeaQL/sea-orm#422
- Upgrade
clap
to 3.2 SeaQL/sea-orm#706 - Upgrade
time
to 0.3 SeaQL/sea-orm#834 - Upgrade
sqlx
to 0.6 SeaQL/sea-orm#834 - Upgrade
uuid
to 1.0 SeaQL/sea-orm#834 - Upgrade
sea-query
to 0.26 SeaQL/sea-orm#834 - Upgrade
sea-schema
to 0.9 SeaQL/sea-orm#834
- Refactor stream metrics SeaQL/sea-orm#778
- [sea-orm-cli] skip checking connection string for credentials SeaQL/sea-orm#851
SelectTwoMany::one()
has been dropped SeaQL/sea-orm#813, you can get(Entity, Vec<RelatedEntity>)
by first querying a single model from Entity, then use [ModelTrait::find_related
] on the model.-
We now adopt the weak dependency syntax in Cargo. That means the flags
["sqlx-json", "sqlx-chrono", "sqlx-decimal", "sqlx-uuid", "sqlx-time"]
are not needed and now removed. Instead,with-time
will enablesqlx?/time
only ifsqlx
is already enabled. As a consequence, now the featureswith-json
,with-chrono
,with-rust_decimal
,with-uuid
,with-time
will not be enabled as a side-effect of enablingsqlx
.
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.8.0...0.9.0
- Removed
async-std
from dependency SeaQL/sea-orm#758
- [sea-orm-cli]
sea migrate generate
to generate a new, empty migration file SeaQL/sea-orm#656
- Add
max_connections
option to CLI SeaQL/sea-orm#670 - Derive
Eq
,Clone
forDbErr
SeaQL/sea-orm#677 - Add
is_changed
toActiveModelTrait
SeaQL/sea-orm#683
- Fix
DerivePrimaryKey
with custom primary key column name SeaQL/sea-orm#694 - Fix
DeriveEntityModel
macros override column name SeaQL/sea-orm#695 - Fix Insert with no value supplied using
DEFAULT
SeaQL/sea-orm#589
- Migration utilities are moved from sea-schema to sea-orm repo, under a new sub-crate
sea-orm-migration
.sea_schema::migration::prelude
should be replaced bysea_orm_migration::prelude
in all migration files
- Upgrade
sea-query
to 0.24.x,sea-schema
to 0.8.x - Upgrade example to Actix Web 4, Actix Web 3 remains SeaQL/sea-orm#638
- Added Tonic gRPC example SeaQL/sea-orm#659
- Upgrade GraphQL example to use axum 0.5.x
- Upgrade axum example to 0.5.x
- Failed to insert row with only default values SeaQL/sea-orm#420
- Reduce database connections to 1 during codegen SeaQL/sea-orm#511
- Column names with single letters separated by underscores are concatenated SeaQL/sea-orm#630
- Update Actix Web examples SeaQL/sea-orm#639
- Lower function missing SeaQL/sea-orm#672
- is_changed on active_model SeaQL/sea-orm#674
- Failing find_with_related with column_name attribute SeaQL/sea-orm#693
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.7.1...0.8.0
- Fix sea-orm-cli error
- Fix sea-orm cannot build without
with-json
- Update ActiveModel by JSON by @billy1624 in SeaQL/sea-orm#492
- Supports
time
crate by @billy1624 SeaQL/sea-orm#602 - Allow for creation of indexes for PostgreSQL and SQLite @nickb937 SeaQL/sea-orm#593
- Added
delete_by_id
@ShouvikGhosh2048 SeaQL/sea-orm#590 - Implement
PaginatorTrait
forSelectorRaw
@shinbunbun SeaQL/sea-orm#617
- Added axum graphql example by @aaronleopold in SeaQL/sea-orm#587
- Add example for integrate with jsonrpsee by @hunjixin SeaQL/sea-orm#632
- Codegen add serde derives to enums, if specified by @BenJeau SeaQL/sea-orm#463
- Codegen Unsigned Integer by @billy1624 SeaQL/sea-orm#397
- Add
Send
bound toQueryStream
andTransactionStream
by @sebpuetz SeaQL/sea-orm#471 - Add
Send
toStreamTrait
by @nappa85 SeaQL/sea-orm#622 sea
as an alternative bin name tosea-orm-cli
by @ZhangHanDong SeaQL/sea-orm#558
- Fix codegen with Enum in expanded format by @billy1624 SeaQL/sea-orm#624
- Fixing and testing into_json of various field types by @billy1624 SeaQL/sea-orm#539
- Exclude
mock
from default features by @billy1624 SeaQL/sea-orm#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/sea-orm#556
- community: add axum-book-management by @lz1998 in SeaQL/sea-orm#564
- Add Backpack to project showcase by @JSH32 in SeaQL/sea-orm#567
- Add mediarepo to showcase by @Trivernis in SeaQL/sea-orm#569
- COMMUNITY: add a link to Svix to showcase by @tasn in SeaQL/sea-orm#537
- Update COMMUNITY.md by @naryand in SeaQL/sea-orm#570
- Update COMMUNITY.md by @BobAnkh in SeaQL/sea-orm#568
- Update COMMUNITY.md by @KaniyaSimeji in SeaQL/sea-orm#566
- Update COMMUNITY.md by @aaronleopold in SeaQL/sea-orm#565
- Update COMMUNITY.md by @gudaoxuri in SeaQL/sea-orm#572
- Update Wikijump's entry in COMMUNITY.md by @ammongit in SeaQL/sea-orm#573
- Update COMMUNITY.md by @koopa1338 in SeaQL/sea-orm#574
- Update COMMUNITY.md by @gengteng in SeaQL/sea-orm#580
- Update COMMUNITY.md by @Yama-Tomo in SeaQL/sea-orm#582
- add oura-postgres-sink to COMMUNITY.md by @rvcas in SeaQL/sea-orm#594
- Add rust-example-caster-api to COMMUNITY.md by @bkonkle in SeaQL/sea-orm#623
- orm-cli generated incorrect type for #[sea_orm(primary_key)]. Should be u64. Was i64. SeaQL/sea-orm#295
- how to update dynamically from json value SeaQL/sea-orm#346
- Make
DatabaseConnection
Clone
with the default features enabled SeaQL/sea-orm#438 - Updating multiple fields in a Model by passing a reference SeaQL/sea-orm#460
- SeaORM CLI not adding serde derives to Enums SeaQL/sea-orm#461
- sea-orm-cli generates wrong data type for nullable blob SeaQL/sea-orm#490
- Support the time crate in addition (instead of?) chrono SeaQL/sea-orm#499
- PaginatorTrait for SelectorRaw SeaQL/sea-orm#500
- sea_orm::DatabaseConnection should implement
Clone
by default SeaQL/sea-orm#517 - How do you seed data in migrations using ActiveModels? SeaQL/sea-orm#522
- Datetime fields are not serialized by
.into_json()
on queries SeaQL/sea-orm#530 - Update / Delete by id SeaQL/sea-orm#552
#[sea_orm(indexed)]
only works for MySQL SeaQL/sea-orm#554sea-orm-cli generate --with-serde
does not work on Postgresql custom type SeaQL/sea-orm#581sea-orm-cli generate --expanded-format
panic when postgres table contains enum type SeaQL/sea-orm#614- UUID fields are not serialized by
.into_json()
on queries SeaQL/sea-orm#619
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.6.0...0.7.0
- Migration Support by @billy1624 in SeaQL/sea-orm#335
- Support
DateTime<Utc>
&DateTime<Local>
by @billy1624 in SeaQL/sea-orm#489 - Add
max_lifetime
connection option by @billy1624 in SeaQL/sea-orm#493
- Model with Generics by @billy1624 in SeaQL/sea-orm#400
- Add Poem example by @sunli829 in SeaQL/sea-orm#446
- Codegen
column_name
proc_macro attribute by @billy1624 in SeaQL/sea-orm#433 - Easy joins with MockDatabase #447 by @cemoktra in SeaQL/sea-orm#455
- CLI allow generate entity with url without password by @billy1624 in SeaQL/sea-orm#436
- Support up to 6-ary composite primary key by @billy1624 in SeaQL/sea-orm#423
- Fix FromQueryResult when Result is redefined by @tasn in SeaQL/sea-orm#495
- Remove
r#
prefix when derivingFromQueryResult
by @smrtrfszm in SeaQL/sea-orm#494
- Name conflict of foreign key constraints when two entities have more than one foreign keys by @billy1624 in SeaQL/sea-orm#417
- Is it possible to have 4 values Composite Key? SeaQL/sea-orm#352
- Support
DateTime<Utc>
&DateTime<Local>
SeaQL/sea-orm#381 - Codegen
column_name
proc_macro attribute if column name isn't in snake case SeaQL/sea-orm#395 - Model with Generics SeaQL/sea-orm#402
- Foreign key constraint collision when multiple keys exist between the same two tables SeaQL/sea-orm#405
- sea-orm-cli passwordless database user causes "No password was found in the database url" error SeaQL/sea-orm#435
- Testing joins with MockDatabase SeaQL/sea-orm#447
- Surface max_lifetime connection option SeaQL/sea-orm#475
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.5.0...0.6.0
- Why insert, update, etc return an ActiveModel instead of Model? SeaQL/sea-orm#289
- Rework
ActiveValue
SeaQL/sea-orm#321 - Some missing ActiveEnum utilities SeaQL/sea-orm#338
- First metric and tracing implementation by @nappa85 in SeaQL/sea-orm#373
- Update sea-orm to depends on SeaQL/sea-query#202 by @billy1624 in SeaQL/sea-orm#370
- Codegen ActiveEnum & Create Enum From ActiveEnum by @billy1624 in SeaQL/sea-orm#348
- Axum example: update to Axum v0.4.2 by @ttys3 in SeaQL/sea-orm#383
- Fix rocket version by @Gabriel-Paulucci in SeaQL/sea-orm#384
- Insert & Update Return
Model
by @billy1624 in SeaQL/sea-orm#339 - Rework
ActiveValue
by @billy1624 in SeaQL/sea-orm#340 - Add wrapper method
ModelTrait::delete
by @billy1624 in SeaQL/sea-orm#396 - Add docker create script for contributors to setup databases locally by @billy1624 in SeaQL/sea-orm#378
- Log with tracing-subscriber by @billy1624 in SeaQL/sea-orm#399
- Codegen SQLite by @billy1624 in SeaQL/sea-orm#386
- PR without clippy warnings in file changed tab by @billy1624 in SeaQL/sea-orm#401
- Rename
sea-strum
lib back tostrum
by @billy1624 in SeaQL/sea-orm#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/sea-orm#362
- find_with_related panic SeaQL/sea-orm#374
- How to define the rust type of TIMESTAMP? SeaQL/sea-orm#344
- Add Table on the generated Column enum SeaQL/sea-orm#356
Delete::many()
withTableRef
by @billy1624 in SeaQL/sea-orm#363- Fix related & linked with enum columns by @billy1624 in SeaQL/sea-orm#376
- Temporary Fix: Handling MySQL & SQLite timestamp columns by @billy1624 in SeaQL/sea-orm#379
- Add feature to generate table Iden by @Sytten in SeaQL/sea-orm#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/sea-orm#352
- [sea-orm-cli] Better handling of relation generations SeaQL/sea-orm#239
- Add TryFromU64 trait for
DateTime<FixedOffset>
. by @kev0960 in SeaQL/sea-orm#331 - add offset and limit by @lz1998 in SeaQL/sea-orm#351
- For some reason the
axum_example
fail to compile by @billy1624 in SeaQL/sea-orm#355 - Support Up to 6 Values Composite Primary Key by @billy1624 in SeaQL/sea-orm#353
- Codegen Handle Self Referencing & Multiple Relations to the Same Related Entity by @billy1624 in SeaQL/sea-orm#347
Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.0...0.4.1
- Disable SQLx query logging SeaQL/sea-orm#290
- Code generated by
sea-orm-cli
cannot pass clippy SeaQL/sea-orm#296 - Should return detailed error message for connection failure SeaQL/sea-orm#310
DateTimeWithTimeZone
does not implementSerialize
andDeserialize
SeaQL/sea-orm#319- Support returning clause to avoid database hits SeaQL/sea-orm#183
- chore: update to Rust 2021 Edition by @sno2 in SeaQL/sea-orm#273
- Enumeration - 3 by @billy1624 in SeaQL/sea-orm#274
- Enumeration - 2 by @billy1624 in SeaQL/sea-orm#261
- Codegen fix clippy warnings by @billy1624 in SeaQL/sea-orm#303
- Add axum example by @YoshieraHuang in SeaQL/sea-orm#297
- Enumeration by @billy1624 in SeaQL/sea-orm#258
- Add
PaginatorTrait
andCountTrait
for more constraints by @YoshieraHuang in SeaQL/sea-orm#306 - Continue
PaginatorTrait
by @billy1624 in SeaQL/sea-orm#307 - Refactor
Schema
by @billy1624 in SeaQL/sea-orm#309 - Detailed connection errors by @billy1624 in SeaQL/sea-orm#312
- Suppress
ouroboros
missing docs warnings by @billy1624 in SeaQL/sea-orm#288 with-json
feature requireschrono/serde
by @billy1624 in SeaQL/sea-orm#320- Pass the argument
entity.table_ref()
instead of justentity
. by @josh-codes in SeaQL/sea-orm#318 - Unknown types could be a newtypes instead of
ActiveEnum
by @billy1624 in SeaQL/sea-orm#324 - Returning by @billy1624 in SeaQL/sea-orm#292
- 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
- Support for BYTEA Postgres primary keys SeaQL/sea-orm#286
- Documentation for sea-orm by @charleschege in SeaQL/sea-orm#280
- Support
Vec<u8>
primary key by @billy1624 in SeaQL/sea-orm#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 transforms across derive macros SeaQL/sea-orm#262
- Added
is_null
andis_not_null
toColumnTrait
SeaQL/sea-orm#267
(The following is generated by GitHub)
- Changed manual url parsing to use Url crate by @AngelOnFira in SeaQL/sea-orm#253
- Test self referencing relation by @billy1624 in SeaQL/sea-orm#256
- Unify case-transform using the same crate by @billy1624 in SeaQL/sea-orm#264
- CI cleaning by @AngelOnFira in SeaQL/sea-orm#263
- CI install sea-orm-cli in debug mode by @billy1624 in SeaQL/sea-orm#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 fetching 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 different 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