This commit is contained in:
2022-10-02 13:15:41 +05:30
parent e624ff4807
commit f2fad5fbba
13 changed files with 252 additions and 28 deletions

View File

@@ -0,0 +1,32 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "book_person")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub person: String,
pub book_id: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::book::Entity",
from = "Column::BookId",
to = "super::book::Column::Id",
on_update = "Cascade",
on_delete = "Cascade"
)]
Book,
}
impl Related<super::book::Entity> for Entity {
fn to() -> RelationDef {
Relation::Book.def()
}
}
impl ActiveModelBehavior for ActiveModel {}