Skip to main content

knowdit_kg_model/db/
project_category.rs

1use sea_orm::entity::prelude::*;
2
3/// Junction table: which categories a project belongs to
4#[sea_orm::model]
5#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize, DeriveEntityModel)]
6#[sea_orm(table_name = "project_category")]
7pub struct Model {
8    #[sea_orm(primary_key, auto_increment = false)]
9    pub project_id: i32,
10    #[sea_orm(primary_key, auto_increment = false)]
11    pub category_id: i32,
12
13    #[sea_orm(belongs_to, from = "project_id", to = "id")]
14    pub project: Option<super::project::Entity>,
15    #[sea_orm(belongs_to, from = "category_id", to = "id")]
16    pub category: Option<super::category::Entity>,
17}
18
19impl ActiveModelBehavior for ActiveModel {}