risingwave_meta_model_migration/
m20241121_101830_table_engine.rs

1use 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        // Replace the sample below with your own migration scripts
10        manager
11            .alter_table(
12                MigrationTable::alter()
13                    .table(Table::Table)
14                    .add_column(ColumnDef::new(Table::Engine).string())
15                    .to_owned(),
16            )
17            .await
18    }
19
20    async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
21        manager
22            .alter_table(
23                MigrationTable::alter()
24                    .table(Table::Table)
25                    .drop_column(Alias::new(Table::Engine.to_string()))
26                    .to_owned(),
27            )
28            .await?;
29        Ok(())
30    }
31}
32
33#[derive(DeriveIden)]
34enum Table {
35    Table,
36    Engine,
37}