microsandbox_db/entity/
manifest.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
11#[sea_orm(table_name = "manifest")]
12pub struct Model {
13 #[sea_orm(primary_key)]
14 pub id: i32,
15 #[sea_orm(unique)]
16 pub digest: String,
17 pub media_type: Option<String>,
18 pub config_digest: Option<String>,
19 pub architecture: Option<String>,
20 pub os: Option<String>,
21 pub variant: Option<String>,
22 pub layer_count: Option<i32>,
23 pub total_size_bytes: Option<i64>,
24 pub created_at: Option<DateTime>,
25}
26
27#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
33pub enum Relation {
34 #[sea_orm(has_many = "super::image_ref::Entity")]
36 ImageRef,
37
38 #[sea_orm(has_one = "super::config::Entity")]
40 Config,
41
42 #[sea_orm(has_many = "super::manifest_layer::Entity")]
44 ManifestLayer,
45
46 #[sea_orm(has_many = "super::sandbox_rootfs::Entity")]
48 SandboxRootfs,
49}
50
51impl Related<super::image_ref::Entity> for Entity {
52 fn to() -> RelationDef {
53 Relation::ImageRef.def()
54 }
55}
56
57impl Related<super::config::Entity> for Entity {
58 fn to() -> RelationDef {
59 Relation::Config.def()
60 }
61}
62
63impl Related<super::manifest_layer::Entity> for Entity {
64 fn to() -> RelationDef {
65 Relation::ManifestLayer.def()
66 }
67}
68
69impl Related<super::layer::Entity> for Entity {
70 fn to() -> RelationDef {
71 super::manifest_layer::Relation::Layer.def()
72 }
73
74 fn via() -> Option<RelationDef> {
75 Some(super::manifest_layer::Relation::Manifest.def().rev())
76 }
77}
78
79impl ActiveModelBehavior for ActiveModel {}