risingwave_meta_model/
fragment_relation.rs1use sea_orm::entity::prelude::*;
16use serde::{Deserialize, Serialize};
17
18use crate::actor_dispatcher::DispatcherType;
19use crate::{FragmentId, I32Array};
20
21#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
22#[sea_orm(table_name = "fragment_relation")]
23pub struct Model {
24 #[sea_orm(primary_key)]
25 pub source_fragment_id: FragmentId,
26 #[sea_orm(primary_key)]
27 pub target_fragment_id: FragmentId,
28 pub dispatcher_type: DispatcherType,
29 pub dist_key_indices: I32Array,
30 pub output_indices: I32Array,
31}
32
33#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
34pub enum Relation {
35 #[sea_orm(
36 belongs_to = "super::fragment::Entity",
37 from = "Column::SourceFragmentId",
38 to = "super::fragment::Column::FragmentId",
39 on_update = "NoAction",
40 on_delete = "Cascade"
41 )]
42 SourceFragment,
43 #[sea_orm(
44 belongs_to = "super::fragment::Entity",
45 from = "Column::TargetFragmentId",
46 to = "super::fragment::Column::FragmentId",
47 on_update = "NoAction",
48 on_delete = "Cascade"
49 )]
50 TargetFragment,
51}
52
53impl ActiveModelBehavior for ActiveModel {}