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

[Messenger] Doctrine transport does not allow schema_filter #31623

Closed
weaverryan opened this issue May 26, 2019 · 1 comment
Closed

[Messenger] Doctrine transport does not allow schema_filter #31623

weaverryan opened this issue May 26, 2019 · 1 comment

Comments

@weaverryan
Copy link
Member

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

@vincenttouzet
Copy link
Contributor

@weaverryan For now I don't see another solution 🤔

I've made a PR to fix this #31625

fabpot added a commit that referenced this issue May 27, 2019
…transport (vincenttouzet)

This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] Disable the SchemaAssetsFilter when setup the transport

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #31623
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Commits
-------

8cbb8f8 [Messenger] Disable the SchemaAssetsFilter when setup the transport
@fabpot fabpot closed this as completed May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants