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 lines_added: Option<i32>,
21 pub lines_deleted: 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 {}