-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(psl, query-engine, schema-engine): add
cuid(2)
support, fix `u…
…uid(7)` (#5047) * feat(psl): add cuid(2) support, fix uuid(7) re-introspection * chore(psl): fix clippy * chore(psl): fix clippy * fix(dmmf): [breaking] serialise uuid and cuid with proper args * test(dmmf): expand functions.json test suite * chore(query-structure): interpret "cuid()" as "cuid(1)" * chore: remove leftover * fix(query-engine): fix "create_uuid_v7_and_retrieve_it_should_work" suite * test(query-engine): add create_cuid_v2_and_retrieve_it_should_work test * feat(query-engine): port cuid to workspace, replace Prisma's wasm32-oriented fork with cuid 1.3.3 * feat(query-engine): replace cuid1 with cuid2 for internal transaction IDs * chore: cargo fmt * chore: clippy * fix(psl): keep cuid() default version as 1 * test(query-engine): add "create_cuid_v1_and_retrieve_it_should_work" suite * chore: address review comments * test(psl): add validation tests for cuid and uuid * fix(dmmf): serialise uuid, cuid like nanoid; parse nanoid like uuid, cuid * chore(psl): revert bad test update to "server_side_functions" * chore(dmmf): remove unused tuple, simplify "default_value" for generators * fix(psl): typo in test * fix(psl): typo in test * chore(psl): use itertools * fix(qe): fix broken shebang in query-engine-wasm/build.sh `#!/bin/bash` is non-portable and only works on some systems which has bash in that location, which is not actually standard or necessarily expected. The only two absolute paths one can rely on in portable scripts are `#!/bin/sh` (which is a POSIX standard) and `#!/usr/bin/env` (which is not technically mandated by a formal standard but is de-facto implemented on all Unix systems). None of my systems have a usable bash installation in `/bin/bash`. My Linux system only has bash in `/run/current-system/sw/bin/bash`, so the script fails with `sh: line 2: ./build.sh: cannot execute: required file not found`. My macOS system has an ancient version of bash shipped with the system installed as `/bin/bash` (which Apple last updated in 2007 and will never ever update anymore for license reasons since bash 4+ switched to GPLv3; it's likely to be removed in future macOS versions though as macOS has long replaced bash with zsh as its shell of choice), and in some ways it's worse than not having any since modern bash scripts that assume bash 4 or 5 often fail or produce incorrect results with it. This specific script accidentally happens to work anyway, but the correct bash installation to use on this system is still `/opt/homebrew/bin/bash`. Anything other than `/bin/sh` (be it `bash` or `python` or `node`) can only be dispatched via `/usr/bin/env` if a script is intended to be used on more than one machine because it's not possible to predict where the interpreter is going to be at. * chore(driver-adapters):: bump wrangler version to 3.88.0 * chore(driver-adapters): bump wasm32-unknown-unknown rust-toolchain to latest version * fix(query-engine-wasm): replace "cuid" with "prisma/cuid-rust?branch=v1.3.3-wasm32-unknown-unknown" * chore: revert upgrade to wrangler (from 3.50.0 to 3.88.0) for suspect race condition in newer versions * chore: remove leftover --------- Co-authored-by: Alexey Orlenko <[email protected]>
- Loading branch information
Showing
44 changed files
with
890 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,9 @@ chrono = { version = "0.4.38", features = ["serde"] } | |
derive_more = "0.99.17" | ||
user-facing-errors = { path = "./libs/user-facing-errors" } | ||
uuid = { version = "1", features = ["serde", "v4", "v7", "js"] } | ||
cuid = { git = "https://github.com/prisma/cuid-rust", branch = "v1.3.3-wasm32-unknown-unknown" } | ||
getrandom = { version = "0.2" } | ||
|
||
indoc = "2.0.1" | ||
indexmap = { version = "2.2.2", features = ["serde"] } | ||
itertools = "0.12" | ||
|
@@ -64,7 +67,6 @@ napi = { version = "2.16.13", default-features = false, features = [ | |
"serde-json", | ||
] } | ||
napi-derive = "2.16.12" | ||
js-sys = { version = "0.3" } | ||
pin-project = "1" | ||
rand = { version = "0.8" } | ||
regex = { version = "1", features = ["std"] } | ||
|
@@ -73,6 +75,11 @@ serde-wasm-bindgen = { version = "0.5" } | |
tracing = { version = "0.1" } | ||
tracing-futures = "0.2" | ||
tsify = { version = "0.4.5" } | ||
|
||
# version for `[email protected]`, see: | ||
# https://github.com/rustwasm/wasm-bindgen/pull/4072/ | ||
js-sys = { version = "0.3.70" } | ||
|
||
wasm-bindgen = { version = "0.2.93" } | ||
wasm-bindgen-futures = { version = "0.4" } | ||
wasm-rs-dbg = { version = "0.1.2", default-features = false, features = ["console-error"] } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//! Convenient access to a ID generator constants, used by Prisma in psl, Query Engine and Schema Engine. | ||
//! Every change to the `DEFAULT_*_VERSION` constants in this module is a breaking change. | ||
|
||
/// Version of the `uuid()` ID generator supported by Prisma. | ||
pub const UUID_SUPPORTED_VERSIONS: [u8; 2] = [4, 7]; | ||
|
||
/// Version of the `cuid()` ID generator supported by Prisma. | ||
pub const CUID_SUPPORTED_VERSIONS: [u8; 2] = [1, 2]; | ||
|
||
/// Default version of the `uuid()` ID generator. | ||
pub const DEFAULT_UUID_VERSION: u8 = 4; | ||
|
||
/// Default version of the `cuid()` ID generator. | ||
// Note: if you change this, you'll likely need to adapt existing tests that rely on `cuid()` sequences being already sorted | ||
// (e.g., `cuid(1)`, the current default, generates monotonically increasing sequences, `cuid(2)` doesn't). | ||
pub const DEFAULT_CUID_VERSION: u8 = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.