use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
#[sea_orm(table_name = "snapshot")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub name: String,
pub sandbox_id: Option<i32>,
pub size_bytes: Option<i64>,
pub description: Option<String>,
pub created_at: Option<DateTime>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::sandbox::Entity",
from = "Column::SandboxId",
to = "super::sandbox::Column::Id",
on_delete = "SetNull"
)]
Sandbox,
}
impl Related<super::sandbox::Entity> for Entity {
fn to() -> RelationDef {
Relation::Sandbox.def()
}
}
impl ActiveModelBehavior for ActiveModel {}