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)]