use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "channels")] pub struct Model { #[sea_orm(primary_key)] pub id: Uuid, pub guild_id: Uuid, pub name: String, pub kind: String, pub created_at: DateTimeWithTimeZone, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( belongs_to = "super::guilds::Entity", from = "Column::GuildId", to = "super::guilds::Column::Id" )] Guilds, #[sea_orm(has_many = "super::messages::Entity")] Messages, } impl Related for Entity { fn to() -> RelationDef { Relation::Guilds.def() } } impl ActiveModelBehavior for ActiveModel {}