risingwave_meta_model_migration/
m20240410_082733_with_version_column_migration.rs1use sea_orm_migration::prelude::{Table as MigrationTable, *};
2
3#[derive(DeriveMigrationName)]
4pub struct Migration;
5
6#[async_trait::async_trait]
7impl MigrationTrait for Migration {
8 async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
9 manager
10 .alter_table(
11 MigrationTable::alter()
12 .table(Table::Table)
13 .add_column(ColumnDef::new(Table::VersionColumnIndex).integer())
14 .to_owned(),
15 )
16 .await?;
17
18 Ok(())
19 }
20
21 async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
22 manager
23 .alter_table(
24 MigrationTable::alter()
25 .table(Table::Table)
26 .drop_column(Alias::new(Table::VersionColumnIndex.to_string()))
27 .to_owned(),
28 )
29 .await?;
30 Ok(())
31 }
32}
33
34#[derive(DeriveIden)]
35enum Table {
36 Table,
37 VersionColumnIndex,
38}