@prisma/orm-sqlite 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +3 -8
- package/dist/config.mjs.map +1 -1
- package/dist/contract-builder.d.mts +205 -15
- package/dist/contract-builder.d.mts.map +1 -1
- package/dist/contract-builder.mjs +24 -4
- package/dist/contract-builder.mjs.map +1 -1
- package/dist/contract__validate-once.d.mts +1 -0
- package/dist/contract__validate-once.mjs +2 -0
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +1 -1
- package/dist/control.mjs.map +1 -1
- package/dist/family-contract__data-type-support.d.mts +1 -0
- package/dist/family-contract__data-type-support.mjs +2 -0
- package/dist/family-contract__data-type.d.mts +1 -0
- package/dist/family-contract__data-type.mjs +2 -0
- package/dist/family-contract__sql-expression.d.mts +1 -0
- package/dist/family-contract__sql-expression.mjs +2 -0
- package/dist/family__psl-build.d.mts +1 -0
- package/dist/family__psl-build.mjs +2 -0
- package/dist/relational-core__collection-methods.d.mts +1 -0
- package/dist/relational-core__collection-methods.mjs +2 -0
- package/dist/relational-core__functions.d.mts +1 -0
- package/dist/relational-core__functions.mjs +2 -0
- package/dist/relational-core__index-reference.d.mts +1 -0
- package/dist/relational-core__index-reference.mjs +2 -0
- package/dist/runtime.d.mts +3 -3
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +107 -62
- package/dist/runtime.mjs.map +1 -1
- package/dist/sqlite-Yizsft25-C2Eb0g8b.d.mts +94 -0
- package/dist/sqlite-Yizsft25-C2Eb0g8b.d.mts.map +1 -0
- package/dist/sqlite-static-B8zoCVS5-XntMNNFh.mjs +83 -0
- package/dist/sqlite-static-B8zoCVS5-XntMNNFh.mjs.map +1 -0
- package/dist/static.d.mts +25 -2
- package/dist/static.d.mts.map +1 -0
- package/dist/static.mjs +2 -2
- package/dist/target__data-types.d.mts +1 -0
- package/dist/target__data-types.mjs +2 -0
- package/dist/utils__suppress-idle-connection-errors.d.mts +1 -0
- package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
- package/dist/utils__text.d.mts +1 -0
- package/dist/utils__text.mjs +2 -0
- package/package.json +26 -15
- package/skills/prisma-8/SKILL.md +96 -0
- package/skills/prisma-8/references/build.md +142 -0
- package/skills/prisma-8/references/contract.md +544 -0
- package/skills/prisma-8/references/debug.md +149 -0
- package/skills/prisma-8/references/feedback.md +251 -0
- package/skills/prisma-8/references/migration-model.md +179 -0
- package/skills/prisma-8/references/migration-review.md +211 -0
- package/skills/prisma-8/references/migrations.md +581 -0
- package/skills/prisma-8/references/queries-mongo.md +238 -0
- package/skills/prisma-8/references/queries-postgres.md +710 -0
- package/skills/prisma-8/references/queries.md +253 -0
- package/skills/prisma-8/references/quickstart.md +317 -0
- package/skills/prisma-8/references/runtime.md +463 -0
- package/skills/prisma-8/references/supabase.md +234 -0
- package/skills/prisma-8/references/upgrade-app.md +102 -0
- package/skills/prisma-8/references/upgrade-extension.md +106 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.10-to-0.11/instructions.md +56 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/instructions.md +381 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-closed-mongo-contracts.ts +202 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-domain-namespaced-contracts.ts +201 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-postgres-public-default.ts +198 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/instructions.md +339 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/re-emit-mti-variant-link-columns.ts +229 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/instructions.md +543 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.14-to-0.15/instructions.md +359 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.15-to-0.16/instructions.md +173 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/instructions.md +805 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.17-to-8.0.0-rc.1/instructions.md +72 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.7-to-0.8/instructions.md +8 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/instructions.md +36 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/instructions.md +86 -0
- package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +588 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +639 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/multifile-psl/add-use-prisma-8-directive.mjs +60 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs +256 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +332 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts +193 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +489 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +1368 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts +1492 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +108 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +755 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +973 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/scripts/sql-expression-literals-psl/rewrite-sql-strings.mjs +271 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +1826 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/client-takes-contract-value/contract-from-json.ts +382 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/data-type-values/data-type-values.ts +1117 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/default-generators-to-on-create/rewrite-default-generators.mjs +86 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/mongo-field-storage-names/mongo-field-storage-names.ts +250 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +813 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +502 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/scripts/expand-type-aliases/expand-type-aliases.ts +1171 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +158 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +42 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md +157 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md +33 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md +36 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md +63 -0
- package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +84 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +276 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/instructions.md +738 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts +97 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/regenerate-extension-public-baseline.ts +223 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.12-to-0.13/instructions.md +266 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/instructions.md +522 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.14-to-0.15/instructions.md +803 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.15-to-0.16/instructions.md +219 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/instructions.md +731 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.17-to-8.0.0-rc.1/instructions.md +194 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.7-to-0.8/instructions.md +8 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/instructions.md +57 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/instructions.md +150 -0
- package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +746 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +857 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/scripts/psl-verbatim-table-names/add-model-map.mjs +256 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +504 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts +193 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +143 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +2168 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/scripts/data-type-in-contract/data-type-in-contract.ts +1492 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +223 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +583 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +1008 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +2000 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/client-takes-contract-value/contract-from-json.ts +382 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +813 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +379 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/scripts/expand-type-aliases/expand-type-aliases.ts +1171 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +137 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +129 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md +102 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md +33 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md +35 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md +86 -0
- package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +63 -0
- package/dist/family-contract__pack-types.d.mts +0 -1
- package/dist/family-contract__pack-types.mjs +0 -2
- package/dist/sqlite-CjWZostj-Cprd7rkt.d.mts +0 -76
- package/dist/sqlite-CjWZostj-Cprd7rkt.d.mts.map +0 -1
- package/dist/sqlite-static-CBCbqogG-BtpT_pWA.mjs +0 -44
- package/dist/sqlite-static-CBCbqogG-BtpT_pWA.mjs.map +0 -1
- package/dist/target__native-type-normalizer.d.mts +0 -1
- package/dist/target__native-type-normalizer.mjs +0 -2
package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md
ADDED
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.12"
|
|
3
|
+
to: "8.0.0-rc.13"
|
|
4
|
+
changes:
|
|
5
|
+
- id: execution-ref-entry-field
|
|
6
|
+
summary: |
|
|
7
|
+
Each entry in `contract.execution.mutations.defaults` now names its target as
|
|
8
|
+
`ref: { namespace, entry, field }` instead of `ref: { namespace, table, column }`. The values
|
|
9
|
+
are the same table and column names. Re-emit the contract; code and types that read `.ref.table` or
|
|
10
|
+
`.ref.column` read `.ref.entry` and `.ref.field`.
|
|
11
|
+
detection:
|
|
12
|
+
glob: "**/*.{json,ts,mts,cts}"
|
|
13
|
+
matches:
|
|
14
|
+
- '"ref"\s*:\s*\{(?![^{}]*"kind")[^{}]*"(?:table|column)"\s*:'
|
|
15
|
+
- '\.ref\??\.(?:table|column)\b'
|
|
16
|
+
- '\bref\s*:\s*\{(?![^{}]*\bkind\b)[^{}]*\b(?:table|column)\s*:[^{}]*\b(?:table|column)\s*:'
|
|
17
|
+
script: ./scripts/execution-ref-entry-field/rename-execution-ref-keys.ts
|
|
18
|
+
- id: mutation-default-generator-types-move-to-framework
|
|
19
|
+
summary: |
|
|
20
|
+
`GeneratorStability` and `RuntimeMutationDefaultGenerator` are no longer exported by the SQL
|
|
21
|
+
runtime (`@prisma/orm-family-sql/runtime`, `@prisma/orm-postgres/family-runtime`,
|
|
22
|
+
`@prisma/orm-sqlite/family-runtime`). Import them from `@prisma/orm-framework/components/runtime`.
|
|
23
|
+
detection:
|
|
24
|
+
glob: "**/*.{ts,mts,cts}"
|
|
25
|
+
matches:
|
|
26
|
+
- '\bimport\s+(?:type\s+)?\{[^}]*\b(?:GeneratorStability|RuntimeMutationDefaultGenerator)\b[^}]*\}\s*from\s*[''"](?:@internal/sql-runtime|@prisma/orm-family-sql/runtime|@prisma/orm-(?:postgres|sqlite)/family-runtime)[''"]'
|
|
27
|
+
- id: mutation-defaults-options-entry-field
|
|
28
|
+
summary: |
|
|
29
|
+
`applyMutationDefaults` options name the storage entry as `entry` instead of `table`, and each
|
|
30
|
+
applied default names its field as `field` instead of `column`. `MutationDefaultsOptions`,
|
|
31
|
+
`AppliedMutationDefault` and `MutationDefaultsOp` now come from
|
|
32
|
+
`@prisma/orm-framework/components/runtime`, not from the SQL `relational-core/query-lane-context` subpath.
|
|
33
|
+
detection:
|
|
34
|
+
glob: "**/*.{ts,mts,cts}"
|
|
35
|
+
matches:
|
|
36
|
+
- '\bapplyMutationDefaults\s*\(\s*\{[^{}]*\btable\s*:'
|
|
37
|
+
- '\bimport\s+(?:type\s+)?\{[^}]*\b(?:AppliedMutationDefault|MutationDefaultsOptions|MutationDefaultsOp)\b[^}]*\}\s*from\s*[''"](?:@internal/sql-relational-core/query-lane-context|@prisma/orm-(?:family-sql|postgres|sqlite)/relational-core/query-lane-context)[''"]'
|
|
38
|
+
- id: temporal-presets-move-to-framework
|
|
39
|
+
summary: |
|
|
40
|
+
`TIMESTAMP_NOW_GENERATOR_ID`, `temporalAuthoringPresets` and `temporalCodecPreset` moved from
|
|
41
|
+
the SQL family's `family/control` subpath to the framework's `components/authoring`, and
|
|
42
|
+
`timestampNowControlDescriptor` moved to `components/control`. `temporalCodecPresetWithPrecision`
|
|
43
|
+
and `temporalStringAuthoringPresets` stay in `family/control`.
|
|
44
|
+
detection:
|
|
45
|
+
glob: "**/*.{ts,mts,cts}"
|
|
46
|
+
matches:
|
|
47
|
+
- '\b(?:TIMESTAMP_NOW_GENERATOR_ID|temporalAuthoringPresets|temporalCodecPreset|timestampNowControlDescriptor)\b[^;]*?from\s*[''"](?:@internal/family-sql/control|@prisma/orm-(?:family-sql|postgres|sqlite)/family/control)[''"]'
|
|
48
|
+
- id: temporal-preset-builders-take-storage-template
|
|
49
|
+
summary: |
|
|
50
|
+
`temporalAuthoringPresets`, `temporalStringAuthoringPresets` and `temporalCodecPreset` take the
|
|
51
|
+
codec's storage template as one type parameter (`<Storage, GeneratorId>`, or `<Storage>` for
|
|
52
|
+
`temporalCodecPreset`) instead of `<CodecId, NativeType, GeneratorId>`. Calls that let
|
|
53
|
+
TypeScript infer the type arguments are unchanged.
|
|
54
|
+
detection:
|
|
55
|
+
glob: "**/*.{ts,mts,cts}"
|
|
56
|
+
matches:
|
|
57
|
+
- '\b(?:temporalAuthoringPresets|temporalStringAuthoringPresets|temporalCodecPreset)\s*<'
|
|
58
|
+
- id: ts-defaults-encoded-by-codec
|
|
59
|
+
summary: |
|
|
60
|
+
`defineContract` from the Postgres and SQLite packages now encodes every literal `.default(value)` through the column's codec. The literal is the codec's input type. TypeScript checks it for fields built inside the `defineContract` factory, and the build fails with `CONTRACT.DEFAULT_INVALID` for a value the codec refuses. Pass a value of the codec's input type, or choose the field preset whose codec takes the value you have.
|
|
61
|
+
detection:
|
|
62
|
+
glob: "**/*.{ts,mts,cts}"
|
|
63
|
+
matches:
|
|
64
|
+
- '\.default\(\s*(?!now\(\)|autoincrement\(\)|sql`)'
|
|
65
|
+
- id: contract-source-format-is-psl-or-typescript
|
|
66
|
+
summary: Every contract source declares format 'psl' or 'typescript'; format is required, and OpaqueContractSourceProvider is removed.
|
|
67
|
+
- id: prisma7-schema-source-declares-psl
|
|
68
|
+
summary: The prisma7Schema() contract source declares format 'psl' instead of 'prisma7'.
|
|
69
|
+
- id: print-psl-description-option
|
|
70
|
+
summary: printPsl() from @internal/psl-printer (@prisma/orm-framework/psl-printer) opens every file with only the // use prisma-8 marker unless the caller passes description.
|
|
71
|
+
- id: family-sql-psl-build-export
|
|
72
|
+
summary: mapDefault, its option types, the PslTypeMap types and toEnumMemberName moved from @internal/family-sql/psl-infer to @internal/family-sql/psl-build (published as family/psl-infer and family/psl-build of @prisma/orm-family-sql).
|
|
73
|
+
- id: cursor-rejects-expression-orders
|
|
74
|
+
summary: "cursor() now throws ORM.ARGUMENT_INVALID when an active orderBy item is not a plain column (extension-operation orders such as vector distance were previously dropped from the keyset silently)"
|
|
75
|
+
detection:
|
|
76
|
+
glob: "**/*.{ts,mts,cts}"
|
|
77
|
+
matches:
|
|
78
|
+
- '\.cursor\('
|
|
79
|
+
- id: order-by-item-nulls
|
|
80
|
+
summary: "OrderByItem from @internal/sql-relational-core/ast (@prisma/orm-family-sql/relational-core/ast) carries a nulls placement: its constructor takes a required third argument, withExpr rebuilds an item around a new expression, and every renderer must emit nulls wherever it emits dir"
|
|
81
|
+
detection:
|
|
82
|
+
glob: "**/*.{ts,mts,cts}"
|
|
83
|
+
matches:
|
|
84
|
+
- 'new OrderByItem\('
|
|
85
|
+
- '\.dir\.toUpperCase\('
|
|
86
|
+
- id: include-expr-join-column-lists
|
|
87
|
+
summary: |
|
|
88
|
+
`IncludeExpr.localColumn` and `IncludeExpr.targetColumn` are now `localColumns` and
|
|
89
|
+
`targetColumns`: ordered string arrays paired by index, with one entry per column of the
|
|
90
|
+
relation's key.
|
|
91
|
+
detection:
|
|
92
|
+
glob: "**/*.{ts,mts,cts}"
|
|
93
|
+
matches:
|
|
94
|
+
- '\.(?:localColumn|targetColumn)\b'
|
|
95
|
+
- id: mongo-codec-subpaths-move-to-target
|
|
96
|
+
summary: |
|
|
97
|
+
The Mongo codecs moved from `@internal/adapter-mongo` to `@internal/target-mongo`: the
|
|
98
|
+
`codec-types`, `codecs`, `codec-ids` and `data-types` subpaths of the adapter are gone and
|
|
99
|
+
live under the target. The same move applies to the published `adapter/*` subpaths of
|
|
100
|
+
`@prisma/orm-mongo` and `@prisma/orm-target-mongo`, which are now `target/*`.
|
|
101
|
+
detection:
|
|
102
|
+
glob: "**/*.{ts,mts,cts,md}"
|
|
103
|
+
matches:
|
|
104
|
+
- '@internal/adapter-mongo/(?:codec-types|codecs|codec-ids|data-types)(?![\w-])'
|
|
105
|
+
- '@prisma/orm-(?:target-)?mongo/adapter/(?:codec-types|codecs|codec-ids|data-types)(?![\w-])'
|
|
106
|
+
- id: create-mongo-runner-deps-removed
|
|
107
|
+
summary: |
|
|
108
|
+
`createMongoRunnerDeps(...)` is removed from `@internal/adapter-mongo/control`
|
|
109
|
+
(`@prisma/orm-mongo/adapter/control`). Build the
|
|
110
|
+
runner dependencies with `new MongoControlAdapterImpl().createRunnerDependencies(controlDriver)`.
|
|
111
|
+
detection:
|
|
112
|
+
glob: "**/*.{ts,mts,cts}"
|
|
113
|
+
matches:
|
|
114
|
+
- '\bcreateMongoRunnerDeps\b'
|
|
115
|
+
- id: mongo-runner-dependency-types-move-to-family
|
|
116
|
+
summary: |
|
|
117
|
+
`MongoRunnerDependencies` and `MarkerOperations` are exported from
|
|
118
|
+
`@internal/family-mongo/control-adapter` (`@prisma/orm-mongo/family/control-adapter`), no
|
|
119
|
+
longer from `@internal/adapter-mongo/control` or `@internal/target-mongo/control` (the
|
|
120
|
+
`adapter/control` and `target/control` subpaths of `@prisma/orm-mongo`).
|
|
121
|
+
detection:
|
|
122
|
+
glob: "**/*.{ts,mts,cts}"
|
|
123
|
+
matches:
|
|
124
|
+
- '\b(?:MongoRunnerDependencies|MarkerOperations)\b[^;]*?from\s*[''"]@internal/(?:adapter|target)-mongo/control[''"]'
|
|
125
|
+
- '\b(?:MongoRunnerDependencies|MarkerOperations)\b[^;]*?from\s*[''"]@prisma/orm-(?:target-)?mongo/(?:adapter|target)/control[''"]'
|
|
126
|
+
- id: mongo-control-adapter-creates-runner-dependencies
|
|
127
|
+
summary: |
|
|
128
|
+
The `MongoControlAdapter` SPI gains `createRunnerDependencies(driver)`, and
|
|
129
|
+
`MongoControlFamilyInstance` gains `createRunnerDependencies({ driver })`. A custom
|
|
130
|
+
implementation of either must add the method.
|
|
131
|
+
detection:
|
|
132
|
+
glob: "**/*.{ts,mts,cts}"
|
|
133
|
+
matches:
|
|
134
|
+
- '\bimplements\s+(?:[\w.]+\s*,\s*)*MongoControlAdapter\b'
|
|
135
|
+
- ':\s*MongoControlFamilyInstance\s*=\s*\{'
|
|
136
|
+
- id: mongo-create-runner-needs-adapter-on-stack
|
|
137
|
+
summary: |
|
|
138
|
+
`mongoTargetDescriptor.migrations.createRunner(family)` reaches the database through the
|
|
139
|
+
control adapter on the family's control stack. A family instance created from an empty stack,
|
|
140
|
+
or from a `createControlStack(...)` with no `adapter`, fails with "Mongo family requires an
|
|
141
|
+
adapter descriptor in ControlStack" when the runner executes.
|
|
142
|
+
detection:
|
|
143
|
+
glob: "**/*.{ts,mts,cts}"
|
|
144
|
+
matches:
|
|
145
|
+
- 'createMongoFamilyInstance\(\s*\{\s*\}'
|
|
146
|
+
- 'createControlStack\(\s*\{(?:(?!adapter)[^}])*mongoTargetDescriptor(?:(?!adapter)[^}])*\}\s*\)'
|
|
147
|
+
- id: mongo-execution-context-applies-mutation-defaults
|
|
148
|
+
summary: |
|
|
149
|
+
`MongoExecutionContext` gains a required `applyMutationDefaults(options)` method, which fills
|
|
150
|
+
the contract's execution defaults on ORM writes. Contexts built with
|
|
151
|
+
`createMongoExecutionContext` have it; an object literal typed as a `MongoExecutionContext`
|
|
152
|
+
(usually a test double) must add it.
|
|
153
|
+
detection:
|
|
154
|
+
glob: "**/*.{ts,mts,cts}"
|
|
155
|
+
matches:
|
|
156
|
+
- '(?:\)|\b\w+)\s*:\s*MongoExecutionContext\b(?:<[^>]*>)?\s*(?:=\s*\{|\{)'
|
|
157
|
+
- '\bsatisfies\s+MongoExecutionContext\b'
|
|
158
|
+
- id: mongo-field-builder-execution-defaults-parameter
|
|
159
|
+
summary: |
|
|
160
|
+
The Mongo `FieldBuilder` type gains a fifth type parameter, the field's execution defaults,
|
|
161
|
+
defaulting to `undefined`, so a bare `FieldBuilder` constraint rejects preset fields such as
|
|
162
|
+
`field.temporal.createdAt()`; widen it to
|
|
163
|
+
`FieldBuilder<ContractFieldType, boolean, boolean, EnumTypeHandle | undefined, ExecutionMutationDefaultPhases | undefined>`.
|
|
164
|
+
`ContractFieldType` and `ExecutionMutationDefaultPhases` come from
|
|
165
|
+
`@prisma/orm-mongo/contract/types`; `FieldBuilder` and `EnumTypeHandle` from
|
|
166
|
+
`@prisma/orm-mongo/contract-builder`.
|
|
167
|
+
- id: mongo-bson-codec-added
|
|
168
|
+
summary: |
|
|
169
|
+
The Mongo target gains the codecs `mongo/int64@1`, `mongo/decimal128@1`, `mongo/binary@1`,
|
|
170
|
+
`mongo/json@1` (JSON values only) and `mongo/bson@1` (any BSON value, typed `BsonInputValue`
|
|
171
|
+
on write and `BsonValue` on read in `CodecTypes`). Collection validators now read a codec's
|
|
172
|
+
whole `targetTypes` list, not only its first entry, and an enum's codec must declare exactly
|
|
173
|
+
one.
|
|
174
|
+
detection:
|
|
175
|
+
glob: "**/*.{ts,mts,cts}"
|
|
176
|
+
matches:
|
|
177
|
+
- 'targetTypes\s*:\s*\[\s*[^\]\s,][^\],]*,\s*[^\]\s]'
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# 8.0.0-rc.12 → 8.0.0-rc.13 — Extension author upgrade instructions
|
|
181
|
+
|
|
182
|
+
## `execution-ref-entry-field`
|
|
183
|
+
|
|
184
|
+
A contract with generated defaults (`temporal.createdAt()`, `temporal.updatedAt()`, `@default(uuid())` and the like) carries them under `execution.mutations.defaults`. Each entry's `ref` changes keys; the values do not:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
// before
|
|
188
|
+
{ "ref": { "namespace": "public", "table": "user", "column": "updated_at" }, "onUpdate": { "kind": "generator", "id": "timestampNow" } }
|
|
189
|
+
|
|
190
|
+
// after
|
|
191
|
+
{ "ref": { "entry": "user", "field": "updated_at", "namespace": "public" }, "onUpdate": { "kind": "generator", "id": "timestampNow" } }
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
1. Run `prisma contract emit` so `contract.json` and `contract.d.ts` use the new keys. The runtime rejects a contract whose refs still say `table` and `column` with `Contract structural validation failed: execution.mutations.defaults[0].ref.entry must be a string`.
|
|
195
|
+
2. Contracts stored under `migrations/` carry the old keys too: the snapshots in `migrations/snapshots/<hash>/contract.json` and `contract.d.ts`, and any intermediate contract a migration imports from its own directory, such as `migrations/<dir>/intermediate.json` and `intermediate.d.ts`. From the extension package root, run the script that sits next to this guide. `<skill>` is the directory of the synced `prisma-8` skill:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
pnpm exec tsx <skill>/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/scripts/execution-ref-entry-field/rename-execution-ref-keys.ts
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The script reads every `.json` and `.d.ts` file under a `migrations/` directory, skipping `node_modules`, `.git` and `dist`, and changes only `execution.mutations.defaults[].ref` entries. In each one it renames `table` to `entry` and `column` to `field`, and writes the keys in the order `entry`, `field`, `namespace`, which is the order `prisma contract emit` writes. The old key order varies between files: older `contract.d.ts` files list `namespace`, `table`, `column`, newer ones `column`, `namespace`, `table`. The script handles any order; a hand edit or a search-and-replace that assumes one order misses some refs. A `contract.json` in canonical form stays canonical, so a snapshot matches a fresh emit apart from `executionHash`; an indented JSON file keeps its indentation. The script leaves every `executionHash` as it is. That hash no longer matches the renamed content, but the snapshot loader re-hashes only the storage section, so nothing checks it. `storageHash` and `profileHash` do not move, so snapshot directory names stay the same. A second run changes nothing. Pass `--check` to list the files it would change without writing them; it exits 1 if any would change. A `.json` file it cannot parse is listed as `NOT JSON` and also makes it exit 1.
|
|
202
|
+
|
|
203
|
+
To confirm the rewrite, run the script again with `--check`; it exits 0 when no ref is left to rename. No CLI command reads the package's own `migrations/snapshots/`: run from the package root, the CLI looks for migrations in `migrations/app/`, and a contract-space package keeps them directly under `migrations/`. The CLI reads an extension's contract space in an app that installs the extension, from the app's `migrations/<space-id>/` and `migrations/snapshots/`. There, `prisma migration check --space <space-id>` loads the contract at the space's head and fails with `MIGRATION.CHECK_CONTRACT_UNREADABLE` while its refs still say `table` and `column`. The head is the only snapshot of an extension space the CLI loads; `prisma db migrate --to <hash>` selects a snapshot of the app space, not of an extension.
|
|
204
|
+
3. Code that reads the section directly changes `.ref.table` to `.ref.entry` and `.ref.column` to `.ref.field`.
|
|
205
|
+
|
|
206
|
+
`executionHash` changes for every contract with generated defaults, because the canonical JSON changes. Nothing compares it against the database, so no migration or re-sign is needed.
|
|
207
|
+
|
|
208
|
+
### For extension authors
|
|
209
|
+
|
|
210
|
+
- The framework type `ExecutionMutationDefault['ref']` from `@internal/contract/types` (`@prisma/orm-framework/contract/types`) is `{ namespace: string; entry: string; field: string }`. A type that matches refs by shape (for example a create-input type that checks whether a column has a generated default) matches `entry` and `field`.
|
|
211
|
+
- A pack that ships a contract with generated defaults re-emits it with `prisma contract emit`, and updates its pinned contract-space snapshots as in step 2.
|
|
212
|
+
- The options passed to `applyMutationDefaults` change separately: see `mutation-defaults-options-entry-field` below for the rename of `table` to `entry`.
|
|
213
|
+
|
|
214
|
+
## `mutation-default-generator-types-move-to-framework`
|
|
215
|
+
|
|
216
|
+
The mutation-default generator runtime now lives in the framework and serves every family. A pack that contributes generators (`mutationDefaultGenerators: () => [...]` on a runtime target, adapter, or extension descriptor) types them with the framework type:
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
// before
|
|
220
|
+
import type { RuntimeMutationDefaultGenerator } from '@prisma/orm-family-sql/runtime';
|
|
221
|
+
|
|
222
|
+
// after
|
|
223
|
+
import type { RuntimeMutationDefaultGenerator } from '@prisma/orm-framework/components/runtime';
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Do the same for `GeneratorStability`. The shape is unchanged: `{ id, generate(params?), stability: 'field' | 'row' | 'query' }`.
|
|
227
|
+
|
|
228
|
+
## `mutation-defaults-options-entry-field`
|
|
229
|
+
|
|
230
|
+
Code that calls `applyMutationDefaults` on an execution context, or stubs it in tests, renames two keys:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
// before
|
|
234
|
+
const applied = context.applyMutationDefaults({ op: 'create', table: tableName, namespace, values });
|
|
235
|
+
for (const def of applied) row[def.column] = def.value;
|
|
236
|
+
|
|
237
|
+
// after
|
|
238
|
+
const applied = context.applyMutationDefaults({ op: 'create', entry: tableName, namespace, values });
|
|
239
|
+
for (const def of applied) row[def.field] = def.value;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
1. In every `applyMutationDefaults({ ... })` call, rename the `table` key to `entry`. The value is the same table name.
|
|
243
|
+
2. Where the result is read, rename `.column` to `.field`. A stub that returns applied defaults returns `{ field, value }`.
|
|
244
|
+
3. Import `MutationDefaultsOptions`, `AppliedMutationDefault` and `MutationDefaultsOp` from `@prisma/orm-framework/components/runtime`; the SQL `relational-core/query-lane-context` subpath no longer exports them.
|
|
245
|
+
|
|
246
|
+
A key present in `values` counts as explicit whatever its value, `undefined` included, and gets no default. That rule is unchanged; drop `undefined` values before the call if they should be defaulted.
|
|
247
|
+
|
|
248
|
+
## `temporal-presets-move-to-framework`
|
|
249
|
+
|
|
250
|
+
The target-neutral temporal preset builders now live in the framework, so a non-SQL target can build `temporal.*` presets too. Change the import source; the functions behave the same.
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
// before
|
|
254
|
+
import {
|
|
255
|
+
TIMESTAMP_NOW_GENERATOR_ID,
|
|
256
|
+
temporalAuthoringPresets,
|
|
257
|
+
temporalCodecPreset,
|
|
258
|
+
timestampNowControlDescriptor,
|
|
259
|
+
} from '@prisma/orm-family-sql/family/control';
|
|
260
|
+
|
|
261
|
+
// after
|
|
262
|
+
import {
|
|
263
|
+
TIMESTAMP_NOW_GENERATOR_ID,
|
|
264
|
+
temporalAuthoringPresets,
|
|
265
|
+
temporalCodecPreset,
|
|
266
|
+
} from '@prisma/orm-framework/components/authoring';
|
|
267
|
+
import { timestampNowControlDescriptor } from '@prisma/orm-framework/components/control';
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The same applies to the `family/control` subpaths of `@prisma/orm-postgres` and `@prisma/orm-sqlite` (move to their `components/authoring` and `components/control` subpaths), and to `@internal/family-sql/control` (move to `@internal/framework-components/authoring` and `@internal/framework-components/control`, published as the `components/authoring` and `components/control` subpaths of `@prisma/orm-framework`). Keep importing `temporalCodecPresetWithPrecision` and `temporalStringAuthoringPresets` from `family/control`.
|
|
271
|
+
|
|
272
|
+
## `temporal-preset-builders-take-storage-template`
|
|
273
|
+
|
|
274
|
+
The builders now carry the codec's whole storage template through, so their type parameters changed. Drop explicit type arguments and let TypeScript infer them:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
// before
|
|
278
|
+
temporalAuthoringPresets<'pg/timestamptz@1', 'timestamptz'>({ codecId: 'pg/timestamptz@1', nativeType: 'timestamptz' });
|
|
279
|
+
|
|
280
|
+
// after
|
|
281
|
+
temporalAuthoringPresets({ codecId: 'pg/timestamptz@1', nativeType: 'timestamptz' });
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
If you need to name them, the first type parameter is the storage template object type (`{ readonly codecId: ...; readonly nativeType: ... }`).
|
|
285
|
+
|
|
286
|
+
## `ts-defaults-encoded-by-codec`
|
|
287
|
+
|
|
288
|
+
A TypeScript contract used to store the value passed to `.default(value)` as it stood. The column's codec now encodes it, so the value must be the codec's input type. For a field built inside the `defineContract` factory, `.default()` is typed with that input type, so a wrong value is a type error in `contract.ts`. PSL contracts, `.default(now())`, `.default(autoincrement())` and `` .default(sql`...`) `` are not affected.
|
|
289
|
+
|
|
290
|
+
What now fails, on Postgres:
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
// before: emitted, although the codec of field.dateTime() holds a Temporal.Instant
|
|
294
|
+
createdAt: field.dateTime().default('2024-01-01T00:00:00Z'),
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
```text
|
|
298
|
+
CONTRACT.DEFAULT_INVALID: Field "Event.createdAt" has a default that its codec refuses: Codec 'pg/timestamptz-temporal@1' encodes a Temporal.Instant, but received a string.
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
1. Search your contract files for `.default(` with a literal argument.
|
|
302
|
+
2. Type-check the contract file, then run `prisma contract emit`. TypeScript reports a default of the wrong type; the emit reports each default the codec refuses, with its model and field.
|
|
303
|
+
3. For each one, either pass the codec's type or change the preset:
|
|
304
|
+
|
|
305
|
+
| You have | Write |
|
|
306
|
+
| --- | --- |
|
|
307
|
+
| an ISO 8601 string | `field.temporal.timestamptzString().default('2024-01-01T00:00:00Z')` |
|
|
308
|
+
| a JavaScript `Date` | `field.temporal.timestamptzJsDate().default(new Date('2024-01-01T00:00:00Z'))` |
|
|
309
|
+
| a `Temporal.Instant` | `field.dateTime().default(Temporal.Instant.from('2024-01-01T00:00:00Z'))` |
|
|
310
|
+
|
|
311
|
+
Changing the preset changes the column's codec, and so the type your queries read and write for that field. On Postgres, `field.bigint()` takes a `bigint` and `field.bytes()` takes a `Uint8Array`. On SQLite, `field.temporal.datetime()` takes a `Date`, `field.column(bigintColumn)` takes a `bigint` and `field.column(blobColumn)` takes a `Uint8Array`.
|
|
312
|
+
|
|
313
|
+
On Node 24 there is no global `Temporal`. A contract file that creates a `Temporal` value must load an implementation itself, for example with `import 'temporal-polyfill/full/global'` as its first import. The type check on a `Temporal` field needs the `Temporal` type declarations in the project, for example from `temporal-polyfill/global`; without them the parameter is unchecked. The error shown above is the one you get with an implementation loaded; without one, the codec reports that the runtime has no global `Temporal` implementation.
|
|
314
|
+
|
|
315
|
+
`.default(null)` used to store `null`. It is now a type error on a field whose codec input type does not include `null`, which is every built-in codec except the JSON codecs: `field.json().optional().default(null)` still compiles and stores `null`. When the contract is built, the codec receives the `null`: a codec that checks its input, such as `pg/int8@1`, refuses it with `CONTRACT.DEFAULT_INVALID`, and a codec that passes any value through, such as `pg/text@1`, still stores `null`. A column without a default already defaults to `NULL` in the database, so remove the call.
|
|
316
|
+
|
|
317
|
+
A JavaScript `number` on a `bigint` field (codec `pg/int8@1`), such as `field.bigint().default(1)` inside the `defineContract` factory, is now a type error. Write a `bigint` literal: `field.bigint().default(1n)`. The default is stored as `"1"`, as the table below shows.
|
|
318
|
+
|
|
319
|
+
A default that gets past the type check, for example from an untyped caller, is stored in a different form than before:
|
|
320
|
+
|
|
321
|
+
| Default | Stored before | Stored now |
|
|
322
|
+
| --- | --- | --- |
|
|
323
|
+
| `field.bigint().default(1)` (also SQLite `bigintColumn`) | `1` | `"1"` |
|
|
324
|
+
| `field.bytes().default('x')` | `"x"` | `"eA=="` (base64) |
|
|
325
|
+
| SQLite `blobColumn` with `.default('x')` | `"x"` | `"78"` (hex) |
|
|
326
|
+
|
|
327
|
+
A contract with such a default emits a different `contract.json` and a different storage hash. Re-emit the contract and review the diff of `contract.json`.
|
|
328
|
+
|
|
329
|
+
A literal default on a column whose codec no pack in the contract declares now fails with `CONTRACT.DEFAULT_INVALID`, because nothing can check it. List the pack that owns the codec in the `extensions` of `defineContract`.
|
|
330
|
+
|
|
331
|
+
### For extension authors
|
|
332
|
+
|
|
333
|
+
- A pack passed in `extensions` contributes its codecs to this lookup through `types.codecTypes.codecDescriptors`. A default on a column of your codec is now passed to your codec's `encodeJson`, built with the column's `typeParams`. Make `encodeJson` throw for a value it cannot encode; the build reports your message.
|
|
334
|
+
- A codec descriptor that the target's codec registry refuses (for Postgres, one that does not extend `PostgresCodecDescriptor` and is not wrapped with `postgresCodec()`), or that reuses a built-in codec id, now fails `defineContract` as it already failed when the control stack was assembled.
|
|
335
|
+
- A caller who passes `codecLookup` to `defineContract` keeps that lookup; the facade does not add to it.
|
|
336
|
+
- A column helper that is a function, such as `varcharColumn(n)`, `timeTemporalColumn()` or pgvector's `vector(n)`, now declares its literal codec id in its return type. One variable can no longer be reassigned between the results of different helpers; annotate such a variable as `ColumnTypeDescriptor`.
|
|
337
|
+
|
|
338
|
+
## `contract-source-format-is-psl-or-typescript`
|
|
339
|
+
|
|
340
|
+
`ContractSourceProvider` from `@internal/config/config-types` (`@prisma/orm-framework/config/config-types`) is now the union of `PslContractSourceProvider` (`format: 'psl'`) and `TypeScriptContractSourceProvider` (`format: 'typescript'`). `format` is required on both. `OpaqueContractSourceProvider` and every other `format` value are gone, and config validation reports a source with no `format`, or any other value, as an issue on `contract.source.format`.
|
|
341
|
+
|
|
342
|
+
Give every contract source an extension defines a `format`: `'psl'` when its inputs are PSL text, and `'typescript'` when it builds the contract in TypeScript. Replace imports of `OpaqueContractSourceProvider` with `ContractSourceProvider`.
|
|
343
|
+
|
|
344
|
+
## `prisma7-schema-source-declares-psl`
|
|
345
|
+
|
|
346
|
+
The source returned by `prisma7Schema()` now declares `format: 'psl'`, because a Prisma 7 schema is PSL text. It still does not implement `interpret`. Code that compared `source.format` with `'prisma7'` must stop doing so; nothing in the framework tells a Prisma 7 schema from a Prisma 8 one by its format.
|
|
347
|
+
|
|
348
|
+
## `print-psl-description-option`
|
|
349
|
+
|
|
350
|
+
`printPsl()` from `@internal/psl-printer` (`@prisma/orm-framework/psl-printer`) used to open every file with the `// use prisma-8` marker and a line saying the contract was inferred from the live database. It now writes only the marker, and a second comment line only when the caller passes `description`. Code that prints an inferred contract and wants the old second line passes it:
|
|
351
|
+
|
|
352
|
+
```ts
|
|
353
|
+
printPsl(ast, {
|
|
354
|
+
pslBlockDescriptors,
|
|
355
|
+
description:
|
|
356
|
+
'Contract inferred from the live database schema. Edit as needed, then run `prisma contract emit`.',
|
|
357
|
+
});
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## `family-sql-psl-build-export`
|
|
361
|
+
|
|
362
|
+
`contract print` uses some of what `@internal/family-sql/psl-infer` exported, so those exports moved to the new subpath `@internal/family-sql/psl-build`: `mapDefault`, `DefaultMappingOptions`, `DefaultMappingResult`, `PslTypeMap`, `PslTypeReference`, `PslTypeResolution` and `toEnumMemberName`. Import them from `@internal/family-sql/psl-build` (`@prisma/orm-family-sql/family/psl-build`, or the same subpath of `@prisma/orm-postgres` and `@prisma/orm-sqlite`). Everything else stays in `@internal/family-sql/psl-infer` (`family/psl-infer`).
|
|
363
|
+
|
|
364
|
+
## `cursor-rejects-expression-orders`
|
|
365
|
+
|
|
366
|
+
A SQL ORM `cursor()` builds its keyset from plain model columns. It throws `ORM.ARGUMENT_INVALID`, naming the 1-based `orderBy` position, when an active order is any of these:
|
|
367
|
+
|
|
368
|
+
- an extension-operation result, such as `(p) => p.embedding.cosineDistance(v).asc()` or `(m) => m.text.fullTextRank(q).desc()`;
|
|
369
|
+
- a relation field, such as `(p) => p.author.name.asc()`;
|
|
370
|
+
- a relation count, such as `(u) => u.posts.count().desc()`;
|
|
371
|
+
- an order with null placement, such as `(p) => p.title.asc({ nulls: 'last' })`.
|
|
372
|
+
|
|
373
|
+
The check runs when `cursor()` is called and again when the query is planned, so an order added after `cursor()` is refused too. Before this change an extension-operation order was left out of the keyset without an error, which returned wrong pages.
|
|
374
|
+
|
|
375
|
+
For each `.cursor(` call in a chain that also calls `.orderBy(`, look at every `orderBy` lambda in the chain. If any of them is one of the orders above, do one of these:
|
|
376
|
+
|
|
377
|
+
- Paginate with `.limit(n).offset(n)` and remove `.cursor(...)`.
|
|
378
|
+
- Keep the cursor and order by plain columns only, for example `(p) => p.createdAt.desc()` and `(p) => p.id.desc()`.
|
|
379
|
+
|
|
380
|
+
`distinctOn()` throws the same error when one of the first N orders, where N is the number of `distinctOn` columns, is not a plain column: Postgres needs those leading orders to match the `DISTINCT ON` columns, so such a query already failed in the database; it now fails earlier, with `ORM.ARGUMENT_INVALID`. Put the `distinctOn` columns first; a relation order, a count or an operation result may follow them. For example, `.orderBy([(post) => post.title.asc(), (post) => post.author.name.asc()]).distinctOn('title')` is accepted.
|
|
381
|
+
|
|
382
|
+
## `order-by-item-nulls`
|
|
383
|
+
|
|
384
|
+
`OrderByItem` has a `nulls` field of type `'first' | 'last' | undefined`, and `undefined` means the database default. The constructor refuses any other value, and any direction other than `'asc'` / `'desc'`, with `RUNTIME.AST_INVALID`.
|
|
385
|
+
|
|
386
|
+
Constructing an item:
|
|
387
|
+
|
|
388
|
+
- `new OrderByItem(expr, dir)` no longer compiles. Pass the placement as the third argument, `new OrderByItem(expr, dir, undefined)`, or use `OrderByItem.asc(expr, { nulls })` / `OrderByItem.desc(expr, { nulls })`.
|
|
389
|
+
- To reorder by a different expression while keeping an existing item's direction and placement, write `item.withExpr(expr)` instead of `new OrderByItem(expr, item.dir)`. The hand-written form drops `nulls`.
|
|
390
|
+
|
|
391
|
+
Rendering an item: an adapter or renderer that writes `ORDER BY` itself must write the placement after the direction, `NULLS FIRST` for `'first'` and `NULLS LAST` for `'last'`, in every position it renders an `OrderByItem` (query, window and aggregate `ORDER BY`). A renderer that ignores `nulls` compiles and returns rows in the wrong order. Map `dir` and `nulls` through a fixed table rather than interpolating the string. A dialect without `NULLS FIRST` / `NULLS LAST` must emulate the placement, for example with a leading `expr IS NULL` key, and must not drop it.
|
|
392
|
+
|
|
393
|
+
## `include-expr-join-column-lists`
|
|
394
|
+
|
|
395
|
+
An ORM include now joins the related rows on every column of the relation's key, not only the first. So `IncludeExpr` (exported from `@prisma/orm-family-sql/orm-client`, and the element type of `Collection.state.includes`) carries the key as two lists instead of two strings:
|
|
396
|
+
|
|
397
|
+
- `localColumn: string` is now `localColumns: readonly string[]`, the key columns in the parent table.
|
|
398
|
+
- `targetColumn: string` is now `targetColumns: readonly string[]`, the matching columns in the related table.
|
|
399
|
+
|
|
400
|
+
Both lists have the same length, and `localColumns[i]` joins to `targetColumns[i]`. A single-column relation has one entry in each list.
|
|
401
|
+
|
|
402
|
+
Update code that reads these fields to use the whole lists and pair them by index. Code that builds an `IncludeExpr` by hand passes arrays, for example `{ localColumns: ['id'], targetColumns: ['user_id'] }` instead of `{ localColumn: 'id', targetColumn: 'user_id' }`. Do not keep only the first entry of each list: for a composite key that matches every related row that shares the first key column, which is the bug this change fixes.
|
|
403
|
+
|
|
404
|
+
## `mongo-codec-subpaths-move-to-target`
|
|
405
|
+
|
|
406
|
+
Rewrite each specifier. The exported names are unchanged.
|
|
407
|
+
|
|
408
|
+
| Before | After |
|
|
409
|
+
| --- | --- |
|
|
410
|
+
| `@internal/adapter-mongo/codec-types` | `@internal/target-mongo/codec-types` |
|
|
411
|
+
| `@internal/adapter-mongo/codecs` | `@internal/target-mongo/codecs` |
|
|
412
|
+
| `@internal/adapter-mongo/codec-ids` | `@internal/target-mongo/codec-ids` |
|
|
413
|
+
| `@internal/adapter-mongo/data-types` | `@internal/target-mongo/data-types` |
|
|
414
|
+
| `@prisma/orm-mongo/adapter/<same four>` | `@prisma/orm-mongo/target/<same four>` |
|
|
415
|
+
| `@prisma/orm-target-mongo/adapter/<same four>` | `@prisma/orm-target-mongo/target/<same four>` |
|
|
416
|
+
|
|
417
|
+
An extension outside this repository imports the published forms in the last two rows. Then re-sort the import block with the package's formatter (the new specifier sorts after `@internal/mongo-*`). A package that imports from `@internal/target-mongo` for the first time needs it in `dependencies`. A pack that emits a Mongo `contract.d.ts` re-emits it with `prisma contract emit`, or applies the same rewrite to the committed file; the contract JSON and hashes do not change.
|
|
418
|
+
|
|
419
|
+
`@internal/target-mongo/codecs` (`@prisma/orm-mongo/target/codecs`) also exports `mongoStandardCodecs` and `buildStandardCodecRegistry`, which the adapter used internally before.
|
|
420
|
+
|
|
421
|
+
## `create-mongo-runner-deps-removed`
|
|
422
|
+
|
|
423
|
+
```ts
|
|
424
|
+
// before
|
|
425
|
+
import { createMongoRunnerDeps, extractDb } from '@prisma/orm-mongo/adapter/control';
|
|
426
|
+
import { MongoDriverImpl } from '@prisma/orm-mongo/driver';
|
|
427
|
+
const deps = createMongoRunnerDeps(controlDriver, MongoDriverImpl.fromDb(extractDb(controlDriver)), family);
|
|
428
|
+
|
|
429
|
+
// after
|
|
430
|
+
import { MongoControlAdapterImpl } from '@prisma/orm-mongo/adapter/control';
|
|
431
|
+
const deps = new MongoControlAdapterImpl().createRunnerDependencies(controlDriver);
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Inside this repository the same imports are `@internal/adapter-mongo/control` and `@internal/driver-mongo`.
|
|
435
|
+
|
|
436
|
+
Drop imports that are now unused and any family instance built only to pass as the third argument.
|
|
437
|
+
|
|
438
|
+
## `mongo-runner-dependency-types-move-to-family`
|
|
439
|
+
|
|
440
|
+
Change the import of `MongoRunnerDependencies` or `MarkerOperations` to `@prisma/orm-mongo/family/control-adapter` (`@internal/family-mongo/control-adapter` inside this repository). The shapes are unchanged.
|
|
441
|
+
|
|
442
|
+
## `mongo-control-adapter-creates-runner-dependencies`
|
|
443
|
+
|
|
444
|
+
Add the method to a custom control adapter. It returns the `MongoRunnerDependencies` the migration runner uses for that driver:
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
createRunnerDependencies(driver: ControlDriverInstance<'mongo', 'mongo'>): MongoRunnerDependencies
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
A custom family instance forwards `createRunnerDependencies({ driver })` to the control adapter it resolves from the stack.
|
|
451
|
+
|
|
452
|
+
## `mongo-create-runner-needs-adapter-on-stack`
|
|
453
|
+
|
|
454
|
+
Create the family instance from a control stack that includes the Mongo adapter:
|
|
455
|
+
|
|
456
|
+
```ts
|
|
457
|
+
createMongoFamilyInstance(
|
|
458
|
+
createControlStack({ family: mongoFamilyDescriptor, target: mongoTargetDescriptor, adapter: mongoAdapterDescriptor }),
|
|
459
|
+
);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
## `mongo-execution-context-applies-mutation-defaults`
|
|
463
|
+
|
|
464
|
+
Mongo contracts can now carry execution defaults (`temporal.createdAt()`, `temporal.updatedAt()`), and the execution context applies them. The ORM calls `context.applyMutationDefaults(...)` on every create and update, so `MongoExecutionContext` has a new required method.
|
|
465
|
+
|
|
466
|
+
Build contexts with `createMongoExecutionContext({ contract, stack })` and nothing changes. A hand-written context, typically a test double, adds a method that applies nothing:
|
|
467
|
+
|
|
468
|
+
```ts
|
|
469
|
+
// before
|
|
470
|
+
const context: MongoExecutionContext = { contract, codecs, stack };
|
|
471
|
+
|
|
472
|
+
// after
|
|
473
|
+
const context: MongoExecutionContext = { contract, codecs, stack, applyMutationDefaults: () => [] };
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## `mongo-field-builder-execution-defaults-parameter`
|
|
477
|
+
|
|
478
|
+
Code that constrains on a bare `FieldBuilder` (for example `Fields extends Record<string, FieldBuilder>`) accepts only builders without execution defaults; pass `ExecutionMutationDefaultPhases | undefined` as the fifth type argument to accept preset fields:
|
|
479
|
+
|
|
480
|
+
```ts
|
|
481
|
+
import type { ContractFieldType, ExecutionMutationDefaultPhases } from '@prisma/orm-mongo/contract/types';
|
|
482
|
+
import type { EnumTypeHandle, FieldBuilder } from '@prisma/orm-mongo/contract-builder';
|
|
483
|
+
|
|
484
|
+
type AnyField = FieldBuilder<
|
|
485
|
+
ContractFieldType,
|
|
486
|
+
boolean,
|
|
487
|
+
boolean,
|
|
488
|
+
EnumTypeHandle | undefined,
|
|
489
|
+
ExecutionMutationDefaultPhases | undefined
|
|
490
|
+
>;
|
|
491
|
+
```
|
|
492
|
+
There is no detection pattern: a bare `FieldBuilder` reference is too common to tell which uses need the wider type.
|
|
493
|
+
|
|
494
|
+
## `mongo-bson-codec-added`
|
|
495
|
+
|
|
496
|
+
The Mongo target adds five codecs, none of which existed in 8.0.0-rc.12: `mongo/int64@1` (PSL `Int64`, `bigint`), `mongo/decimal128@1` (PSL `Decimal128`, a decimal string), `mongo/binary@1` (PSL `Binary`, `Uint8Array`), `mongo/json@1` (PSL `Json`, JSON values only, refused on encode and decode otherwise) and `mongo/bson@1` (PSL `Bson`, `field.bson()`, any BSON value). The `mongo/bson@1` entry of `CodecTypes` reads `BsonValue` and writes `BsonInputValue` (a `BsonValue`, or a `Uint8Array` at any depth), both exported from `@prisma/orm-mongo/target/codec-types` (`@internal/target-mongo/codec-types` inside this repository) and declared in `@prisma/orm-mongo/value` (`@internal/mongo-value`), where the Mongo TypeScript builder reads them. `BsonValue` covers every value the driver returns with its default settings, `Code`, `MinKey`, `MaxKey`, `BSONSymbol` and a native `RegExp` (what a stored regex reads back as) included; `BSONRegExp` appears only with a driver configured with `bsonRegExp: true`. A `DBRef` is never returned, because decode turns it back into its `{ $ref, $id[, $db], ...fields }` document. It declares an empty `targetTypes`, so the validator does not constrain its value: a single field gets `{}`, and a list field still must be an array, `{ bsonType: 'array', items: {} }`. An extension that lists every Mongo codec id, or keys a map by `CodecTypes`, adds the five new ones. An extension that stores arbitrary BSON in a field of its own contract types it `mongo/bson@1`, not `mongo/json@1`, which refuses non-JSON values.
|
|
497
|
+
|
|
498
|
+
The detection pattern finds a descriptor whose `targetTypes` lists two or more entries, quoted strings or named constants, on one line or several. It does not see a list built elsewhere and referenced by name (`targetTypes: TYPES`); check those descriptors by hand.
|
|
499
|
+
|
|
500
|
+
The Mongo validator derivation reads every entry of a codec descriptor's `targetTypes`. For a list field the list applies to `items`, and a nullable field prepends `'null'` unless the list already has it. An empty list leaves the value's type unconstrained but not a list field's cardinality: a single field gets `{}`, and a list field gets `{ bsonType: 'array', items: {} }`.
|
|
501
|
+
|
|
502
|
+
For each Mongo codec descriptor in the extension whose `targetTypes` has more than one entry, check that every entry is a BSON type the codec's `encode` can produce, because each one is now admitted by the validator. Remove any entry the codec does not write. Then re-emit the extension's contracts and any test fixtures; their validators list every entry.
|
|
503
|
+
|
|
504
|
+
An enum's `@@type` codec must declare exactly one entry: the Mongo enum factory reports `enum "<name>" @@type codec "<id>" declares <n> BSON types; an enum needs exactly one` otherwise.
|