|
| 1 | +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0 |
| 2 | +
|
| 3 | +use sea_orm::entity::prelude::*; |
| 4 | + |
| 5 | +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] |
| 6 | +#[sea_orm(table_name = "cascades_group")] |
| 7 | +pub struct Model { |
| 8 | + #[sea_orm(primary_key)] |
| 9 | + pub id: i32, |
| 10 | + pub winner: Option<i32>, |
| 11 | + pub cost: Option<i64>, |
| 12 | + pub is_optimized: bool, |
| 13 | + pub parent_id: Option<i32>, |
| 14 | +} |
| 15 | + |
| 16 | +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] |
| 17 | +pub enum Relation { |
| 18 | + #[sea_orm( |
| 19 | + belongs_to = "Entity", |
| 20 | + from = "Column::ParentId", |
| 21 | + to = "Column::Id", |
| 22 | + on_update = "Cascade", |
| 23 | + on_delete = "SetNull" |
| 24 | + )] |
| 25 | + SelfRef, |
| 26 | + #[sea_orm(has_many = "super::logical_children::Entity")] |
| 27 | + LogicalChildren, |
| 28 | + #[sea_orm(has_many = "super::logical_expression::Entity")] |
| 29 | + LogicalExpression, |
| 30 | + #[sea_orm(has_many = "super::physical_children::Entity")] |
| 31 | + PhysicalChildren, |
| 32 | + #[sea_orm( |
| 33 | + belongs_to = "super::physical_expression::Entity", |
| 34 | + from = "Column::Winner", |
| 35 | + to = "super::physical_expression::Column::Id", |
| 36 | + on_update = "Cascade", |
| 37 | + on_delete = "SetNull" |
| 38 | + )] |
| 39 | + PhysicalExpression, |
| 40 | +} |
| 41 | + |
| 42 | +impl Related<super::logical_children::Entity> for Entity { |
| 43 | + fn to() -> RelationDef { |
| 44 | + Relation::LogicalChildren.def() |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +impl Related<super::physical_children::Entity> for Entity { |
| 49 | + fn to() -> RelationDef { |
| 50 | + Relation::PhysicalChildren.def() |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +impl Related<super::logical_expression::Entity> for Entity { |
| 55 | + fn to() -> RelationDef { |
| 56 | + super::logical_children::Relation::LogicalExpression.def() |
| 57 | + } |
| 58 | + fn via() -> Option<RelationDef> { |
| 59 | + Some(super::logical_children::Relation::CascadesGroup.def().rev()) |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +impl Related<super::physical_expression::Entity> for Entity { |
| 64 | + fn to() -> RelationDef { |
| 65 | + super::physical_children::Relation::PhysicalExpression.def() |
| 66 | + } |
| 67 | + fn via() -> Option<RelationDef> { |
| 68 | + Some( |
| 69 | + super::physical_children::Relation::CascadesGroup |
| 70 | + .def() |
| 71 | + .rev(), |
| 72 | + ) |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +impl ActiveModelBehavior for ActiveModel {} |
0 commit comments