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