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