Changelog
This commit is contained in:
parent
92ea837cdf
commit
5e5aa7cbd1
11
CHANGELOG.md
11
CHANGELOG.md
@ -536,6 +536,16 @@ impl ColumnTrait for Column {
|
||||
* Added the `sea-orm-internal` feature flag to expose some SQLx types
|
||||
* Added `DatabaseConnection::get_*_connection_pool()` for accessing the inner SQLx connection pool https://github.com/SeaQL/sea-orm/pull/1297
|
||||
* Re-exporting SQLx errors https://github.com/SeaQL/sea-orm/pull/1434
|
||||
* Added `TryInsert` that does not panic on empty inserts https://github.com/SeaQL/sea-orm/pull/1708
|
||||
```rust
|
||||
// now, you can do:
|
||||
let empty_insert = Bakery::insert_many(std::iter::empty())
|
||||
.on_empty_do_nothing()
|
||||
.exec(db)
|
||||
.await;
|
||||
|
||||
assert!(matches!(empty_insert, TryInsertResult::Empty));
|
||||
```
|
||||
|
||||
### Upgrades
|
||||
|
||||
@ -564,6 +574,7 @@ impl ColumnTrait for Column {
|
||||
* Fixes hitting 'negative last_insert_rowid' panic with Sqlite https://github.com/SeaQL/sea-orm/issues/1357
|
||||
* Noop when update without providing any values https://github.com/SeaQL/sea-orm/pull/1384
|
||||
* Fixes Syntax Error when saving active model that sets nothing https://github.com/SeaQL/sea-orm/pull/1376
|
||||
* Resolved `insert_many` failing if the models iterator is empty https://github.com/SeaQL/sea-orm/issues/873
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
|
@ -15,7 +15,7 @@ pub enum Relation {
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Users,
|
||||
#[sea_orm(has_many = "super::users_saved_bills::Entity")]
|
||||
|
@ -16,7 +16,7 @@ pub enum Relation {
|
||||
from = "Column::BillId",
|
||||
to = "super::bills::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Bills,
|
||||
#[sea_orm(
|
||||
@ -24,7 +24,7 @@ pub enum Relation {
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ pub enum Relation {
|
||||
from = "Column::BillId",
|
||||
to = "super::bills::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Bills,
|
||||
#[sea_orm(
|
||||
@ -25,7 +25,7 @@ pub enum Relation {
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub enum Relation {
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Users,
|
||||
#[sea_orm(has_many = "super::users_votes::Entity")]
|
||||
|
@ -17,7 +17,7 @@ pub enum Relation {
|
||||
from = "Column::BillId",
|
||||
to = "super::bills::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Bills,
|
||||
#[sea_orm(
|
||||
@ -25,7 +25,7 @@ pub enum Relation {
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub enum Relation {
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Users,
|
||||
}
|
||||
|
@ -17,25 +17,25 @@ pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::bills::Entity",
|
||||
from = "Column::BillIdd",
|
||||
to = "super::bills::Column::Id",
|
||||
to = "super::bills::Column::Id"
|
||||
)]
|
||||
Bills2,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::bills::Entity",
|
||||
from = "Column::BillId",
|
||||
to = "super::bills::Column::Id",
|
||||
to = "super::bills::Column::Id"
|
||||
)]
|
||||
Bills1,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::users::Entity",
|
||||
from = "Column::UserIdd",
|
||||
to = "super::users::Column::Id",
|
||||
to = "super::users::Column::Id"
|
||||
)]
|
||||
Users2,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::users::Entity",
|
||||
from = "Column::UserId",
|
||||
to = "super::users::Column::Id",
|
||||
to = "super::users::Column::Id"
|
||||
)]
|
||||
Users1,
|
||||
}
|
||||
|
@ -10,11 +10,7 @@ pub struct Model {
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "Entity",
|
||||
from = "Column::SelfId",
|
||||
to = "Column::Id",
|
||||
)]
|
||||
#[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")]
|
||||
SelfRef,
|
||||
}
|
||||
|
||||
|
@ -11,17 +11,9 @@ pub struct Model {
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "Entity",
|
||||
from = "Column::SelfId",
|
||||
to = "Column::Id",
|
||||
)]
|
||||
#[sea_orm(belongs_to = "Entity", from = "Column::SelfId", to = "Column::Id")]
|
||||
SelfRef2,
|
||||
#[sea_orm(
|
||||
belongs_to = "Entity",
|
||||
from = "Column::SelfIdd",
|
||||
to = "Column::Id",
|
||||
)]
|
||||
#[sea_orm(belongs_to = "Entity", from = "Column::SelfIdd", to = "Column::Id")]
|
||||
SelfRef1,
|
||||
}
|
||||
|
||||
|
@ -37,15 +37,7 @@ pub async fn test(db: &DbConn) {
|
||||
|
||||
assert!(matches!(res, TryInsertResult::Inserted(_)));
|
||||
|
||||
let empty_iterator = [bakery::ActiveModel {
|
||||
name: Set("SeaSide Bakery".to_owned()),
|
||||
profit_margin: Set(10.4),
|
||||
..Default::default()
|
||||
}]
|
||||
.into_iter()
|
||||
.filter(|_| false);
|
||||
|
||||
let empty_insert = Bakery::insert_many(empty_iterator)
|
||||
let empty_insert = Bakery::insert_many(std::iter::empty())
|
||||
.on_empty_do_nothing()
|
||||
.exec(db)
|
||||
.await;
|
||||
|
Loading…
x
Reference in New Issue
Block a user