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}
19
20#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
21pub enum Relation {
22    #[sea_orm(
23        belongs_to = "super::toolchain::Entity",
24        from = "Column::ToolchainFk",
25        to = "super::toolchain::Column::Id",
26        on_update = "NoAction",
27        on_delete = "Cascade"
28    )]
29    Toolchain,
30}
31
32impl Related<super::toolchain::Entity> for Entity {
33    fn to() -> RelationDef {
34        Relation::Toolchain.def()
35    }
36}
37
38impl ActiveModelBehavior for ActiveModel {}