File tree 3 files changed +34
-1
lines changed
3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,10 @@ export function relationType(x: Relation) {
67
67
return "SINK"
68
68
} else if ( ( x as Source ) . info !== undefined ) {
69
69
return "SOURCE"
70
- } else {
70
+ } else if ( ( x as Subscription ) . dependentTableId !== undefined ) {
71
+ return "SUBSCRIPTION"
72
+ }
73
+ else {
71
74
return "UNKNOWN"
72
75
}
73
76
}
Original file line number Diff line number Diff line change @@ -581,6 +581,29 @@ impl CatalogController {
581
581
}
582
582
} ) ) ;
583
583
584
+ let subscription_dependencies: Vec < ( SubscriptionId , TableId ) > = Sink :: find ( )
585
+ . select_only ( )
586
+ . columns ( [
587
+ subscription:: Column :: SubscriptionId ,
588
+ subscription:: Column :: DependentTableId ,
589
+ ] )
590
+ . join ( JoinType :: InnerJoin , sink:: Relation :: Object . def ( ) )
591
+ . filter (
592
+ subscription:: Column :: SubscriptionState
593
+ . eq ( Into :: < i32 > :: into ( SubscriptionState :: Created ) )
594
+ . and ( subscription:: Column :: DependentTableId . is_not_null ( ) ) ,
595
+ )
596
+ . into_tuple ( )
597
+ . all ( & inner. db )
598
+ . await ?;
599
+
600
+ obj_dependencies. extend ( subscription_dependencies. into_iter ( ) . map (
601
+ |( sink_id, table_id) | PbObjectDependencies {
602
+ object_id : table_id as _ ,
603
+ referenced_object_id : sink_id as _ ,
604
+ } ,
605
+ ) ) ;
606
+
584
607
Ok ( obj_dependencies)
585
608
}
586
609
Original file line number Diff line number Diff line change @@ -3698,6 +3698,13 @@ impl CatalogManager {
3698
3698
}
3699
3699
}
3700
3700
3701
+ for subscription in core. subscriptions . values ( ) {
3702
+ dependencies. push ( PbObjectDependencies {
3703
+ object_id : subscription. id ,
3704
+ referenced_object_id : subscription. dependent_table_id ,
3705
+ } ) ;
3706
+ }
3707
+
3701
3708
dependencies
3702
3709
}
3703
3710
You can’t perform that action at this time.
0 commit comments