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

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,317 @@
1
+ #!/usr/bin/env node
2
+ // Names every index of a MongoDB contract written before contracts recorded index names.
3
+ // A contract snapshot's index takes the name its own project's emitted contract gives the index with the same
4
+ // collection, keys and options. A snapshot's project is the nearest folder, going up from the folder that holds
5
+ // its `migrations` folder, that holds an emitted contract (a MongoDB contract outside every `snapshots` folder).
6
+ // The walk stops at the first folder with a `package.json`, the project root, so no name comes from another project.
7
+ // When no emitted contract of the project has the index, or two of them name it differently, the index gets the
8
+ // name earlier releases gave it in the database, its keys and directions such as `email_1`, and the script says so.
9
+ // Usage: node mongo-index-names.ts [<root>]
10
+
11
+ import { existsSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
12
+ import { dirname, join, relative, resolve, sep } from 'node:path';
13
+
14
+ const SKIPPED_DIRECTORIES = new Set(['node_modules', '.git', 'dist', 'build']);
15
+ const TEMPORARY_SUFFIX = '.mongo-index-names-tmp';
16
+
17
+ type JsonObject = { [key: string]: unknown };
18
+
19
+ function isObject(value: unknown): value is JsonObject {
20
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
21
+ }
22
+
23
+ function walk(dir: string, found: string[], links: string[]): void {
24
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
25
+ const path = join(dir, entry.name);
26
+ if (entry.isDirectory()) {
27
+ if (!SKIPPED_DIRECTORIES.has(entry.name)) walk(path, found, links);
28
+ continue;
29
+ }
30
+ if (entry.isSymbolicLink()) {
31
+ links.push(path);
32
+ continue;
33
+ }
34
+ if (!entry.isFile()) continue;
35
+ if (entry.name.endsWith(TEMPORARY_SUFFIX)) {
36
+ rmSync(path);
37
+ continue;
38
+ }
39
+ if (entry.name.endsWith('.json')) found.push(path);
40
+ }
41
+ }
42
+
43
+ function isUnnamedIndex(value: unknown): value is JsonObject {
44
+ return (
45
+ isObject(value) &&
46
+ value['kind'] === 'mongo-index' &&
47
+ Array.isArray(value['keys']) &&
48
+ !('name' in value)
49
+ );
50
+ }
51
+
52
+ function defaultName(keys: unknown): string {
53
+ return (Array.isArray(keys) ? keys : [])
54
+ .map((key) => (isObject(key) ? `${String(key['field'])}_${String(key['direction'])}` : ''))
55
+ .join('_');
56
+ }
57
+
58
+ /** The index with its name, its keys in sorted order as `contract emit` writes them. */
59
+ function named(index: JsonObject, name: string): JsonObject {
60
+ const entries = [...Object.entries(index), ['name', name] as const];
61
+ return Object.fromEntries(entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));
62
+ }
63
+
64
+ /** An index's collection, keys and options, as a string: what the database tells two indexes apart by. */
65
+ function contentKey(collection: string, index: JsonObject): string {
66
+ const { name: _name, kind: _kind, ...content } = index;
67
+ return canonicalJson([collection, content]);
68
+ }
69
+
70
+ function canonicalJson(value: unknown): string {
71
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;
72
+ if (!isObject(value)) return JSON.stringify(value);
73
+ const entries = Object.keys(value)
74
+ .sort()
75
+ .map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`);
76
+ return `{${entries.join(',')}}`;
77
+ }
78
+
79
+ /** Each index of a contract, with the collection it belongs to. */
80
+ function indexesOf(
81
+ value: unknown,
82
+ found: { readonly collection: string; readonly index: JsonObject }[],
83
+ collection = '',
84
+ ): void {
85
+ if (Array.isArray(value)) {
86
+ for (const item of value) indexesOf(item, found, collection);
87
+ return;
88
+ }
89
+ if (!isObject(value)) return;
90
+ if (value['kind'] === 'mongo-index') {
91
+ found.push({ collection, index: value });
92
+ return;
93
+ }
94
+ for (const [key, item] of Object.entries(value)) {
95
+ if (key === 'collection' && isObject(item)) {
96
+ for (const [name, entry] of Object.entries(item)) indexesOf(entry, found, name);
97
+ } else {
98
+ indexesOf(item, found, collection);
99
+ }
100
+ }
101
+ }
102
+
103
+ /** The names emitted contracts give indexes, by collection and content; each name is listed once. */
104
+ type EmittedNames = Map<string, readonly string[]>;
105
+
106
+ function recordEmittedNames(contract: JsonObject, emitted: EmittedNames): void {
107
+ const found: { readonly collection: string; readonly index: JsonObject }[] = [];
108
+ indexesOf(contract, found);
109
+ for (const { collection, index } of found) {
110
+ const name = index['name'];
111
+ if (typeof name !== 'string') continue;
112
+ const key = contentKey(collection, index);
113
+ const names = emitted.get(key) ?? [];
114
+ if (!names.includes(name)) emitted.set(key, [...names, name]);
115
+ }
116
+ }
117
+
118
+ type NameFor = (collection: string, index: JsonObject) => string;
119
+
120
+ /** The value with each unnamed index named, and the names given, in the order the JSON lists the indexes. */
121
+ function nameIndexes(value: unknown, names: string[], nameFor: NameFor, collection = ''): unknown {
122
+ if (Array.isArray(value))
123
+ return value.map((item) => nameIndexes(item, names, nameFor, collection));
124
+ if (!isObject(value)) return value;
125
+ if (isUnnamedIndex(value)) {
126
+ const name = nameFor(collection, value);
127
+ names.push(name);
128
+ return named(value, name);
129
+ }
130
+ return Object.fromEntries(
131
+ Object.entries(value).map(([key, item]) => [
132
+ key,
133
+ key === 'collection' && isObject(item)
134
+ ? Object.fromEntries(
135
+ Object.entries(item).map(([name, entry]) => [
136
+ name,
137
+ nameIndexes(entry, names, nameFor, name),
138
+ ]),
139
+ )
140
+ : nameIndexes(item, names, nameFor, collection),
141
+ ]),
142
+ );
143
+ }
144
+
145
+ function hasUnnamedIndex(contract: JsonObject): boolean {
146
+ const found: { readonly collection: string; readonly index: JsonObject }[] = [];
147
+ indexesOf(contract, found);
148
+ return found.some(({ index }) => !('name' in index));
149
+ }
150
+
151
+ function sortKeys(value: unknown): unknown {
152
+ if (Array.isArray(value)) return value.map(sortKeys);
153
+ if (!isObject(value)) return value;
154
+ return Object.fromEntries(
155
+ Object.keys(value)
156
+ .sort()
157
+ .map((key) => [key, sortKeys(value[key])]),
158
+ );
159
+ }
160
+
161
+ /** The contract in the layout it had: one line with sorted keys, as snapshots are written, or indented by two. */
162
+ function serializeLike(original: string, value: unknown): string {
163
+ const trailingNewline = original.endsWith('\n') ? '\n' : '';
164
+ const singleLine = !original.trimEnd().includes('\n');
165
+ return `${singleLine ? JSON.stringify(sortKeys(value)) : JSON.stringify(value, null, 2)}${trailingNewline}`;
166
+ }
167
+
168
+ const INDEX_KIND = /readonly kind: (['"])mongo-index\1;?(\n[ \t]*)?/g;
169
+
170
+ /** The declarations with `readonly name` added after each index's `readonly kind`, or undefined when their indexes are not the JSON's. */
171
+ function nameIndexTypes(declarations: string, names: readonly string[]): string | undefined {
172
+ const matches = [...declarations.matchAll(INDEX_KIND)];
173
+ if (matches.length !== names.length) return undefined;
174
+ let rewritten = '';
175
+ let from = 0;
176
+ matches.forEach((match, position) => {
177
+ const quote = match[1];
178
+ const name = `readonly name: ${quote}${names[position]}${quote}`;
179
+ const lineBreak = match[2];
180
+ const kindEnd = match.index + match[0].length - (lineBreak?.length ?? 0);
181
+ if (lineBreak === undefined) {
182
+ const kind = declarations.slice(match.index, kindEnd).replace(/;$/, '');
183
+ rewritten += `${declarations.slice(from, match.index)}${kind}; ${name}${match[0].endsWith(';') ? ';' : ''}`;
184
+ } else {
185
+ const indent = declarations.slice(
186
+ declarations.lastIndexOf('\n', match.index) + 1,
187
+ match.index,
188
+ );
189
+ rewritten += `${declarations.slice(from, kindEnd)}\n${indent}${name};`;
190
+ }
191
+ from = kindEnd;
192
+ });
193
+ return rewritten + declarations.slice(from);
194
+ }
195
+
196
+ function writeFile(path: string, content: string): void {
197
+ const temporary = `${path}${TEMPORARY_SUFFIX}`;
198
+ writeFileSync(temporary, content);
199
+ renameSync(temporary, path);
200
+ }
201
+
202
+ function isSnapshot(path: string): boolean {
203
+ return path.split(sep).includes('snapshots');
204
+ }
205
+
206
+ /** The folder a snapshot's project is in: the one that holds the `migrations` folder its `snapshots` folder is in. */
207
+ function migrationsParentOf(snapshotPath: string): string {
208
+ const parts = snapshotPath.split(sep);
209
+ const snapshots = parts.lastIndexOf('snapshots');
210
+ return parts.slice(0, Math.max(snapshots - 1, 1)).join(sep) || sep;
211
+ }
212
+
213
+ function keysText(index: JsonObject): string {
214
+ const keys = Array.isArray(index['keys']) ? index['keys'] : [];
215
+ return keys
216
+ .map((key) => (isObject(key) ? `${String(key['field'])}: ${String(key['direction'])}` : ''))
217
+ .join(', ');
218
+ }
219
+
220
+ function main(): number {
221
+ const root = resolve(process.argv[2] ?? '.');
222
+ const files: string[] = [];
223
+ const links: string[] = [];
224
+ walk(root, files, links);
225
+ const contracts: {
226
+ readonly path: string;
227
+ readonly original: string;
228
+ readonly contract: JsonObject;
229
+ }[] = [];
230
+ for (const path of files.sort()) {
231
+ const original = readFileSync(path, 'utf8');
232
+ let contract: unknown;
233
+ try {
234
+ contract = JSON.parse(original);
235
+ } catch {
236
+ continue;
237
+ }
238
+ if (isObject(contract) && contract['targetFamily'] === 'mongo') {
239
+ contracts.push({ path, original, contract });
240
+ }
241
+ }
242
+ const emittedContracts = contracts.filter(
243
+ ({ path, contract }) => !isSnapshot(path) && !hasUnnamedIndex(contract),
244
+ );
245
+
246
+ /** The names the emitted contracts of the nearest folder up from `start` that holds any give their indexes, going no higher than the first folder with a `package.json`. */
247
+ const projectNames = (
248
+ start: string,
249
+ ): { readonly folder: string; readonly names: EmittedNames } => {
250
+ for (let folder = start; ; folder = dirname(folder)) {
251
+ const inFolder = emittedContracts.filter(({ path }) => path.startsWith(`${folder}${sep}`));
252
+ const projectRoot = existsSync(join(folder, 'package.json'));
253
+ if (inFolder.length > 0 || projectRoot || folder === root || folder === dirname(folder)) {
254
+ const names: EmittedNames = new Map();
255
+ for (const { contract } of inFolder) recordEmittedNames(contract, names);
256
+ return { folder, names };
257
+ }
258
+ }
259
+ };
260
+
261
+ const changed: string[] = [];
262
+ const notes: string[] = [];
263
+ const warnings: string[] = links.map(
264
+ (link) =>
265
+ `${relative(root, link)}: is a symbolic link, so the script did not read it; if it holds migration snapshots, run the script on the folder it points to.`,
266
+ );
267
+ for (const { path, original, contract } of contracts) {
268
+ const project = projectNames(isSnapshot(path) ? migrationsParentOf(path) : dirname(path));
269
+ const nameFor: NameFor = (collection, index) => {
270
+ const fallback = defaultName(index['keys']);
271
+ const emitted = project.names.get(contentKey(collection, index)) ?? [];
272
+ const [only] = emitted;
273
+ if (emitted.length === 1 && only !== undefined) return only;
274
+ const where = `${relative(root, path)}: the index on { ${keysText(index)} } in collection "${collection}"`;
275
+ notes.push(
276
+ emitted.length === 0
277
+ ? `${where} is in no emitted contract under ${relative(root, project.folder) || '.'}; named ${fallback} after its keys.`
278
+ : `${where} is named ${emitted.join(' and ')} by the emitted contracts under ${relative(root, project.folder) || '.'}; named ${fallback} after its keys.`,
279
+ );
280
+ return fallback;
281
+ };
282
+ const names: string[] = [];
283
+ const rewritten = nameIndexes(contract, names, nameFor);
284
+ if (names.length === 0) continue;
285
+ writeFile(path, serializeLike(original, rewritten));
286
+ changed.push(path);
287
+
288
+ const declarationsPath = path.replace(/\.json$/, '.d.ts');
289
+ let declarations: string;
290
+ try {
291
+ declarations = readFileSync(declarationsPath, 'utf8');
292
+ } catch {
293
+ continue;
294
+ }
295
+ const namedDeclarations = nameIndexTypes(declarations, names);
296
+ if (namedDeclarations === undefined) {
297
+ warnings.push(
298
+ `${relative(root, declarationsPath)}: could not match its index types with ${relative(root, path)}. Add readonly name: '<name>' to each index type by hand.`,
299
+ );
300
+ continue;
301
+ }
302
+ writeFile(declarationsPath, namedDeclarations);
303
+ changed.push(declarationsPath);
304
+ }
305
+
306
+ for (const path of changed) console.log(relative(root, path));
307
+ for (const note of notes) console.log(note);
308
+ for (const warning of warnings) console.error(warning);
309
+ console.log(
310
+ changed.length === 0
311
+ ? 'Nothing to change.'
312
+ : `Rewrote ${changed.length} file${changed.length === 1 ? '' : 's'}.`,
313
+ );
314
+ return warnings.length === 0 ? 0 : 1;
315
+ }
316
+
317
+ process.exitCode = main();
@@ -0,0 +1,319 @@
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 requires `@prisma/cli-engine@0.10.0` (up from 0.9.0). A project that depends on `@prisma/cli-engine` itself 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: prisma-7-commands-answer-v7-command
14
+ summary: |
15
+ A Prisma 7 command the ORM answers, such as `prisma migrate dev`, now fails with `CLI.V7_COMMAND` instead of `CLI.COMMAND_MOVED`, still with exit code 2.
16
+ - id: planner-warnings-json-field
17
+ summary: |
18
+ In `--json` output, `db update` and `db init` list the planner's warnings under `plannerWarnings` instead of `warnings`, as `migration plan` does.
19
+ - id: mongo-fields-take-a-type
20
+ summary: |
21
+ 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`. 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.
22
+ detection:
23
+ glob: "**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx}"
24
+ matches:
25
+ - '(?<![\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"])'
26
+ - '(?<![\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"])'
27
+ script: ./scripts/mongo-type-helpers/rewrite-mongo-field-types.ts
28
+ - id: mongo-date-is-a-calendar-date
29
+ summary: |
30
+ 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.
31
+ detection:
32
+ glob: "**/*.{prisma,ts,mts,cts,tsx,js,mjs,cjs,jsx}"
33
+ matches:
34
+ - '(?<![\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$])'
35
+ - '(?<![\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*\('
36
+ - '(?<![\s\S])(?=[\s\S]*[\x27"]@prisma/orm-mongo/config[\x27"])[\s\S]*(?<![\w$])contract\s*:\s*[\x27"][^\x27"]+?(?<!\.ts)[\x27"]'
37
+ script: ./scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts
38
+ - id: temporal-polyfill-is-a-peer-dependency-of-mongo
39
+ summary: |
40
+ `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`). A project that installs with Yarn must add `temporal-polyfill` (`^1.0.4`) to its own dependencies.
41
+ detection:
42
+ glob: "**/yarn.lock"
43
+ contains:
44
+ - "@prisma/orm-mongo@"
45
+ - "@prisma/orm-target-mongo@"
46
+ anyMatch: true
47
+ - id: temporal-polyfill-with-legacy-peer-deps
48
+ summary: |
49
+ npm does not install peer dependencies when `legacy-peer-deps` is set, so a MongoDB project that installs with npm and that setting must add `temporal-polyfill` (`^1.0.4`) to its own dependencies, as a Yarn project must. The MongoDB control plane imports it. 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.
50
+ detection:
51
+ glob: "**/package.json"
52
+ contains:
53
+ - '"@prisma/orm-mongo"'
54
+ - '"@prisma/orm-target-mongo"'
55
+ anyMatch: true
56
+ - id: mongo-validator-change-checks-documents
57
+ summary: |
58
+ A MongoDB validator change that `migration plan` or `db update` writes now checks the documents first, and the apply stops while a document does not fit the new validator. Existing `migration.ts` files are unchanged.
59
+ - id: mongo-type-change-is-asked
60
+ summary: |
61
+ A MongoDB field type change that can lose values is now a question, answered with `--convert` or `--delete`, as on SQL. A cast that keeps every value, such as `Int` to `Int64`, is planned with nothing asked.
62
+ - id: mongo-new-required-field-gets-temporary-value
63
+ summary: |
64
+ A new required MongoDB field is now filled with a temporary value in the documents that lack it, as on SQL, unless `--backfill` names it.
65
+ - id: create-extension-not-exported
66
+ summary: |
67
+ `@prisma/orm-postgres/migration` no longer exports 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.
68
+ detection:
69
+ glob: "**/migration.{ts,mts}"
70
+ matches:
71
+ - '(?<![\w$.])createExtension\s*\('
72
+ - '\bimport\s*\{[^}]*(?<![\w$])createExtension(?![\w$])[^}]*\}\s*from\s*[\x27"]@prisma/orm-postgres/migration[\x27"]'
73
+ - id: data-transform-not-exported
74
+ summary: |
75
+ `@prisma/orm-postgres/migration` no longer exports 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.
76
+ detection:
77
+ glob: "**/migration.{ts,mts}"
78
+ matches:
79
+ - '\bimport\s*\{[^}]*(?<![\w$])dataTransform(?![\w$])[^}]*\}\s*from\s*[\x27"]@prisma/orm-postgres/migration[\x27"]'
80
+ - id: raw-parts-hold-statement-asts
81
+ summary: |
82
+ The `parts` of `RawExpr` and `RawQueryAst` (from `@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`.
83
+ detection:
84
+ glob: "**/*.{ts,mts,cts,tsx}"
85
+ matches:
86
+ - '(?<![\s\S])(?=[\s\S]*@prisma/orm-family-sql/relational-core/(?:ast|expression)[\x27"])(?=[\s\S]*(?<![\w$])(?:RawExpr|RawQueryAst|RawPart)(?![\w$]))[\s\S]*\.parts(?![\w$])'
87
+ - id: mysql-explicit-isolation-default
88
+ summary: Configure ReadCommitted explicitly if MySQL callbacks relied on the previous session-wide override.
89
+ - id: contract-artifacts-restamp
90
+ summary: |
91
+ An extension that writes its own package version into the contracts it emits, such as the Supabase extension, now writes 8.0.0-rc.24. Run `contract emit` once after upgrading so the emitted `contract.json` and `contract.d.ts` match the installed extension.
92
+ detection:
93
+ glob: "**/contract.json"
94
+ contains:
95
+ - '"version": "8.0.0-rc.23"'
96
+ ---
97
+
98
+ # 8.0.0-rc.23 → 8.0.0-rc.24 — User upgrade instructions
99
+
100
+ ## Order of the steps
101
+
102
+ Do the steps in this order, and skip a step that does not apply to the project:
103
+
104
+ 1. Upgrade the Prisma packages. A project that depends on `@prisma/cli-engine` itself moves it to `0.10.0` (`engine-pin-moves-to-0-10-0`). A MongoDB project that installs with Yarn, or with npm and `legacy-peer-deps`, adds `temporal-polyfill` to its dependencies (`temporal-polyfill-is-a-peer-dependency-of-mongo`, `temporal-polyfill-with-legacy-peer-deps`).
105
+ 2. Change the MongoDB contract sources. Run the field-types script first (`mongo-fields-take-a-type`), then the date-types script (`mongo-date-is-a-calendar-date`). The first script writes `field.date()` as `field.scalar(type.DateTime())`, so the second has nothing left to do for it; the second rewrites `Date` to `DateTime` in MongoDB schemas.
106
+ 3. Run `prisma contract emit` and commit what it writes. The MongoDB contracts must not change; the only change to expect is the extension version stamp (`contract-artifacts-restamp`).
107
+ 4. In PostgreSQL `migration.ts` files, call `this.createExtension(...)` and `this.dataTransform(...)` instead of the free functions (`create-extension-not-exported`, `data-transform-not-exported`). Existing `ops.json` files do not change.
108
+ 5. Change the remaining code: MySQL callback transactions that relied on READ COMMITTED (`mysql-explicit-isolation-default`), code that walks the `parts` of a raw SQL node (`raw-parts-hold-statement-asts`), and scripts that read the CLI's `--json` planner warnings or check for `CLI.COMMAND_MOVED` (`planner-warnings-json-field`, `prisma-7-commands-answer-v7-command`).
109
+ 6. On MongoDB, the next `migration plan` or `db update` checks documents against a changed validator, asks about field type changes that can lose values, and fills new required fields with a temporary value. Read those three entries before planning the next schema change (`mongo-validator-change-checks-documents`, `mongo-type-change-is-asked`, `mongo-new-required-field-gets-temporary-value`).
110
+
111
+
112
+ ## The CLI moves to `@prisma/cli-engine` 0.10.0 and answers Prisma 7 commands with `CLI.V7_COMMAND`
113
+
114
+ ### `engine-pin-moves-to-0-10-0`
115
+
116
+ 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. Projects assembled by the `prisma` CLI resolve the engine automatically.
117
+
118
+ ### `prisma-7-commands-answer-v7-command`
119
+
120
+ `prisma generate`, `validate`, `format`, `studio`, `db pull`, `db push`, `db seed`, `db execute` and the six `prisma migrate` commands fail with `CLI.V7_COMMAND`. The error names the Prisma 8 commands to run instead and their `--help`, or links the CLI docs when Prisma 8 has no equivalent. A script that checks for `CLI.COMMAND_MOVED` after running one of these commands checks for `CLI.V7_COMMAND` instead.
121
+
122
+
123
+ ## The CLI's `--json` output lists planner warnings under `plannerWarnings`
124
+
125
+ ### `planner-warnings-json-field`
126
+
127
+ A script that reads the planner's warnings from the `--json` result of `db update` or `db init` reads `plannerWarnings` instead of `warnings`. Each entry is unchanged: `kind`, `summary` and `why`. `migration plan --json` lists them under `plannerWarnings` too, and its `warnings` keeps its own messages, such as a default origin that forks the migration graph.
128
+
129
+
130
+ ## MongoDB fields take a type from `type`
131
+
132
+ ```ts
133
+ // Before
134
+ export const contract = defineContract({}, ({ field, model }) => ({
135
+ models: {
136
+ Doc: model('Doc', {
137
+ fields: {
138
+ _id: field.objectId(),
139
+ embedding: field.vector({ typeParams: { length: 3 } }),
140
+ raw: field.scalar('mongo/bson@1'),
141
+ },
142
+ }),
143
+ },
144
+ }));
145
+
146
+ // After
147
+ export const contract = defineContract({}, ({ field, model, type }) => ({
148
+ models: {
149
+ Doc: model('Doc', {
150
+ fields: {
151
+ _id: field.scalar(type.ObjectId()),
152
+ embedding: field.scalar(type.Vector(3)),
153
+ raw: field.scalar(type.Bson()),
154
+ },
155
+ }),
156
+ },
157
+ }));
158
+ ```
159
+
160
+ ### `mongo-fields-take-a-type`
161
+
162
+ Commit your work first. The script reads your code with the TypeScript compiler, so the project needs `typescript` installed; a JavaScript project adds it as a dev dependency for the run. From the project root, run:
163
+
164
+ ```sh
165
+ node <path-to-this-guide>/scripts/mongo-type-helpers/rewrite-mongo-field-types.ts
166
+ ```
167
+
168
+ 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()`.
169
+
170
+ A field written with an extension's codec id, such as `field.scalar('shout/text@1')`, is one the script reports: write the type constructor the extension contributes, such as `field.scalar(type.shout.Text())`.
171
+
172
+ MongoDB PSL gains `Vector` and `Vector(length)` for `mongo/vector@1`, which had no PSL name before. It now reads the arguments of a type call, so `Vector(3)` keeps its length. A type that takes no arguments, written with one, such as `String(5)`, used to have the argument ignored and is now refused with a message naming the argument; remove the argument.
173
+
174
+
175
+ ## MongoDB: `Date` is a calendar date, and `temporal-polyfill` is a peer dependency
176
+
177
+ ### `mongo-date-is-a-calendar-date`
178
+
179
+ ```prisma
180
+ // Before: an instant
181
+ model Order {
182
+ id ObjectId @id @map("_id")
183
+ paidAt Date
184
+ }
185
+
186
+ // After: the same instant, the same contract
187
+ model Order {
188
+ id ObjectId @id @map("_id")
189
+ paidAt DateTime
190
+ }
191
+ ```
192
+
193
+ MongoDB now has the convenience date and time types PostgreSQL, SQLite and MySQL have. `Date` is the calendar date, so a field that holds an instant must be written `DateTime`. Commit your work first, then from the project root run:
194
+
195
+ ```sh
196
+ node <path-to-this-guide>/scripts/mongo-convenience-date-time-types/rewrite-mongo-date-types.ts
197
+ ```
198
+
199
+ It rewrites `Date` to `DateTime` in MongoDB schemas, including in `types {}` aliases, and `type.Date()` to `type.DateTime()` in MongoDB TypeScript contracts. No release had `type.Date()` for an instant, because MongoDB's `type` helpers ship in this release too; the script rewrites it for a contract written against an unreleased build that already had them. Pass files or directories to limit it. Fix by hand each line it reports, then run `prisma contract emit`: the contract must not change.
200
+
201
+ A field you miss still compiles. Its TypeScript type becomes `string`, and reading a document whose value has a time of day fails with an error that names the field. Worse, `@onCreate(now())` or `@onUpdate(now())` on it writes today's date at midnight UTC, losing the time, with no error, so check every generated timestamp field. A field that really holds a calendar date can stay `Date`, if every stored value is at midnight UTC; it then reads `"2024-02-29"` instead of a `Date`. A Prisma 6 schema read with `prisma6Schema` is not rewritten: its `DateTime` and `DateTime @db.Date` stay instants read as a JavaScript `Date`.
202
+
203
+ ### `temporal-polyfill-is-a-peer-dependency-of-mongo`
204
+
205
+ For each Yarn project that `detection` matches, add `"temporal-polyfill": "^1.0.4"` to `dependencies` in the `package.json` that depends on `@prisma/orm-mongo` or `@prisma/orm-target-mongo`, then reinstall.
206
+
207
+ ### `temporal-polyfill-with-legacy-peer-deps`
208
+
209
+ Skip this if the project installs with Yarn (see `temporal-polyfill-is-a-peer-dependency-of-mongo`), pnpm or bun. For a project 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 project's install command passes `--legacy-peer-deps`, add `"temporal-polyfill": "^1.0.4"` to that `package.json`'s `dependencies`, then reinstall.
210
+
211
+
212
+ ## MongoDB plans rewrite the documents a schema change touches
213
+
214
+ ### `mongo-validator-change-checks-documents`
215
+
216
+ Every validator change a new plan writes is `collMod(..., { ..., checkDocuments: true })`: as its own precheck, after the plan's rewrites, it checks that every document fits the new validator. When `db migrate` or `db update` stops with `MIGRATION.PRECHECK_FAILED` because documents do not fit:
217
+
218
+ 1. Find them with the `mongosh` query the error prints, and change them so they fit the new validator. The old validator is still in place and may reject a document changed to the new shape, so an update that fixes one can skip document validation: write a `dataTransform` in `migration.ts`, or in `mongosh` run an update command with `bypassDocumentValidation: true`, such as `db.runCommand({ update: "users", updates: [{ q: { _id: … }, u: { $set: { … } } }], bypassDocumentValidation: true })`. Run the command again. For a field the change makes required, `migration plan --backfill Model.field` writes a step to fill it instead.
219
+ 2. Or, under `db migrate`, apply the validator over them as before: set `checkDocuments` to `false` on that `collMod` in the migration's `migration.ts`, run the file with `node`, and run `db migrate` again. Those documents then fail their next update until they fit. `db update` writes no `migration.ts`, so there the documents must be fixed first.
220
+
221
+ Operations of the migration that ran before the validator change stay applied; a re-run skips them.
222
+
223
+ A database adopted from Prisma 6 has no validator, so its first plan adds one and checks every collection.
224
+
225
+ ### `mongo-type-change-is-asked`
226
+
227
+ Where a plan now asks about a field, answer with `--delete Model.field`, which casts the values with `$convert` and fails on a value it cannot cast (a change such as `String` to `Boolean`, where `$convert` would turn `"false"` into `true`, has no cast and offers `--convert` only), or plan it with `migration plan --convert Model.field` and write the update in the `placeholder('Model.field:update')` slot of the data transform it writes.
228
+
229
+ ### `mongo-new-required-field-gets-temporary-value`
230
+
231
+ To write your own value instead of the temporary one, plan the change with `migration plan --backfill Model.field` and write the update in the `placeholder('Model.field:update')` slot of the data transform it writes. A new required field under a unique index gets no temporary value, since every document would get the same one: on a collection with documents, the unique index build stops the apply first, because the documents that lack the field all hold `null`, and its error names `--backfill`. Plan it with `--backfill`.
232
+
233
+
234
+ ## `createExtension` and `dataTransform` are no longer free functions
235
+
236
+ ### `create-extension-not-exported`
237
+
238
+ `@prisma/orm-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.
239
+
240
+ In every `migration.ts` the detection matches, call the method and remove `createExtension` from the import:
241
+
242
+ ```ts
243
+ // Before
244
+ import { createExtension, Migration, MigrationCLI } from '@prisma/orm-postgres/migration';
245
+
246
+ override get operations() {
247
+ return [createExtension('btree_gist'), ...];
248
+ }
249
+
250
+ // After
251
+ import { Migration, MigrationCLI } from '@prisma/orm-postgres/migration';
252
+
253
+ override get operations() {
254
+ return [this.createExtension({ extension: 'btree_gist' }), ...];
255
+ }
256
+ ```
257
+
258
+ 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`.
259
+
260
+ ### `data-transform-not-exported`
261
+
262
+ `@prisma/orm-postgres/migration` no longer exports 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.
263
+
264
+
265
+ ## Raw parts can hold a statement AST
266
+
267
+ ### `raw-parts-hold-statement-asts`
268
+
269
+ `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.
270
+
271
+ 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:
272
+
273
+ ```ts
274
+ // Before
275
+ parts.map((part) => (typeof part === 'string' ? part : renderExpr(part, ctx))).join('');
276
+
277
+ // After
278
+ parts
279
+ .map((part) => {
280
+ if (typeof part === 'string') {
281
+ return part;
282
+ }
283
+ switch (part.kind) {
284
+ case 'select':
285
+ return renderSelect(part, ctx);
286
+ case 'insert':
287
+ return renderInsert(part, ctx);
288
+ case 'update':
289
+ return renderUpdate(part, ctx);
290
+ case 'delete':
291
+ return renderDelete(part, ctx);
292
+ default:
293
+ return renderExpr(part, ctx);
294
+ }
295
+ })
296
+ .join('');
297
+ ```
298
+
299
+ 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.
300
+
301
+ `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.
302
+
303
+
304
+ ## Preserve an intentional MySQL callback isolation choice
305
+
306
+ ### `mysql-explicit-isolation-default`
307
+
308
+ MySQL no longer sets every session to READ COMMITTED. Unconfigured explicit callback transactions now use the server/session default. If application code relied on the previous override, add `transactionOptions: { isolationLevel: 'ReadCommitted' }` to its MySQL client factory, or pass `{ isolationLevel: 'ReadCommitted' }` as the second argument to the relevant `transaction(callback, options)` calls.
309
+
310
+ You can also import `{ IsolationLevel }` from `@prisma/orm-mysql/runtime` and use `IsolationLevel.ReadCommitted` in either position. This optional constant syntax does not require migrating existing strings.
311
+
312
+ A defined per-call level overrides the factory level. An omitted or undefined level inherits it; null does not reset defaults and is rejected. ORM-owned implicit transactions continue to use ReadCommitted, independently of callback options. Manual lower-level transactions do not inherit factory defaults.
313
+
314
+ Verify behavior against the deployment's configured database default and concurrent transactions. Do not assume the server default is RepeatableRead. This change does not introduce batch transactions, timeout/maxWait options, P2028 handling or retry behavior.
315
+
316
+
317
+ ## `contract-artifacts-restamp`
318
+
319
+ For every `contract.json` matched by `detection`, run the project's emit command (`prisma contract emit`, or the project's `contract:emit` script) once after upgrading. This entry accounts for the extension's embedded `version` moving to `8.0.0-rc.24`; any other difference in the emitted files comes from an earlier entry in this guide.