Skip to main content

kellnr_entity/
toolchain_target.rs

1//! `SeaORM` Entity for toolchain target archives
2
3use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6#[sea_orm(table_name = "toolchain_target")]
7pub struct Model {
8    #[sea_orm(primary_key)]
9    pub id: i64,
10    pub toolchain_fk: i64,
11    #[sea_orm(column_type = "Text")]
12    pub target: String,
13    #[sea_orm(column_type = "Text")]
14    pub storage_path: String,
15    #[sea_orm(column_type = "Text")]
16    pub hash: String,
17    pub size: i64,
18    #[sea_orm(column_type = "Text")]
19    pub status: String,
20}
21
22#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
23pub enum Relation {
24    #[sea_orm(
25        belongs_to = "super::toolchain::Entity",
26        from = "Column::ToolchainFk",
27        to = "super::toolchain::Column::Id",
28        on_update = "NoAction",
29        on_delete = "Cascade"
30    )]
31    Toolchain,
32    #[sea_orm(has_many = "super::toolchain_component::Entity")]
33    ToolchainComponents,
34}
35
36impl Related<super::toolchain::Entity> for Entity {
37    fn to() -> RelationDef {
38        Relation::Toolchain.def()
39    }
40}
41
42impl Related<super::toolchain_component::Entity> for Entity {
43    fn to() -> RelationDef {
44        Relation::ToolchainComponents.def()
45    }
46}
47
48impl ActiveModelBehavior for ActiveModel {}