worktree_repository_statuses.rs

 1use crate::db::ProjectId;
 2use sea_orm::entity::prelude::*;
 3
 4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
 5#[sea_orm(table_name = "worktree_repository_statuses")]
 6pub struct Model {
 7    #[sea_orm(primary_key)]
 8    pub project_id: ProjectId,
 9    #[sea_orm(primary_key)]
10    pub worktree_id: i64,
11    #[sea_orm(primary_key)]
12    pub work_directory_id: i64,
13    #[sea_orm(primary_key)]
14    pub repo_path: String,
15    /// Old single-code status field, no longer used but kept here to mirror the DB schema.
16    pub status: i64,
17    pub status_kind: StatusKind,
18    /// For unmerged entries, this is the `first_head` status. For tracked entries, this is the `index_status`.
19    pub first_status: Option<i32>,
20    /// For unmerged entries, this is the `second_head` status. For tracked entries, this is the `worktree_status`.
21    pub second_status: Option<i32>,
22    pub scan_id: i64,
23    pub is_deleted: bool,
24}
25
26#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
27#[sea_orm(rs_type = "i32", db_type = "Integer")]
28pub enum StatusKind {
29    Untracked = 0,
30    Ignored = 1,
31    Unmerged = 2,
32    Tracked = 3,
33}
34
35#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
36pub enum Relation {}
37
38impl ActiveModelBehavior for ActiveModel {}