project_repository.rs

 1use crate::db::ProjectId;
 2use sea_orm::entity::prelude::*;
 3
 4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
 5#[sea_orm(table_name = "project_repositories")]
 6pub struct Model {
 7    #[sea_orm(primary_key)]
 8    pub project_id: ProjectId,
 9    #[sea_orm(primary_key)]
10    pub id: i64,
11    pub abs_path: String,
12    pub legacy_worktree_id: Option<i64>,
13    // JSON array containing 1 or more integer project entry ids
14    pub entry_ids: String,
15    pub scan_id: i64,
16    pub is_deleted: bool,
17    // JSON array typed string
18    pub current_merge_conflicts: Option<String>,
19    // The suggested merge commit message
20    pub merge_message: Option<String>,
21    // A JSON object representing the current Branch values
22    pub branch_summary: Option<String>,
23    // A JSON object representing the current Head commit values
24    pub head_commit_details: Option<String>,
25}
26
27#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
28pub enum Relation {
29    #[sea_orm(
30        belongs_to = "super::project::Entity",
31        from = "Column::ProjectId",
32        to = "super::project::Column::Id"
33    )]
34    Project,
35}
36
37impl Related<super::project::Entity> for Entity {
38    fn to() -> RelationDef {
39        Relation::Project.def()
40    }
41}
42
43impl ActiveModelBehavior for ActiveModel {}