Skip to main content

cognee_database/entities/
pipeline_run.rs

1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
5#[sea_orm(rs_type = "String", db_type = "Text")]
6pub enum PipelineRunStatus {
7    #[sea_orm(string_value = "DATASET_PROCESSING_INITIATED")]
8    Initiated,
9    #[sea_orm(string_value = "DATASET_PROCESSING_STARTED")]
10    Started,
11    #[sea_orm(string_value = "DATASET_PROCESSING_COMPLETED")]
12    Completed,
13    #[sea_orm(string_value = "DATASET_PROCESSING_ERRORED")]
14    Errored,
15}
16
17#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
18#[sea_orm(table_name = "pipeline_runs")]
19pub struct Model {
20    #[sea_orm(primary_key, auto_increment = false)]
21    pub id: String,
22    pub created_at: DateTimeUtc,
23    pub status: PipelineRunStatus,
24    #[sea_orm(indexed)]
25    pub pipeline_run_id: String,
26    pub pipeline_name: String,
27    #[sea_orm(indexed)]
28    pub pipeline_id: String,
29    #[sea_orm(indexed, nullable)]
30    pub dataset_id: Option<String>,
31    #[sea_orm(column_type = "Json", nullable)]
32    pub run_info: Option<Json>,
33}
34
35#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
36pub enum Relation {
37    #[sea_orm(
38        belongs_to = "super::dataset::Entity",
39        from = "Column::DatasetId",
40        to = "super::dataset::Column::Id"
41    )]
42    Dataset,
43}
44
45impl ActiveModelBehavior for ActiveModel {}