Skip to content

Commit

Permalink
fix(nimtable): fix sql backend with new column Engine (#18468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Li0k committed Oct 25, 2024
1 parent 56bbc20 commit 258ba80
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/meta/model/migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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),
]
}
}
38 changes: 38 additions & 0 deletions src/meta/model/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,
}

0 comments on commit 258ba80

Please sign in to comment.