risingwave_meta_model_migration/
m20240410_154406_session_params.rs1use sea_orm_migration::prelude::*;
2
3use crate::{assert_not_has_tables, drop_tables};
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 assert_not_has_tables!(manager, SessionParameter);
12 manager
13 .create_table(
14 Table::create()
15 .table(SessionParameter::Table)
16 .col(
17 ColumnDef::new(SessionParameter::Name)
18 .string()
19 .primary_key()
20 .not_null(),
21 )
22 .col(ColumnDef::new(SessionParameter::Value).string().not_null())
23 .col(ColumnDef::new(SessionParameter::Description).text())
24 .to_owned(),
25 )
26 .await?;
27 Ok(())
28 }
29
30 async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
31 drop_tables!(manager, SessionParameter);
33 Ok(())
34 }
35}
36
37#[derive(DeriveIden)]
38enum SessionParameter {
39 Table,
40 Name,
41 Value,
42 Description,
43}