Skip to main content

kellnr_entity/
toolchain_component.rs

1use sea_orm::entity::prelude::*;
2
3#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
4#[sea_orm(table_name = "toolchain_component")]
5pub struct Model {
6    #[sea_orm(primary_key)]
7    pub id: i64,
8    pub toolchain_target_fk: i64,
9    #[sea_orm(column_type = "Text")]
10    pub name: String,
11    #[sea_orm(column_type = "Text")]
12    pub storage_path: String,
13    #[sea_orm(column_type = "Text")]
14    pub hash: String,
15    pub size: i64,
16}
17
18#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
19pub enum Relation {
20    #[sea_orm(
21        belongs_to = "super::toolchain_target::Entity",
22        from = "Column::ToolchainTargetFk",
23        to = "super::toolchain_target::Column::Id",
24        on_update = "NoAction",
25        on_delete = "Cascade"
26    )]
27    ToolchainTarget,
28}
29
30impl Related<super::toolchain_target::Entity> for Entity {
31    fn to() -> RelationDef {
32        Relation::ToolchainTarget.def()
33    }
34}
35
36impl ActiveModelBehavior for ActiveModel {}