-
Notifications
You must be signed in to change notification settings - Fork 17
fix: split multi-statement ClickHouse golang-migrate migrations #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ClickHouse's golang-migrate driver does not support multi-statement queries. The migrations introduced in #1415 and #1416 contained multiple ALTER TABLE statements per file, which works fine with Atlas but fails with golang-migrate. Split the 3 multi-statement migrations into 9 single-statement files. Also re-timestamps out-of-order postgres migrations. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||||||||||||||||
Preview Environment (PR #1420)Preview environment scaled down after 12h of inactivity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did these get renamed? I don't believe this should go in because it's completely unrelated with the clickhouse issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a result of running clickhouse rebase i believe but might be wrong - the original issue i ran into was out of order migrations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that these migrations are not clickhouse migrations - they're PG migrations, which was what stood out to me 🤔
Summary
Root cause
mise clickhouse:diffuses Atlas to generate both Atlas and golang-migrate migration files. Atlas natively supports multi-statement SQL, so the generated Atlas migrations work fine. However, the golang-migrate output uses the exact same SQL content, and golang-migrate's ClickHouse driver only supports one statement per migration file.This was never caught because:
golang-migrate exists specifically as an alternative for developers who don't have an Atlas Pro account (see
server/clickhouse/local/golang_migrate/README.md). Anyone using it would hit this error onmise clickhouse:migrate:Recovery
If you previously attempted these migrations with golang-migrate and hit a dirty state, run:
migrate -path server/clickhouse/local/golang_migrate -database "$GRAM_CLICKHOUSE_GOMIGRATE_URL" force 20251217163326Then run
mise clickhouse:migrateas normal.Test plan
mise clickhouse:migratewithCLICKHOUSE_MIGRATION_ENGINE=golang-migrateand verify all migrations apply cleanlymise clickhouse:downrolls back correctly🤖 Generated with Claude Code