database
Technical notes on web development, DevOps, and AI integration.
2 articles
- 07:59database
MySQL ENUM Migration in Three Steps: No Table Copy Required
Swapping a status vocabulary on live MySQL 5.7 tables: expand-migrate-contract, an honestly lossy down file, and an up-down-up proof before production.
TL;DR: Changing submission statuses from four to six values forces a costly MySQL table copy unless new ENUM values are appended. Instead the migration appends all values, remaps the data, then trims to the final list to stay in-place. Rollback is lossy for newer statuses, so history is tracked separately and the flow was verified with an up-down-up test.
#mysql#migration#schema - 09:17backend
Moving a Category Between Modules Is a Two-Part Job
One UPDATE sounds finished. If the importer map keeps the old value, the next import quietly resurrects stale data.
TL;DR: Moving the souvenir category to tourism required more than a database update. The migration uses a guarded WHERE clause to stay idempotent and reversible, while the importer map was updated in the same commit to prevent the old value from resurrecting. Wrapping it in a transaction would not help since MySQL auto-commits DDL.
#mysql#database-migration#golang