risingwave_meta_model_migration/
m20240702_080451_system_param_value.rs1use sea_orm_migration::prelude::*;
2
3use crate::sea_orm::DbBackend;
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 if manager.get_database_backend() == DbBackend::MySql {
12 manager
13 .alter_table(
14 Table::alter()
15 .table(SystemParameter::Table)
16 .modify_column(ColumnDef::new(SystemParameter::Value).text().not_null())
17 .to_owned(),
18 )
19 .await?;
20 }
21 Ok(())
22 }
23
24 async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
25 if manager.get_database_backend() == DbBackend::MySql {
26 manager
27 .alter_table(
28 Table::alter()
29 .table(SystemParameter::Table)
30 .modify_column(ColumnDef::new(SystemParameter::Value).string().not_null())
31 .to_owned(),
32 )
33 .await?;
34 }
35 Ok(())
36 }
37}
38
39#[derive(DeriveIden)]
40enum SystemParameter {
41 Table,
42 Value,
43}