Skip to main content

cognee_database/entities/
graph_sync_checkpoint.rs

1//! Graph sync checkpoint entity for Stage 4 of `improve()`.
2//!
3//! Stores high-water mark timestamps per `(user_id, dataset_id, session_id)`
4//! triple so that `sync_graph_to_session()` can process only new edges
5//! on re-runs.
6use sea_orm::entity::prelude::*;
7use serde::{Deserialize, Serialize};
8
9#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
10#[sea_orm(table_name = "graph_sync_checkpoints")]
11pub struct Model {
12    /// Checkpoint key of the form
13    /// `graph_sync_checkpoint:{user_id}:{dataset_id}:{session_id}`.
14    #[sea_orm(primary_key, auto_increment = false)]
15    pub key: String,
16    /// Last-synced edge `created_at` timestamp.
17    pub ts: DateTimeUtc,
18}
19
20#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
21pub enum Relation {}
22
23impl ActiveModelBehavior for ActiveModel {}