-
-
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
Segregated support of unique index and unique constraint #3980
Conversation
301d678
to
204c4c7
Compare
@morozov should be the one checking this. However, as it was mentioned on Slack, I'm pretty sure you should be looking at using DBAL 4.x instead of 3.x |
@lcobucci unfortunately the amount of work for dev-master is way too big. I need first to make it work back again (for 3.0.x), and then I can consider pointing to dev-master (4.0.x). |
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.
- Can we remove underscore prefix in method and property names at least in new classes?
- Since this is a major release branch that had no release yet, can return values be added to methods (at least those with scopes less than public)?
- As mentioned in a comment it looks like there are missing tests.
There is only one class added to project (
I've moved a lot of methods following logical declarations. I only added 2 public methods and added type hint and return types there.
Fixed that adding tests to |
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.
Looks good. 👍 Only the coding style issues seem to prevent a full build.
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.
Since this is a new API and a breaking change, I'd expect thew new API to be documented in the PR description and the BC break documented in upgrade notes.
When we decided to release DBAL 3.0 earlier for compatibility with PHP 8, we agreed that it should only have trivial to handle breaking changes. There doesn't seem to be much BC break here, so it should be good IMO.
@guilhermeblanco please make sure all new methods have native parameter and return type declarations.
@morozov all updated. Please merge if appropriate. |
src/Platforms/AbstractPlatform.php
Outdated
/** | ||
* Gets the sequence name prefix based on table information. | ||
*/ | ||
public function getSequencePrefix(string $tableName, ?string $schemaName = null) : string |
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.
This looks like a leaky abstraction to me. Especially because it's not used by DBAL itself. Given that all the internally used APIs are public, should ORM implement this logic instead?
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.
ORM is the one that would be leaking abstraction if calling this method.
Conceptually, ORM is telling DBAL "build me a primary key sequence for this table under this schema". The fact that ORM needs to do more than that is a bad abstraction on its own.
DBAL should defer to platforms that once a PK sequence is requested, a sequence named "bar__foo_seq" should be created if schemas are not supported or "bar.foo_seq" if they are.
I migrated the method to the project that owns it. A later stage would be encapsulate it and handle it accordingly internally without exposing this API.
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.
ORM is the one that would be leaking abstraction if calling this method.
As far as I understand, what you're saying is ORM already relies on implementation details of DBAL. This is a given fact and it cannot be used to make DBAL leak even more of its implementation details.
The very fact that there's a string in ORM that "bar__foo_seq" is built with "__" defined DBAL and "_" defined in ORM looks horrible.
I would agree that the DBAL abstraction used by ORM needs to be improved but the fact that it's already bad cannot be used as a reason to make it even worse.
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.
The addition of Platform::getSequencePrefix()
is really questionable. Although this code is ported from the former develop
, I don't see any PR/discussion through which it would get merged there.
@morozov answered you in the specific comment about why it was moved. |
@guilhermeblanco given the lack of progress on this issue in the past months and the fact that we're approaching the release, I'm inclined to move it out of the release milestone. Please let me know if you plan to finish the work before the release. |
@morozov it's there dbal/src/Platforms/AbstractPlatform.php Line 3110 in 5c7a0e2
|
I mean that I don't agree with this method being introduced. |
@guilhermeblanco can you please rebase? So that version 3.0 can be released. |
I'm on it... should be ready later today or tomorrow |
@guilhermeblanco do you need help with this? |
I worked on that yesterday, but the amount of caused conflicts (and their pointed blocks) are too hard to resolve. |
5c7a0e2
to
48963c1
Compare
@guilhermeblanco I rebased this and reorganized the commits in the way that each individual commit passes Please make the needed code changes and do some more cleanup. E.g.:
In the future, please open PRs from your personal repo instead of this one. Otherwise, the PR gets built twice on each CI platform which slows down the feedback. |
@guilhermeblanco given your lack of availability, how do you think we proceed here? Should I just remove |
I'm fine with the changes. If getting Handling |
48963c1
to
577f8a4
Compare
Added missing commits:
BC BREAK: Doctrine\DBAL\Schema\Table constructor new parameter
Deprecated parameter
$idGeneratorType
removed and added a new parameter$uniqueConstraints
.Constructor changed from:
__construct($tableName, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = [])
To the new constructor:
__construct($tableName, array $columns = [], array $indexes = [], array $uniqueConstraints = [], array $fkConstraints = [], array $options = [])