diff --git a/src/tests_cfg/filling.rs b/src/tests_cfg/filling.rs index 5e691980..433a89b8 100644 --- a/src/tests_cfg/filling.rs +++ b/src/tests_cfg/filling.rs @@ -2,14 +2,9 @@ use crate as sea_orm; use crate::entity::prelude::*; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] +#[sea_orm(table_name = "filling")] pub struct Entity; -impl EntityName for Entity { - fn table_name(&self) -> &str { - "filling" - } -} - #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] pub struct Model { pub id: i32, diff --git a/src/tests_cfg/fruit.rs b/src/tests_cfg/fruit.rs index 102fe10e..9a47e3cf 100644 --- a/src/tests_cfg/fruit.rs +++ b/src/tests_cfg/fruit.rs @@ -1,37 +1,15 @@ use crate as sea_orm; use crate::entity::prelude::*; -#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, DeriveModel, DeriveActiveModel)] #[sea_orm(table_name = "fruit")] -pub struct Entity; - -#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] pub struct Model { + #[sea_orm(primary_key)] pub id: i32, pub name: String, pub cake_id: Option, } -#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] -pub enum Column { - Id, - Name, - CakeId, -} - -#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] -pub enum PrimaryKey { - Id, -} - -impl PrimaryKeyTrait for PrimaryKey { - type ValueType = i32; - - fn auto_increment() -> bool { - true - } -} - #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( @@ -42,18 +20,6 @@ pub enum Relation { Cake, } -impl ColumnTrait for Column { - type EntityName = Entity; - - fn def(&self) -> ColumnDef { - match self { - Self::Id => ColumnType::Integer.def(), - Self::Name => ColumnType::String(None).def(), - Self::CakeId => ColumnType::Integer.def(), - } - } -} - impl Related for Entity { fn to() -> RelationDef { Relation::Cake.def()