Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #52029, I'm proposing to switch the
HasUuids
trait to UUID v7.This change is similar to the reverted #44210 but addresses its privacy concerns: While #44210 switched all UUIDs to v7, this PR only targets model UUIDs and they already contain a timestamp in the current implementation.
v7 is a standardized format, while the UUIDs generated by
Str::orderedUuid()
at the moment are only a custom variant of the v4 standard.At least on PostgreSQL, v7 UUIDs also seem to perform much better.
Upgrade
This is a breaking change for users of the trait that rely on the sortability of UUIDs. The affected models need to continue generating UUIDs with
Str::orderedUuid()
. I added a legacyHasVersion4Uuids
trait because that's the most convenient solution, IMO.I removed the
HasVersion7Uuids
trait from #52029 because it's redundant now. We could also deprecate it and remove it later.