Skip to content

fix(drizzle-seed): change uuid generator#4503

Closed
MasterAM wants to merge 1 commit into
drizzle-team:mainfrom
MasterAM:fix/seed-uuid-v4-spec
Closed

fix(drizzle-seed): change uuid generator#4503
MasterAM wants to merge 1 commit into
drizzle-team:mainfrom
MasterAM:fix/seed-uuid-v4-spec

Conversation

@MasterAM
Copy link
Copy Markdown

@MasterAM MasterAM commented May 8, 2025

Add a restriction to the uuid-v4 format to make it adhere to RFC9562: the variant field should be in the 8..b range.

This RFC spec is used by npm's uuid package.

While this change would likely alter UUIDs generated by previous drizzle-seed versions, the current implementation would cause issues in applications where the UUID value is validated.

For example, Payload CMS is validating the id when querying for a document by a UUID key using findById, and I ran into an issue when invalid UUIDs were generated by drizzle-seed. This also broke the Payload CMS admin panel, as select queries failed to fetch data.

Add restriction to uuid-v4 format to make it adhere to  RFC9562: the variant field should be in the 8..b range.
@OleksiiKH0240
Copy link
Copy Markdown
Collaborator

Hi @MasterAM. Your PR was very helpful, and I used it to fix the uuid generator.
Since this fix alters the UUID values generated with the same seed, I also had to add a new version of the generator.

I’ve updated this PR (#4222) with your fix, and we’ll add you as a contributor during the merge. I’ll close this PR now.

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.

2 participants