SeaQL/sea-orm
 Watch   
 Star   
 Fork   
6 days ago
sea-orm

2.0.0-rc.29

  • 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 (#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 left join (#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>,
}
20 days ago
sea-orm

2.0.0-rc.28

  • 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)
2025-11-11 08:09:11
sea-orm

1.1.19

Enhancements

Bug Fixes

2025-10-09 20:20:40
sea-orm

1.1.17

New Features

let mut opt = ConnectOptions::new(url);
opt.map_sqlx_postgres_opts(|pg_opt: PgConnectOptions| {
    pg_opt.ssl_mode(PgSslMode::Require)
});
2025-09-11 21:58:36
sea-orm

1.1.16

Bug Fixes

#[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

2025-08-31 19:28:14
sea-orm

1.1.15

Enhancements

#[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>,
}
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

2025-07-21 23:01:15
sea-orm

1.1.14

1.1.14 - 2025-07-21

Enhancements

Bug Fixes

#[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
2025-06-29 23:19:24
sea-orm

1.1.13

New Features

// 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

2025-05-27 16:28:01
sea-orm

1.1.12

Enhancements

Bug Fixes

#[derive(DeriveEntityModel)]
pub struct Model {
    #[sea_orm(column_name = "lAsTnAmE")]
    last_name: String,
}

assert!(matches!(Column::from_str("lAsTnAmE").unwrap(), Column::LastName));
2025-05-08 06:40:17
sea-orm

1.1.11

Enhancements

  • Added ActiveModelTrait::default_values
assert_eq!(
    fruit::ActiveModel::default_values(),
    fruit::ActiveModel {
        id: Set(0),
        name: Set("".into()),
        cake_id: Set(None),
        type_without_default: NotSet,
    },
);
// This allows using `RelationDef` directly where sea-query expects an `IntoCondition`
let query = Query::select()
    .from(fruit::Entity)
    .inner_join(cake::Entity, fruit::Relation::Cake.def())
    .to_owned();

Bug fixes

assert_eq!(
    lunch_set::Entity::find()
        .select_only()
        .column(lunch_set::Column::Tea)
        .build(DbBackend::Postgres)
        .to_string(),
    r#"SELECT CAST("lunch_set"."tea" AS "text") FROM "lunch_set""#
    // "text" is now quoted; will work for "text"[] as well
);

Upgrades