Repository navigation
fix(migrations): PostgreSQL-compatible migrations - #5
Merged
Merged
Conversation
The shipped migrations used MySQL-only DDL (CHAR(36) COMMENT, LONGTEXT, inline INDEX, ENGINE=InnoDB, `RENAME TABLE`) and failed on PostgreSQL. Rewrite the CREATE against the DBAL Schema API and replace `RENAME TABLE` with the portable `ALTER TABLE ... RENAME TO`, so Doctrine emits correct DDL for MySQL, PostgreSQL and SQLite alike. Adds MigrationsPortabilityTest, which runs the real migration classes on an in-memory SQLite database as a regression guard. Pulls doctrine/migrations + doctrine/dbal ^3.7 and pdo_sqlite into require-dev. Co-Authored-By: Claude Opus 4.8 <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.
Problem
The bundle's migrations were raw MySQL-only DDL (
CHAR(36) COMMENT,LONGTEXT, inlineINDEX,ENGINE=InnoDB,RENAME TABLE), sodoctrine:migrations:migratefails on PostgreSQL.Fix
CREATE TABLE jobagainst the DBAL Schema API, so Doctrinegenerates the correct DDL per platform (MySQL / PostgreSQL / SQLite).
RENAME TABLE job TO za7_jobwith the portableALTER TABLE job RENAME TO za7_job.Existing MySQL installs are unaffected — these migrations already ran there.
Test
Adds
MigrationsPortabilityTest, which runs the real migration classes on anin-memory SQLite database (neither MySQL nor PostgreSQL). Any remaining
MySQL-only SQL would make SQLite throw, so a green test proves portability.
require-devgainsdoctrine/migrations,doctrine/dbal ^3.7andpdo_sqlite;CI (
setup-php) and the local docker runner getpdo_sqlite.🤖 Generated with Claude Code