migrations
migrations copied to clipboard
Adding the migrations table to doctrine (dbal) schema assets filter breaks migrations
Bug Report
Q | A |
---|---|
BC Break | no |
Version | 3.5.5 |
Summary
Adding the migrations table to schema assets filter causes migrations to break
Current behavior
With the latest doctrine/dbal (3.5.3) and doctrine/orm (2.14.1) orm:schema-tool:update
gives a deprecation notice
[WARNING] Not passing the "--complete" option to "orm:schema-tool:update" is deprecated and will not be supported when using doctrine/dbal 4
Running it with the --complete option will drop the migrations table (which is not desirable)
DROP TABLE doctrine_migration_versions;
This is prevented by filtering out the migrations table using the dbal schemaAssetFilter configuration (callback), however this breaks the doctrine migrations.
Running migrations:status
doesn't recognize previously executed migrations (Migrations Executed is listed as 0 and all available migrations are seen as New) and migrations:migrate
tries to add the already existing migrations table
An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'doctrine_migration_versions' already exists
How to reproduce
Add the migrations table to any existing doctrine configuration (where at least one migration was already run), e.g.
$connection->getConfiguration()->setSchemaAssetsFilter(
fn (string $tableName): bool => (
$tableName !== 'doctrine_migration_versions'
));
Expected behavior
migrations:status
and migrations:migrate
to function as normal (when the migrations table is added to asset filter)
Not sure what to do yet, but this is likely caused by https://github.com/doctrine/orm/pull/10153/commits/7cb96fcf0e3aa151cba463cff4ea2e99a5ba6517, itself caused by https://github.com/doctrine/dbal/pull/5766
Being worked on from/related PRs mentioned in #1406