Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nimtable): fix sql backend with new column Engine #18468

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/meta/model_v2/migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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),
]
}
}
Expand Down
38 changes: 38 additions & 0 deletions src/meta/model_v2/migration/src/m20240909_101830_nimtable_dev.rs
Original file line number Diff line number Diff line change
@@ -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,
}
Loading