1use sea_orm::entity::prelude::*;
2
3#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
4#[sea_orm(table_name = "worktrees")]
5pub struct Model {
6 #[sea_orm(primary_key)]
7 pub id: i32,
8 #[sea_orm(primary_key)]
9 pub project_id: i32,
10 pub abs_path: String,
11 pub root_name: String,
12 pub visible: bool,
13 pub scan_id: i64,
14 pub is_complete: bool,
15}
16
17#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
18pub enum Relation {
19 #[sea_orm(
20 belongs_to = "super::project::Entity",
21 from = "Column::ProjectId",
22 to = "super::project::Column::Id"
23 )]
24 Project,
25}
26
27impl Related<super::project::Entity> for Entity {
28 fn to() -> RelationDef {
29 Relation::Project.def()
30 }
31}
32
33impl ActiveModelBehavior for ActiveModel {}