This commit is contained in:
2022-10-22 16:46:45 +05:30
parent 44f9a8b15f
commit 2143923ee8
20 changed files with 409 additions and 229 deletions

View File

@@ -1,4 +1,4 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;
@@ -33,6 +33,8 @@ pub enum Relation {
BookSubject,
#[sea_orm(has_many = "super::book_time::Entity")]
BookTime,
#[sea_orm(has_many = "super::book_isbn::Entity")]
BookIsbn,
}
impl Related<super::book_author::Entity> for Entity {
@@ -65,4 +67,10 @@ impl Related<super::book_time::Entity> for Entity {
}
}
impl Related<super::book_isbn::Entity> for Entity {
fn to() -> RelationDef {
Relation::BookIsbn.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@@ -1,4 +1,4 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;

View File

@@ -0,0 +1,32 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "book_isbn")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub isbn: 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 {}

View File

@@ -1,4 +1,4 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;

View File

@@ -1,4 +1,4 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;

View File

@@ -1,4 +1,4 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;

View File

@@ -1,4 +1,4 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
use sea_orm::entity::prelude::*;

View File

@@ -1,9 +1,10 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
pub mod prelude;
pub mod book;
pub mod book_author;
pub mod book_isbn;
pub mod book_person;
pub mod book_place;
pub mod book_subject;

View File

@@ -1,7 +1,8 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.2
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
pub use super::book::Entity as Book;
pub use super::book_author::Entity as BookAuthor;
pub use super::book_isbn::Entity as BookIsbn;
pub use super::book_person::Entity as BookPerson;
pub use super::book_place::Entity as BookPlace;
pub use super::book_subject::Entity as BookSubject;