Skip to content

fix(models): generate uuid v7 keys - #5

Merged
danielebarbaro merged 1 commit into
mainfrom
fix/uuid-v7-keys
Sep 17, 2026
Merged

danielebarbaro merged 1 commit into
mainfrom
fix/uuid-v7-keys

Conversation

@danielebarbaro

Copy link
Copy Markdown
Contributor

With key_type set to uuid, CustomField and CustomFieldValue filled their key in the creating hook with Str::uuid(), a random UUID v4. Hosts that key their own models with HasUuids get UUID v7 from Laravel, so the package rows were the only ones in the schema whose keys carried no time ordering: they sort randomly, fragment the primary key index on insert, and break the convention of an application that uses v7 everywhere.

Both hooks now call Str::uuid7(). The ulid branch and the id default are untouched, and the column type does not change, so existing v4 keys stay valid and no migration is needed. Str::uuid7() is available on both supported illuminate/support floors (12 and 13).

The uuid keyed host test in KeyTypeTest now also asserts the version nibble of both the definition key and the value key, so a regression to v4 fails the suite.

CHANGELOG gets the 0.1.1 entry and the README key_type row says that uuid generates UUID v7.

@danielebarbaro
danielebarbaro merged commit 8fbfabd into main Sep 17, 2026
18 checks passed
@danielebarbaro
danielebarbaro deleted the fix/uuid-v7-keys branch September 17, 2026 15:36
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.

1 participant