@prisma/orm-mongo 8.0.0-rc.4-dev.17 → 8.0.0-rc.5-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.
Files changed (64) hide show
  1. package/package.json +11 -10
  2. package/skills/prisma-8/SKILL.md +84 -0
  3. package/skills/prisma-8/references/build.md +142 -0
  4. package/skills/prisma-8/references/contract.md +417 -0
  5. package/skills/prisma-8/references/debug.md +141 -0
  6. package/skills/prisma-8/references/feedback.md +251 -0
  7. package/skills/prisma-8/references/migration-review.md +224 -0
  8. package/skills/prisma-8/references/migrations.md +519 -0
  9. package/skills/prisma-8/references/queries-mongo.md +236 -0
  10. package/skills/prisma-8/references/queries-postgres.md +415 -0
  11. package/skills/prisma-8/references/queries.md +168 -0
  12. package/skills/prisma-8/references/quickstart.md +326 -0
  13. package/skills/prisma-8/references/runtime.md +344 -0
  14. package/skills/prisma-8/references/supabase.md +244 -0
  15. package/skills/prisma-8/references/upgrade-app.md +101 -0
  16. package/skills/prisma-8/references/upgrade-extension.md +105 -0
  17. package/skills/prisma-8/upgrading/app/upgrades/0.10-to-0.11/instructions.md +56 -0
  18. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/instructions.md +381 -0
  19. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-closed-mongo-contracts.ts +202 -0
  20. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-domain-namespaced-contracts.ts +201 -0
  21. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-postgres-public-default.ts +198 -0
  22. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
  23. package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/instructions.md +339 -0
  24. package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/re-emit-mti-variant-link-columns.ts +229 -0
  25. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/instructions.md +543 -0
  26. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
  27. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
  28. package/skills/prisma-8/upgrading/app/upgrades/0.14-to-0.15/instructions.md +359 -0
  29. package/skills/prisma-8/upgrading/app/upgrades/0.15-to-0.16/instructions.md +173 -0
  30. package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/instructions.md +805 -0
  31. package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
  32. package/skills/prisma-8/upgrading/app/upgrades/0.17-to-8.0.0-rc.1/instructions.md +72 -0
  33. package/skills/prisma-8/upgrading/app/upgrades/0.7-to-0.8/instructions.md +8 -0
  34. package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/instructions.md +36 -0
  35. package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
  36. package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/instructions.md +86 -0
  37. package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
  38. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +588 -0
  39. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
  40. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +158 -0
  41. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +42 -0
  42. package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +276 -0
  43. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/instructions.md +738 -0
  44. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts +97 -0
  45. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/regenerate-extension-public-baseline.ts +223 -0
  46. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
  47. package/skills/prisma-8/upgrading/extension/upgrades/0.12-to-0.13/instructions.md +266 -0
  48. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/instructions.md +522 -0
  49. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
  50. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
  51. package/skills/prisma-8/upgrading/extension/upgrades/0.14-to-0.15/instructions.md +803 -0
  52. package/skills/prisma-8/upgrading/extension/upgrades/0.15-to-0.16/instructions.md +219 -0
  53. package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/instructions.md +731 -0
  54. package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
  55. package/skills/prisma-8/upgrading/extension/upgrades/0.17-to-8.0.0-rc.1/instructions.md +194 -0
  56. package/skills/prisma-8/upgrading/extension/upgrades/0.7-to-0.8/instructions.md +8 -0
  57. package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/instructions.md +57 -0
  58. package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
  59. package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/instructions.md +150 -0
  60. package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
  61. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +746 -0
  62. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
  63. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +137 -0
  64. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +129 -0
@@ -0,0 +1,522 @@
1
+ ---
2
+ from: "0.13"
3
+ to: "0.14"
4
+ changes:
5
+ - id: uuid-preset-rename
6
+ summary: |
7
+ The uuid field presets are renamed: `field.uuid()` → `field.uuidString()`,
8
+ `field.id.uuidv4()` → `field.id.uuidv4String()`, `field.id.uuidv7()` →
9
+ `field.id.uuidv7String()`. These names now describe the storage encoding
10
+ (char(36) string). Postgres-native uuid storage uses the new
11
+ `field.uuidNative()` / `field.id.uuidv4Native()` / `field.id.uuidv7Native()`
12
+ presets from `@internal/postgres/contract-builder`.
13
+ detection:
14
+ glob: "**/*.ts"
15
+ contains:
16
+ - "field.uuid()"
17
+ - "field.id.uuidv4()"
18
+ - "field.id.uuidv7()"
19
+ anyMatch: true
20
+ script: uuid-preset-rename.ts
21
+ - id: qualify-flat-builder-accessors
22
+ summary: |
23
+ The builder-layer flat accessors are removed: `@internal/sql-builder`'s `sql()` and
24
+ `@internal/sql-orm-client`'s `orm()` now expose per-namespace facets only. Extension
25
+ code that builds queries by accessing a bare table/model on the builder output
26
+ (`sql.<table>` / `orm.<Model>`) must name the namespace the table/model is declared in:
27
+ `sql.<namespace>.<table>`, `orm.<namespace>.<Model>` (`public` for a standard
28
+ single-schema SQL contract; the late-bound `__unbound__` namespace for an unbound/SQLite
29
+ contract). There is no codemod — the correct namespace is the one each table/model is
30
+ declared in, which is call-site-specific. Extensions that only contribute codecs, types,
31
+ or migrations (and never build queries through `sql`/`orm`) are unaffected.
32
+ detection:
33
+ glob: "**/*.{ts,tsx}"
34
+ contains:
35
+ - "@internal/sql-builder"
36
+ - "@internal/sql-orm-client"
37
+ anyMatch: true
38
+ - id: create-runtime-removed
39
+ summary: |
40
+ `createRuntime` is removed from `@internal/sql-runtime`. Extension code that
41
+ constructed a runtime via `createRuntime(...)` must switch to the target class
42
+ constructor directly: `new PostgresRuntimeImpl({...})` from
43
+ `@internal/postgres/runtime`, or `new SqliteRuntimeImpl({...})` from
44
+ `@internal/sqlite/runtime`. Pass the same options minus the `stackInstance`
45
+ unpacking — supply `adapter` directly instead of `stackInstance.adapter`.
46
+ detection:
47
+ glob: "**/*.{ts,tsx}"
48
+ contains:
49
+ - "createRuntime"
50
+ - id: migration-op-factories-to-methods
51
+ summary: |
52
+ The bare migration op factory functions are removed from
53
+ `@internal/postgres/migration` (and the deprecated
54
+ `@internal/target-postgres/migration` alias). Replace each import and
55
+ call-site with the corresponding method on `this` inside your `Migration`
56
+ subclass. The option shapes changed from positional arguments to a single
57
+ options object.
58
+ detection:
59
+ glob: "**/migration.ts"
60
+ contains:
61
+ - "from '@internal/postgres/migration'"
62
+ - "from '@internal/target-postgres/migration'"
63
+ anyMatch: true
64
+ script: migration-op-factories-to-methods.ts
65
+ - id: namespace-entries-open-dict
66
+ summary: |
67
+ `SqlNamespace.entries` is now an open dictionary typed
68
+ `Readonly<Record<string, Readonly<Record<string, unknown>>>>`. The previously
69
+ closed shape (`{ table?: ..., valueSet?: ... }`) is gone — dot-access
70
+ like `.entries.table` or `.entries.collection` no longer compiles. Read tables via
71
+ the `namespaceTables(ns)` helper from `@internal/sql-contract/types`, or via
72
+ bracket notation `entries['table']`. For typed getter access on the concrete
73
+ class instances use the non-enumerable getters (`ns.table`, `db.collection`).
74
+ Annotations and type constraints that hard-code the closed shape
75
+ must be widened to the open dict.
76
+ detection:
77
+ glob: "**/*.{ts,tsx}"
78
+ contains:
79
+ - ".entries.table"
80
+ - ".entries.collection"
81
+ - ".entries.valueSet"
82
+ anyMatch: true
83
+ - id: enum-becomes-domain-concept
84
+ summary: |
85
+ The native Postgres enum surface is deleted from the SPI. `PostgresEnumStorageEntry`
86
+ no longer exists in `@internal/sql-contract/types` — the `SqlStorage.types` slot
87
+ now holds codec-instance entries only (`StorageTypeInstance`). The `pg/enum@1`
88
+ codec surface is deleted from `@internal/target-postgres` (`PgEnumDescriptor`,
89
+ `pgEnumColumn`, `PG_ENUM_CODEC_ID`, the `enum` codec-type-map entry), as are the
90
+ native `enumType` / `enumColumn` helpers from
91
+ `@internal/adapter-postgres/column-types`. Enums are domain entities plus a
92
+ storage `valueSet` enforced by a CHECK constraint; columns reference them as
93
+ `pg/text@1` (or another codec) with a `valueSet` ref. Extensions that referenced
94
+ `PostgresEnumStorageEntry` in type constraints drop it (use `StorageTypeInstance`
95
+ alone); fixtures that used `pg/enum@1` as a codec id must switch to a live codec
96
+ or an inert fixture id.
97
+ detection:
98
+ glob: "**/*.{ts,tsx}"
99
+ contains:
100
+ - "PostgresEnumStorageEntry"
101
+ - "pg/enum@1"
102
+ - "pgEnumColumn"
103
+ - "PgEnumDescriptor"
104
+ - "PG_ENUM_CODEC_ID"
105
+ anyMatch: true
106
+ - id: namespaced-type-resolution
107
+ summary: |
108
+ Per-namespace type resolution. The emitted TypeMaps `ExtractFieldOutputTypes` /
109
+ `ExtractFieldInputTypes` (from `@internal/sql-contract`) now nest by namespace —
110
+ `{ [namespace]: { [model]: { [field] } } }` — and `TableProxy` (from
111
+ `@internal/sql-builder`) takes a required namespace coordinate: `TableProxy<C, Name>`
112
+ becomes `TableProxy<C, NsId, Name>`. Extension code that indexes those TypeMaps or
113
+ constructs `TableProxy` types directly must thread the namespace coordinate
114
+ (`ExtractFieldOutputTypes<C>[namespace][Model][Field]`, `TableProxy<C, namespace, Name>`):
115
+ `public` for a standard single-schema contract, the late-bound `__unbound__` namespace
116
+ for an unbound/SQLite contract. Extensions that only contribute codecs, native types, or
117
+ migrations and never reference these types are unaffected.
118
+ detection:
119
+ glob: "**/*.{ts,tsx}"
120
+ contains:
121
+ - "ExtractFieldOutputTypes"
122
+ - "ExtractFieldInputTypes"
123
+ - "TableProxy<"
124
+ anyMatch: true
125
+ - id: contract-model-definitions-removed
126
+ summary: |
127
+ `ContractModelDefinitions` is removed from `@internal/contract` (and its
128
+ `/types` export), along with the second `TModels` type parameter on
129
+ `Contract` (now `Contract<TStorage>`). The flat cross-namespace model union
130
+ it produced is gone; resolve models per-namespace instead. Replace
131
+ `ContractModelDefinitions<C>` with
132
+ `C['domain']['namespaces'][<ns>]['models']` (use `[keyof C['domain']['namespaces']]`
133
+ for the sole-namespace case). Family wrappers like `MongoContract<S, M>`
134
+ become single-arg `MongoContract<S>`; carry precise per-model types via an
135
+ explicit per-namespace `domain` override.
136
+ detection:
137
+ glob: "**/*.{ts,tsx}"
138
+ contains:
139
+ - "ContractModelDefinitions"
140
+ - "Contract<"
141
+ - "MongoContract<"
142
+ anyMatch: true
143
+ ---
144
+
145
+ <!--
146
+ control-query-extension-codecs: pgvector test files
147
+ (planner.behavior.test.ts, planner.contract-to-schema-ir.test.ts,
148
+ planner.storage-types.test.ts) were updated to pass an explicit
149
+ `PostgresControlAdapter` to `createPostgresMigrationPlanner`, which now
150
+ requires an adapter argument. Internal test harness change only — no
151
+ extension-author API change. Incidental substrate diff only.
152
+ -->
153
+
154
+ <!--
155
+ TML-2867: codec-routed DDL defaults. The pgvector extension test files were updated
156
+ to await lazy plan operations (`Promise.all(result.plan.operations)`) and to use
157
+ `PostgresControlAdapter` instead of the removed `createPostgresAdapter`. The
158
+ `packages/3-extensions/postgres re-export test` deletion was already declared by
159
+ TML-2859 above. No extension-author API change. Incidental substrate diff only.
160
+ -->
161
+
162
+ <!--
163
+ TML-2859: SQLite createTable authoring method. The free `createTable` function from
164
+ `@internal/sqlite/migration` is now a protected method on the `SqliteMigration`
165
+ base class. The `createTable` re-export test in `packages/3-extensions/sqlite/` was
166
+ removed (it asserted the free function was exported, which is no longer true). The
167
+ README was updated to reflect the current authoring surface. No extension-author action
168
+ beyond what the `sqlite-create-table-method` entry in the 0.12-to-0.13 instructions
169
+ already covers. Incidental substrate diff only.
170
+ -->
171
+
172
+
173
+ <!--
174
+ TML-2785: the sql-orm-client runtime gained M:N correlated include
175
+ reads — `.include()` of an N:M relation resolves child rows through the
176
+ junction table via a correlated subquery. Internal runtime only; no
177
+ extension API or contract-shape change. No extension-author action
178
+ required.
179
+
180
+ TML-2786: the sql-orm-client runtime gained M:N relation filters — a
181
+ `where` predicate on an N:M relation lowers to an EXISTS subquery joined
182
+ through the junction table. Internal runtime only; no extension API or
183
+ contract-shape change. No extension-author action required.
184
+
185
+ TML-2787: the sql-orm-client runtime gained M:N nested writes — connect /
186
+ disconnect / nested create on an N:M relation insert and delete
187
+ junction-table rows. Internal runtime only; no extension API or
188
+ contract-shape change. No extension-author action required.
189
+
190
+ TML-2838: the temporary `--no-memory-protection-keys` test-harness workaround
191
+ has been removed from every PGlite-backed vitest config (including
192
+ `packages/3-extensions/{postgres,supabase}`) now that the WAL-teardown crash is
193
+ fixed upstream in `@prisma/dev` 0.24.12 (which pulls in the
194
+ `@prisma/streams-local` worker-termination fix). Test-harness only — no
195
+ runtime, contract, or public-API change. Incidental substrate diff only.
196
+ -->
197
+
198
+ <!--
199
+ #823: `jose` bumped from ^5 to ^6 in `packages/3-extensions/supabase`. The Supabase
200
+ extension's transitive auth dependency only — no extension-author API, runtime, or
201
+ contract-shape change. Incidental substrate diff only.
202
+ -->
203
+
204
+ <!--
205
+ TML-2852: the enum read surface. Additive surface for `enumType`-authored enums.
206
+ `@internal/postgres/contract-builder` gains `enumType` / `member` exports (the
207
+ Postgres-bound `enumType` constrains member values to the column codec) and the
208
+ factory `defineContract` overload threads a top-level `enums` key;
209
+ `@internal/sql-orm-client` gains the lane-agnostic `db.enums.<namespace>.<Name>`
210
+ runtime accessor map (built from `domain.namespaces[ns].enum`) and value-union
211
+ narrowing of enum-restricted fields, plus emit-time narrowing in the emitter from a
212
+ field's `valueSet` ref. All additive — existing exports and the framework SPI are
213
+ unchanged, PSL `enum` stays native until the cutover, and `fixtures:check` is
214
+ byte-identical. No extension-author action. Incidental substrate diff only.
215
+ -->
216
+
217
+ # 0.13 → 0.14 — Extension-author upgrade instructions
218
+
219
+ ## `uuid-preset-rename`
220
+
221
+ The uuid field preset names now include the storage encoding suffix:
222
+
223
+ | Before | After |
224
+ | --- | --- |
225
+ | `field.uuid()` | `field.uuidString()` |
226
+ | `field.id.uuidv4()` | `field.id.uuidv4String()` |
227
+ | `field.id.uuidv7()` | `field.id.uuidv7String()` |
228
+
229
+ Apply the rename in any extension test files, contract fixture files, or documentation that uses these presets. The rename is mechanical — run the colocated script or apply the substitutions directly:
230
+
231
+ ```ts
232
+ // Before
233
+ id: field.id.uuidv7(),
234
+ userId: field.id.uuidv4(),
235
+ externalId: field.uuid(),
236
+
237
+ // After
238
+ id: field.id.uuidv7String(),
239
+ userId: field.id.uuidv4String(),
240
+ externalId: field.uuidString(),
241
+ ```
242
+
243
+ No change to emitted `contract.json` — both old and new preset names emit the same codec (`sql/char@1`).
244
+
245
+ ## `qualify-flat-builder-accessors`
246
+
247
+ The query builder (`@internal/sql-builder`) and ORM client (`@internal/sql-orm-client`) are now **always qualified by namespace**. The flat by-bare-name accessors are gone: the value returned by `sql({ … })` / `orm({ … })` is a map of per-namespace facets, so there is no `sql.<table>` and no `orm.<Model>` at the top level. You reach a table or model by naming its namespace.
248
+
249
+ This affects extension code that *builds queries* through these packages. Extensions that only contribute codecs, native types, or migration operations — and never construct a `sql`/`orm` query — need no change.
250
+
251
+ ### Migrate query-building call sites
252
+
253
+ Insert the namespace segment after the builder output, naming the namespace each table/model is declared in:
254
+
255
+ ```ts
256
+ // Before
257
+ const plan = sql.user.select('id', 'email').build();
258
+ const row = await orm.User.find({ where: { id } });
259
+
260
+ // After — name the namespace (`public` for a standard single-schema SQL contract)
261
+ const plan = sql.public.user.select('id', 'email').build();
262
+ const row = await orm.public.User.find({ where: { id } });
263
+ ```
264
+
265
+ For an unbound contract (e.g. SQLite, or any target whose entities live in the late-bound namespace) the namespace segment is `__unbound__` — import `UNBOUND_NAMESPACE_ID` from `@internal/framework-components/ir` and index with it (`sql[UNBOUND_NAMESPACE_ID].user`) rather than hard-coding the string. For a multi-namespace contract, name the specific namespace each table/model sits in.
266
+
267
+ ### Validation
268
+
269
+ This is a type-level change — `pnpm typecheck` (or `pnpm build`) pinpoints every remaining flat access as a compile error (`Property '<table>' does not exist on type 'Db<…>'`). Fix each by inserting the namespace segment, then run your extension's standard `pnpm test`.
270
+
271
+ ## `migration-op-factories-to-methods`
272
+
273
+ The bare op factory functions previously exported from `@internal/postgres/migration` (and the deprecated `@internal/target-postgres/migration` alias) are removed. Each function is now a protected method on the `PostgresMigration` base class — call it as `this.<method>(...)` inside your extension's `Migration` subclass.
274
+
275
+ The option shapes also changed: positional arguments are replaced by a single options object.
276
+
277
+ Remove the bare names from your import and replace each call-site:
278
+
279
+ | Before (bare function) | After (method) |
280
+ | --- | --- |
281
+ | `dropColumn(schema, table, column)` | `this.dropColumn({ schema, table, column })` |
282
+ | `setNotNull(schema, table, column)` | `this.setNotNull({ schema, table, column })` |
283
+ | `setDefault(schema, table, column, defaultSql)` | `this.setDefault({ schema, table, column, defaultSql })` |
284
+ | `addPrimaryKey(schema, table, name, columns)` | `this.addPrimaryKey({ schema, table, constraint: name, columns })` |
285
+ | `addForeignKey(schema, table, { name, columns, references, onDelete })` | `this.addForeignKey({ schema, table, foreignKey: { name, columns, references, onDelete } })` |
286
+ | `addCheckConstraint(schema, table, name, column, values)` | `this.addCheckConstraint({ schema, table, constraint: name, column, values })` |
287
+ | `createIndex(schema, table, indexName, columns)` | `this.createIndex({ schema, table, index: indexName, columns })` |
288
+ | `installExtension({ id, extensionName, invariantId })` | `this.installExtension({ id, extensionName, invariantId })` |
289
+
290
+ Example (extension migration):
291
+
292
+ ```ts
293
+ // Before
294
+ import { installExtension, Migration, MigrationCLI } from '@internal/target-postgres/migration';
295
+
296
+ override get operations() {
297
+ return [
298
+ installExtension({
299
+ id: 'my-ext.install',
300
+ extensionName: 'my_extension',
301
+ invariantId: MY_INVARIANTS.install,
302
+ }),
303
+ ];
304
+ }
305
+
306
+ // After
307
+ import { Migration, MigrationCLI } from '@internal/target-postgres/migration';
308
+
309
+ override get operations() {
310
+ return [
311
+ this.installExtension({
312
+ id: 'my-ext.install',
313
+ extensionName: 'my_extension',
314
+ invariantId: MY_INVARIANTS.install,
315
+ }),
316
+ ];
317
+ }
318
+ ```
319
+
320
+ The colocated script applies this transformation automatically. Run it from your extension root:
321
+
322
+ ```bash
323
+ pnpm exec tsx .claude/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts
324
+ ```
325
+
326
+ ## `create-runtime-removed`
327
+
328
+ `createRuntime` is removed from `@internal/sql-runtime`. Construct the target runtime class directly instead.
329
+
330
+ ```ts
331
+ // Before
332
+ import { createRuntime } from '@internal/sql-runtime';
333
+ const runtime = createRuntime({ stackInstance, context, driver, ...opts });
334
+
335
+ // After — Postgres
336
+ import { PostgresRuntimeImpl } from '@internal/postgres/runtime';
337
+ const runtime = new PostgresRuntimeImpl({ adapter: stackInstance.adapter, context, driver, ...opts });
338
+
339
+ // After — SQLite
340
+ import { SqliteRuntimeImpl } from '@internal/sqlite/runtime';
341
+ const runtime = new SqliteRuntimeImpl({ adapter: stackInstance.adapter, context, driver, ...opts });
342
+ ```
343
+
344
+ The options are identical except `stackInstance` is no longer passed: supply `adapter` from `stackInstance.adapter` directly. Depend on the bare-name interfaces (`PostgresRuntime`, `SqliteRuntime`) for type annotations, not the `Impl` classes.
345
+
346
+ ## `namespace-entries-open-dict`
347
+
348
+ The `entries` property on every namespace class is now an open dictionary:
349
+
350
+ ```ts
351
+ // The type is now:
352
+ entries: Readonly<Record<string, Readonly<Record<string, unknown>>>>
353
+
354
+ // Previously it was a closed shape:
355
+ entries: {
356
+ table?: Readonly<Record<string, StorageTable>>;
357
+ valueSet?: Readonly<Record<string, StorageValueSet>>;
358
+ }
359
+ ```
360
+
361
+ Dot-access like `.entries.table` or `.entries.collection` no longer compiles. Migrate to one of the two canonical read styles:
362
+
363
+ **Generic/walker code** — bracket notation:
364
+
365
+ ```ts
366
+ // Before
367
+ const tables = ns.entries.table;
368
+
369
+ // After — bracket notation
370
+ const tables = ns.entries['table'] as Record<string, StorageTable> | undefined;
371
+ ```
372
+
373
+ **Typed family/target code** — use the exported family helpers or the class getters:
374
+
375
+ ```ts
376
+ // Using the namespaceTables() helper (for SqlNamespace values)
377
+ import { namespaceTables, namespaceValueSets } from '@internal/sql-contract/types';
378
+ const tables = namespaceTables(ns); // Record<string, StorageTable>
379
+ const vsets = namespaceValueSets(ns); // Record<string, StorageValueSet> | undefined
380
+
381
+ // Using the namespaceCollections() helper (for MongoNamespace values)
382
+ import { namespaceCollections } from '@internal/mongo-contract';
383
+ const collections = namespaceCollections(ns); // Record<string, MongoCollection>
384
+ ```
385
+
386
+ **Type annotations** — widen any closed-shape annotation to the open dict:
387
+
388
+ ```ts
389
+ // Before
390
+ const ns = namespaces[id] as { entries: { table: Record<string, StorageTable> } };
391
+
392
+ // After — open dict annotation
393
+ const ns = namespaces[id] as { entries: Record<string, Record<string, unknown>> };
394
+ // then narrow via the helper:
395
+ const tables = namespaceTables(ns);
396
+ ```
397
+
398
+ This is a compile-time-only change when using the helpers — no runtime behavior differs. Run `pnpm typecheck` to find all remaining dot-access sites.
399
+
400
+ ## `enum-becomes-domain-concept`
401
+
402
+ Native Postgres enums are removed from the framework. Enums are now a **domain concept**: a domain enum entity plus a storage `valueSet` entity, with member values stored through an ordinary codec (typically `pg/text@1` → a `text` column) and the value set enforced by a planner-generated CHECK constraint. The whole native surface is deleted:
403
+
404
+ - `PostgresEnumStorageEntry` is gone from `@internal/sql-contract/types`. The polymorphic `SqlStorage.types` slot now carries codec-instance entries only. Type constraints that accepted both narrow to `StorageTypeInstance`:
405
+
406
+ ```ts
407
+ // Before
408
+ import type { PostgresEnumStorageEntry, StorageTypeInstance } from '@internal/sql-contract/types';
409
+ type TypesConstraint = Record<string, StorageTypeInstance | PostgresEnumStorageEntry>;
410
+
411
+ // After
412
+ import type { StorageTypeInstance } from '@internal/sql-contract/types';
413
+ type TypesConstraint = Record<string, StorageTypeInstance>;
414
+ ```
415
+
416
+ - The `pg/enum@1` codec and its registry surface are deleted from `@internal/target-postgres`: `PgEnumDescriptor`, `pgEnumColumn`, `PG_ENUM_CODEC_ID`, and the `enum` entry in the codec type map. Test fixtures that used `'pg/enum@1'` as an opaque codec id must switch to a live codec id or an inert fixture id (e.g. `app/test-enum@1`) — the id no longer resolves to a registered codec.
417
+ - The native `enumType(name, values[])` / `enumColumn(...)` authoring helpers are deleted from `@internal/adapter-postgres/column-types`. The domain authoring surface is `enumType(name, codecRef, ...member(name, value))` + `member` from the target contract-builder, returned under the contract's `enums` key.
418
+ - Introspection no longer adopts native enum types: the adapter records detected native enum type names under `annotations.pg.nativeEnumTypeNames` (names only), and `contract infer` refuses with a diagnostic naming them. The old `annotations.pg.enumTypes` structure is gone.
419
+
420
+ Columns restricted to an enum now carry `codecId: 'pg/text@1'` (or another codec), `nativeType: 'text'`, and a `valueSet` reference; the owning table carries a check entry. If your extension reads `storage.types` looking for enum shapes, read the namespace's `valueSet` entries instead.
421
+
422
+ ### Validation
423
+
424
+ `pnpm typecheck` flags every deleted-symbol reference. After fixing, run your extension's standard `pnpm test`.
425
+
426
+ ## `namespaced-type-resolution`
427
+
428
+ The SQL/ORM type machinery now resolves columns, fields, and models **by namespace coordinate** rather than by bare name across all namespaces. Two type-shape changes affect extension code that depends on these types directly:
429
+
430
+ 1. **Emitted TypeMaps nest by namespace.** `ExtractFieldOutputTypes<C>` / `ExtractFieldInputTypes<C>` (from `@internal/sql-contract`) now return `{ [namespace]: { [model]: { [field]: <type> } } }` instead of the flat `{ [model]: { [field] } }`. Index the namespace first:
431
+
432
+ ```ts
433
+ // Before
434
+ type Row = ExtractFieldOutputTypes<C>['User'];
435
+ // After — name the namespace the model is declared in
436
+ type Row = ExtractFieldOutputTypes<C>['public']['User'];
437
+ ```
438
+
439
+ 2. **`TableProxy` takes a required namespace coordinate.** `TableProxy<C, Name>` (from `@internal/sql-builder`) becomes `TableProxy<C, NsId, Name>`:
440
+
441
+ ```ts
442
+ // Before
443
+ let p: TableProxy<C, 'users'>;
444
+ // After
445
+ let p: TableProxy<C, 'public', 'users'>;
446
+ ```
447
+
448
+ Use `public` for a standard single-schema SQL contract; for an unbound/SQLite contract use the late-bound namespace (`UNBOUND_NAMESPACE_ID` from `@internal/framework-components/ir`); for a multi-namespace contract, name the namespace each model/table actually sits in. There is no codemod — the correct namespace is call-site-specific. `pnpm typecheck` pins every remaining flat access (`Property '<model>' does not exist on type '{ public: ... }'`). Extensions that only contribute codecs, native types, or migrations — and never reference `ExtractFieldOutputTypes` / `ExtractFieldInputTypes` / `TableProxy` directly — need no change.
449
+
450
+ ## `contract-model-definitions-removed`
451
+
452
+ `ContractModelDefinitions` is removed from `@internal/contract` (and the `@internal/contract/types` re-export), and the `Contract` interface loses its second `TModels` type parameter — `Contract<TStorage, TModels>` becomes `Contract<TStorage>`. The flat, first-name-wins cross-namespace model union is gone; models resolve per-namespace from the domain plane.
453
+
454
+ Replace any `ContractModelDefinitions<C>` use with a read of a namespace's models:
455
+
456
+ ```ts
457
+ // Before
458
+ import type { Contract, ContractModelDefinitions } from '@internal/contract/types';
459
+ type Models = ContractModelDefinitions<C>;
460
+ type UserModel = Models['User'];
461
+
462
+ // After — read the sole namespace's models (or name a specific namespace)
463
+ type Models = C['domain']['namespaces'][keyof C['domain']['namespaces']]['models'];
464
+ type UserModel = Models['User'];
465
+ ```
466
+
467
+ If you need a bare model shape rather than the contract's own models, use `ContractModelBase` from `@internal/contract/types`. Family contract aliases drop their model parameter too — `MongoContract<S, M>` becomes `MongoContract<S>`. When you build a contract *type* that must carry precise per-model shapes (e.g. a test fixture or a `defineContract` result type), override the `domain` explicitly:
468
+
469
+ ```ts
470
+ type MyContract = Omit<Contract<MyStorage>, 'domain'> & {
471
+ readonly domain: {
472
+ readonly namespaces: {
473
+ readonly public: { readonly models: MyModels };
474
+ };
475
+ };
476
+ };
477
+ ```
478
+
479
+ <!--
480
+ TML-2550: per-namespace typed resolution. The extension-package contract.d.ts fixtures
481
+ (supabase, paradedb, pgvector, postgis) regenerate to the namespace-nested TypeMaps shape
482
+ above; the diff round-trips on a consumer re-emit and needs no extension-author action beyond
483
+ the `namespaced-type-resolution` entry. Incidental substrate diff only.
484
+ -->
485
+
486
+ <!--
487
+ TML-2918: schema-namespaced op-ids for addColumn. The pgvector test files
488
+ (planner.behavior.test.ts, planner.contract-to-schema-ir.test.ts) were updated to
489
+ assert the new `column.${schema}.${table}.${column}` op-id format for add-column
490
+ operations. Test-only assertion updates — no extension-author API change. Incidental
491
+ substrate diff only.
492
+ -->
493
+
494
+ <!--
495
+ TML-2919: typed-DDL conversion of the not-null-with-temporary-default recipe. The
496
+ recipe's ADD COLUMN execute step now lowers a typed `PostgresAlterTable` DDL node
497
+ through the adapter, with the temporary backfill value carried as a
498
+ `FunctionColumnDefault` — so the emitted DEFAULT clause parenthesizes its expression
499
+ (e.g. `DEFAULT ('')` instead of the previous `DEFAULT ''`). Semantically identical
500
+ in PostgreSQL (parenthesizing an atomic primary expression in a `DEFAULT` clause is
501
+ a no-op). The pgvector `planner.behavior.test.ts` assertion that pins the recipe's
502
+ emitted ADD COLUMN SQL was updated to the parenthesized form. Test-only assertion
503
+ update — no extension-author API change. Incidental substrate diff only.
504
+ -->
505
+
506
+ <!--
507
+ TML-2916: un-namespaced Postgres extension contracts (pgvector, paradedb, postgis,
508
+ supabase) regenerate to drop the spurious empty `__unbound__` storage namespace slot
509
+ the authoring + serializer pipeline was injecting, restoring ADR 223 compliance.
510
+ Migration `head.json` and `migration.ts` hashes update. No extension-author action:
511
+ re-emit picks up the new shape. Incidental substrate diff only.
512
+ -->
513
+
514
+ <!--
515
+ TML-2886 (redo, PR #841): type SQL enum columns via a baked storage column lookup.
516
+ The SQL emitter generates a new `StorageColumnTypes` map in `contract.d.ts`, keyed
517
+ `[namespace][table][column]`; `FieldOutputTypes`/`FieldInputTypes` are derived from it
518
+ at emit time. The extension-package `contract.d.ts` fixtures (paradedb, pgvector,
519
+ postgis, supabase, sql-orm-client test fixture) regenerate to add the `StorageColumnTypes`
520
+ block. `contract.json` and hashes are byte-identical; `FieldOutputTypes` is unchanged.
521
+ No extension-author API or surface change. Incidental substrate diff only.
522
+ -->