Skip to content

Commit 032b5a1

Browse files
authored
fix(clickhouse): renumber task_kind migration 029 → 031 (#3631)
## Summary Renumber `029_add_task_kind_to_task_runs_v2.sql` → `031_add_task_kind_to_task_runs_v2.sql` to fix a deploy-blocking out-of-order migration, and make the DDL idempotent with `ADD COLUMN IF NOT EXISTS` / `DROP COLUMN IF EXISTS`. ## Root cause - Migration `030_create_sessions_v1.sql` landed on main on 2026-04-28 (PR #3417) and was applied to test cloud ClickHouse on a subsequent deploy. Current goose version on test ClickHouse: **30**. - Migration `029_add_task_kind_to_task_runs_v2.sql` was authored later on 2026-05-10 as part of the Sessions primitive PR series (`be1a6cf8`). - The next test cloud deploy failed because goose strict-mode refused to apply a missing version *before* the current version: ``` goose run: error: found 1 missing migrations before current version 30: version 29: 029_add_task_kind_to_task_runs_v2.sql ``` ## Fix 1. **Rename to `031_*`** (next available number after 030). Goose now treats it as a new migration after 030 and applies it cleanly on test/prod where the column does not yet exist. 2. **Make the DDL idempotent** (`ADD COLUMN IF NOT EXISTS`). The original 029 may have been applied in environments that ran goose with `--allow-missing` (e.g. some local dev databases) — those would have the column already, and the rename causes goose to see 031 as new and re-attempt the ADD. Idempotent DDL keeps that path safe. The `Down` mirrors with `DROP COLUMN IF EXISTS`. ## Test plan - [ ] Test cloud deploy (after this lands) successfully runs the ClickHouse migration step - [ ] `task_kind` column shows up on `trigger_dev.task_runs_v2` post-migration - [ ] Local environments that had previously applied 029 do not error on the next `goose up`
1 parent 5788573 commit 032b5a1

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

internal-packages/clickhouse/schema/029_add_task_kind_to_task_runs_v2.sql

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- +goose Up
2+
-- IF NOT EXISTS is required because this migration was previously numbered
3+
-- 029 and may have been applied in environments where goose accepted it
4+
-- before 030_create_sessions_v1 advanced the version counter. Renaming to
5+
-- 031 makes goose treat this as new everywhere, so the DDL must tolerate
6+
-- the column already being present.
7+
ALTER TABLE trigger_dev.task_runs_v2
8+
ADD COLUMN IF NOT EXISTS task_kind LowCardinality(String) DEFAULT '';
9+
10+
-- +goose Down
11+
ALTER TABLE trigger_dev.task_runs_v2
12+
DROP COLUMN IF EXISTS task_kind;

0 commit comments

Comments
 (0)