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    pub remote_upstream_url: Option<String>,
26    pub remote_origin_url: Option<String>,
27}
28
29#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
30pub enum Relation {
31    #[sea_orm(
32        belongs_to = "super::project::Entity",
33        from = "Column::ProjectId",
34        to = "super::project::Column::Id"
35    )]
36    Project,
37}
38
39impl Related<super::project::Entity> for Entity {
40    fn to() -> RelationDef {
41        Relation::Project.def()
42    }
43}
44
45impl ActiveModelBehavior for ActiveModel {}