diff --git a/src/meta/model/migration/src/lib.rs b/src/meta/model/migration/src/lib.rs index 4ae39aea2919..4111055c4174 100644 --- a/src/meta/model/migration/src/lib.rs +++ b/src/meta/model/migration/src/lib.rs @@ -21,6 +21,7 @@ mod m20240702_084927_unnecessary_fk; mod m20240726_063833_auto_schema_change; mod m20240806_143329_add_rate_limit_to_source_catalog; mod m20240820_081248_add_time_travel_per_table_epoch; +mod m20240909_101830_nimtable_dev; mod m20240911_083152_variable_vnode_count; mod m20241016_065621_hummock_gc_history; @@ -83,6 +84,7 @@ impl MigratorTrait for Migrator { Box::new(m20240820_081248_add_time_travel_per_table_epoch::Migration), Box::new(m20240911_083152_variable_vnode_count::Migration), Box::new(m20241016_065621_hummock_gc_history::Migration), + Box::new(m20240909_101830_nimtable_dev::Migration), ] } } diff --git a/src/meta/model/migration/src/m20240909_101830_nimtable_dev.rs b/src/meta/model/migration/src/m20240909_101830_nimtable_dev.rs new file mode 100644 index 000000000000..3deb80863604 --- /dev/null +++ b/src/meta/model/migration/src/m20240909_101830_nimtable_dev.rs @@ -0,0 +1,38 @@ +use sea_orm_migration::prelude::{Table as MigrationTable, *}; + +#[derive(DeriveMigrationName)] +pub struct Migration; + +#[async_trait::async_trait] +impl MigrationTrait for Migration { + async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { + // Replace the sample below with your own migration scripts + manager + .alter_table( + MigrationTable::alter() + .table(Table::Table) + .add_column(ColumnDef::new(Table::Engine).string().not_null()) + .to_owned(), + ) + .await + } + + async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { + manager + .alter_table( + MigrationTable::alter() + .table(Table::Table) + .drop_column(Alias::new(Table::Engine.to_string())) + .to_owned(), + ) + .await?; + Ok(()) + } +} + +#[derive(DeriveIden)] + +enum Table { + Table, + Engine, +}