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