Skip to content
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

[11.x] Implement HasV7Uuids to use with MariaDB native uuid data type #52029

Merged
merged 5 commits into from
Jul 18, 2024

Conversation

Karem-sobhy
Copy link
Contributor

This PR addresses issue #51883. The referenced issue points out that the uuid data type in MariaDB has problems with orderedUuid, which is used by the HasUuid trait.

MariaDB's documentation suggests using uuid1 or UUID versions >= 6 as a better option.

With this PR, Laravel developers can better utilize their MariaDB UUID columns in terms of performance, indexing, ordering, and storage. Using UUID v7 instead of the ordered UUID v4 currently used by Laravel will:

  • Fix the incorrect order bug in MariaDB.
  • Improve performance during insertion.
  • Align with the standard method of ordering UUIDs by using a truly ordered UUID version instead of simulating one.

Additionally, this PR introduces a new uuid7 helper method in Str.

If this PR is merged, necessary edits to the documentation will be required to guide users on using this trait with MariaDB instead of HasUuid.

@antonkomarev
Copy link
Contributor

I think this could be solved on attribute casts level

@Karem-sobhy
Copy link
Contributor Author

I think this could be solved on attribute casts level

@antonkomarev can you please give example on how to do this? I tried to make something like the old HasUuid implementation

@Karem-sobhy Karem-sobhy requested a review from Jubeki July 5, 2024 15:57
@staudenmeir
Copy link
Contributor

As discussed in #51883, this PR is then also the base for our plan to switch the HasUuid trait to UUID v7 by default in Laravel 12. This is related to the reverted #44210 but would address its privacy concerns.

@taylorotwell taylorotwell merged commit c49e901 into laravel:11.x Jul 18, 2024
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants