risingwave_meta_model/
object_dependency.rs1use sea_orm::entity::prelude::*;
16use serde::{Deserialize, Serialize};
17
18use crate::{ObjectId, UserId};
19
20#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
21#[sea_orm(table_name = "object_dependency")]
22pub struct Model {
23 #[sea_orm(primary_key)]
24 pub id: i32,
25 pub oid: ObjectId,
26 pub used_by: UserId,
27}
28
29#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
30pub enum Relation {
31 #[sea_orm(
32 belongs_to = "super::object::Entity",
33 from = "Column::Oid",
34 to = "super::object::Column::Oid",
35 on_update = "NoAction",
36 on_delete = "Cascade"
37 )]
38 Object2,
39 #[sea_orm(
40 belongs_to = "super::object::Entity",
41 from = "Column::UsedBy",
42 to = "super::object::Column::Oid",
43 on_update = "NoAction",
44 on_delete = "Cascade"
45 )]
46 Object1,
47
48 #[sea_orm(
50 belongs_to = "super::source::Entity",
51 from = "Column::Oid",
52 to = "super::source::Column::SourceId",
53 on_update = "NoAction",
54 on_delete = "Cascade"
55 )]
56 Source,
57}
58
59impl ActiveModelBehavior for ActiveModel {}