//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19 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 = "message")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub channel_id: Uuid, pub user_id: Uuid, #[sea_orm(column_type = "Text")] pub content: String, pub created_at: DateTimeUtc, pub updated_at: Option, pub reply_to_id: Option, #[sea_orm(has_many)] pub attachments: HasMany, #[sea_orm(has_many)] pub reactions: HasMany, #[sea_orm( belongs_to, from = "channel_id", to = "id", on_update = "NoAction", on_delete = "Cascade" )] pub channel: HasOne, #[sea_orm( self_ref, relation_enum = "ReplyTo", relation_reverse = "Replies", from = "reply_to_id", to = "id", on_update = "NoAction", on_delete = "SetNull" )] pub reply_to: HasOne, #[sea_orm(self_ref, relation_enum = "Replies", relation_reverse = "ReplyTo")] pub replies: HasMany, #[sea_orm( belongs_to, from = "user_id", to = "id", on_update = "NoAction", on_delete = "Cascade" )] pub user: HasOne, } #[async_trait] impl ActiveModelBehavior for ActiveModel { fn new() -> Self { Self { id: Set(Uuid::now_v7()), ..ActiveModelTrait::default() } } }