Skip to content

Conversation

@MasterAM
Copy link

@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
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