risingwave_meta_model_migration/
m20250528_064717_barrier_interval_per_database.rs

1use sea_orm_migration::prelude::*;
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        manager
10            .alter_table(
11                Table::alter()
12                    .table(Database::Table)
13                    .add_column(ColumnDef::new(Database::BarrierIntervalMs).integer().null())
14                    .to_owned(),
15            )
16            .await?;
17
18        manager
19            .alter_table(
20                Table::alter()
21                    .table(Database::Table)
22                    .add_column(
23                        ColumnDef::new(Database::CheckpointFrequency)
24                            .big_integer()
25                            .null(),
26                    )
27                    .to_owned(),
28            )
29            .await
30    }
31
32    async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
33        manager
34            .alter_table(
35                Table::alter()
36                    .table(Database::Table)
37                    .drop_column(Database::BarrierIntervalMs)
38                    .to_owned(),
39            )
40            .await?;
41
42        manager
43            .alter_table(
44                Table::alter()
45                    .table(Database::Table)
46                    .drop_column(Database::CheckpointFrequency)
47                    .to_owned(),
48            )
49            .await
50    }
51}
52
53#[derive(DeriveIden)]
54enum Database {
55    Table,
56    BarrierIntervalMs,
57    CheckpointFrequency,
58}