language_server.rs

 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}
14
15#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16pub enum Relation {
17    #[sea_orm(
18        belongs_to = "super::project::Entity",
19        from = "Column::ProjectId",
20        to = "super::project::Column::Id"
21    )]
22    Project,
23}
24
25impl Related<super::project::Entity> for Entity {
26    fn to() -> RelationDef {
27        Relation::Project.def()
28    }
29}
30
31impl ActiveModelBehavior for ActiveModel {}