Skip to content

Commit 5169f25

Browse files
committed
Added parent column for Union Find in Cascades Group
1 parent d01a97a commit 5169f25

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

optd-persistent/src/migrator/memo/m20241029_000001_cascades_group.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub enum CascadesGroup {
7575
LatestWinner,
7676
InProgress,
7777
IsOptimized,
78+
ParentId,
7879
}
7980

8081
#[derive(DeriveMigrationName)]
@@ -99,6 +100,14 @@ impl MigrationTrait for Migration {
99100
)
100101
.col(boolean(CascadesGroup::InProgress))
101102
.col(boolean(CascadesGroup::IsOptimized))
103+
.col(integer_null(CascadesGroup::ParentId))
104+
.foreign_key(
105+
ForeignKey::create()
106+
.from(CascadesGroup::Table, CascadesGroup::ParentId)
107+
.to(CascadesGroup::Table, CascadesGroup::Id)
108+
.on_delete(ForeignKeyAction::SetNull)
109+
.on_update(ForeignKeyAction::Cascade),
110+
)
102111
.to_owned(),
103112
)
104113
.await

0 commit comments

Comments
 (0)