8000 Introduce IndexedColumn by morozov · Pull Request #6787 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Introduce IndexedColumn #6787

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

Merged
merged 1 commit into from
Feb 17, 2025
Merged

Introduce IndexedColumn #6787

merged 1 commit into from
Feb 17, 2025

Conversation

morozov
Copy link
Member
@morozov morozov commented Feb 17, 2025

Before reworking Index similarly to UniqueConstraint and ForeignKeyConstraint, I want to introduce PrimaryKeyConstraint. Currently, they are represented as indexes with the "is primary" attribute set to true, but there's no such thing as "primary index". On all supported platforms, a primary index is implemented as a PRIMARY KEY constraint.

Besides introducing such a class, I want to provide an upgrade path and implement a new API (e.g. Table#getPrimaryKeyConstraint()) which would be state-compatible with the existing API. For instance, a user should be able to create a primary index and then access the primary key constraint.

For that, I want to deprecate all invalid states that an index may currently have. The IndexedColumn class, particularly, will provide some guarantees for indexed column names and their lengths. Also, it will combine the name and the length together, which should be easier to use.

Additionally, even though it currently works correctly, I'm deprecating using nullable columns in a primary index. The reasons are:

  1. It's a made-up requirement. Columns in DBAL are non-nullable by default, so someone has to manually to declare it as nullable for that feature to be relevant. Implicitly overriding the definition that the user has explicitly provided looks shady.
  2. It mutates the column, while we're moving towards immutable types.

@morozov morozov marked this pull request as ready for review February 17, 2025 01:18
@morozov morozov requested a review from greg0ire February 17, 2025 01:18
@morozov morozov added this to the 4.3.0 milestone Feb 17, 2025
@morozov morozov merged commit 94d0e3e into doctrine:4.3.x Feb 17, 2025
66 checks passed
@morozov morozov deleted the indexed-columns branch February 17, 2025 14:46
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Feb 18, 2025
….3 (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[DoctrineBridge] Fix deprecation with `doctrine/dbal` ^4.3

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Fixes deprecations raised by doctrine/dbal#6787.

Commits
-------

b1d5de5 [DoctrineBridge] Fix deprecation with `doctrine/dbal` ^4.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0