Skip to content

Releases: SeaQL/sea-orm

2.0.0-rc.32

11 Feb 21:02

Choose a tag to compare

  • permit passing custom derives to Model or ModelEx (#2933)
#[sea_orm::model]
#[derive(TS, ...)]
// Apply attributes specifically to the generated Model struct
#[sea_orm(model_attrs(ts(rename = "Fruit")))]
// Apply attributes specifically to the generated ModelEx struct
#[sea_orm(model_ex_attrs(ts(rename = "FruitEx")))]
struct Model {
    // ...
}

The code above expands to:

// ...
#[derive(TS, ...)]
#[ts(rename = "Fruit")]
struct Model {
    // ...
}

// ...
#[derive(TS, ...)]
#[ts(rename = "FruitEx")]
struct ModelEx {
    // ...
}
  • Add typed column for TextUuid (#2717)
  • Fix proxy compile error (#2935)
  • Use i64 for COUNT(*) result on MySQL and SQLite (#2944)
  • MigratorTrait with self (#2806)

2.0.0-rc.29

26 Jan 00:03

Choose a tag to compare

  • Add missing lifetime hint to EntityName::table_name (#2907)
  • [sea-orm-cli] Fix codegen to not generate relations to filtered entities (#2913)
  • [sea-orm-cli] Fix enum variants starting with digits (#2905)
  • Add wrapper type for storing Uuids as TEXT (#2914)
  • Optimize exists; PaginatorTrait::exists is moved to SelectExt (#2909)
  • Add tracing spans for database operations (#2885)
  • Fix derive enums without per-case rename (#2922)
  • Fix DeriveIntoActiveModel on Option<T> fields (#2926)
#[derive(DeriveIntoActiveModel)]
#[sea_orm(active_model = "<fruit::Entity as EntityTrait>::ActiveModel")]
struct PartialFruit {
    cake_id: Option<i32>,
}

assert_eq!(
    PartialFruit { cake_id: Some(1) }.into_active_model(),
    fruit::ActiveModel {
        id: NotSet,
        name: NotSet,
        cake_id: Set(Some(1)),
    }
);
  • FromQueryResult now supports nullable nested model (#2845)
#[derive(FromQueryResult)]
struct CakeWithOptionalBakeryModel {
    #[sea_orm(alias = "cake_id")]
    id: i32,
    #[sea_orm(alias = "cake_name")]
    name: String,
    #[sea_orm(nested)]
    bakery: Option<bakery::Model>, // can be null
}

2.0.0-rc.28

11 Jan 23:04

Choose a tag to compare

  • Deprecate do_nothing and on_empty_do_nothing (#2883)
  • Add set_if_not_equals_and to ActiveValue (#2888)
  • Add sqlx-all feature in sea-orm-migration (#2887)
  • Add debug log for entity registry (#2900)
  • Set auto_increment to false for String / Uuid primary key by default (#2881)

1.1.19

11 Nov 00:47

Choose a tag to compare

Enhancements

  • Add find_linked_recursive method to ModelTrait #2480
  • Skip drop extension type in fresh #2716

Bug Fixes

  • Handle null values in from_sqlx_*_row_to_proxy_row functions #2744

1.1.17

09 Oct 12:26

Choose a tag to compare

New Features

  • Added map_sqlx_mysql_opts, map_sqlx_postgres_opts, map_sqlx_sqlite_opts to ConnectOptions #2731
let mut opt = ConnectOptions::new(url);
opt.map_sqlx_postgres_opts(|pg_opt: PgConnectOptions| {
    pg_opt.ssl_mode(PgSslMode::Require)
});
  • Added mariadb-use-returning to use returning syntax for MariaDB #2710
  • Released sea-orm-rocket 0.6 #2732

1.1.16

11 Sep 16:28

Choose a tag to compare

Bug Fixes

  • Fix enum casting in DerivePartialModel #2719 #2720
#[derive(DerivePartialModel)]
#[sea_orm(entity = "active_enum::Entity", from_query_result, alias = "zzz")]
struct PartialWithEnumAndAlias {
    #[sea_orm(from_col = "tea")]
    foo: Option<Tea>,
}

let sql = active_enum::Entity::find()
    .into_partial_model::<PartialWithEnumAndAlias>()
    .into_statement(DbBackend::Postgres)
    .sql;

assert_eq!(
    sql,
    r#"SELECT CAST("zzz"."tea" AS "text") AS "foo" FROM "public"."active_enum""#,
);

Enhancements

  • [sea-orm-cli] Use tokio (optional) instead of async-std #2721

1.1.15

31 Aug 12:02

Choose a tag to compare

Enhancements

  • Allow DerivePartialModel to have nested aliases #2686
#[derive(DerivePartialModel)]
#[sea_orm(entity = "bakery::Entity", from_query_result)]
struct Factory {
    id: i32,
    #[sea_orm(from_col = "name")]
    plant: String,
}

#[derive(DerivePartialModel)]
#[sea_orm(entity = "cake::Entity", from_query_result)]
struct CakeFactory {
    id: i32,
    name: String,
    #[sea_orm(nested, alias = "factory")] // <- new
    bakery: Option<Factory>,
}
  • Add ActiveModelTrait::try_set #2706
fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value);
/// New: a non-panicking version of above
fn try_set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value) -> Result<(), DbErr>;

Bug Fixes

  • [sea-orm-cli] Fix compilation issue #2713

1.1.14

21 Jul 15:12

Choose a tag to compare

1.1.14 - 2025-07-21

Enhancements

  • [sea-orm-cli] Mask sensitive ENV values #2658

Bug Fixes

  • FromJsonQueryResult: panic on serialization failures #2635
#[derive(Clone, Debug, PartialEq, Deserialize, FromJsonQueryResult)]
pub struct NonSerializableStruct;

impl Serialize for NonSerializableStruct {
    fn serialize<S>(&self, _serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        Err(serde::ser::Error::custom(
            "intentionally failing serialization",
        ))
    }
}

let model = Model {
    json: Some(NonSerializableStruct),
};

let _ = model.into_active_model().insert(&ctx.db).await; // panic here

1.1.13

29 Jun 17:37

Choose a tag to compare

New Features

  • [sea-orm-cli] New --frontend-format flag to generate entities in pure Rust #2631
// for example, below is the normal (compact) Entity:
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "cake")]
pub struct Model {
    #[sea_orm(primary_key)]
    #[serde(skip_deserializing)]
    pub id: i32,
    #[sea_orm(column_type = "Text", nullable)]
    pub name: Option<String> ,
}
// this is the generated frontend model, there is no SeaORM dependency:
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Model {
    #[serde(skip_deserializing)]
    pub id: i32,
    pub name: Option<String> ,
}

Enhancements

  • Remove potential panics in Loader #2637

1.1.12

27 May 09:18

Choose a tag to compare

Enhancements

  • Make sea-orm-cli & sea-orm-migration dependencies optional #2367
  • Relax TransactionError's trait bound for errors to allow anyhow::Error #2602

Bug Fixes

  • Include custom column_name in DeriveColumn Column::from_str impl #2603
#[derive(DeriveEntityModel)]
pub struct Model {
    #[sea_orm(column_name = "lAsTnAmE")]
    last_name: String,
}

assert!(matches!(Column::from_str("lAsTnAmE").unwrap(), Column::LastName));