36 lines
992 B
Rust
36 lines
992 B
Rust
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "package_related")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub package_id: i32,
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub r#type: crate::db::PackageRelatedEnum,
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub name: String,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::package::Entity",
|
|
from = "Column::PackageId",
|
|
to = "super::package::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "Cascade"
|
|
)]
|
|
Package,
|
|
}
|
|
|
|
impl Related<super::package::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Package.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|