diff --git a/src/meta/model_v2/migration/src/lib.rs b/src/meta/model_v2/migration/src/lib.rs index 08291e5b163d5..5c3cbfa0146e1 100644 --- a/src/meta/model_v2/migration/src/lib.rs +++ b/src/meta/model_v2/migration/src/lib.rs @@ -20,6 +20,7 @@ mod m20240702_080451_system_param_value; mod m20240702_084927_unnecessary_fk; mod m20240726_063833_auto_schema_change; mod m20240806_143329_add_rate_limit_to_source_catalog; +mod m20240909_101830_nimtable_dev; pub struct Migrator; @@ -45,6 +46,7 @@ impl MigratorTrait for Migrator { Box::new(m20240702_084927_unnecessary_fk::Migration), Box::new(m20240726_063833_auto_schema_change::Migration), Box::new(m20240806_143329_add_rate_limit_to_source_catalog::Migration), + Box::new(m20240909_101830_nimtable_dev::Migration), ] } } diff --git a/src/meta/model_v2/migration/src/m20240909_101830_nimtable_dev.rs b/src/meta/model_v2/migration/src/m20240909_101830_nimtable_dev.rs new file mode 100644 index 0000000000000..3deb80863604c --- /dev/null +++ b/src/meta/model_v2/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, +}