Files
booksman/backend/entity/src/entities/book_person.rs
2023-05-28 15:17:13 +05:30

33 lines
749 B
Rust

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.6
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[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 {}