Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the migrations table to doctrine (dbal) schema assets filter breaks migrations #1317

Open
ittmann opened this issue Feb 6, 2023 · 2 comments

Comments

@ittmann
Copy link

ittmann commented Feb 6, 2023

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)

@greg0ire
Copy link
Member

Not sure what to do yet, but this is likely caused by doctrine/orm@7cb96fc, itself caused by doctrine/dbal#5766

@ittmann
Copy link
Author

ittmann commented Apr 5, 2024

Being worked on from/related PRs mentioned in #1406

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

No branches or pull requests

2 participants