fix(migration): make kyte_locked migration portable to MySQL (v4.15.1, KYTE-#325)#112
Merged
Merged
Conversation
…, KYTE-#325) migrations/4.15.0_datamodel_kyte_locked.sql used MariaDB-only `ALTER TABLE ... ADD COLUMN IF NOT EXISTS`, which is a syntax error on MySQL 5.7/8.0. Surfaced during the v4.15.0 rollout to the first MySQL-backed install (ETOM, MySQL 8.0.44) — no harm there since its kyte_locked columns already existed (failed stmt was a no-op) and the decimal migration is portable, but a drifted MySQL install would have errored and never gained the column, leaving the model-level lock guard inert. Rewritten with an information_schema column check + a prepared statement, which is idempotent on BOTH MySQL and MariaDB. Validated live: clean no-op on MySQL 8.0.44 and MariaDB 11.8.6. Migration-only; no PHP behavior change. Installs already on v4.15.0 with the columns present need no action. CHANGELOG: 4.15.1 section added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Rewrites
migrations/4.15.0_datamodel_kyte_locked.sqlto be engine-portable (MySQL + MariaDB), replacing the MariaDB-onlyADD COLUMN IF NOT EXISTSwith aninformation_schemaguard + prepared statement. Ships as v4.15.1.Why
The migration (added in #111) used
ALTER TABLE ... ADD COLUMN IF NOT EXISTS, which is MariaDB-only — it's a syntax error on MySQL 5.7/8.0. This surfaced during the v4.15.0 rollout to the first MySQL-backed install (ETOM, MySQL 8.0.44).kyte_lockedcolumns already existed, so the failed statement was a no-op, and the decimal migration (portable) succeeded. The MariaDB clients applied the original fine.Fix
Idempotent, portable pattern:
(repeated for
ModelAttribute).Validation
Ran the new pattern live against both engines — clean, exit 0, columns intact:
shipyard) — the engine that rejected the old syntaxImpact
Migration-only; no PHP change. Installs already on v4.15.0 with the columns present need no action — the deployed clients do not require re-rolling. Protects future/fresh/drifted MySQL installs.
🤖 Generated with Claude Code