Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Doctrine transport does not allow schema_filter #31623

Closed
@weaverryan

Description

@weaverryan

Symfony version(s) affected: 4.3

Description
If you use the Messenger Doctrine transports, you'll probably want to use the doctrine.dbal.schema_filter config set to, for example, ~^(?!messenger_messages)~ so that migrations doesn't try to drop your "extra" table. However, I found out that the auto_setup functionality in the Doctrine transport uses the SchemaSynchronizer, which is aware of your "schema_filter" config. In other words, it gets a "list" of your existing tables in a way that respects schema_filter, which means that it thinks this table doesn't exist. It then tries to recreate it.

The problem is here: https://github.com/doctrine/dbal/blob/cdc12afe378722b649ce07f1cb2d990fe43025e0/lib/Doctrine/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizer.php#L42

Which then ultimately, in listTableNames(), calls this:

https://github.com/doctrine/dbal/blob/cdc12afe378722b649ce07f1cb2d990fe43025e0/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php#L225

Possible Solution
I'm not sure how to best solve it. We could "hack" the connection configuration before/after using the database synchronizer (to remove the schema filter, then re-add)... but that's ugly.

ping @vincenttouzet

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions