@prisma/orm-mariadb 0.0.0-stage → 8.0.0-rc.24-dev.3

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 (319) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +48 -2
  3. package/dist/adapter.d.mts +1 -0
  4. package/dist/adapter.mjs +2 -0
  5. package/dist/adapter__codec-types.d.mts +1 -0
  6. package/dist/adapter__codec-types.mjs +2 -0
  7. package/dist/adapter__control.d.mts +3 -0
  8. package/dist/adapter__control.mjs +3 -0
  9. package/dist/components.d.mts +1 -0
  10. package/dist/components.mjs +2 -0
  11. package/dist/components__authoring.d.mts +1 -0
  12. package/dist/components__authoring.mjs +2 -0
  13. package/dist/components__codec.d.mts +1 -0
  14. package/dist/components__codec.mjs +2 -0
  15. package/dist/components__components.d.mts +1 -0
  16. package/dist/components__components.mjs +2 -0
  17. package/dist/components__control.d.mts +1 -0
  18. package/dist/components__control.mjs +2 -0
  19. package/dist/components__emission.d.mts +1 -0
  20. package/dist/components__emission.mjs +2 -0
  21. package/dist/components__execution.d.mts +1 -0
  22. package/dist/components__execution.mjs +2 -0
  23. package/dist/components__ir.d.mts +1 -0
  24. package/dist/components__ir.mjs +2 -0
  25. package/dist/components__psl-ast.d.mts +1 -0
  26. package/dist/components__psl-ast.mjs +2 -0
  27. package/dist/components__runtime.d.mts +1 -0
  28. package/dist/components__runtime.mjs +2 -0
  29. package/dist/components__utils.d.mts +1 -0
  30. package/dist/components__utils.mjs +2 -0
  31. package/dist/config.d.mts +10 -0
  32. package/dist/config.d.mts.map +1 -0
  33. package/dist/config.mjs +17 -0
  34. package/dist/config.mjs.map +1 -0
  35. package/dist/contract.d.mts +1 -0
  36. package/dist/contract.mjs +2 -0
  37. package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -0
  38. package/dist/contract__apply-specifier-default-control-policy.mjs +2 -0
  39. package/dist/contract__contract-validation-error.d.mts +1 -0
  40. package/dist/contract__contract-validation-error.mjs +2 -0
  41. package/dist/contract__default-namespace.d.mts +1 -0
  42. package/dist/contract__default-namespace.mjs +2 -0
  43. package/dist/contract__enum-accessor.d.mts +1 -0
  44. package/dist/contract__enum-accessor.mjs +2 -0
  45. package/dist/contract__hashing-utils.d.mts +1 -0
  46. package/dist/contract__hashing-utils.mjs +2 -0
  47. package/dist/contract__hashing.d.mts +1 -0
  48. package/dist/contract__hashing.mjs +2 -0
  49. package/dist/contract__is-plain-record.d.mts +1 -0
  50. package/dist/contract__is-plain-record.mjs +2 -0
  51. package/dist/contract__resolve-domain-model.d.mts +1 -0
  52. package/dist/contract__resolve-domain-model.mjs +2 -0
  53. package/dist/contract__types.d.mts +1 -0
  54. package/dist/contract__types.mjs +2 -0
  55. package/dist/contract__validate-domain.d.mts +1 -0
  56. package/dist/contract__validate-domain.mjs +2 -0
  57. package/dist/contract__validate-once.d.mts +1 -0
  58. package/dist/contract__validate-once.mjs +2 -0
  59. package/dist/contract__validate-storage.d.mts +1 -0
  60. package/dist/contract__validate-storage.mjs +2 -0
  61. package/dist/control.d.mts +12 -0
  62. package/dist/control.d.mts.map +1 -0
  63. package/dist/control.mjs +22 -0
  64. package/dist/control.mjs.map +1 -0
  65. package/dist/driver.d.mts +1 -0
  66. package/dist/driver.mjs +2 -0
  67. package/dist/driver__control.d.mts +3 -0
  68. package/dist/driver__control.mjs +3 -0
  69. package/dist/driver__runtime.d.mts +3 -0
  70. package/dist/driver__runtime.mjs +3 -0
  71. package/dist/family-contract.d.mts +1 -0
  72. package/dist/family-contract.mjs +2 -0
  73. package/dist/family-contract__authored-check-naming.d.mts +1 -0
  74. package/dist/family-contract__authored-check-naming.mjs +2 -0
  75. package/dist/family-contract__canonicalization-hooks.d.mts +1 -0
  76. package/dist/family-contract__canonicalization-hooks.mjs +2 -0
  77. package/dist/family-contract__check-expressions.d.mts +1 -0
  78. package/dist/family-contract__check-expressions.mjs +2 -0
  79. package/dist/family-contract__codec-json-type.d.mts +1 -0
  80. package/dist/family-contract__codec-json-type.mjs +2 -0
  81. package/dist/family-contract__contract-view.d.mts +1 -0
  82. package/dist/family-contract__contract-view.mjs +2 -0
  83. package/dist/family-contract__data-type-support.d.mts +1 -0
  84. package/dist/family-contract__data-type-support.mjs +2 -0
  85. package/dist/family-contract__data-type.d.mts +1 -0
  86. package/dist/family-contract__data-type.mjs +2 -0
  87. package/dist/family-contract__entity-handle-lowering-hook.d.mts +1 -0
  88. package/dist/family-contract__entity-handle-lowering-hook.mjs +2 -0
  89. package/dist/family-contract__entity-kinds.d.mts +1 -0
  90. package/dist/family-contract__entity-kinds.mjs +2 -0
  91. package/dist/family-contract__factories.d.mts +1 -0
  92. package/dist/family-contract__factories.mjs +2 -0
  93. package/dist/family-contract__foreign-key-materialization.d.mts +1 -0
  94. package/dist/family-contract__foreign-key-materialization.mjs +2 -0
  95. package/dist/family-contract__generated-id-column-aliases.d.mts +1 -0
  96. package/dist/family-contract__generated-id-column-aliases.mjs +2 -0
  97. package/dist/family-contract__index-naming.d.mts +1 -0
  98. package/dist/family-contract__index-naming.mjs +2 -0
  99. package/dist/family-contract__index-type-validation.d.mts +1 -0
  100. package/dist/family-contract__index-type-validation.mjs +2 -0
  101. package/dist/family-contract__index-types.d.mts +1 -0
  102. package/dist/family-contract__index-types.mjs +2 -0
  103. package/dist/family-contract__referential-action-sql.d.mts +1 -0
  104. package/dist/family-contract__referential-action-sql.mjs +2 -0
  105. package/dist/family-contract__resolve-storage-table.d.mts +1 -0
  106. package/dist/family-contract__resolve-storage-table.mjs +2 -0
  107. package/dist/family-contract__sql-expression.d.mts +1 -0
  108. package/dist/family-contract__sql-expression.mjs +2 -0
  109. package/dist/family-contract__types.d.mts +1 -0
  110. package/dist/family-contract__types.mjs +2 -0
  111. package/dist/family-contract__validators.d.mts +1 -0
  112. package/dist/family-contract__validators.mjs +2 -0
  113. package/dist/family-contract__value-set-derivation-hook.d.mts +1 -0
  114. package/dist/family-contract__value-set-derivation-hook.mjs +2 -0
  115. package/dist/family__control-adapter.d.mts +1 -0
  116. package/dist/family__control-adapter.mjs +2 -0
  117. package/dist/family__control.d.mts +3 -0
  118. package/dist/family__control.mjs +3 -0
  119. package/dist/family__diff.d.mts +1 -0
  120. package/dist/family__diff.mjs +2 -0
  121. package/dist/family__ir.d.mts +1 -0
  122. package/dist/family__ir.mjs +2 -0
  123. package/dist/family__migration.d.mts +1 -0
  124. package/dist/family__migration.mjs +2 -0
  125. package/dist/family__pack.d.mts +3 -0
  126. package/dist/family__pack.mjs +3 -0
  127. package/dist/family__psl-build.d.mts +1 -0
  128. package/dist/family__psl-build.mjs +2 -0
  129. package/dist/family__psl-infer.d.mts +1 -0
  130. package/dist/family__psl-infer.mjs +2 -0
  131. package/dist/family__runtime.d.mts +3 -0
  132. package/dist/family__runtime.mjs +3 -0
  133. package/dist/family__verify.d.mts +1 -0
  134. package/dist/family__verify.mjs +2 -0
  135. package/dist/migration-tools__aggregate.d.mts +1 -0
  136. package/dist/migration-tools__aggregate.mjs +2 -0
  137. package/dist/migration-tools__contract-snapshot-store.d.mts +1 -0
  138. package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
  139. package/dist/migration-tools__hash.d.mts +1 -0
  140. package/dist/migration-tools__hash.mjs +2 -0
  141. package/dist/migration-tools__io.d.mts +1 -0
  142. package/dist/migration-tools__io.mjs +2 -0
  143. package/dist/migration-tools__spaces.d.mts +1 -0
  144. package/dist/migration-tools__spaces.mjs +2 -0
  145. package/dist/migration.d.mts +3 -0
  146. package/dist/migration.mjs +3 -0
  147. package/dist/target__control.d.mts +3 -0
  148. package/dist/target__control.mjs +3 -0
  149. package/dist/target__migration.d.mts +1 -0
  150. package/dist/target__migration.mjs +2 -0
  151. package/dist/target__pack.d.mts +3 -0
  152. package/dist/target__pack.mjs +3 -0
  153. package/dist/utils.d.mts +1 -0
  154. package/dist/utils.mjs +2 -0
  155. package/dist/utils__abortable.d.mts +1 -0
  156. package/dist/utils__abortable.mjs +2 -0
  157. package/dist/utils__array-equal.d.mts +1 -0
  158. package/dist/utils__array-equal.mjs +2 -0
  159. package/dist/utils__assertions.d.mts +1 -0
  160. package/dist/utils__assertions.mjs +2 -0
  161. package/dist/utils__canonical-stringify.d.mts +1 -0
  162. package/dist/utils__canonical-stringify.mjs +2 -0
  163. package/dist/utils__casts.d.mts +1 -0
  164. package/dist/utils__casts.mjs +2 -0
  165. package/dist/utils__defined.d.mts +1 -0
  166. package/dist/utils__defined.mjs +2 -0
  167. package/dist/utils__hash-content.d.mts +1 -0
  168. package/dist/utils__hash-content.mjs +2 -0
  169. package/dist/utils__internal-error.d.mts +1 -0
  170. package/dist/utils__internal-error.mjs +2 -0
  171. package/dist/utils__json.d.mts +1 -0
  172. package/dist/utils__json.mjs +2 -0
  173. package/dist/utils__promise.d.mts +1 -0
  174. package/dist/utils__promise.mjs +2 -0
  175. package/dist/utils__redact-db-url.d.mts +1 -0
  176. package/dist/utils__redact-db-url.mjs +2 -0
  177. package/dist/utils__result.d.mts +1 -0
  178. package/dist/utils__result.mjs +2 -0
  179. package/dist/utils__simplify-deep.d.mts +1 -0
  180. package/dist/utils__simplify-deep.mjs +2 -0
  181. package/dist/utils__structured-error.d.mts +1 -0
  182. package/dist/utils__structured-error.mjs +2 -0
  183. package/dist/utils__suppress-idle-connection-errors.d.mts +1 -0
  184. package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
  185. package/dist/utils__text.d.mts +1 -0
  186. package/dist/utils__text.mjs +2 -0
  187. package/dist/utils__types.d.mts +1 -0
  188. package/dist/utils__types.mjs +2 -0
  189. package/dist/vite-plugin-contract-emit.d.mts +1 -0
  190. package/dist/vite-plugin-contract-emit.mjs +2 -0
  191. package/package.json +139 -3
  192. package/skills/prisma-8/SKILL.md +100 -0
  193. package/skills/prisma-8/references/build.md +142 -0
  194. package/skills/prisma-8/references/contract.md +552 -0
  195. package/skills/prisma-8/references/debug.md +150 -0
  196. package/skills/prisma-8/references/feedback.md +251 -0
  197. package/skills/prisma-8/references/migration-model.md +179 -0
  198. package/skills/prisma-8/references/migration-review.md +211 -0
  199. package/skills/prisma-8/references/migrations.md +635 -0
  200. package/skills/prisma-8/references/queries-mongo.md +261 -0
  201. package/skills/prisma-8/references/queries-postgres.md +710 -0
  202. package/skills/prisma-8/references/queries.md +255 -0
  203. package/skills/prisma-8/references/quickstart.md +317 -0
  204. package/skills/prisma-8/references/runtime.md +463 -0
  205. package/skills/prisma-8/references/supabase.md +234 -0
  206. package/skills/prisma-8/references/upgrade-app.md +102 -0
  207. package/skills/prisma-8/references/upgrade-extension.md +108 -0
  208. package/skills/prisma-8/upgrading/app/upgrades/0.10-to-0.11/instructions.md +56 -0
  209. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/instructions.md +381 -0
  210. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-closed-mongo-contracts.ts +202 -0
  211. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-domain-namespaced-contracts.ts +201 -0
  212. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/re-emit-postgres-public-default.ts +198 -0
  213. package/skills/prisma-8/upgrading/app/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
  214. package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/instructions.md +339 -0
  215. package/skills/prisma-8/upgrading/app/upgrades/0.12-to-0.13/re-emit-mti-variant-link-columns.ts +229 -0
  216. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/instructions.md +543 -0
  217. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
  218. package/skills/prisma-8/upgrading/app/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
  219. package/skills/prisma-8/upgrading/app/upgrades/0.14-to-0.15/instructions.md +359 -0
  220. package/skills/prisma-8/upgrading/app/upgrades/0.15-to-0.16/instructions.md +173 -0
  221. package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/instructions.md +805 -0
  222. package/skills/prisma-8/upgrading/app/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
  223. package/skills/prisma-8/upgrading/app/upgrades/0.17-to-8.0.0-rc.1/instructions.md +72 -0
  224. package/skills/prisma-8/upgrading/app/upgrades/0.7-to-0.8/instructions.md +8 -0
  225. package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/instructions.md +36 -0
  226. package/skills/prisma-8/upgrading/app/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
  227. package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/instructions.md +86 -0
  228. package/skills/prisma-8/upgrading/app/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
  229. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +588 -0
  230. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
  231. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +639 -0
  232. 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
  233. 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
  234. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +332 -0
  235. 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
  236. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +489 -0
  237. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +1368 -0
  238. 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
  239. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +108 -0
  240. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +755 -0
  241. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +973 -0
  242. 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
  243. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +1862 -0
  244. 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 +597 -0
  245. 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 +1120 -0
  246. 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
  247. 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 +304 -0
  248. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +2462 -0
  249. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +513 -0
  250. 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 +1206 -0
  251. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
  252. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +802 -0
  253. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/instructions.md +586 -0
  254. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/scripts/value-objects-in-storage/value-objects-in-storage.ts +1184 -0
  255. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/instructions.md +480 -0
  256. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/scripts/mongo-index-names/mongo-index-names.ts +317 -0
  257. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/instructions.md +319 -0
  258. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts +220 -0
  259. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts +621 -0
  260. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +158 -0
  261. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +42 -0
  262. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md +157 -0
  263. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md +33 -0
  264. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md +36 -0
  265. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md +63 -0
  266. package/skills/prisma-8/upgrading/app/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +84 -0
  267. package/skills/prisma-8/upgrading/extension/upgrades/0.10-to-0.11/instructions.md +276 -0
  268. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/instructions.md +738 -0
  269. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts +97 -0
  270. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/regenerate-extension-public-baseline.ts +223 -0
  271. package/skills/prisma-8/upgrading/extension/upgrades/0.11-to-0.12/strip-migration-labels-hints.ts +340 -0
  272. package/skills/prisma-8/upgrading/extension/upgrades/0.12-to-0.13/instructions.md +266 -0
  273. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/instructions.md +522 -0
  274. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/migration-op-factories-to-methods.ts +290 -0
  275. package/skills/prisma-8/upgrading/extension/upgrades/0.13-to-0.14/uuid-preset-rename.ts +43 -0
  276. package/skills/prisma-8/upgrading/extension/upgrades/0.14-to-0.15/instructions.md +803 -0
  277. package/skills/prisma-8/upgrading/extension/upgrades/0.15-to-0.16/instructions.md +219 -0
  278. package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/instructions.md +731 -0
  279. package/skills/prisma-8/upgrading/extension/upgrades/0.16-to-0.17/strip-sha256-hash-prefixes.ts +382 -0
  280. package/skills/prisma-8/upgrading/extension/upgrades/0.17-to-8.0.0-rc.1/instructions.md +194 -0
  281. package/skills/prisma-8/upgrading/extension/upgrades/0.7-to-0.8/instructions.md +8 -0
  282. package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/instructions.md +57 -0
  283. package/skills/prisma-8/upgrading/extension/upgrades/0.8-to-0.9/strip-inline-contracts.ts +226 -0
  284. package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/instructions.md +150 -0
  285. package/skills/prisma-8/upgrading/extension/upgrades/0.9-to-0.10/stamp-storage-types-kind.ts +360 -0
  286. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.1-to-8.0.0-rc.2/instructions.md +746 -0
  287. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.10-to-8.0.0-rc.11/instructions.md +34 -0
  288. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.11-to-8.0.0-rc.12/instructions.md +857 -0
  289. 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
  290. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.12-to-8.0.0-rc.13/instructions.md +504 -0
  291. 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
  292. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.13-to-8.0.0-rc.14/instructions.md +143 -0
  293. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.14-to-8.0.0-rc.15/instructions.md +2168 -0
  294. 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
  295. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.15-to-8.0.0-rc.16/instructions.md +223 -0
  296. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.16-to-8.0.0-rc.17/instructions.md +583 -0
  297. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.17-to-8.0.0-rc.18/instructions.md +1008 -0
  298. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/instructions.md +2186 -0
  299. 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 +597 -0
  300. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/data-type-values/data-type-values.ts +1120 -0
  301. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/default-generators-to-on-create/rewrite-default-generators.mjs +86 -0
  302. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/mongo-field-storage-names/mongo-field-storage-names.ts +304 -0
  303. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.18-to-8.0.0-rc.19/scripts/remove-nocheck/remove-nocheck.ts +2462 -0
  304. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.19-to-8.0.0-rc.20/instructions.md +381 -0
  305. 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 +1206 -0
  306. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.2-to-8.0.0-rc.3/instructions.md +5 -0
  307. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.20-to-8.0.0-rc.21/instructions.md +570 -0
  308. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.21-to-8.0.0-rc.22/instructions.md +464 -0
  309. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.22-to-8.0.0-rc.23/instructions.md +410 -0
  310. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/instructions.md +304 -0
  311. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts +220 -0
  312. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.23-to-8.0.0-rc.24/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts +621 -0
  313. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.3-to-8.0.0-rc.4/instructions.md +137 -0
  314. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.4-to-8.0.0-rc.5/instructions.md +129 -0
  315. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.5-to-8.0.0-rc.6/instructions.md +102 -0
  316. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.6-to-8.0.0-rc.7/instructions.md +33 -0
  317. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.7-to-8.0.0-rc.8/instructions.md +35 -0
  318. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.8-to-8.0.0-rc.9/instructions.md +86 -0
  319. package/skills/prisma-8/upgrading/extension/upgrades/8.0.0-rc.9-to-8.0.0-rc.10/instructions.md +63 -0
@@ -0,0 +1,304 @@
1
+ ---
2
+ from: "8.0.0-rc.23"
3
+ to: "8.0.0-rc.24"
4
+ changes:
5
+ - id: engine-pin-moves-to-0-10-0
6
+ summary: |
7
+ The toolchain now peers `@prisma/cli-engine@0.10.0` (up from 0.9.0). An extension package that depends on `@prisma/cli-engine` for its tests or tooling must move to `0.10.0`.
8
+ detection:
9
+ glob: "**/{package.json,pnpm-workspace.yaml}"
10
+ matches:
11
+ - '"@prisma/cli-engine":\s*"[^"]*(?<![\d.])0\.\d(?!\d)'
12
+ - '[''"]?@prisma/cli-engine[''"]?:\s*[''"]?[\^~]?0\.\d(?![\d])'
13
+ - id: mongo-fields-take-a-type
14
+ summary: |
15
+ The MongoDB TypeScript builder writes a field as `field.scalar(type.X())`, where `type` holds the type constructors the target and extension packs contribute, as PSL names them: `field.objectId()` is now `field.scalar(type.ObjectId())`, `field.date()` is `field.scalar(type.DateTime())` (on MongoDB `Date` is now a calendar date), `field.vector({ typeParams: { length: 3 } })` is `field.scalar(type.Vector(3))`, and `field.scalar('mongo/string@1')` is `field.scalar(type.String())`. `field.objectId()`, `field.string()`, `field.double()`, `field.int32()`, `field.bool()`, `field.date()`, `field.int64()`, `field.int64Number()`, `field.decimal128()`, `field.binary()`, `field.json()`, `field.bson()`, `field.vector()` and `field.scalar(codecId)` are removed. `type` comes from the `defineContract` callback, or from `@prisma/orm-mongo/contract-builder`. The MongoDB target now contributes these constructors in its descriptor's `authoring.type`, which the adapter contributed before; `Vector` is new. Run `scripts/mongo-type-helpers/rewrite-mongo-field-types.ts` to rewrite them. The contract does not change. The detection matches MongoDB contract sources that call a removed helper.
16
+ detection:
17
+ glob: "**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx}"
18
+ matches:
19
+ - '(?<![\s\S])(?=[\s\S]*@prisma/orm-(?:mongo|family-mongo/contract-ts)/contract-builder[\x27"])[\s\S]*(?<![\w$])field\s*\.\s*(?:(?:objectId|string|double|int32|bool|date|int64|int64Number|decimal128|binary|json|bson|vector)\s*\(|scalar\s*\(\s*[\x27"])'
20
+ - '(?<![\s\S])(?=[\s\S]*@prisma/orm-(?:mongo|family-mongo/contract-ts)/contract-builder[\x27"])(?=[\s\S]*\bfield\s*(?:as\s+|:\s*)[A-Za-z_$][\w$]*)[\s\S]*\.\s*(?:(?:objectId|string|double|int32|bool|date|int64|int64Number|decimal128|binary|json|bson|vector)\s*\(|scalar\s*\(\s*[\x27"])'
21
+ script: ./scripts/mongo-type-helpers/rewrite-mongo-field-types.ts
22
+ - id: mongo-date-is-a-calendar-date
23
+ summary: |
24
+ On MongoDB, `Date` is now a calendar date, stored as a BSON date at midnight UTC and read as a string such as `"2024-02-29"`. `DateTime` with no arguments is what `Date` was: an instant read as a JavaScript `Date` (`mongo/date@1`). Rewrite `Date` to `DateTime` in MongoDB schemas and `type.Date()` to `type.DateTime()` in MongoDB TypeScript contracts with `scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts`. The contract does not change.
25
+ detection:
26
+ glob: "**/*.{prisma,ts,mts,cts,tsx,js,mjs,cjs,jsx}"
27
+ matches:
28
+ - '(?<![\s\S])(?![\s\S]*(?<![\w$])datasource[ \t]+\w+[ \t]*\{)(?=[\s\S]*(?:(?<![\w$])ObjectId(?![\w$])|@map\("_id"\)))[\s\S]*\n[ \t]+[A-Za-z_]\w*[ \t]+(?:=[ \t]*)?Date(?![\w$])'
29
+ - '(?<![\s\S])(?=[\s\S]*@(?:prisma/orm-(?:mongo|family-mongo/contract-ts)|internal/mongo)/contract-builder[\x27"])[\s\S]*(?<![\w$])[A-Za-z_$][\w$]*\s*\.\s*Date\s*\('
30
+ - '(?<![\s\S])(?=[\s\S]*[\x27"]@prisma/orm-mongo/config[\x27"])[\s\S]*(?<![\w$])contract\s*:\s*[\x27"][^\x27"]+?(?<!\.ts)[\x27"]'
31
+ script: ./scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts
32
+ - id: temporal-polyfill-is-a-peer-dependency-of-mongo
33
+ summary: |
34
+ `temporal-polyfill` is now a required peer dependency of `@prisma/orm-mongo` and `@prisma/orm-target-mongo`. The MongoDB control plane imports it, because `DateTime(as: temporal)`, `Date(as: temporal)` and `Time(as: temporal)` read `Temporal` values. npm, pnpm and bun install it automatically (npm with `legacy-peer-deps` set does not: see `temporal-polyfill-with-legacy-peer-deps`). An extension package that installs with Yarn and loads the target's control entry in its tests or tooling must add `temporal-polyfill` (`^1.0.4`) to its `devDependencies`.
35
+ detection:
36
+ glob: "**/yarn.lock"
37
+ contains:
38
+ - "@prisma/orm-mongo@"
39
+ - "@prisma/orm-target-mongo@"
40
+ anyMatch: true
41
+ - id: temporal-polyfill-with-legacy-peer-deps
42
+ summary: |
43
+ npm does not install peer dependencies when `legacy-peer-deps` is set, so an extension package that installs with npm and that setting, and loads the MongoDB target's control entry in its tests or tooling, must add `temporal-polyfill` (`^1.0.4`) to its `devDependencies`, as a Yarn package must. The setting can come from an `.npmrc`, the user's npm config or the environment, which no file shows, so the detection matches every `package.json` that depends on `@prisma/orm-mongo` or `@prisma/orm-target-mongo`, and the step checks the setting npm uses.
44
+ detection:
45
+ glob: "**/package.json"
46
+ contains:
47
+ - '"@prisma/orm-mongo"'
48
+ - '"@prisma/orm-target-mongo"'
49
+ anyMatch: true
50
+ - id: mongo-runtime-has-prepare
51
+ summary: |
52
+ `MongoRuntime`, from `@prisma/orm-mongo/family-runtime`, has `prepare(declaration, callback)`, and the `MongoClient` that `mongo()` returns has it too. An object you type as `MongoRuntime` or `MongoClient` yourself, such as a test double, needs a `prepare` method.
53
+ detection:
54
+ glob: "**/*.{ts,mts,cts,tsx}"
55
+ matches:
56
+ - ':\s{0,20}(?:MongoRuntime|MongoClient<[^<>]{0,200}>)\s{0,20}=\s{0,20}\{'
57
+ - '\bimplements\s{1,20}MongoRuntime\b'
58
+ - id: mongo-limit-skip-take-placeholders
59
+ summary: |
60
+ `MongoLimitStage.limit` and `MongoSkipStage.skip`, from `@prisma/orm-mongo/query-ast/execution`, are `number | MongoPreparedParamRef`, and `MongoValue` includes `MongoPreparedParamRef`, the placeholder a `prepare` callback receives. Code that reads `stage.limit` or `stage.skip` as a number, or that handles every kind of `MongoValue`, must handle the placeholder.
61
+ detection:
62
+ glob: "**/*.{ts,mts,cts,tsx}"
63
+ matches:
64
+ - '\bMongo(?:Limit|Skip)Stage\b'
65
+ - '\bMongoValue\b'
66
+ - id: runtime-transaction-signal
67
+ summary: Forward runtime transaction options and provide the required transaction AbortSignal.
68
+ - id: forward-sql-transaction-options
69
+ summary: Forward resolved isolation options through SQL transaction wrappers and configure ORM-owned transactions separately.
70
+ - id: create-extension-not-exported
71
+ summary: |
72
+ `@internal/target-postgres/migration` and its public entrypoint `@prisma/orm-postgres/migration` no longer export the free function `createExtension`, which a `migration.ts` could not call correctly since 8.0.0-rc.22. A `migration.ts` that imports it now fails at once with `does not provide an export named 'createExtension'`. Call the method on the migration class instead: `createExtension('btree_gist')` becomes `this.createExtension({ extension: 'btree_gist' })`. The migration's `ops.json` does not change, so there is no need to run `node migration.ts` again.
73
+ detection:
74
+ glob: "**/migration.{ts,mts}"
75
+ matches:
76
+ - '(?<![\w$.])createExtension\s*\('
77
+ - '\bimport\s*\{[^}]*(?<![\w$])createExtension(?![\w$])[^}]*\}\s*from\s*[\x27"](?:@internal/target-postgres|@prisma/orm-postgres)/migration[\x27"]'
78
+ - id: data-transform-not-exported
79
+ summary: |
80
+ `@internal/target-postgres/migration` and its public entrypoint `@prisma/orm-postgres/migration` no longer export the free function `dataTransform`, which took an internal fourth argument a `migration.ts` cannot pass. A `migration.ts` that imports it now fails at once with `does not provide an export named 'dataTransform'`. Call the method on the migration class instead: `this.dataTransform(endContract, name, { check, run })`. The planner writes the method. The types `DataTransformClosure` and `DataTransformOptions` are still exported.
81
+ detection:
82
+ glob: "**/migration.{ts,mts}"
83
+ matches:
84
+ - '\bimport\s*\{[^}]*(?<![\w$])dataTransform(?![\w$])[^}]*\}\s*from\s*[\x27"](?:@internal/target-postgres|@prisma/orm-postgres)/migration[\x27"]'
85
+ - id: raw-parts-hold-statement-asts
86
+ summary: |
87
+ The `parts` of `RawExpr` and `RawQueryAst` (from `@internal/sql-relational-core/ast`, published as `@prisma/orm-family-sql/relational-core/ast`) are now `ReadonlyArray<RawPart>`, where `RawPart = string | AnyExpression | SelectAst | InsertAst | UpdateAst | DeleteAst`. A raw template places a builder query, or a builder mutation after `.returning()`, as one statement part. Code that walks `parts` and treats every non-string part as an expression must handle the four statement kinds. The detection matches files that import these nodes and read `.parts`.
88
+ detection:
89
+ glob: "**/*.{ts,mts,cts,tsx}"
90
+ matches:
91
+ - '(?<![\s\S])(?=[\s\S]*(?:@internal/sql-relational-core|@prisma/orm-family-sql/relational-core)/(?:ast|expression)[\x27"])(?=[\s\S]*(?<![\w$])(?:RawExpr|RawQueryAst|RawPart)(?![\w$]))[\s\S]*\.parts(?![\w$])'
92
+ ---
93
+
94
+ # 8.0.0-rc.23 → 8.0.0-rc.24 — Extension author upgrade instructions
95
+
96
+ ## Order of the steps
97
+
98
+ Make the changes below in any order, with three exceptions:
99
+
100
+ 1. Move `@prisma/cli-engine` to `0.10.0` and add `temporal-polyfill` where it is needed before running anything else (`engine-pin-moves-to-0-10-0`, `temporal-polyfill-is-a-peer-dependency-of-mongo`, `temporal-polyfill-with-legacy-peer-deps`).
101
+ 2. In MongoDB contract sources, run the field-types script before the date-types script (`mongo-fields-take-a-type`, then `mongo-date-is-a-calendar-date`). The first writes `field.date()` as `field.scalar(type.DateTime())`.
102
+ 3. In SQL transaction wrappers, forward the isolation options first, then change the runtime wrappers to `RuntimeTransactionOptions` and the transaction `signal` (`forward-sql-transaction-options`, then `runtime-transaction-signal`).
103
+
104
+
105
+ ## The toolchain moves to `@prisma/cli-engine` 0.10.0
106
+
107
+ ### `engine-pin-moves-to-0-10-0`
108
+
109
+ For every file matched by `detection`, change the `@prisma/cli-engine` version (`0.9.0`, `^0.9.0` or any other 0.x below 0.10) to `0.10.0` and reinstall. In engine 0.10.0 a normalized redirect's `replacement` is a list of steps rather than one string, so code that reads `CommandRedirect.replacement` from a command family reads an array.
110
+
111
+
112
+ ## MongoDB fields take a type from `type`
113
+
114
+ ```ts
115
+ // Before
116
+ export const contract = defineContract({}, ({ field, model }) => ({
117
+ models: {
118
+ Doc: model('Doc', {
119
+ fields: {
120
+ _id: field.objectId(),
121
+ embedding: field.vector({ typeParams: { length: 3 } }),
122
+ raw: field.scalar('mongo/bson@1'),
123
+ },
124
+ }),
125
+ },
126
+ }));
127
+
128
+ // After
129
+ export const contract = defineContract({}, ({ field, model, type }) => ({
130
+ models: {
131
+ Doc: model('Doc', {
132
+ fields: {
133
+ _id: field.scalar(type.ObjectId()),
134
+ embedding: field.scalar(type.Vector(3)),
135
+ raw: field.scalar(type.Bson()),
136
+ },
137
+ }),
138
+ },
139
+ }));
140
+ ```
141
+
142
+ ### `mongo-fields-take-a-type`
143
+
144
+ Commit your work first. The script reads your code with the TypeScript compiler, so the project needs `typescript` installed. From the project root, run:
145
+
146
+ ```sh
147
+ node <path-to-this-guide>/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts
148
+ ```
149
+
150
+ Pass files or directories to limit it. The script prints a line for each call it leaves. Rewrite each one by hand, except where the line says the script cannot tell the `field` is the MongoDB builder's and it is not. Then type-check the project. The script neither changes nor reports a `field.scalar` call whose argument is computed, such as `field.scalar(codecIdOf(kind))`, because it cannot tell a codec id from a type there; the type check reports each one that passes a codec id, since `field.scalar` takes only a type now. Where the type check cannot see it, in plain JavaScript or with an argument typed `any`, `contract emit` refuses the call with `CONTRACT.ARGUMENT_INVALID`. Write those with `type.X()`.
151
+
152
+ A field typed by your extension's own codec, written `field.scalar('shout/text@1')` before, needs a type constructor in your extension descriptor's `authoring.type`, under your namespace. The contract then writes `field.scalar(type.shout.Text())`:
153
+
154
+ ```ts
155
+ authoring: {
156
+ type: {
157
+ shout: { Text: { kind: 'typeConstructor', output: { codecId: 'shout/text@1' } } },
158
+ },
159
+ },
160
+ ```
161
+
162
+ The script reports such a call and leaves it, because it cannot know the constructor's name.
163
+
164
+
165
+ ## MongoDB: `Date` is a calendar date, and `temporal-polyfill` is a peer dependency
166
+
167
+ ### `mongo-date-is-a-calendar-date`
168
+
169
+ Commit your work first. From the project root, run:
170
+
171
+ ```sh
172
+ node <path-to-this-guide>/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts
173
+ ```
174
+
175
+ Pass files or directories to limit it.
176
+
177
+ ### `temporal-polyfill-is-a-peer-dependency-of-mongo`
178
+
179
+ For each Yarn project that `detection` matches, add `"temporal-polyfill": "^1.0.4"` to `devDependencies` in the `package.json` that depends on `@prisma/orm-mongo` or `@prisma/orm-target-mongo`, then reinstall.
180
+
181
+ ### `temporal-polyfill-with-legacy-peer-deps`
182
+
183
+ Skip this if the package installs with Yarn (see `temporal-polyfill-is-a-peer-dependency-of-mongo`), pnpm or bun. For a package that installs with npm, run `npm config get legacy-peer-deps` in the folder of each `package.json` that `detection` matches. It reports the setting npm uses there, from any `.npmrc`, the user's npm config or the `npm_config_legacy_peer_deps` environment variable. Where it prints `true`, or the install command passes `--legacy-peer-deps`, add `"temporal-polyfill": "^1.0.4"` to that `package.json`'s `devDependencies`, then reinstall.
184
+
185
+
186
+ ## MongoDB prepared statements
187
+
188
+ ### `mongo-runtime-has-prepare`
189
+
190
+ Give a hand-written `MongoRuntime` or `MongoClient` a `prepare` method. A test double that never prepares can throw:
191
+
192
+ ```ts
193
+ const runtime: MongoRuntime = {
194
+ query,
195
+ execute,
196
+ close: async () => {},
197
+ prepare: () => Promise.reject(new Error('not used in this test')),
198
+ };
199
+ ```
200
+
201
+ ### `mongo-limit-skip-take-placeholders`
202
+
203
+ Where you read a `$limit` or `$skip` count from a stage, check for a placeholder before using it as a number:
204
+
205
+ ```ts
206
+ const count = typeof stage.limit === 'number' ? stage.limit : undefined;
207
+ ```
208
+
209
+ A placeholder's value is known only when a prepared statement runs.
210
+
211
+
212
+ ## SQL transactions take isolation options and timeouts
213
+
214
+ Make the isolation change first, then the timeout change: both touch the same transaction wrappers.
215
+
216
+ ### `forward-sql-transaction-options`
217
+
218
+ Import `SqlTransactionOptions` from `@prisma/orm-family-sql/relational-core/ast` when implementing SQL transaction wrappers. Accept optional `options?: SqlTransactionOptions` on driver connection `beginTransaction`/`transaction` methods and forward it unchanged through held-session and activity-owned routes. Runtime connection and activity wrappers take `RuntimeTransactionOptions` instead, which adds the callback timeouts; `runtime-transaction-signal` below describes them. The options contain only an optional `isolationLevel`; drivers must not receive an implicit/explicit discriminator. An absent level retains database/session defaults.
219
+
220
+ Custom facades validate global and local callback isolation options before acquisition, resolve a defined local level over the global level, and pass the result as the third argument of `withTransaction`. Keep callback defaults in facade closures, never on shared runtimes or drivers. Unknown keys, null and unsupported levels reject; an undefined property inherits.
221
+
222
+ Configure ORM-owned transactions separately through the ORM factory's optional `implicitTransactionOptions`. The MySQL facade supplies `{ isolationLevel: 'ReadCommitted' }`; standalone ORM instances can opt into the same policy. Retain these options in collection configuration when rebinding execution to an activity. Nested create/update and other multi-statement mutations use the mutation graph, which passes resolved options to the activity's transaction method when opening a transaction. Do not restore the removed nested-mutation executor or its connection fallback. Existing transaction-bound ORM scopes participate without opening another transaction or changing isolation. Do not copy callback defaults into this configuration.
223
+
224
+ Drivers validate supplied levels and select fixed SQL. Preserve existing query serialization. MySQL SET TRANSACTION and BEGIN share one lock; a missing level uses the server/session default. Remove any blanket session isolation override used only to implement the old ORM policy.
225
+
226
+ Preserve start-refusal and settlement metadata in wrappers. Release only a known-clean connection; destroy after uncertain start or rollback, including successful SET followed by failed BEGIN. Keep the original setup error when cleanup fails. Role-session setup, transaction, and reset must use the same held connection.
227
+
228
+ Validate resolved-options forwarding, absent/default ORM policy, factory-to-activity-to-graph propagation, nested writes, callback precedence, same-session role behavior and destruction/reset failures. Do not add timeout or batch semantics as part of this translation.
229
+
230
+ ### `runtime-transaction-signal`
231
+
232
+ - Change runtime connection/activity wrapper parameters from driver `SqlTransactionOptions` to `RuntimeTransactionOptions`, imported from your SQL runtime entry (`@prisma/orm-family-sql/runtime` for published extensions). Forward the complete options to the underlying runtime transaction or `beginTransactionOn`, and preserve the returned transaction's `signal` when wrapping it. Drivers still receive isolation-only `SqlTransactionOptions`.
233
+ - Every handwritten `RuntimeTransaction` implementation or test double must expose a stable readonly `signal: AbortSignal`, even when untimed: `withTransaction` reads it unconditionally. For an untimed double, allocate one `AbortController` per transaction and expose its signal (for an object literal, `signal: new AbortController().signal` allocates it once).
234
+ - Never replace a real timed transaction's signal with an inert signal: doing so prevents callback timeout observation. Delegate the original signal; if implementing timed runtime transactions yourself, own the deadline and invalidation, abort with the structured timeout reason after invalidating access, and stop the timer at commit admission or rollback. There is no separate lifetime argument or `started(control)` callback.
235
+
236
+
237
+ ## `createExtension` and `dataTransform` are no longer free functions
238
+
239
+ ### `create-extension-not-exported`
240
+
241
+ `@internal/target-postgres/migration` no longer exports `createExtension`. Since 8.0.0-rc.22 the free function took an internal argument that only the migration class can supply, so a `migration.ts` that called it failed with `Cannot read properties of undefined (reading 'lowerToExecuteRequest')`. Now the import fails at once instead.
242
+
243
+ In every `migration.ts` the detection matches, call the method and remove `createExtension` from the import:
244
+
245
+ ```ts
246
+ // Before
247
+ import { createExtension, Migration, MigrationCLI } from '@internal/target-postgres/migration';
248
+
249
+ override get operations() {
250
+ return [createExtension('btree_gist'), ...];
251
+ }
252
+
253
+ // After
254
+ import { Migration, MigrationCLI } from '@internal/target-postgres/migration';
255
+
256
+ override get operations() {
257
+ return [this.createExtension({ extension: 'btree_gist' }), ...];
258
+ }
259
+ ```
260
+
261
+ Without `schema`, the method creates the extension where the old function did: in the connection's current schema, unless the extension's control file names one. The migration's `ops.json` does not change, and there is no need to run `node migration.ts` again: `prisma db migrate` applies `ops.json` and does not load `migration.ts`.
262
+
263
+ ### `data-transform-not-exported`
264
+
265
+ `@internal/target-postgres/migration` and its public entrypoint `@prisma/orm-postgres/migration` no longer export the free function `dataTransform`. It took an internal fourth argument that only the migration class can supply, so a `migration.ts` could not call it correctly. Remove `dataTransform` from the import and call `this.dataTransform(endContract, name, { check, run })`, as the planner writes it. The types `DataTransformClosure` and `DataTransformOptions` are still exported.
266
+
267
+
268
+ ## Raw parts can hold a statement AST
269
+
270
+ ### `raw-parts-hold-statement-asts`
271
+
272
+ `RawExpr.parts` and `RawQueryAst.parts` used to hold strings and expression nodes. They now hold `RawPart`, which adds `SelectAst`, `InsertAst`, `UpdateAst` and `DeleteAst`: a builder query interpolated into `db.raw.sql` or `fns.raw` lands in the parts as its statement AST. A `RawQueryAst` interpolated into another raw template is still spread into the outer parts, so it never appears as a part.
273
+
274
+ In every file the detection matches, find each walk over `parts` that sends a non-string part to an expression handler, and give the statement kinds their own branch. Each statement AST has `kind` `'select'`, `'insert'`, `'update'` or `'delete'`, which no expression kind uses. A renderer renders a statement part with the function it uses for that statement at top level, with no parentheses:
275
+
276
+ ```ts
277
+ // Before
278
+ parts.map((part) => (typeof part === 'string' ? part : renderExpr(part, ctx))).join('');
279
+
280
+ // After
281
+ parts
282
+ .map((part) => {
283
+ if (typeof part === 'string') {
284
+ return part;
285
+ }
286
+ switch (part.kind) {
287
+ case 'select':
288
+ return renderSelect(part, ctx);
289
+ case 'insert':
290
+ return renderInsert(part, ctx);
291
+ case 'update':
292
+ return renderUpdate(part, ctx);
293
+ case 'delete':
294
+ return renderDelete(part, ctx);
295
+ default:
296
+ return renderExpr(part, ctx);
297
+ }
298
+ })
299
+ .join('');
300
+ ```
301
+
302
+ A walker that only needs parameters can call `part.collectParamRefs()` on every non-string part, since the statement ASTs have it too. `RawQueryAst.collectParamRefs()` and `rewrite()` already reach into statement parts.
303
+
304
+ `ExpressionFolder` has a new optional `mutation` arm, called for an INSERT, UPDATE or DELETE part of a `RawExpr`, beside the `select` arm called for a SELECT part. A folder that leaves it out gets `empty` for a mutation part, so existing folders compile unchanged; add the arm where a mutation's contents matter.
@@ -0,0 +1,220 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Rewrites `Date` to `DateTime` in MongoDB schemas and `type.Date()` to `type.DateTime()` in MongoDB TypeScript contracts. On MongoDB, `Date` was an instant read as a JavaScript `Date`; it is now a calendar date, and `DateTime` with no arguments is what `Date` was, so the contract does not change.
4
+ *
5
+ * A `.prisma` file is a MongoDB schema when the nearest `prisma.config.*` at or above its folder imports `@prisma/orm-mongo`. So is any file such a config names as its `contract`, whatever its extension, except a `.ts` contract. A schema with a `datasource` block, which is a Prisma 6 or Prisma 7 schema, and one a config reads with `prisma6Schema(...)` are left alone. A TypeScript or JavaScript file is a MongoDB contract when it imports a MongoDB contract builder entry; in it, a call of `Date` on `type`, or on a name `type` is imported or destructured as, becomes `DateTime`.
6
+ *
7
+ * A schema that declares a model, type or enum named `Date`, in any of its files, is left as it is, because `Date` there names that declaration. The script prints one line per file it changes, and one line per place it leaves for a person: a schema that declares its own `Date`, and a call of `Date` on a name it cannot tell is the `type` of a MongoDB contract builder.
8
+ *
9
+ * Usage: node rewrite-mongo-date-types.ts [file or directory ...]
10
+ *
11
+ * The paths default to the working directory, which is also where the script looks for `prisma.config.*` files. In a directory it reads every file outside `node_modules`, `.git`, `dist` and `build`.
12
+ */
13
+ import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
14
+ import { dirname, join, relative, resolve, sep } from 'node:path';
15
+
16
+ const SKIPPED_DIRECTORIES = new Set(['node_modules', '.git', 'dist', 'build']);
17
+ const CONFIG_FILE = /^prisma\.config\.(?:[cm]?ts|[cm]?js)$/;
18
+ const SOURCE_FILE = /\.(?:[cm]?ts|tsx|[cm]?js|jsx)$/;
19
+ const MONGO_CONFIG_IMPORT = /['"]@prisma\/orm-mongo(?:\/[\w/-]*)?['"]/;
20
+ const CONTRACT_PATH = /\bcontract\s*:\s*['"]([^'"]+?)(?<!\.ts)['"]/g;
21
+ const PRISMA6_SCHEMA_PATH = /\bprisma6Schema\s*\(\s*['"]([^'"]+)['"]/g;
22
+ const DATASOURCE_BLOCK = /(?:^|\n)[ \t]*datasource[ \t]+\w+[ \t]*\{/;
23
+ const FIELD_OR_ALIAS_OF_TYPE_DATE = /^([ \t]+[A-Za-z_]\w*[ \t]+(?:=[ \t]*)?)Date(?![\w$])/gm;
24
+ const MONGO_BUILDER_IMPORT =
25
+ /['"](?:@prisma\/orm-mongo|@prisma\/orm-family-mongo\/contract-ts|@internal\/mongo|@internal\/mongo-contract-ts)\/contract-builder['"]/;
26
+ const TYPE_ALIASES = /(?<![\w$])type\s*(?:as|:)\s*([A-Za-z_$][\w$]*)/g;
27
+ const DECLARES_DATE = /(?:^|\n)[ \t]*(?:model|type|enum|view)[ \t]+Date[ \t]*\{/;
28
+ const OTHER_DATE_CALL = /(?<![\w$])[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*\s*\.\s*Date\s*\(/g;
29
+
30
+ function filesUnder(path: string): string[] {
31
+ if (!statSync(path).isDirectory()) return [path];
32
+ return readdirSync(path, { withFileTypes: true }).flatMap((entry) => {
33
+ if (entry.isDirectory()) {
34
+ return SKIPPED_DIRECTORIES.has(entry.name) ? [] : filesUnder(join(path, entry.name));
35
+ }
36
+ return entry.isFile() ? [join(path, entry.name)] : [];
37
+ });
38
+ }
39
+
40
+ /** Whether a file is `path`, or one a glob `path` names, as the CLI expands a `contract` glob: `*` and `?` within a folder, `**` across folders, `{a,b}` for either. */
41
+ function pathMatcher(path: string): (file: string) => boolean {
42
+ if (!/[*?{]/.test(path)) return (file) => file === path;
43
+ const glob = path.split(sep).join('/');
44
+ let source = '';
45
+ for (let index = 0; index < glob.length; index += 1) {
46
+ const char = glob[index] ?? '';
47
+ if (glob.startsWith('**/', index)) {
48
+ source += '(?:.*/)?';
49
+ index += 2;
50
+ } else if (glob.startsWith('**', index)) {
51
+ source += '.*';
52
+ index += 1;
53
+ } else if (char === '*') source += '[^/]*';
54
+ else if (char === '?') source += '[^/]';
55
+ else if (char === '{') source += '(?:';
56
+ else if (char === '}') source += ')';
57
+ else if (char === ',') source += '|';
58
+ else source += char.replace(/[.+^$()|[\]\\]/g, '\\$&');
59
+ }
60
+ const pattern = new RegExp(`^${source}$`);
61
+ return (file) => pattern.test(file.split(sep).join('/'));
62
+ }
63
+
64
+ interface Config {
65
+ readonly dir: string;
66
+ readonly mongo: boolean;
67
+ }
68
+
69
+ function readConfigs(root: string): {
70
+ readonly configs: readonly Config[];
71
+ readonly named: ReadonlyArray<{
72
+ readonly matches: (file: string) => boolean;
73
+ readonly dir: string;
74
+ }>;
75
+ readonly prisma6: ReadonlySet<string>;
76
+ } {
77
+ const configs: Config[] = [];
78
+ const named: { matches: (file: string) => boolean; dir: string }[] = [];
79
+ const prisma6 = new Set<string>();
80
+ for (const file of filesUnder(root)) {
81
+ if (!CONFIG_FILE.test(file.split(sep).at(-1) ?? '')) continue;
82
+ const text = readFileSync(file, 'utf8');
83
+ const dir = dirname(file);
84
+ const mongo = MONGO_CONFIG_IMPORT.test(text);
85
+ configs.push({ dir, mongo });
86
+ if (!mongo) continue;
87
+ for (const [, path = ''] of text.matchAll(CONTRACT_PATH)) {
88
+ named.push({ matches: pathMatcher(resolve(dir, path)), dir });
89
+ }
90
+ for (const [, path = ''] of text.matchAll(PRISMA6_SCHEMA_PATH)) prisma6.add(resolve(dir, path));
91
+ }
92
+ return { configs, named, prisma6 };
93
+ }
94
+
95
+ function isInside(file: string, dir: string): boolean {
96
+ return file.startsWith(`${dir}${sep}`);
97
+ }
98
+
99
+ /** The folder of the MongoDB config whose schema `file` is part of, or `undefined` when it is no MongoDB schema. A schema's files share it, so a model one file declares is seen from every other. */
100
+ function mongoSchemaOf(file: string, configs: ReturnType<typeof readConfigs>): string | undefined {
101
+ if (configs.prisma6.has(file)) return undefined;
102
+ const namedBy = configs.named.find((entry) => entry.matches(file));
103
+ if (namedBy !== undefined) return namedBy.dir;
104
+ const nearest = configs.configs
105
+ .filter((config) => isInside(file, config.dir))
106
+ .sort((a, b) => b.dir.length - a.dir.length)[0];
107
+ return nearest?.mongo === true ? nearest.dir : undefined;
108
+ }
109
+
110
+ /** Where a schema declares its own model, type or enum named `Date`. */
111
+ interface DateDeclaration {
112
+ readonly file: string;
113
+ readonly line: number;
114
+ }
115
+
116
+ /** The first declaration of `Date` in each MongoDB schema, by its config's folder, read from every schema file under `root`. */
117
+ function dateDeclarations(
118
+ schemaFiles: readonly string[],
119
+ configs: ReturnType<typeof readConfigs>,
120
+ ): ReadonlyMap<string, DateDeclaration> {
121
+ const declarations = new Map<string, DateDeclaration>();
122
+ for (const file of schemaFiles) {
123
+ const schema = mongoSchemaOf(file, configs);
124
+ if (schema === undefined || declarations.has(schema)) continue;
125
+ const text = readFileSync(file, 'utf8');
126
+ const declared = DATASOURCE_BLOCK.test(text) ? null : DECLARES_DATE.exec(text);
127
+ if (declared !== null) {
128
+ declarations.set(schema, {
129
+ file,
130
+ line: lineOf(text, declared.index + declared[0].indexOf('Date')),
131
+ });
132
+ }
133
+ }
134
+ return declarations;
135
+ }
136
+
137
+ /** What a rewrite did: the new text, how many places it rewrote, and the lines it left for a person, each with the reason. */
138
+ interface Rewrite {
139
+ readonly text: string;
140
+ readonly count: number;
141
+ readonly left: readonly string[];
142
+ }
143
+
144
+ const UNCHANGED = (text: string): Rewrite => ({ text, count: 0, left: [] });
145
+
146
+ function lineOf(text: string, offset: number): number {
147
+ return text.slice(0, offset).split('\n').length;
148
+ }
149
+
150
+ function rewriteSchema(text: string, declaration: DateDeclaration | undefined): Rewrite {
151
+ if (DATASOURCE_BLOCK.test(text)) return UNCHANGED(text);
152
+ if (declaration !== undefined) {
153
+ const [first] = text.matchAll(FIELD_OR_ALIAS_OF_TYPE_DATE);
154
+ return first === undefined
155
+ ? UNCHANGED(text)
156
+ : {
157
+ text,
158
+ count: 0,
159
+ left: [
160
+ `line ${lineOf(text, first.index + first[0].length - 'Date'.length)}: Date names the Date declared in ${relative(root, declaration.file)} line ${declaration.line}, not MongoDB's date; the script leaves this schema as it is`,
161
+ ],
162
+ };
163
+ }
164
+ let count = 0;
165
+ const rewritten = text.replace(FIELD_OR_ALIAS_OF_TYPE_DATE, (_whole, before: string) => {
166
+ count += 1;
167
+ return `${before}DateTime`;
168
+ });
169
+ return { text: rewritten, count, left: [] };
170
+ }
171
+
172
+ function rewriteContract(text: string): Rewrite {
173
+ if (!MONGO_BUILDER_IMPORT.test(text)) return UNCHANGED(text);
174
+ const receivers = new Set(['type', ...[...text.matchAll(TYPE_ALIASES)].map(([, name]) => name)]);
175
+ const call = new RegExp(
176
+ `(?<![\\w$])((?:${[...receivers].join('|').replaceAll('$', '\\$')})\\s*\\.\\s*)Date(\\s*\\()`,
177
+ 'g',
178
+ );
179
+ let count = 0;
180
+ const rewritten = text.replace(call, (_whole, before: string, after: string) => {
181
+ count += 1;
182
+ return `${before}DateTime${after}`;
183
+ });
184
+ const left = [...rewritten.matchAll(OTHER_DATE_CALL)].map(
185
+ (match) =>
186
+ `line ${lineOf(rewritten, match.index)}: ${match[0].trim()}): the script cannot tell this is the type of a MongoDB contract builder; if it is, write DateTime`,
187
+ );
188
+ return { text: rewritten, count, left };
189
+ }
190
+
191
+ const root = process.cwd();
192
+ const configs = readConfigs(root);
193
+ const isSchemaFile = (file: string) =>
194
+ file.endsWith('.prisma') || configs.named.some((entry) => entry.matches(file));
195
+ const declarations = dateDeclarations(filesUnder(root).filter(isSchemaFile), configs);
196
+ const paths = process.argv.slice(2);
197
+ const files = (paths.length === 0 ? [root] : paths.map((path) => resolve(root, path))).flatMap(
198
+ filesUnder,
199
+ );
200
+
201
+ let changed = 0;
202
+ for (const file of [...new Set(files)].sort()) {
203
+ const isSchema = isSchemaFile(file);
204
+ if (!isSchema && !SOURCE_FILE.test(file)) continue;
205
+ const schema = isSchema ? mongoSchemaOf(file, configs) : undefined;
206
+ if (isSchema && schema === undefined) continue;
207
+ const text = readFileSync(file, 'utf8');
208
+ const result = isSchema
209
+ ? rewriteSchema(text, schema === undefined ? undefined : declarations.get(schema))
210
+ : rewriteContract(text);
211
+ const name = relative(root, file);
212
+ if (result.count > 0) {
213
+ writeFileSync(file, result.text);
214
+ changed += 1;
215
+ const what = isSchema ? 'field type' : 'type.Date() call';
216
+ console.log(`${name}: rewrote ${result.count} ${what}${result.count === 1 ? '' : 's'}.`);
217
+ }
218
+ for (const line of result.left) console.log(`${name}: ${line}.`);
219
+ }
220
+ console.log(`Changed ${changed} file${changed === 1 ? '' : 's'}.`);