-
-
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
Incorrect handling changed primary key #2925
Comments
@SCIF thanks for being ready to help us! Writing functional tests for schema comparison is quite simple, you can use these tests as example: dbal/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php Lines 470 to 505 in 954ce2e
|
@lcobucci , please take a look on test introduced: SCIF@c7ca968 |
Can you send us a PR? It's way easier for us |
@lcobucci , I thought to send PR since I will fix it. Right now it's just test case reproducing issue. |
@SCIF you can send the PR with the test only and add new commits with the fix later 👍 |
PK'es are treated as index. Let's assume it's correct idea and should not be changed. |
Hi @lcobucci , I changed my mind and implemented a fix in another way. Could you check it? All green except scrutinizer's check detected previously introduced bugs. Please take a look on my implementation. |
Hi, same issue with Postgresql and changing index. Is it possible to tag this issue, so it would be clear from first glance if it's valid, confirmed, bug or worked on. Thanks. |
See related PRs |
I've received next error message:
Searching got me next ticket: doctrine/orm#6271
Here is a dump of diff:
Diff looks correct except one notice: name for primary keys is
primary
for newely generated index but typical postgres schema looks like{$tableName}_pkey
. That difference causes generation incorrect SQL here. That line produces:Changing code to:
probably is a bit better but not fully correct, because changed PK could hould raise much more difference than just drop index (postgres requires to drop constraint
{$table}_pkey
before dropping index).I'm ready to prepare PR and add proper tests but require help of gurus to advice me a correct direction. :)
Thanks.
The text was updated successfully, but these errors were encountered: