Skip to content

Conversation

@michaelperrin
Copy link

@michaelperrin michaelperrin commented Sep 25, 2025

Q A
Type bug

Summary

Filters are currently only applied to table and sequence names, but not to schema names.

I discovered the issue when using the schema_filter parameter in the Doctrine config of a Symfony project:

doctrine:
    dbal:
        url: "%env(resolve:DATABASE_URL)%"
        schema_filter: "/^(?!schema_name_that_i_want_to_ignore)/"

The schema named schema_name_that_i_want_to_ignore does exist in my PostgreSQL database, but I want it to be ignored.

However, when I generate Doctrine migrations with the doctrine:migrations:diff command, I realized the schema gets ignored in the automatically generated up method, but not in the automatically generated down method where I constantly get the following call:

$this->addSql('CREATE SCHEMA schema_name_that_i_want_to_ignore');

And it actually comes down to the missing filter call for schema names.

This PR adds the call to filter + adds a test very similar to the existing testListTablesWithFilter test.

Let me know if you have any questions or suggestion!

@michaelperrin michaelperrin force-pushed the filter-schema-name branch 7 times, most recently from 14bb0ef to 0a87d53 Compare September 25, 2025 20:55
@morozov
Copy link
Member

morozov commented Sep 26, 2025

@michaelperrin thank you for the patch, but I don't think we should proceed this way. The immediate downside of the approach you're using is that the filter that was previously applied only to table names will now also apply to schema names. It may be a breaking change.

The schema filtering API you're attempting to reuse is obsolete and is going to be replaced with a new one. See the "Future plans" section in #7153. My vision of the new API isn't documented yet, but I plan to do it later.

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.

2 participants