microsandbox_db/entity/
layer.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
11#[sea_orm(table_name = "layer")]
12pub struct Model {
13 #[sea_orm(primary_key)]
14 pub id: i32,
15 #[sea_orm(unique)]
16 pub digest: String,
17 pub diff_id: String,
18 pub media_type: Option<String>,
19 pub size_bytes: Option<i64>,
20 pub created_at: Option<DateTime>,
21}
22
23#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
29pub enum Relation {
30 #[sea_orm(has_many = "super::manifest_layer::Entity")]
32 ManifestLayer,
33}
34
35impl Related<super::manifest_layer::Entity> for Entity {
36 fn to() -> RelationDef {
37 Relation::ManifestLayer.def()
38 }
39}
40
41impl Related<super::manifest::Entity> for Entity {
42 fn to() -> RelationDef {
43 super::manifest_layer::Relation::Manifest.def()
44 }
45
46 fn via() -> Option<RelationDef> {
47 Some(super::manifest_layer::Relation::Layer.def().rev())
48 }
49}
50
51impl ActiveModelBehavior for ActiveModel {}