From e10dcd012fdbfcd137c5a034c8a4c2c18df92137 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Thu, 14 Dec 2023 20:20:25 +0000 Subject: [PATCH] Revert "Fixup" This reverts commit 8a29cba78a45fc6c7fa578dfb0163ec44a77de98. --- .../duplicated_many_to_many_paths/bills.rs | 4 ++-- .../users_saved_bills.rs | 4 ++-- .../duplicated_many_to_many_paths/users_votes.rs | 4 ++-- .../src/tests_cfg/many_to_many/bills.rs | 4 ++-- .../src/tests_cfg/many_to_many/users_votes.rs | 4 ++-- .../src/tests_cfg/many_to_many_multiple/bills.rs | 4 ++-- .../many_to_many_multiple/users_votes.rs | 12 ++++++------ .../src/tests_cfg/self_referencing/bills.rs | 8 ++++++-- .../src/tests_cfg/self_referencing/users.rs | 16 ++++++++++++---- tests/active_enum_tests.rs | 2 -- 10 files changed, 36 insertions(+), 26 deletions(-) diff --git a/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/bills.rs b/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/bills.rs index baf33426..a3a6911b 100644 --- a/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/bills.rs +++ b/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/bills.rs @@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key)] pub id: i32, - pub user_id: Option, + pub user_id: Option , } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] @@ -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")] diff --git a/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_saved_bills.rs b/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_saved_bills.rs index 575bac58..4ef0281c 100644 --- a/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_saved_bills.rs +++ b/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_saved_bills.rs @@ -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, } diff --git a/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_votes.rs b/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_votes.rs index 62f9cf7d..a04ad7fa 100644 --- a/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_votes.rs +++ b/sea-orm-codegen/src/tests_cfg/duplicated_many_to_many_paths/users_votes.rs @@ -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, } diff --git a/sea-orm-codegen/src/tests_cfg/many_to_many/bills.rs b/sea-orm-codegen/src/tests_cfg/many_to_many/bills.rs index f2de469f..5a3acef9 100644 --- a/sea-orm-codegen/src/tests_cfg/many_to_many/bills.rs +++ b/sea-orm-codegen/src/tests_cfg/many_to_many/bills.rs @@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key)] pub id: i32, - pub user_id: Option, + pub user_id: Option , } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] @@ -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")] diff --git a/sea-orm-codegen/src/tests_cfg/many_to_many/users_votes.rs b/sea-orm-codegen/src/tests_cfg/many_to_many/users_votes.rs index 62f9cf7d..a04ad7fa 100644 --- a/sea-orm-codegen/src/tests_cfg/many_to_many/users_votes.rs +++ b/sea-orm-codegen/src/tests_cfg/many_to_many/users_votes.rs @@ -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, } diff --git a/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/bills.rs b/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/bills.rs index 6874aeed..5094e588 100644 --- a/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/bills.rs +++ b/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/bills.rs @@ -5,7 +5,7 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key)] pub id: i32, - pub user_id: Option, + pub user_id: Option , } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] @@ -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, } diff --git a/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/users_votes.rs b/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/users_votes.rs index 29fb173c..87187f4c 100644 --- a/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/users_votes.rs +++ b/sea-orm-codegen/src/tests_cfg/many_to_many_multiple/users_votes.rs @@ -7,8 +7,8 @@ pub struct Model { pub user_id: i32, #[sea_orm(primary_key, auto_increment = false)] pub bill_id: i32, - pub user_idd: Option, - pub bill_idd: Option, + pub user_idd: Option , + pub bill_idd: Option , pub vote: bool, } @@ -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, } diff --git a/sea-orm-codegen/src/tests_cfg/self_referencing/bills.rs b/sea-orm-codegen/src/tests_cfg/self_referencing/bills.rs index 22cfc469..583655f6 100644 --- a/sea-orm-codegen/src/tests_cfg/self_referencing/bills.rs +++ b/sea-orm-codegen/src/tests_cfg/self_referencing/bills.rs @@ -5,12 +5,16 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key)] pub id: i32, - pub self_id: Option, + pub self_id: Option , } #[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, } diff --git a/sea-orm-codegen/src/tests_cfg/self_referencing/users.rs b/sea-orm-codegen/src/tests_cfg/self_referencing/users.rs index 487ba940..b54f3e5e 100644 --- a/sea-orm-codegen/src/tests_cfg/self_referencing/users.rs +++ b/sea-orm-codegen/src/tests_cfg/self_referencing/users.rs @@ -5,15 +5,23 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key)] pub id: i32, - pub self_id: Option, - pub self_idd: Option, + pub self_id: Option , + pub self_idd: Option , } #[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, } diff --git a/tests/active_enum_tests.rs b/tests/active_enum_tests.rs index 1a38f3b7..e06e0ab2 100644 --- a/tests/active_enum_tests.rs +++ b/tests/active_enum_tests.rs @@ -113,7 +113,6 @@ pub async fn insert_active_enum(db: &DatabaseConnection) -> Result<(), DbErr> { // Equivalent to the above. let select_with_tea_in = Entity::find().filter(Column::Tea.is_in([Tea::EverydayTea, Tea::BreakfastTea])); - #[cfg(feature = "sqlx-postgres")] assert_eq!( select_with_tea_in .build(sea_orm::DatabaseBackend::Postgres) @@ -146,7 +145,6 @@ pub async fn insert_active_enum(db: &DatabaseConnection) -> Result<(), DbErr> { let select_with_tea_not_in = Entity::find() .filter(Column::Tea.is_not_null()) .filter(Column::Tea.is_not_in([Tea::BreakfastTea])); - #[cfg(feature = "sqlx-postgres")] assert_eq!( select_with_tea_not_in .build(sea_orm::DatabaseBackend::Postgres)