Skip to content

fix(migrations): PostgreSQL-compatible migrations - #5

Merged
eluhr merged 1 commit into
masterfrom
feature/postgres-compatible-migrations
Jul 1, 2026
Merged

eluhr merged 1 commit into
masterfrom
feature/postgres-compatible-migrations

Conversation

@eluhr

@eluhr eluhr commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Problem

The bundle's migrations were raw MySQL-only DDL (CHAR(36) COMMENT,
LONGTEXT, inline INDEX, ENGINE=InnoDB, RENAME TABLE), so
doctrine:migrations:migrate fails on PostgreSQL.

Fix

  • Rewrite CREATE TABLE job against the DBAL Schema API, so Doctrine
    generates the correct DDL per platform (MySQL / PostgreSQL / SQLite).
  • Replace the MySQL-only RENAME TABLE job TO za7_job with the portable
    ALTER 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 an
in-memory SQLite database (neither MySQL nor PostgreSQL). Any remaining
MySQL-only SQL would make SQLite throw, so a green test proves portability.
require-dev gains doctrine/migrations, doctrine/dbal ^3.7 and pdo_sqlite;
CI (setup-php) and the local docker runner get pdo_sqlite.

🤖 Generated with Claude Code

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>
@eluhr
eluhr merged commit a3cceeb into master Jul 1, 2026
2 checks passed
@eluhr
eluhr deleted the feature/postgres-compatible-migrations branch July 1, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant