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