init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
use sea_orm::Set;
|
||||
use sea_orm::entity::prelude::*;
|
||||
use sea_orm::prelude::async_trait::async_trait;
|
||||
|
||||
#[sea_orm::model]
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "emoji_alias")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub emoji_id: Uuid,
|
||||
pub alias: String,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
#[sea_orm(belongs_to, from = "emoji_id", to = "id", on_delete = "Cascade")]
|
||||
pub emoji: HasOne<super::emoji::Entity>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ActiveModelBehavior for ActiveModel {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
id: Set(Uuid::new_v4()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user