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    // A JSON object representing the current Branch values
20    pub branch_summary: Option<String>,
21    // A JSON object representing the current Head commit values
22    pub head_commit_details: Option<String>,
23}
24
25#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
26pub enum Relation {
27    #[sea_orm(
28        belongs_to = "super::project::Entity",
29        from = "Column::ProjectId",
30        to = "super::project::Column::Id"
31    )]
32    Project,
33}
34
35impl Related<super::project::Entity> for Entity {
36    fn to() -> RelationDef {
37        Relation::Project.def()
38    }
39}
40
41impl ActiveModelBehavior for ActiveModel {}