From 94dadd96b89d43916f54b120b18b80d546bd92e6 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Sat, 12 Oct 2024 12:30:19 +0800 Subject: [PATCH] also set singleton to 1 in migration script Signed-off-by: Bugen Zhao --- .../m20240911_083152_variable_vnode_count.rs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/meta/model_v2/migration/src/m20240911_083152_variable_vnode_count.rs b/src/meta/model_v2/migration/src/m20240911_083152_variable_vnode_count.rs index 5b0aad3ea5586..e7ad6b7b8dc1b 100644 --- a/src/meta/model_v2/migration/src/m20240911_083152_variable_vnode_count.rs +++ b/src/meta/model_v2/migration/src/m20240911_083152_variable_vnode_count.rs @@ -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() @@ -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() @@ -74,12 +96,16 @@ impl MigrationTrait for Migration { enum Fragment { Table, VnodeCount, + DistributionType, } #[derive(DeriveIden)] enum Table { Table, VnodeCount, + DistributionKey, + DistKeyInPk, + VnodeColIndex, } #[derive(DeriveIden)]