@prisma/orm-mongo 8.0.0-rc.1-dev.45 → 8.0.0-rc.10
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 +5 -9
- package/dist/contract-builder.d.mts +1 -0
- package/dist/contract-builder.d.mts.map +1 -1
- package/dist/utils__suppress-idle-connection-errors.d.mts +1 -0
- package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
- package/package.json +14 -16
- package/skills/prisma-8/SKILL.md +96 -0
- package/skills/prisma-8/references/build.md +142 -0
- package/skills/prisma-8/references/contract.md +446 -0
- package/skills/prisma-8/references/debug.md +144 -0
- package/skills/prisma-8/references/feedback.md +251 -0
- package/skills/prisma-8/references/migration-model.md +175 -0
- package/skills/prisma-8/references/migration-review.md +241 -0
- package/skills/prisma-8/references/migrations.md +538 -0
- package/skills/prisma-8/references/queries-mongo.md +236 -0
- package/skills/prisma-8/references/queries-postgres.md +415 -0
- package/skills/prisma-8/references/queries.md +237 -0
- package/skills/prisma-8/references/quickstart.md +317 -0
- package/skills/prisma-8/references/runtime.md +366 -0
- package/skills/prisma-8/references/supabase.md +231 -0
- package/skills/prisma-8/references/upgrade-app.md +101 -0
- package/skills/prisma-8/references/upgrade-extension.md +105 -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.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.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/bin__prisma-next.mjs +0 -3
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.3"
|
|
3
|
+
to: "8.0.0-rc.4"
|
|
4
|
+
changes:
|
|
5
|
+
- id: prisma-config-hard-cut-and-top-level-commands
|
|
6
|
+
summary: |
|
|
7
|
+
The deprecated fallbacks are gone: the CLI no longer reads
|
|
8
|
+
`prisma-next.config.ts`, no longer accepts the flat (un-nested) config shape, and the
|
|
9
|
+
`prisma-next` command no longer exists. The unified CLI (`@prisma/cli`, installed from
|
|
10
|
+
the `next` dist-tag; its binary is currently `prisma-cli`) runs the ORM commands at the
|
|
11
|
+
top level — `contract emit`, `db init`, `migration plan`, `migrate` — with only `init`
|
|
12
|
+
under the `orm` group (`orm init`), and the only config it reads is `prisma.config.ts`
|
|
13
|
+
in the engine envelope shape.
|
|
14
|
+
|
|
15
|
+
1. Rename `prisma-next.config.ts` to `prisma.config.ts` if you have not already.
|
|
16
|
+
2. Rewrite the export to the envelope shape. Old flat shape:
|
|
17
|
+
`import { defineConfig } from '@prisma/orm-postgres/config';`
|
|
18
|
+
`export default defineConfig({ contract: '…', db: { connection: … } });`
|
|
19
|
+
New shape:
|
|
20
|
+
`import { definePrismaConfig } from '@prisma/cli-engine';`
|
|
21
|
+
`import { defineConfig as ormConfig } from '@prisma/orm-postgres/config';`
|
|
22
|
+
`export default definePrismaConfig({ orm: ormConfig({ contract: '…', db: { connection: … } }) });`
|
|
23
|
+
The options object moves into the target helper unchanged. The same pattern applies
|
|
24
|
+
to `@prisma/orm-sqlite/config` and `@prisma/orm-mongo/config`.
|
|
25
|
+
3. If the config reads `process.env`, keep (or add) `import 'dotenv/config';` as the
|
|
26
|
+
first import — the loader does not read `.env` for you.
|
|
27
|
+
4. In `package.json`, replace the `prisma-next` devDependency with `prisma@latest`
|
|
28
|
+
plus `@prisma/cli-engine` at the exact version that `@prisma/cli` names in its own
|
|
29
|
+
dependencies, and rewrite scripts: `prisma-next <subcommand>` becomes
|
|
30
|
+
`prisma-cli <subcommand>` (`migration apply` becomes `migrate`; `init` alone moves
|
|
31
|
+
under the orm group as `prisma-cli orm init`).
|
|
32
|
+
5. Run `prisma-cli contract emit` to confirm the config loads and to regenerate the
|
|
33
|
+
artifacts (their generated-file headers change with this release).
|
|
34
|
+
detection:
|
|
35
|
+
glob: "**/prisma-next.config.ts"
|
|
36
|
+
- id: raw-moves-to-its-own-lane
|
|
37
|
+
summary: |
|
|
38
|
+
Whole-query raw SQL moves address: ``db.sql.raw`SELECT ...` `` becomes
|
|
39
|
+
``db.raw.sql`SELECT ...` ``. Everything after the template is unchanged.
|
|
40
|
+
`.returnsRow(spec)`, `.affectedCount()`, `.returns(codecId)`, and splicing a
|
|
41
|
+
row-returning statement into another template all behave as they did.
|
|
42
|
+
|
|
43
|
+
The client's `raw` property changes shape in the same move. It was a tagged template you
|
|
44
|
+
could call directly for an expression fragment. It is now the raw lane, an object whose
|
|
45
|
+
`sql` key holds the statement tag.
|
|
46
|
+
|
|
47
|
+
An author who called `db.raw` as a fragment tag has two replacements. Use `fns.raw`
|
|
48
|
+
inside a builder callback, which is where fragments belong. Or terminate the lane's tag
|
|
49
|
+
with `.returns(codecId)` for the same expression, now bound to the contract.
|
|
50
|
+
detection:
|
|
51
|
+
glob: "**/*.{ts,tsx,mts,cts}"
|
|
52
|
+
regex:
|
|
53
|
+
# The old whole-query address, on any receiver.
|
|
54
|
+
- '\.sql\.raw`'
|
|
55
|
+
# The client tag being repurposed. `fns.raw` is a fragment call site and
|
|
56
|
+
# is deliberately excluded: fragments are unchanged by this release.
|
|
57
|
+
- '(?<!(?<![\w$])fns)\.raw`'
|
|
58
|
+
anyMatch: true
|
|
59
|
+
- id: raw-is-no-longer-a-reserved-namespace
|
|
60
|
+
summary: |
|
|
61
|
+
A storage namespace named `raw` is allowed again. 8.0.0-rc.2 and 8.0.0-rc.3 refused such a contract when
|
|
62
|
+
the client was built, with `ORM.NAMESPACE_RESERVED`, because the SQL surface answered
|
|
63
|
+
`db.sql.raw` with the raw tag. The tag has moved to `db.raw.sql`, so nothing a contract
|
|
64
|
+
declares can collide with it.
|
|
65
|
+
|
|
66
|
+
If you renamed a namespace to get past that error, you may rename it back:
|
|
67
|
+
`@@schema("raw")` is an ordinary name, reachable as `db.sql.raw.<table>`. Re-emit the
|
|
68
|
+
contract afterwards, then plan the rename against the database as you would any other
|
|
69
|
+
namespace rename. The physical schema keeps the name it has until a plan moves it.
|
|
70
|
+
Renaming back is optional: a namespace you renamed away stays valid.
|
|
71
|
+
detection:
|
|
72
|
+
glob: "**/*.{prisma,json}"
|
|
73
|
+
contains:
|
|
74
|
+
- "ORM.NAMESPACE_RESERVED"
|
|
75
|
+
- '@@schema("raw")'
|
|
76
|
+
anyMatch: true
|
|
77
|
+
- id: contract-artifacts-restamp
|
|
78
|
+
summary: |
|
|
79
|
+
The emitted `contract.json` / `contract.d.ts` embed the toolchain version, which moves
|
|
80
|
+
to 8.0.0-rc.4. Run `contract emit` once after upgrading so the emitted artifacts match
|
|
81
|
+
the installed toolchain. This applies even to projects whose config needed no
|
|
82
|
+
migration — the restamp is independent of the config changes above.
|
|
83
|
+
detection:
|
|
84
|
+
glob: "**/contract.json"
|
|
85
|
+
contains:
|
|
86
|
+
- '"version": "8.0.0-rc.3"'
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
# 8.0.0-rc.3 → 8.0.0-rc.4 — User upgrade instructions
|
|
90
|
+
|
|
91
|
+
## `raw-moves-to-its-own-lane`
|
|
92
|
+
|
|
93
|
+
Whole-query raw SQL has its own front door. The tag that sat inside the namespace map is now a
|
|
94
|
+
lane on the client:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
// Before
|
|
98
|
+
const plan = db.sql.raw`SELECT id, email FROM users WHERE id = ${1}`
|
|
99
|
+
.returnsRow({ id: users.columns.id, email: users.columns.email })
|
|
100
|
+
.build();
|
|
101
|
+
|
|
102
|
+
// After
|
|
103
|
+
const plan = db.raw.sql`SELECT id, email FROM users WHERE id = ${1}`
|
|
104
|
+
.returnsRow({ id: users.columns.id, email: users.columns.email })
|
|
105
|
+
.build();
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Everything after the template is unchanged: the terminators, the row specs they take, the plans
|
|
109
|
+
they build, and splicing a row-returning statement into another template.
|
|
110
|
+
|
|
111
|
+
The client's `raw` property changes shape in the same move. It was the expression tag you could
|
|
112
|
+
call directly; it is now the lane, whose `sql` key holds the statement tag:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// Before: `raw` is a tag
|
|
116
|
+
const upper = db.raw`UPPER(${email})`.returns('pg/text@1');
|
|
117
|
+
|
|
118
|
+
// After, inside a builder callback — where fragments belong
|
|
119
|
+
const rows = db.sql.public.users
|
|
120
|
+
.select((f, fns) => ({ upper: fns.raw`UPPER(${f.email})`.returns('pg/text@1') }))
|
|
121
|
+
.build();
|
|
122
|
+
|
|
123
|
+
// After, from the lane, for a fragment you hold on its own
|
|
124
|
+
const upper = db.raw.sql`UPPER(${email})`.returns('pg/text@1');
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The detector looks for the old address and for `raw` used as a tag. It skips the receiver `fns`
|
|
128
|
+
exactly, including `x.fns.raw`, because that is a fragment call site and needs no change. A
|
|
129
|
+
receiver that merely ends in those letters, such as `myfns.raw`, still matches. So does a
|
|
130
|
+
builder callback that names its functions object something else. Check whether the receiver is
|
|
131
|
+
a client before you change anything.
|
|
132
|
+
|
|
133
|
+
## `raw-is-no-longer-a-reserved-namespace`
|
|
134
|
+
|
|
135
|
+
8.0.0-rc.2 and 8.0.0-rc.3 refused a contract whose storage declared a namespace named `raw`, because that was
|
|
136
|
+
the key the SQL surface answered with the raw tag:
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
ORM.NAMESPACE_RESERVED: The SQL surface exposes the raw statement tag as "db.raw", so a storage
|
|
140
|
+
namespace named "raw" cannot be reached through it. Rename the namespace in the schema.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
That constraint is gone. `db.sql` is a namespace map and nothing else, and the lane is composed
|
|
144
|
+
by the client rather than derived from your contract, so the two cannot collide.
|
|
145
|
+
|
|
146
|
+
If you renamed a namespace to get past the error, you may rename it back:
|
|
147
|
+
|
|
148
|
+
```prisma
|
|
149
|
+
model Event {
|
|
150
|
+
id String @id
|
|
151
|
+
@@schema("raw")
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Its tables are then reachable as `db.sql.raw.<table>`, like any other namespace. Re-emit the
|
|
156
|
+
contract, and plan the rename against the database as you would any other namespace rename —
|
|
157
|
+
the physical schema carries the old name until a plan moves it. Renaming back is optional; the
|
|
158
|
+
name you moved to stays valid.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.4"
|
|
3
|
+
to: "8.0.0-rc.5"
|
|
4
|
+
changes:
|
|
5
|
+
- id: attach-pg-client-error-listener
|
|
6
|
+
summary: |
|
|
7
|
+
Attach an 'error' listener to any pg `Client` or `Pool` your own code constructs outside the Prisma runtime. node-postgres emits 'error' on the pool or client when an idle connection drops (database restart, pooler timeout, network blip); with no listener Node treats it as an uncaught exception and kills the process. Starting at rc.5 every pool and client the Prisma runtime creates or receives — including a pool you pass via the `pg:` binding — gets a listener automatically, so this only applies to pg handles your code uses directly (health checks, side-channel observers, hand-rolled scripts).
|
|
8
|
+
detection:
|
|
9
|
+
glob: "**/*.{ts,tsx}"
|
|
10
|
+
contains:
|
|
11
|
+
- "new Client("
|
|
12
|
+
- "new pg.Client("
|
|
13
|
+
- "new Pool("
|
|
14
|
+
- "new pg.Pool("
|
|
15
|
+
anyMatch: true
|
|
16
|
+
- id: contract-artifacts-restamp
|
|
17
|
+
summary: |
|
|
18
|
+
The emitted `contract.json` / `contract.d.ts` embed the toolchain version, which moves
|
|
19
|
+
to 8.0.0-rc.5. Run `contract emit` once after upgrading so the emitted artifacts match
|
|
20
|
+
the installed toolchain. The restamp is independent of the other changes in this
|
|
21
|
+
release.
|
|
22
|
+
detection:
|
|
23
|
+
glob: "**/contract.json"
|
|
24
|
+
contains:
|
|
25
|
+
- '"version": "8.0.0-rc.4"'
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# 8.0.0-rc.4 → 8.0.0-rc.5 — User upgrade instructions
|
|
29
|
+
|
|
30
|
+
## `attach-pg-client-error-listener`
|
|
31
|
+
|
|
32
|
+
Walk every file matched by `detection.glob`. For each `pg.Client` or `pg.Pool` your code constructs and uses directly (not one handed to `postgres({ pg: ... })` / `supabase({ pg: ... })` — the runtime covers those since rc.5), attach an `'error'` listener right after construction, before `connect()`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const client = new pg.Client({ connectionString });
|
|
36
|
+
client.on('error', () => {});
|
|
37
|
+
await client.connect();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
A no-op listener is enough: connect and query failures still reject their own promises, so nothing real is masked — the listener only stops a dropped idle connection from becoming an uncaught exception. If the handle is long-lived and you have a logging channel, log the error instead of discarding it.
|
|
41
|
+
|
|
42
|
+
Note that a surrounding `try/catch` does **not** cover this case — the `'error'` event is emitted on the client object asynchronously, outside any promise chain the `catch` can see.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.5"
|
|
3
|
+
to: "8.0.0-rc.6"
|
|
4
|
+
changes:
|
|
5
|
+
- id: postgres-temporal-representations
|
|
6
|
+
summary: |
|
|
7
|
+
PostgreSQL temporal columns no longer read as JavaScript `Date`. Each of `date`,
|
|
8
|
+
`timestamp(p)`, `timestamptz(p)` and `time(p)` now offers two explicit representations,
|
|
9
|
+
and five codecs were removed with no compatibility aliases:
|
|
10
|
+
|
|
11
|
+
| Retired | Replace with (Temporal) | Replace with (text) |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `pg/date@1` | `Date` → `pg/date-temporal@1` (`Temporal.PlainDate`) | `DateString` |
|
|
14
|
+
| `pg/timestamp@1` | `Timestamp(p)` → `pg/timestamp-temporal@1` (`Temporal.PlainDateTime`) | `TimestampString(p)` |
|
|
15
|
+
| `pg/timestamptz@1` | `Timestamptz(p)` → `pg/timestamptz-temporal@1` (`Temporal.Instant`) | `TimestamptzString(p)` |
|
|
16
|
+
| `pg/time@1` | `Time(p)` → `pg/time-temporal@1` (`Temporal.PlainTime`) | `TimeString(p)` |
|
|
17
|
+
| `sql/timestamp@1` (`field.timestamp()`) | `Timestamptz(p)` or `field.temporal.timestamptz(p)` | `TimestamptzString(p)` |
|
|
18
|
+
|
|
19
|
+
1. **Decide a representation per column.** The bare PSL spellings (`Date`, `Timestamp`,
|
|
20
|
+
`Timestamptz`, `Time`) keep working and now select the Temporal-backed codec. If a
|
|
21
|
+
column's values should stay text — because your code treats them as strings, or
|
|
22
|
+
because they include values Temporal cannot denote (`infinity`, non-ISO `DateStyle`
|
|
23
|
+
output, years beyond ±271821) — rename the type to its `*String` spelling. Note
|
|
24
|
+
`pg/time@1` already handed back a `string`: a `time` column whose value you treat as
|
|
25
|
+
text needs `TimeString(p)`, not `Time(p)`.
|
|
26
|
+
2. **Replace `field.timestamp()`.** The generic cross-target helper and its
|
|
27
|
+
`sql/timestamp@1` codec are gone. On PostgreSQL use `field.temporal.timestamptz(p)`
|
|
28
|
+
(or `field.temporal.timestamptzString(p)`), or the bare `Timestamptz(p)` type.
|
|
29
|
+
3. **Repoint any codec id you wrote by hand.** Ids appear in raw-lane return
|
|
30
|
+
declarations (``db.raw.sql`now()`.returns('pg/timestamptz@1')``), in
|
|
31
|
+
`prepare({ id })`, and in hand-built contracts. A retired id no longer resolves and
|
|
32
|
+
fails contract validation rather than degrading silently.
|
|
33
|
+
4. **Re-emit every contract.** `prisma contract emit` rewrites `contract.json` and
|
|
34
|
+
`contract.d.ts` together; the generated application types are where the new
|
|
35
|
+
representation becomes visible. Commit the regenerated artifacts. A contract emitted
|
|
36
|
+
before this release references a codec the registry cannot resolve and is rejected at
|
|
37
|
+
runtime.
|
|
38
|
+
5. **Provide a Temporal implementation if you kept any Temporal-backed column.** Prisma
|
|
39
|
+
bundles no polyfill. Where the runtime has no native `Temporal`, install a global one
|
|
40
|
+
in your entry point before any query runs — `import 'temporal-polyfill/full/global';`.
|
|
41
|
+
Take `full/global`, not `global`: the default build omits non-ISO calendars and its
|
|
42
|
+
published types resolve to `export {}`, so TypeScript will not see the namespace.
|
|
43
|
+
**Every read** of a Temporal-backed column needs it, and so does any insert into a
|
|
44
|
+
table carrying `temporal.updatedAt()`, whose generated value is a `Temporal.Instant`.
|
|
45
|
+
Without it the operation fails with `RUNTIME.TEMPORAL_UNAVAILABLE`, which names the
|
|
46
|
+
codec and recommends the matching `*String` type. A contract whose temporal columns
|
|
47
|
+
are all `*String` needs no Temporal anywhere.
|
|
48
|
+
6. **Update application code that consumed a `Date`.** `Temporal.Instant.from()` parses
|
|
49
|
+
**only an ISO string carrying an offset** — it throws on a `Date`, on an
|
|
50
|
+
epoch-millisecond number, and on a date-time string with no offset. Convert by source:
|
|
51
|
+
|
|
52
|
+
| You have | Use |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| a `Date` | `instant = date.toTemporalInstant()`, or `Temporal.Instant.fromEpochMilliseconds(date.getTime())` |
|
|
55
|
+
| epoch milliseconds | `Temporal.Instant.fromEpochMilliseconds(ms)` |
|
|
56
|
+
| an ISO string **with** an offset (`…Z`, `…+02:00`) | `Temporal.Instant.from(text)` |
|
|
57
|
+
| an ISO string **without** an offset | pick the zone it meant: `Temporal.PlainDateTime.from(text).toZonedDateTime('UTC').toInstant()` |
|
|
58
|
+
| "now" | `Temporal.Now.instant()` |
|
|
59
|
+
|
|
60
|
+
Match the column, not just the type name: a `date` column takes a
|
|
61
|
+
`Temporal.PlainDate` (`Temporal.PlainDate.from('2024-01-01')`), a `timestamp` column a
|
|
62
|
+
`Temporal.PlainDateTime`, a `time` column a `Temporal.PlainTime`. Only `timestamptz`
|
|
63
|
+
takes an `Instant`.
|
|
64
|
+
|
|
65
|
+
`Temporal.Instant.compare(a, b)` replaces `a.getTime() - b.getTime()`, but **both
|
|
66
|
+
operands must already be `Instant`s** — it throws on a `Date`. Values read back from
|
|
67
|
+
the ORM already are; convert anything you brought from elsewhere first.
|
|
68
|
+
|
|
69
|
+
In tests, be careful with **`toMatchObject`**. A Temporal value has no own enumerable
|
|
70
|
+
properties — every accessor lives on the prototype — so a subset matcher finds nothing
|
|
71
|
+
to compare and passes for *any* value of the same type. `toEqual` is not affected
|
|
72
|
+
(Vitest compares these correctly), but `toMatchObject` will silently stop checking the
|
|
73
|
+
timestamp. Where you need a subset match, compare `toString()` or use the type's own
|
|
74
|
+
`equals` / `compare`.
|
|
75
|
+
detection:
|
|
76
|
+
glob: "**/*.{ts,mts,cts,prisma,json}"
|
|
77
|
+
regex:
|
|
78
|
+
- "pg/(date|timestamp|timestamptz|time)@1"
|
|
79
|
+
- "sql/timestamp@1"
|
|
80
|
+
- "field\\.timestamp\\("
|
|
81
|
+
anyMatch: true
|
|
82
|
+
- id: literal-default-needs-the-string-spelling
|
|
83
|
+
summary: |
|
|
84
|
+
A literal `@default(...)` on a Temporal-backed temporal column cannot be emitted today.
|
|
85
|
+
The default value is encoded through the column's codec while the contract is being
|
|
86
|
+
emitted, inside the CLI's own process, and stock Node ships no `Temporal`. So
|
|
87
|
+
|
|
88
|
+
```prisma
|
|
89
|
+
occurredAt Timestamptz @default("2024-01-01T00:00:00Z")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
fails `prisma contract emit` with `CONTRACT.SOURCE_LOAD_FAILED` and "this runtime has no
|
|
93
|
+
global Temporal implementation".
|
|
94
|
+
|
|
95
|
+
Use the string spelling for a column that needs a literal default:
|
|
96
|
+
|
|
97
|
+
```prisma
|
|
98
|
+
occurredAt TimestamptzString @default("2024-01-01T00:00:00Z")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Function defaults are unaffected — `@default(now())` lowers to a PostgreSQL `now()`
|
|
102
|
+
storage default, never passes through a codec, and works on either representation.
|
|
103
|
+
detection:
|
|
104
|
+
glob: "**/*.prisma"
|
|
105
|
+
regex:
|
|
106
|
+
- "(Date|Timestamp|Timestamptz|Time)(\\([0-9]+\\))?\\s+@default\\(\""
|
|
107
|
+
anyMatch: true
|
|
108
|
+
- id: orm-init-no-longer-installs-agent-skills
|
|
109
|
+
summary: |
|
|
110
|
+
`prisma orm init` no longer installs agent skills: the GitHub fetch (`npx skills add`)
|
|
111
|
+
is removed and nothing inside `orm init` replaces it. Agent-skills setup belongs to the
|
|
112
|
+
family-level `prisma init` command. The `--skip-skills` flag is removed with the
|
|
113
|
+
behavior it opted out of. Existing projects keep whatever skills they already have;
|
|
114
|
+
only scripts that invoke `orm init` and expect it to deliver skills (or pass
|
|
115
|
+
`--skip-skills`) need to change.
|
|
116
|
+
detection:
|
|
117
|
+
glob: "**/*.{sh,yml,yaml,json,md}"
|
|
118
|
+
regex:
|
|
119
|
+
- '\borm\s+init\b'
|
|
120
|
+
anyMatch: true
|
|
121
|
+
- id: contract-artifacts-restamp
|
|
122
|
+
summary: |
|
|
123
|
+
The emitted `contract.json` / `contract.d.ts` embed the toolchain version, which moves
|
|
124
|
+
to 8.0.0-rc.6. Run `contract emit` once after upgrading so the emitted artifacts match
|
|
125
|
+
the installed toolchain. The restamp is independent of the other changes in this
|
|
126
|
+
release.
|
|
127
|
+
detection:
|
|
128
|
+
glob: "**/contract.json"
|
|
129
|
+
contains:
|
|
130
|
+
- '"version": "8.0.0-rc.5"'
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
# 8.0.0-rc.5 → 8.0.0-rc.6 — User upgrade instructions
|
|
134
|
+
|
|
135
|
+
# PostgreSQL temporal representations
|
|
136
|
+
|
|
137
|
+
Both entries are schema-and-code renames; there is no codemod, because the choice between the
|
|
138
|
+
Temporal and the string representation is per column and only you know which values a column
|
|
139
|
+
holds. Work through the schema first, re-emit, then let the generated `contract.d.ts` types drive
|
|
140
|
+
the application-code changes — the compiler will point at every site whose value type moved.
|
|
141
|
+
|
|
142
|
+
Two behaviours are worth knowing before you choose. A Temporal codec rejects what `Temporal` cannot
|
|
143
|
+
denote — `infinity`, years beyond roughly ±271821, and output rendered under a non-ISO `DateStyle` —
|
|
144
|
+
naming the `*String` type that reads the same column losslessly. And a nested read returns the same
|
|
145
|
+
text a flat read does, because temporal expressions are cast to `text` before PostgreSQL builds the
|
|
146
|
+
JSON, which means both reflect the session `TimeZone`.
|
|
147
|
+
|
|
148
|
+
## `orm-init-no-longer-installs-agent-skills`
|
|
149
|
+
|
|
150
|
+
Nothing to change in an existing project: skills already on disk stay as they are. Walk every `orm init` invocation the detection finds (a mention in prose that is not a command needs no action):
|
|
151
|
+
|
|
152
|
+
- An invocation passing `--skip-skills`: drop the flag — it no longer exists and the invocation fails with an unknown-flag error. The behavior it opted out of is gone, so the flagless invocation is the equivalent.
|
|
153
|
+
- A plain invocation with no flag: the scaffold itself is unchanged, but it no longer installs agent skills. If the script (or the person following it) relied on that, run `prisma init` in the project afterwards; that command owns skills setup now. If skills were incidental, no change is needed.
|
|
154
|
+
|
|
155
|
+
## `contract-artifacts-restamp`
|
|
156
|
+
|
|
157
|
+
For every `contract.json` matched by `detection`, run the project's emit command (`prisma contract emit`, or the project's `contract:emit` script) once after upgrading. The only expected diff is the embedded `version` moving to `8.0.0-rc.6`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.6"
|
|
3
|
+
to: "8.0.0-rc.7"
|
|
4
|
+
changes:
|
|
5
|
+
- id: rename-orm-pagination-methods
|
|
6
|
+
summary: |
|
|
7
|
+
Rename ORM collection pagination calls from `.take(n)` to `.limit(n)` and from `.skip(n)` to `.offset(n)`. This applies to SQL and Mongo ORM collections, including relation refinements and grouped SQL collections. Do not rename Mongo query-builder `.skip(n)` calls: that lower-level API continues to mirror the `$skip` pipeline stage.
|
|
8
|
+
- id: contract-artifacts-restamp
|
|
9
|
+
summary: |
|
|
10
|
+
The emitted `contract.json` / `contract.d.ts` embed the toolchain version, which moves
|
|
11
|
+
to 8.0.0-rc.7. Run `contract emit` once after upgrading so the emitted artifacts match
|
|
12
|
+
the installed toolchain. The toolchain also re-released against
|
|
13
|
+
`@prisma/cli-engine@0.2.3` (a CLI-side change with no ORM-facing surface).
|
|
14
|
+
detection:
|
|
15
|
+
glob: "**/contract.json"
|
|
16
|
+
contains:
|
|
17
|
+
- '"version": "8.0.0-rc.6"'
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# 8.0.0-rc.6 → 8.0.0-rc.7 — User upgrade instructions
|
|
21
|
+
|
|
22
|
+
## `rename-orm-pagination-methods`
|
|
23
|
+
|
|
24
|
+
Find calls on Prisma 8 ORM collections and apply these translations:
|
|
25
|
+
|
|
26
|
+
- `.take(n)` → `.limit(n)`
|
|
27
|
+
- `.skip(n)` → `.offset(n)`
|
|
28
|
+
|
|
29
|
+
Apply the same translation inside `include(...)` refinement callbacks, `combine(...)` branches, and after SQL ORM `groupBy(...)`. Leave Mongo query-builder chains that start from `db.query.from(...)` unchanged: their `.limit(...)` and `.skip(...)` methods name Mongo aggregation pipeline stages rather than the ORM collection API.
|
|
30
|
+
|
|
31
|
+
## `contract-artifacts-restamp`
|
|
32
|
+
|
|
33
|
+
For every `contract.json` matched by `detection`, run the project's emit command (`prisma contract emit`, or the project's `contract:emit` script) once after upgrading. The only expected diff beyond the pagination rename is the embedded `version` moving to `8.0.0-rc.7`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.7"
|
|
3
|
+
to: "8.0.0-rc.8"
|
|
4
|
+
changes:
|
|
5
|
+
- id: engine-pin-moves-to-0-3-0
|
|
6
|
+
summary: |
|
|
7
|
+
The toolchain now peers `@prisma/cli-engine@0.3.0` (up from 0.2.3). Projects assembled
|
|
8
|
+
by the unified `prisma` CLI resolve the engine automatically. A project that pins
|
|
9
|
+
`@prisma/cli-engine` itself must move the pin to `0.3.0`. The engine now declares
|
|
10
|
+
`@prisma/management-api-sdk` as a peer dependency (`^1.55.0`) instead of a regular
|
|
11
|
+
dependency; the `prisma` CLI shell supplies it at runtime, so only a project that runs
|
|
12
|
+
the engine outside the CLI shell needs to install the SDK itself.
|
|
13
|
+
detection:
|
|
14
|
+
glob: "**/package.json"
|
|
15
|
+
contains:
|
|
16
|
+
- '"@prisma/cli-engine": "0.2.3"'
|
|
17
|
+
- id: contract-artifacts-restamp
|
|
18
|
+
summary: |
|
|
19
|
+
The emitted `contract.json` / `contract.d.ts` embed the toolchain version, which moves
|
|
20
|
+
to 8.0.0-rc.8. Run `contract emit` once after upgrading so the emitted artifacts match
|
|
21
|
+
the installed toolchain.
|
|
22
|
+
detection:
|
|
23
|
+
glob: "**/contract.json"
|
|
24
|
+
contains:
|
|
25
|
+
- '"version": "8.0.0-rc.7"'
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# 8.0.0-rc.7 → 8.0.0-rc.8 — User upgrade instructions
|
|
29
|
+
|
|
30
|
+
## `engine-pin-moves-to-0-3-0`
|
|
31
|
+
|
|
32
|
+
For every `package.json` matched by `detection`, change the `@prisma/cli-engine` version from `0.2.3` to `0.3.0` and reinstall. If the project runs the engine outside the unified `prisma` CLI shell (rare), also install `@prisma/management-api-sdk` at a version satisfying `^1.55.0` — the engine now declares it as a peer dependency and no longer bundles it.
|
|
33
|
+
|
|
34
|
+
## `contract-artifacts-restamp`
|
|
35
|
+
|
|
36
|
+
For every `contract.json` matched by `detection`, run the project's emit command (`prisma contract emit`, or the project's `contract:emit` script) once after upgrading. The only expected diff is the embedded `version` moving to `8.0.0-rc.8`.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.8"
|
|
3
|
+
to: "8.0.0-rc.9"
|
|
4
|
+
changes:
|
|
5
|
+
- id: reemit-supabase-extension-version
|
|
6
|
+
summary: |
|
|
7
|
+
Re-emit contracts using the Supabase extension so their extension version metadata matches the installed rc.9 package.
|
|
8
|
+
- id: mongo-index-projections-use-native-lists
|
|
9
|
+
summary: |
|
|
10
|
+
MongoDB wildcard index `include` and `exclude` projections in Prisma schema files must use native PSL lists instead of encoded list strings.
|
|
11
|
+
detection:
|
|
12
|
+
glob: "**/*.prisma"
|
|
13
|
+
matches:
|
|
14
|
+
- '\b(?:include|exclude)\s*:\s*"\[[^"\r\n]*\]"'
|
|
15
|
+
- id: mongo-text-index-weights-use-native-records
|
|
16
|
+
summary: |
|
|
17
|
+
MongoDB text-index `weights` in Prisma schema files must use native PSL records instead of encoded JSON strings.
|
|
18
|
+
detection:
|
|
19
|
+
glob: "**/*.prisma"
|
|
20
|
+
matches:
|
|
21
|
+
- '\bweights\s*:\s*"\{\s*(?:\\.|[^"\\])*\}"'
|
|
22
|
+
- id: explicit-enum-sort-values
|
|
23
|
+
summary: |
|
|
24
|
+
PostgreSQL text-backed enums now sort by stored value rather than declaration order; encode semantic ranks explicitly when ordering matters.
|
|
25
|
+
- id: namespace-qualify-sql-orm-filter-types
|
|
26
|
+
summary: |
|
|
27
|
+
SQL ORM reusable filter types now require the domain namespace before the model name: `<Contract, Namespace, Model>`.
|
|
28
|
+
- id: mongo-unlowered-attributes-are-rejected
|
|
29
|
+
summary: |
|
|
30
|
+
MongoDB Prisma schema files must not carry `@default(...)`, `@updatedAt`, or `@db.*` attributes; the Mongo interpreter never lowered them and now rejects them.
|
|
31
|
+
detection:
|
|
32
|
+
glob: "**/*.prisma"
|
|
33
|
+
matches:
|
|
34
|
+
- '@(?:default\(|updatedAt\b|db\.)'
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# 8.0.0-rc.8 → 8.0.0-rc.9 — User upgrade instructions
|
|
38
|
+
|
|
39
|
+
## `reemit-supabase-extension-version`
|
|
40
|
+
|
|
41
|
+
After updating the Supabase extension to rc.9, run `prisma contract emit` for each contract that uses it and commit the regenerated `contract.json` and `contract.d.ts`. Verify that the Supabase extension's version metadata is `8.0.0-rc.9` in both artifacts; do not edit generated contracts by hand.
|
|
42
|
+
|
|
43
|
+
## `mongo-index-projections-use-native-lists`
|
|
44
|
+
|
|
45
|
+
For every Prisma schema matched by `detection`, replace encoded projection strings with native PSL lists. For example, change `include: "[a, b]"` to `include: ["a", "b"]` and `exclude: "[a]"` to `exclude: ["a"]`. Decode each string's fields in their existing order and preserve whether the argument is `include` or `exclude`.
|
|
46
|
+
|
|
47
|
+
## `mongo-text-index-weights-use-native-records`
|
|
48
|
+
|
|
49
|
+
For every Prisma schema matched by `detection`, replace the encoded JSON string passed to `weights` with a native PSL record. For example, change `weights: "{\"title\": 10}"` to `weights: { title: 10 }`, preserving every field name and numeric weight.
|
|
50
|
+
|
|
51
|
+
## `explicit-enum-sort-values`
|
|
52
|
+
|
|
53
|
+
Review queries that order text-backed enum columns and rely on declaration order. To retain semantic ranking, use an explicit ranking expression or numeric enum values. For example, a priority enum can use `{ codecId: 'pg/int4@1', nativeType: 'int4' }` with `member('Low', 0)`, `member('High', 1)`, and `member('Urgent', 2)`. In PSL, use `@@type("pg/int4@1")` with `Low = 0`, `High = 1`, and `Urgent = 2`. Update literal writes and type annotations to the numeric values, then re-emit the contract. For an existing database, create a data-preserving migration mapping the old strings to their numeric ranks and update defaults and constraints; do not rewrite applied migration history. PostgreSQL native enum columns retain the database's native ordering.
|
|
54
|
+
|
|
55
|
+
## `namespace-qualify-sql-orm-filter-types`
|
|
56
|
+
|
|
57
|
+
Find TypeScript references to `ShorthandWhereFilter`, `RelationPredicate`, `RelationPredicateInput`, and `RelationFilterAccessor`. Add the model's domain namespace as the second generic argument and place the model name third. Rewrite `ShorthandWhereFilter<Contract, Model>` as `ShorthandWhereFilter<Contract, Namespace, Model>` and `ShorthandWhereFilter<Contract, Model, Namespace>` as `ShorthandWhereFilter<Contract, Namespace, Model>`. Rewrite the relation types from `<Contract, Model>` to `<Contract, Namespace, Model>`. Use the namespace facet through which the model is queried, such as `'public'` for `db.public.User`.
|
|
58
|
+
|
|
59
|
+
## `mongo-unlowered-attributes-are-rejected`
|
|
60
|
+
|
|
61
|
+
First, before editing any schema, determine whether the project targets MongoDB: its `prisma.config.ts` imports `@prisma/orm-mongo`, or its `package.json` depends on that package. If neither holds, skip this change entirely and leave every schema untouched. The `detection` pattern also matches SQL schemas, where `@default(...)` and `@db.<Type>` are supported and deleting them breaks the contract.
|
|
62
|
+
|
|
63
|
+
For every matched MongoDB schema, delete each `@default(...)`, `@updatedAt`, and `@db.<Type>` attribute from the field that carries it, leaving the field's type and its other attributes in place. For example, change `status ProductStatus @default(Active)` to `status ProductStatus` and `updatedAt DateTime @updatedAt` to `updatedAt DateTime`. The Mongo interpreter never lowered these attributes into the contract, so the emitted `contract.json` does not change; defaults and timestamps stay the responsibility of application code, as they already were. `prisma contract emit` now fails with `PSL_UNSUPPORTED_FIELD_ATTRIBUTE` while any of them remain.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
from: "8.0.0-rc.9"
|
|
3
|
+
to: "8.0.0-rc.10"
|
|
4
|
+
changes:
|
|
5
|
+
- id: schema-header-use-prisma-8
|
|
6
|
+
summary: |
|
|
7
|
+
The schema header that marks a Prisma 8 schema is now `// use prisma-8`. The language server
|
|
8
|
+
still serves the old header and its Format action rewrites it; new schemas and the
|
|
9
|
+
inferred-schema printer write the new form. Replace `// use prisma-next`
|
|
10
|
+
at the top of every `.prisma` file.
|
|
11
|
+
detection:
|
|
12
|
+
glob: "**/*.prisma"
|
|
13
|
+
contains:
|
|
14
|
+
- "// use prisma-next"
|
|
15
|
+
- id: env-vars-drop-next-infix
|
|
16
|
+
summary: |
|
|
17
|
+
The CLI environment variables lost their `NEXT_` infix: `PRISMA_NEXT_DISABLE_TELEMETRY`,
|
|
18
|
+
`PRISMA_NEXT_TELEMETRY_ENDPOINT`, `PRISMA_NEXT_DEBUG`, and the rest are now
|
|
19
|
+
`PRISMA_DISABLE_TELEMETRY`, `PRISMA_TELEMETRY_ENDPOINT`, `PRISMA_DEBUG`, and so on. The old
|
|
20
|
+
`PRISMA_NEXT_DISABLE_TELEMETRY` opt-out is still honoured; the others are not. Rename them
|
|
21
|
+
in shell profiles, `.env` files, and CI configuration. The per-user telemetry config also moved
|
|
22
|
+
from `~/.config/prisma-next/` to `~/.config/prisma-8/`, so the consent prompt runs once more.
|
|
23
|
+
detection:
|
|
24
|
+
glob: "**/*"
|
|
25
|
+
contains:
|
|
26
|
+
- "PRISMA_NEXT_"
|
|
27
|
+
- id: primer-file-prisma-8-md
|
|
28
|
+
summary: |
|
|
29
|
+
The quick-reference primer `init` writes at the project root is now `prisma-8.md`. Rename the
|
|
30
|
+
existing `prisma-next.md` and update any README or agent instruction that points at it.
|
|
31
|
+
detection:
|
|
32
|
+
glob: "**/prisma-next.md"
|
|
33
|
+
contains:
|
|
34
|
+
- "#"
|
|
35
|
+
- id: to-one-relations-record-nullable
|
|
36
|
+
summary: |
|
|
37
|
+
Every `1:1` and `N:1` relation in `contract.json` now carries a `nullable` boolean. A
|
|
38
|
+
contract without it still loads, with the flag derived from the foreign-key columns (or
|
|
39
|
+
fields), but its `contract.d.ts` lacks the `Models` namespace. Re-run
|
|
40
|
+
`prisma contract emit` so the emitted `contract.json` / `contract.d.ts` match the installed
|
|
41
|
+
toolchain.
|
|
42
|
+
detection:
|
|
43
|
+
glob: "**/contract.json"
|
|
44
|
+
matches:
|
|
45
|
+
- '"cardinality":\s*"(?:N:1|1:1)",\s*"on":'
|
|
46
|
+
- id: reemit-supabase-extension-version
|
|
47
|
+
summary: |
|
|
48
|
+
Contracts that use the Supabase extension carry its package version in their extension
|
|
49
|
+
metadata. Re-emit them after upgrading so `contract.json` and `contract.d.ts` say
|
|
50
|
+
`8.0.0-rc.10` instead of `8.0.0-rc.9`.
|
|
51
|
+
detection:
|
|
52
|
+
glob: "**/contract.json"
|
|
53
|
+
contains:
|
|
54
|
+
- '"id": "supabase"'
|
|
55
|
+
- id: contract-dts-exports-models
|
|
56
|
+
summary: |
|
|
57
|
+
`contract.d.ts` now exports a `Models` namespace and a `models` constant that name every
|
|
58
|
+
model with its fields and relations. The re-emit above produces them; use them with
|
|
59
|
+
`Scalars` and `Shape` to name row types without a client in scope.
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## `to-one-relations-record-nullable`
|
|
63
|
+
|
|
64
|
+
For every `contract.json` matched by `detection`, run the project's emit command (`prisma contract emit`, or the project's `contract:emit` script) once after upgrading. The emit reads the `?` on each to-one relation field in the schema and writes `"nullable": true` or `"nullable": false` next to that relation's `"cardinality"`. The emit also fails, rather than emitting, when a required relation field sits over a nullable foreign key or the reverse; fix the schema so the field's `?` matches the key's `?`, then emit again. Until the re-emit, the client and the migration tools still load the old `contract.json`: a to-one relation without the flag is treated as nullable when any of its foreign-key columns (Mongo: fields) is nullable, and as required otherwise. Migration contract snapshots written by earlier versions are never rewritten and load the same way.
|
|
65
|
+
|
|
66
|
+
## `contract-dts-exports-models`
|
|
67
|
+
|
|
68
|
+
After the emit, `import type { Models, models } from './prisma/contract'` (the project's contract path) gives `Models.<namespace>_<Model>` for every model, and `Scalars<M>` / `Shape<M, { '+': 'relation' }>` from `@prisma/orm-postgres/family-contract/types` (or the Mongo family package) derive the default row and a data structure with relations from it. Replace hand-written row types that duplicate a model's fields with these when convenient.
|
|
69
|
+
|
|
70
|
+
## `schema-header-use-prisma-8`
|
|
71
|
+
|
|
72
|
+
For every `.prisma` file matched by `detection`, replace the first-line header `// use prisma-next` with `// use prisma-8`. Nothing else in the file changes.
|
|
73
|
+
|
|
74
|
+
## `env-vars-drop-next-infix`
|
|
75
|
+
|
|
76
|
+
For every file matched by `detection`, replace the `PRISMA_NEXT_` prefix with `PRISMA_` on each environment variable name. Delete `~/.config/prisma-next/` (or `%APPDATA%\prisma-next\` on Windows); the CLI recreates its config under `prisma-8` and asks for telemetry consent once.
|
|
77
|
+
|
|
78
|
+
## `primer-file-prisma-8-md`
|
|
79
|
+
|
|
80
|
+
Rename `prisma-next.md` at the project root to `prisma-8.md`, and update any link to it in the project README or agent instructions.
|
|
81
|
+
|
|
82
|
+
## `reemit-supabase-extension-version`
|
|
83
|
+
|
|
84
|
+
For every `contract.json` matched by `detection`, run `prisma contract emit` once after upgrading the Supabase extension and commit the regenerated `contract.json` and `contract.d.ts`. The only expected change is the Supabase extension's `version` field moving from `8.0.0-rc.9` to `8.0.0-rc.10` in both files. Do not edit the generated files by hand.
|