risingwave_meta_model_migration/
m20241125_043732_connection_params.rs

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