Releases: SeaQL/sea-orm
Releases Β· SeaQL/sea-orm
2.0.0-rc.32
- 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 {
// ...
}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::existsis moved toSelectExt(#2909) - Add tracing spans for database operations (#2885)
- Fix derive enums without per-case rename (#2922)
- Fix
DeriveIntoActiveModelonOption<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)),
}
);FromQueryResultnow 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
1.1.19
1.1.17
New Features
- Added
map_sqlx_mysql_opts,map_sqlx_postgres_opts,map_sqlx_sqlite_optstoConnectOptions#2731
let mut opt = ConnectOptions::new(url);
opt.map_sqlx_postgres_opts(|pg_opt: PgConnectOptions| {
pg_opt.ssl_mode(PgSslMode::Require)
});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
- [sea-orm-cli] Use tokio (optional) instead of async-std #2721
1.1.15
Enhancements
- Allow
DerivePartialModelto 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
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 here1.1.13
New Features
- [sea-orm-cli] New
--frontend-formatflag 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
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_namein DeriveColumnColumn::from_strimpl #2603
#[derive(DeriveEntityModel)]
pub struct Model {
#[sea_orm(column_name = "lAsTnAmE")]
last_name: String,
}
assert!(matches!(Column::from_str("lAsTnAmE").unwrap(), Column::LastName));