risingwave_meta_model_migration/
m20240417_062305_subscription_internal_table_name.rs

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