use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] #[sea_orm(table_name = "task_runs")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub task_id: Uuid, pub status: String, #[sea_orm(column_type = "Text")] pub logs: String, #[sea_orm(column_type = "Text", nullable)] pub answer: Option, pub created_at: DateTimeWithTimeZone, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( belongs_to = "super::task::Entity", from = "Column::TaskId", to = "super::task::Column::Id", on_update = "NoAction", on_delete = "Cascade" )] Task, } impl Related for Entity { fn to() -> RelationDef { Relation::Task.def() } } impl ActiveModelBehavior for ActiveModel {}