51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
|
#[sea_orm(table_name = "messages")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
#[sea_orm(unique)]
|
|
pub id_discord: i64,
|
|
pub id_sender: i32,
|
|
pub id_content: i32,
|
|
pub id_channel: i32,
|
|
pub id_server: i32,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::channel::Entity",
|
|
from = "Column::IdChannel",
|
|
to = "super::channel::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Channel,
|
|
#[sea_orm(
|
|
belongs_to = "super::content::Entity",
|
|
from = "Column::IdContent",
|
|
to = "super::content::Column::Id",
|
|
on_update = "NoAction",
|
|
on_delete = "NoAction"
|
|
)]
|
|
Content,
|
|
}
|
|
|
|
impl Related<super::channel::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Channel.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::content::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Content.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|