New Features
- Support PgVector (under feature flag
postgres-vector) #2500
// Model
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "image_model")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: i32,
pub embedding: PgVector,
}
// Schema
sea_query::Table::create()
.table(image_model::Entity.table_ref())
.col(ColumnDef::new(embedding::Column::Id).integer().not_null().primary_key())
.col(ColumnDef::new(embedding::Column::Embedding).vector(None).not_null())
..
// Insert
ActiveModel {
id: NotSet,
embedding: Set(PgVector::from(vec![1., 2., 3.])),
}
.insert(db)
.await?- Added
Insert::exec_with_returning_keys&Insert::exec_with_returning_many(Postgres only)
assert_eq!(
Entity::insert_many([
ActiveModel { id: NotSet, name: Set("two".into()) },
ActiveModel { id: NotSet, name: Set("three".into()) },
])
.exec_with_returning_many(db)
.await
.unwrap(),
[
Model { id: 2, name: "two".into() },
Model { id: 3, name: "three".into() },
]
);
assert_eq!(
cakes_bakers::Entity::insert_many([
cakes_bakers::ActiveModel {
cake_id: Set(1),
baker_id: Set(2),
},
cakes_bakers::ActiveModel {
cake_id: Set(2),
baker_id: Set(1),
},
])
.exec_with_returning_keys(db)
.await
.unwrap(),
[(1, 2), (2, 1)]
);- Added
DeleteOne::exec_with_returning&DeleteMany::exec_with_returning#2432
Enhancements
- Expose underlying row types (e.g.
sqlx::postgres::PgRow) #2265 - [sea-orm-cli] Added
acquire-timeoutoption #2461 - [sea-orm-cli] Added
with-preludeoption #2322 - [sea-orm-cli] Added
impl-active-model-behavioroption #2487
Bug Fixes
- Fixed
seaography::register_active_enumsmacro #2475
House keeping
- Remove
futurescrate, replace withfutures-util#2466