use pagetop_seaorm::db::*; #[derive(Clone, Debug, DeriveEntityModel, PartialEq)] #[sea_orm(table_name = "sessions")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub sid: String, pub user_id: i32, pub data: String, pub remember: bool, pub last_activity_at: Option, pub expires_at: DateTimeUtc, pub created_at: DateTimeUtc, } #[derive(Clone, Copy, Debug, DeriveRelation, EnumIter)] pub enum Relation { #[sea_orm( belongs_to = "super::user::Entity", from = "Column::UserId", to = "super::user::Column::Id", on_delete = "Cascade" )] User, } impl Related for Entity { fn to() -> RelationDef { Relation::User.def() } } impl ActiveModelBehavior for ActiveModel {}