-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add comparison of foreign key names with option to opt-out of this #6521
Conversation
9f4d76c
to
028e25d
Compare
I don't think this is the right way. Also, after your change, the schema managers don't inject the configuration into the comparators. They inject an empty configuration object with all default settings. That means, I can change that new settings of yours for my connection, but it will have absolutely no effect.
That's not how we decide such things. If the new behavior you're introducing has the potential of breaking existing apps, the new behavior has to be opt-in. I have to be able to upgrade my apps to a new minor release of DBAL without changing either my code or configuration. |
Ah, I've only missed it in the
Ok, I'll change it to opt-in then. |
028e25d
to
d7c47bf
Compare
I'm happy to change it if you could tell me how to configure this otherwise. |
#6300 also introduces configurable behavior to the schema comparison. Maybe you find some inspiration there. |
I've replied there - looks like quite similar, but I don't see how his solution can be configured with one configuration (e.g. symfony), yet |
@uncaught If you want Symfony to support it through configs, you also need to create a PR here - https://github.com/doctrine/DoctrineBundle |
yes, will do that. I just thought I wait until I know this here is ok to merge. |
I'm gonna give up here. With #6300 introducing a configuration class that currently cannot be configured in the dbal/orm/migrations ecosystem this isn't worth persuing. I'll keep relying on an phpunit test for now, which compares the index/FK names of the existing DB with those of a freshly created schema. |
Summary
This PR is targeted at 4.1. I initially tried to target 3.9 (#6520), but that was pretty much not mergeable into 4.1. Using the platform as a go-between for configuration settings seemed wrong, too.
I hope it is okay to inject the Configuration into the Comparator now!? I didn't know how else to configure this behavior. And I'm considering to add another opt-in option for the comparator to enable comparing the implicitly added indexes for FKs, too, in a later PR because these have the same problems in migrations (generated once but then forgotten and untracked).
I'm also not sure what this classifies under. This should be a bug fix, but the conditions under which this hurts are quite rare. So I went with "improvement" because this improves the schema diff.
I've decided to make the behavior opt-out instead of opt-in because it is more dangerous to have wrong FK names than to have extra migration diffs. (You will notice the latter during development, but not the other way around.)