36 lines · 937 B · Rust
RawDownload
use crate::db::ProjectId;use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]#[sea_orm(table_name = "worktrees")]pub struct Model {    #[sea_orm(primary_key)]    pub id: i64,    #[sea_orm(primary_key)]    pub project_id: ProjectId,    pub abs_path: String,    pub root_name: String,    pub visible: bool,    /// The last scan for which we've observed entries. It may be in progress.    pub scan_id: i64,    /// The last scan that fully completed.    pub completed_scan_id: i64,} #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]pub enum Relation {    #[sea_orm(        belongs_to = "super::project::Entity",        from = "Column::ProjectId",        to = "super::project::Column::Id"    )]    Project,} impl Related<super::project::Entity> for Entity {    fn to() -> RelationDef {        Relation::Project.def()    }} impl ActiveModelBehavior for ActiveModel {}