prisma-engines
prisma-engines copied to clipboard
Add support for UUIDv7
This implements https://github.com/prisma/prisma/issues/24079. The change is pretty minimal, widening the support from @default(uuid()) to @default(uuid(7)).
It leverages the existing uuid crate instead of adding a new one (uuid7).
~Right now this code is mostly untested (apart from the tests I added to psl), because I couldn't get the tests running locally. I'd appreciate some guidance in this area.~ CI runs fine
uuid seems to be behind uuid7 with regards to how accurately it represents the spec. See discussion here: https://github.com/uuid-rs/uuid/issues/717
CodSpeed Performance Report
Merging #4877 will not alter performance
Comparing mcuelenaere:feature/uuidv7 (81642e5) with main (34ace0e)
Summary
✅ 11 untouched benchmarks
FYI: after this gets an approval, I'll rebase + squash the fixup commits
@Weakky Gentle ping. Is anything missing in this PR?
@mcuelenaere Thanks for the quick review fix. I have run the tests. Would you mind having a look at the failures?
@Weakky I am able to run the tests for sqlite locally, but they seem to fail in CI for the driver adapters. However, I can't seem to easily run these locally + the output of the CI does not give any indication as to what's going wrong (just that it's failing).
Any help would be appreciated.
follow
I've rebased on current main, as that seems stable and the tests were failing due to something else the last time
I've also updated uuid to v1.10.0 to address @kibertoad 's comment
@Weakky Is there anything missing?
@mcuelenaere I have investigated why tests were failing. Turns out SystemTime::now is not implemented yet for Wasm. https://github.com/rust-lang/rust/issues/48564
Fortunately, uuid has a "js" feature which works around this limitation.
https://github.com/uuid-rs/uuid/blob/main/src/timestamp.rs#L302-L327
Could you please add the "js" feature for the uuid crate?
Thanks
Aha, good catch! I've pushed a fixup commit for that.
I assume just straight-up adding the feature to uuid is fine and it does not need to be in some kind of [target.'cfg(target_arch = "wasm32")'.dependencies] context, right?