microsandbox_db/entity/
index.rs1use sea_orm::entity::prelude::*;
4
5#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
11#[sea_orm(table_name = "index")]
12pub struct Model {
13 #[sea_orm(primary_key)]
14 pub id: i32,
15 pub image_id: i32,
16 pub schema_version: Option<i32>,
17 pub media_type: Option<String>,
18 pub platform_os: Option<String>,
19 pub platform_arch: Option<String>,
20 pub platform_variant: Option<String>,
21 pub annotations: Option<String>,
22 pub created_at: Option<DateTime>,
23}
24
25#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
31pub enum Relation {
32 #[sea_orm(
34 belongs_to = "super::image::Entity",
35 from = "Column::ImageId",
36 to = "super::image::Column::Id",
37 on_delete = "Cascade"
38 )]
39 Image,
40
41 #[sea_orm(has_many = "super::manifest::Entity")]
43 Manifest,
44}
45
46impl Related<super::image::Entity> for Entity {
47 fn to() -> RelationDef {
48 Relation::Image.def()
49 }
50}
51
52impl Related<super::manifest::Entity> for Entity {
53 fn to() -> RelationDef {
54 Relation::Manifest.def()
55 }
56}
57
58impl ActiveModelBehavior for ActiveModel {}