From d99da269a50fdb4c181ee39d227c8f76df2c4308 Mon Sep 17 00:00:00 2001 From: Li0k Date: Mon, 9 Sep 2024 18:40:36 +0800 Subject: [PATCH 1/2] fix(nimtable): fix sql backend with new column `Engine` --- src/meta/model_v2/migration/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) 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), ] } } From 0073f358adf632c423f692ea1b4c8cba72a79009 Mon Sep 17 00:00:00 2001 From: Li0k Date: Mon, 9 Sep 2024 18:41:16 +0800 Subject: [PATCH 2/2] add migration --- .../src/m20240909_101830_nimtable_dev.rs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/meta/model_v2/migration/src/m20240909_101830_nimtable_dev.rs 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, +}