sea-orm/tests/common/bakery_chain/cakes_bakers.rs
Billy Chan 950a3bc201
Upstream Changes - 2 (#2149)
* Upstream Changes - 2

* revert
2024-03-13 08:51:17 +00:00

31 lines
740 B
Rust

use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "cakes_bakers")]
pub struct Model {
#[sea_orm(primary_key)]
pub cake_id: i32,
#[sea_orm(primary_key)]
pub baker_id: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::cake::Entity",
from = "Column::CakeId",
to = "super::cake::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Cake,
#[sea_orm(
belongs_to = "super::baker::Entity",
from = "Column::BakerId",
to = "super::baker::Column::Id"
)]
Baker,
}
impl ActiveModelBehavior for ActiveModel {}