Skip to content

Commit

Permalink
also set singleton to 1 in migration script
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Oct 12, 2024
1 parent d350f94 commit 94dadd9
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ impl MigrationTrait for Migration {
)
.await?;

manager
.exec_stmt(
UpdateStatement::new()
.table(Table::Table)
.values([(Table::VnodeCount, Expr::value(1))])
.and_where(Expr::col(Table::DistributionKey).eq(Expr::value("[]")))
.and_where(Expr::col(Table::DistKeyInPk).eq(Expr::value("[]")))
.and_where(Expr::col(Table::VnodeColIndex).is_null())
.to_owned(),
)
.await?;

manager
.alter_table(
MigrationTable::alter()
Expand All @@ -30,6 +42,16 @@ impl MigrationTrait for Migration {
)
.await?;

manager
.exec_stmt(
UpdateStatement::new()
.table(Fragment::Table)
.values([(Fragment::VnodeCount, Expr::value(1))])
.and_where(Expr::col(Fragment::DistributionType).eq(Expr::value("SINGLE")))
.to_owned(),
)
.await?;

manager
.alter_table(
MigrationTable::alter()
Expand Down Expand Up @@ -74,12 +96,16 @@ impl MigrationTrait for Migration {
enum Fragment {
Table,
VnodeCount,
DistributionType,
}

#[derive(DeriveIden)]
enum Table {
Table,
VnodeCount,
DistributionKey,
DistKeyInPk,
VnodeColIndex,
}

#[derive(DeriveIden)]
Expand Down

0 comments on commit 94dadd9

Please sign in to comment.