Skip to main content

cognee_database/entities/
dataset_configuration.rs

1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
5#[sea_orm(table_name = "dataset_configurations")]
6pub struct Model {
7    #[sea_orm(primary_key, auto_increment = false)]
8    pub id: String,
9    #[sea_orm(unique)]
10    pub dataset_id: String,
11    #[sea_orm(column_type = "Json", nullable)]
12    pub graph_schema: Option<serde_json::Value>,
13    #[sea_orm(column_type = "Text", nullable)]
14    pub custom_prompt: Option<String>,
15    pub created_at: DateTimeUtc,
16    pub updated_at: Option<DateTimeUtc>,
17}
18
19#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
20pub enum Relation {
21    #[sea_orm(
22        belongs_to = "super::dataset::Entity",
23        from = "Column::DatasetId",
24        to = "super::dataset::Column::Id",
25        on_delete = "Cascade"
26    )]
27    Dataset,
28}
29
30impl Related<super::dataset::Entity> for Entity {
31    fn to() -> RelationDef {
32        Relation::Dataset.def()
33    }
34}
35
36impl ActiveModelBehavior for ActiveModel {}