risingwave_meta_model_migration/
m20260312_000000_streaming_job_backfill_parallelism_strategy.rs

1use sea_orm_migration::prelude::*;
2
3// Legacy jobs never persisted a separate backfill adaptive strategy. During creation they either
4// used an explicit fixed `backfill_parallelism` or fell back to the main job strategy. Starting
5// this column as NULL preserves that old behavior because runtime recovery now resolves
6// `backfill_adaptive_parallelism_strategy.or(adaptive_parallelism_strategy)`.
7#[derive(DeriveMigrationName)]
8pub struct Migration;
9
10#[async_trait::async_trait]
11impl MigrationTrait for Migration {
12    async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
13        manager
14            .alter_table(
15                Table::alter()
16                    .table(StreamingJob::Table)
17                    .add_column(
18                        ColumnDef::new(StreamingJob::BackfillAdaptiveParallelismStrategy)
19                            .string()
20                            .null(),
21                    )
22                    .to_owned(),
23            )
24            .await
25    }
26
27    async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
28        manager
29            .alter_table(
30                Table::alter()
31                    .table(StreamingJob::Table)
32                    .drop_column(StreamingJob::BackfillAdaptiveParallelismStrategy)
33                    .to_owned(),
34            )
35            .await
36    }
37}
38
39#[derive(DeriveIden)]
40enum StreamingJob {
41    Table,
42    BackfillAdaptiveParallelismStrategy,
43}