fix: fix duplicate locale migration and make Go migrate tool crash-resilientBrowse files at 0010aa6
stripsior committed 3 months ago · 2 changed files
This is the actual migration tool used in production (packages/db/migrate,
built into the ghcr.io/struxadotcloud/migrate image) - my earlier fix to
migrate.ts doesn't apply to it.
- 0004_noisy_black_bolt.sql redundantly re-added user.locale, which
0003_add_user_locale.sql already adds. Fresh installs died on that
duplicate statement every time.
- main.go re-runs an entire migration file from scratch if it isn't marked
as fully applied, but MySQL auto-commits DDL per statement, so a file
killed partway through leaves some statements already applied. Now
known "already exists" MySQL errors during a statement are treated as
already-applied and skipped instead of failing the whole migrate run.