-
-
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
Fix incorrect syntax for dropping primary indexes in PostgreSQL #6025
Conversation
Please add a functional test that reproduces your problem. Your test makes assertions on the produced SQL statements, but that neither tells me that the new statement is correct nor that the old one is incorrect. |
Yes, it would be a good thing to add a functional test. Could you please give me a pointer to the process of creating a new functional test? |
Have a look at any test in the |
I've already seen them and they seems simple to replicate. My problem is that I don't know exactly how to run them against PostgreSQL. Thanks in advance. |
You'll find a PHPUnit configuration in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. We're almost there, I think. 🙂
You can run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your new test apparently only works on MySQL and Postgres. That's a problem that we can solve in a follow-up PR. Please skip the test for all failing platforms. Sorry for the back and forth here. 🙈
Uhm, I think it would be better to revert to the initial code that was designed just for PostgreSQL, since the fix is actually realated to a problem with this DB. What do you think? |
Co-authored-by: Alexander M. Turek <[email protected]>
src/Platforms/PostgreSQLPlatform.php
Outdated
/** @psalm-suppress MissingClosureParamType */ | ||
$tableName = static fn ($t): string => $t instanceof Table ? $t->getName() : (string) $t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this a private method. This allows us to document the parameter type via PHPDoc which should make Psalm happy.
* 3.6.x: Fix incorrect syntax for dropping primary indexes in PostgreSQL (doctrine#6025) trigger if called outside for AbstractPlatform::supportsCreateDropDatabase (doctrine#6064) Run tests with PHP 8.3 (doctrine#6060)
Summary
The correct way of dropping primary index in PostgreSQL is not dropping the index, but removing the primary key constraints