@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,234 @@
1
+
2
+ # Prisma 8 — Supabase
3
+
4
+ > **Edit your data contract. Prisma handles the rest.**
5
+
6
+ This skill covers using Prisma 8 against a **Supabase** project end-to-end: composing the Supabase extension pack, referencing Supabase-owned tables from your contract, authoring row-level-security (RLS) policies, and running role-bound queries through the `supabase()` runtime.
7
+
8
+ ## When to Use
9
+
10
+ - User has a Supabase project (or wants one) and is wiring Prisma 8 into it.
11
+ - User wants RLS policies on their tables (`policy_select`, `@@rls`, `auth.uid()`).
12
+ - User wants per-request role binding (`asUser(jwt)`, `asAnon()`, `asServiceRole()`).
13
+ - User wants a foreign key into `auth.users` (cross-space FK).
14
+ - User wants to read Supabase-internal tables (`auth.*`, `storage.*`) as an admin.
15
+ - User mentions: *supabase, RLS, row level security, policy, anon, authenticated, service_role, auth.users, auth.uid(), JWT, jwtSecret, jwksUrl, SUPABASE.JWT_INVALID, RoleBoundDb, session pooler*.
16
+
17
+ ## When Not to Use
18
+
19
+ - General contract editing (models, fields, relations) → `references/contract.md`.
20
+ - Non-Supabase `db.ts` wiring, middleware, teardown → `references/runtime.md`.
21
+ - General query shapes (filtering, includes, aggregates) → `references/queries.md` — everything there applies to a role-bound `db` too.
22
+ - Migration planning / applying → `references/migrations.md`.
23
+
24
+ ## Key Concepts
25
+
26
+ - **The pack is an `external` contract space.** `@internal/extension-supabase/pack` ships a complete, introspection-generated contract of everything Supabase owns — the `auth` and `storage` schemas, their native enum types, and the platform roles (`anon`, `authenticated`, `service_role`) — all with control policy `external`. Composed via `extensions`, it means: the migration planner **emits no DDL** for those objects (Supabase manages them), and `db verify` **confirms they exist** in the live database. Your own tables stay `managed` as usual.
27
+ - **Roles come from the pack; you never declare them.** RLS `roles = [authenticated]` identifiers resolve against the composed contract. Pointing the runtime at a non-Supabase Postgres fails verify with a `not-found` issue naming the missing role — the common "wrong database" misconfiguration surfaces before queries run.
28
+ - **The runtime is role-first.** `supabase()` returns a `SupabaseDb` with **no top-level query surface** — there is no `db.sql` / `db.orm` until you bind a role. `await db.asUser(jwt)` / `db.asAnon()` / `db.asServiceRole()` each return a `RoleBoundDb` exposing `.sql`, `.orm`, `.raw`, `.prepare(...)`, `.query(plan)` (rows), `.execute(plan)` (affected count), `.enums`, `.nativeEnums`, and `.transaction(fn)`. This is deliberate: in a Supabase app there is no meaningful "no role" execution context, and defaulting to the connection's login role is a silent-RLS-bypass footgun.
29
+ - **Role binding is below middleware and cannot leak.** Each role-bound query runs on a connection that had `set_config('role', …)` and `set_config('request.jwt.claims', …)` applied beneath the user-middleware chain, with `RESET ALL` on release. Postgres-side `auth.uid()` / `auth.jwt()` read those session vars — RLS enforcement is Postgres's job; the runtime's job is binding the context.
30
+ - **RLS is enforced by policies *and* grants.** Policies filter *rows*; `GRANT` controls *table access*. Prisma 8 authors and migrates the policies; it does not author grants (see *What Prisma 8 doesn't do yet*). A role with policies but no `GRANT` gets a permission error, not filtered rows. On Supabase your `public` tables already carry the platform-role grants via default privileges — the grant that is actually missing out of the box is `service_role`'s on `auth.*` / `storage.*` (see *Workflow — Grants*).
31
+ - **JWT validation is eager and configurable — current Supabase projects need `jwksUrl`.** `asUser(jwt)` verifies the token (via `jose`) *before* any connection is acquired: signature + expiry against `jwksUrl` (asymmetric signing keys — **the default on current Supabase projects**, which sign ES256) **xor** `jwtSecret` (the symmetric HS256 secret — legacy projects only). Both or neither → a structured error with code `SUPABASE.CONFIG_INVALID`. Bad tokens throw a structured error with code `SUPABASE.JWT_INVALID` and a typed `meta.reason` — including a mismatch between the token's algorithm and the configured key source (an ES256 token against a `jwtSecret` client names the problem and tells you to switch to `jwksUrl`). The Postgres role is derived from the token's `role` claim (defaults to `authenticated`). Note: `supabase status` still prints a `JWT_SECRET` even on projects that sign ES256 — its presence does not mean your project uses it.
32
+ - **Admin access to `auth.*` / `storage.*` is a secondary root on `service_role` only — and needs a one-time grant.** `db.asServiceRole().supabase` exposes the pack's own contract (`.sql`, `.orm`, `.nativeEnums`, `.execute`). The root exists only on `service_role` by design, but a real Supabase project grants `service_role` **no table privileges** on `auth.*` / `storage.*` (only schema `USAGE`; only `postgres` holds table grants). Before the admin root can read a Supabase-internal table, run the narrow grant once (see *Workflow — Grants*). `asUser` / `asAnon` have no `.supabase`, and the primary `asServiceRole().sql` / `.orm` stay scoped to *your* contract.
33
+
34
+ ## Workflow — Wire the pack into the config
35
+
36
+ The concept: the pack registers the Supabase contract space so your contract can reference it and the planner/verifier know what Supabase owns. Its descriptor is the `pack` export and it goes into the ordinary `extensions` array of the target config, inside the standard envelope (see `references/contract.md` § *Key Concepts*). The block mirrors `examples/supabase/prisma.config.ts`:
37
+
38
+ ```typescript
39
+ // prisma.config.ts
40
+ import { definePrismaConfig } from '@prisma/cli-engine';
41
+ import supabasePack from '@internal/extension-supabase/pack';
42
+ import { defineConfig as ormConfig } from '@internal/postgres/config';
43
+
44
+ export default definePrismaConfig({
45
+ orm: ormConfig({
46
+ contract: './src/contract.prisma',
47
+ extensions: [supabasePack],
48
+ migrations: { dir: 'migrations' },
49
+ }),
50
+ });
51
+ ```
52
+
53
+ ## Workflow — Contract: FK into `auth.users` + RLS policies
54
+
55
+ The concept: your models live in your namespaces (`public`); Supabase's live in the pack's (`auth`, `storage`). A relation field typed `supabase:auth.AuthUser` is a **cross-space FK** — the planner emits `REFERENCES "auth"."users"("id")`, and the target table is verified, never migrated. RLS policies are top-level `policy_<operation>` blocks in the same namespace as their target model, and the target model must opt in with `@@rls`. Mirror `examples/supabase/src/contract.prisma`:
56
+
57
+ ```prisma
58
+ namespace public {
59
+ model Profile {
60
+ id Uuid @id @onCreate(uuid())
61
+ username String
62
+ userId Uuid @unique
63
+ user supabase:auth.AuthUser @relation(fields: [userId], references: [id], onDelete: Cascade)
64
+ @@map("profile")
65
+ @@rls
66
+ }
67
+
68
+ // authenticated may read only their own profile.
69
+ policy_select profile_owner_read {
70
+ target = Profile
71
+ roles = [authenticated]
72
+ using = sql`"userId"::uuid = auth.uid()`
73
+ }
74
+
75
+ // anon may read every profile (a public directory listing).
76
+ policy_select profile_public_read {
77
+ target = Profile
78
+ roles = [anon]
79
+ using = sql`true`
80
+ }
81
+
82
+ // authenticated may update only their own profile, and may not
83
+ // reassign it to another owner (WITH CHECK).
84
+ policy_update profile_owner_write {
85
+ target = Profile
86
+ roles = [authenticated]
87
+ using = sql`"userId"::uuid = auth.uid()`
88
+ withCheck = sql`"userId"::uuid = auth.uid()`
89
+ }
90
+ }
91
+ ```
92
+
93
+ The `Uuid` constructor selects native UUID storage in type position. The legacy `@db.Uuid` spelling is removed; rewrite any `String @db.Uuid` alias or field as `Uuid` before emitting.
94
+
95
+ The pieces:
96
+
97
+ - **Per-operation policy blocks**: `policy_select`, `policy_insert`, `policy_update`, `policy_delete`, `policy_all`. Body is `key = value`: `target` (a model in this namespace), `roles` (resolve against the composed contract — the pack supplies `anon` / `authenticated` / `service_role`), `using`, and (for write operations) `withCheck`. `using` and `withCheck` are `sql` literals, as in `` using = sql`"userId"::uuid = auth.uid()` ``; a quoted string is refused, and the error message gives the rewrite. Multiple permissive policies per `(target, operation)` are valid — Postgres ORs them. A block may also carry `@@map("physical name")` to adopt an existing live policy under its exact name (no wire-name hash; drift detection then byte-compares the body against Postgres's reprint, so keep the text as captured — hand-authoring it warns).
98
+ - **`@@rls` is required on policy targets.** A `policy_*` block whose target model lacks `@@rls` fails emit with `PSL_EXTENSION_TARGET_MODEL_MISSING_ATTRIBUTE`. A model with `@@rls` and *no* policies is also meaningful: RLS enabled, deny-all.
99
+ - **Predicates are `sql` literals holding verbatim SQL.** Quote camelCase column names inside them with ordinary double quotes (`"userId"`; inside a backtick `sql` literal the only escapes are `` \` `` and `\\`), and cast where needed — `auth.uid()` returns `uuid`. Renames in your contract do not rewrite predicate bodies.
100
+ - **TS-builder parity exists.** `@internal/postgres/contract-builder` exports `policySelect` / `policyInsert` / `policyUpdate` / `policyDelete` / `policyAll`, `rlsEnabled(Model)`, and `role('anon')` — mirroring the PSL lowering key-for-key (identical emitted wire names). PSL is the canonical path shown here.
101
+
102
+ Emit + migrate as usual (`prisma contract emit`, then `references/migrations.md`). The plan creates your table, its FK, `ENABLE ROW LEVEL SECURITY`, and the `CREATE POLICY` statements — and **no DDL for `auth.*`**.
103
+
104
+ ## Workflow — `db.ts` with the `supabase()` factory
105
+
106
+ The concept: instead of the stock `postgres()` factory, a Supabase app builds its client with `supabase()` from the extension's `/runtime` subpath. The factory is **async** (it prepares JWT key material — including the one-time JWKS fetch when `jwksUrl` is set), and the result is role-first.
107
+
108
+ ```typescript
109
+ // src/prisma/db.ts
110
+ import { supabase } from '@internal/extension-supabase/runtime';
111
+ import { contractFromJson } from '@internal/postgres/static';
112
+ import type { Contract } from './contract.d';
113
+ import contractJson from './contract.json' with { type: 'json' };
114
+
115
+ export const contract = contractFromJson<Contract>(contractJson);
116
+
117
+ export const db = await supabase({
118
+ contract,
119
+ url: process.env['DATABASE_URL'], // direct Postgres connection — see pitfalls
120
+ jwksUrl: process.env['SUPABASE_JWKS_URL'], // https://<project-ref>.supabase.co/auth/v1/.well-known/jwks.json
121
+ // Legacy HS256 projects use jwtSecret: process.env['SUPABASE_JWT_SECRET'] instead — exactly one of the two.
122
+ });
123
+ ```
124
+
125
+ Options beyond the basics: `middleware` (same composition as `postgres()` — see `references/runtime.md`; middleware never sees the role-binding `set_config` calls), `poolOptions`, `pg` (BYO `pg.Pool` instead of `url`; a `pg.Client` is rejected with `SUPABASE.CONFIG_INVALID`). Teardown is `await db.close()` / `await using` exactly as in `references/runtime.md` — the same script-hang rules apply.
126
+
127
+ ## Workflow — Role-bound queries
128
+
129
+ The concept: bind the role that should execute the request, then query through the returned `RoleBoundDb` — every query surface from `references/queries.md` works, RLS-filtered by Postgres.
130
+
131
+ ```typescript
132
+ // A signed-in user: rows are RLS-scoped to the JWT's auth.uid().
133
+ const userDb = await db.asUser(jwt); // async — rejects with code SUPABASE.JWT_INVALID on a bad/expired token
134
+ const mine = await userDb.orm.public.Profile.select('id', 'username').all();
135
+
136
+ // The anon role: sees what anon policies permit.
137
+ const listing = await db.asAnon().orm.public.Profile.select('id', 'username').all();
138
+
139
+ // service_role: BYPASSRLS — sees everything in YOUR contract.
140
+ const all = await db.asServiceRole().orm.public.Profile.select('id', 'username').all();
141
+
142
+ // Writes ride the same surfaces; RLS filters them too. An UPDATE against
143
+ // another owner's row affects 0 rows; a withCheck violation raises an error.
144
+ const updated = await userDb.orm.public.Profile
145
+ .where({ userId: me })
146
+ .updateAndCount({ username: 'new-name' });
147
+ ```
148
+
149
+ Notes: `asAnon()` / `asServiceRole()` are sync; only `asUser` is async. Multi-namespace contracts address models by coordinate (`orm.public.Profile`, `sql.public.profile`) — see `references/queries.md` § *Namespace-aware accessors*. `RoleBoundDb.transaction(fn)` wraps work in a transaction on the role-bound session; its `tx` offers `sql`, `orm` (with the client's custom collection classes), `raw`, `prepare`, `query`, `execute`, `enums` and `nativeEnums`, and runs every statement under the bound role. A prepared statement runs on what it is given: `ps.query(userDb, params)` runs under that client's role, and `ps.query(tx, params)` runs inside the transaction.
150
+
151
+ ## Workflow — Admin reads of `auth.*` / `storage.*`
152
+
153
+ The concept: Supabase-internal tables are not part of your contract, so they are not on your query surfaces. The `service_role` binding carries a **secondary root** — `db.asServiceRole().supabase` — which is the *pack's* contract surface:
154
+
155
+ ```typescript
156
+ const admin = db.asServiceRole();
157
+
158
+ // SQL builder over the pack contract — rows come from `query`, not `execute`:
159
+ const users = await admin.supabase.query(
160
+ admin.supabase.sql.auth.users.select('id', 'email').build(),
161
+ );
162
+
163
+ // ORM over the pack contract:
164
+ const sessions = await admin.supabase.orm.auth.AuthSession.select('id', 'aal').all();
165
+
166
+ // Native enum values (e.g. auth.aal_level) come typed:
167
+ type AalLevel = (typeof admin.supabase.nativeEnums.auth.AalLevel)['Value'];
168
+ ```
169
+
170
+ **The admin root needs a one-time grant.** A real Supabase project gives `service_role` no table privileges on `auth.*` / `storage.*` — out of the box, the reads above fail with `permission denied for table users` (sqlState `42501`). Grant exactly what you read, narrowly:
171
+
172
+ ```sql
173
+ GRANT USAGE ON SCHEMA auth TO service_role;
174
+ GRANT SELECT ON TABLE auth.users TO service_role;
175
+ ```
176
+
177
+ Other boundaries to respect: `asUser` / `asAnon` have **no** `.supabase`; the admin root has **no** `.transaction` (it is a separate contract-bound runtime sharing the pool — a transaction spanning both roots is out of scope); and for user *management* (creating users, password resets) prefer the GoTrue Admin API — Supabase-internal schemas can drift across platform upgrades; direct `service_role` SQL is for ad-hoc admin reads.
178
+
179
+ ## Workflow — Grants
180
+
181
+ The concept: RLS policies are row filters on top of ordinary table privileges — a role with policies but no `GRANT` gets `permission denied`, not filtered rows. On Supabase the two directions are easy to get backwards:
182
+
183
+ - **Your own `public` tables need nothing.** Supabase ships `ALTER DEFAULT PRIVILEGES` on `public`, so tables created by `prisma db init` / `prisma db migrate` inherit full grants for `anon` / `authenticated` / `service_role` automatically — the same as dashboard-created tables. RLS policies are what actually protect the rows; do not add per-table grants, and do not narrow the defaults unless you have a reason.
184
+ - **The one grant you do need is for admin reads of Supabase-internal tables** — `service_role` has no table privileges on `auth.*` / `storage.*` (see *Admin reads* above for the narrow `GRANT USAGE` / `GRANT SELECT` pair).
185
+
186
+ Run grants via the Supabase SQL editor or `psql`. Symptom of a missing grant: `permission denied for table …` (sqlState `42501`) instead of an empty result.
187
+
188
+ ## Workflow — Connecting to a real Supabase project
189
+
190
+ The concept: the runtime needs a **direct, session-capable** Postgres connection — it binds roles with session-scoped `set_config` + `RESET ALL`.
191
+
192
+ - **Session pooler** (`aws-0-<region>.pooler.supabase.com:5432`, username `postgres.<project-ref>`) — works everywhere, IPv4. The default choice.
193
+ - **Direct connection** (`db.<project-ref>.supabase.co:5432`) — works, but is **IPv6-only** on new projects; from IPv4-only environments it fails DNS/connect.
194
+ - **Transaction pooler (port 6543) — do not use.** Transaction pooling breaks session GUCs; role binding will misbehave.
195
+
196
+ `.env` carries `DATABASE_URL` and the JWT key source. For current projects that is `SUPABASE_JWKS_URL` — `https://<project-ref>.supabase.co/auth/v1/.well-known/jwks.json` (local stack: `http://127.0.0.1:54321/auth/v1/.well-known/jwks.json`). Only legacy HS256 projects use `SUPABASE_JWT_SECRET` (Project Settings → API → JWT Secret) — and note `supabase status` prints a `JWT_SECRET` even on ES256 projects, so don't infer the mode from its presence; check the JWKS endpoint or a token's header `alg`.
197
+
198
+ ## Common Pitfalls
199
+
200
+ 1. **Using the transaction pooler (port 6543).** Session GUC role binding requires a session-capable connection — use the session pooler (5432) or the direct connection.
201
+ 2. **Wiring `jwtSecret` because `supabase status` prints a `JWT_SECRET`.** Current projects sign ES256; `asUser` then throws `SUPABASE.JWT_INVALID` explaining the token is ES256 and the client needs `jwksUrl`. Configure `SUPABASE_JWKS_URL`; reserve `jwtSecret` for legacy HS256 projects.
202
+ 3. **Grants in the wrong direction.** Your `public` tables need no grants (Supabase's default privileges cover them; RLS protects the rows) — the grant you need is the narrow `auth.*` pair for `service_role` admin reads. `permission denied` (42501) means a missing grant, not a filtered result.
203
+ 4. **Expecting `db.sql` / `db.orm` on the top-level `db`.** The Supabase db is role-first; bind a role, query the `RoleBoundDb`.
204
+ 5. **Forgetting `await`** — on the `supabase()` factory and on `asUser(jwt)`. Both are async; `asAnon()` / `asServiceRole()` are not.
205
+ 6. **Expecting `.supabase` on `asUser` / `asAnon`.** Admin access to `auth.*` is `service_role`-only by construction — and even `service_role` needs the one-time narrow grant first.
206
+ 7. **A `policy_*` block whose target lacks `@@rls`.** Emit fails with `PSL_EXTENSION_TARGET_MODEL_MISSING_ATTRIBUTE` — add `@@rls` to the model.
207
+ 8. **Unquoted camelCase columns or missing casts in predicates.** Predicates are verbatim SQL: `"userId"` needs quotes; compare uuid to `auth.uid()` with a `::uuid` cast where the column isn't already `uuid`.
208
+ 9. **Passing both `jwksUrl` and `jwtSecret`** (or neither) — the `supabase()` promise rejects with `SUPABASE.CONFIG_INVALID`. It's an async factory, so the misconfiguration surfaces as a rejection (`await` / `.catch`), not a synchronous throw.
209
+ 10. **Treating an RLS-filtered write as an error.** An `UPDATE` against a row the role can't see affects **0 rows** (no exception); only `withCheck` violations raise.
210
+
211
+ ## What Prisma 8 doesn't do yet
212
+
213
+ - **`GRANT` authoring.** Table privileges are not contract elements; the one grant a Supabase app needs (the `service_role` `auth.*` pair for admin reads) is run once by hand (SQL editor / `psql`). If you want grants managed by the contract, file via `references/feedback.md`.
214
+ - **Transactions spanning the app root and the `.supabase` admin root.** The two roots are separate contract-bound runtimes sharing one pool; a cross-root transaction is not supported.
215
+ - **Triggers / functions as contract elements.** The classic "create a profile row on signup" `auth.users` trigger is authored as raw SQL against your database, not in the contract. `auth.uid()` etc. appear only inside opaque policy predicate strings.
216
+ - **Supabase Realtime, storage uploads, PostgREST / `@supabase/supabase-js` interop, edge runtimes.** Out of scope for the extension — it speaks Postgres directly (Node.js / Bun).
217
+
218
+ ## Reference Files
219
+
220
+ - `examples/supabase` — the canonical runnable app: config, contract, `db.ts`, acceptance tests, README.
221
+ - `packages/3-extensions/supabase/README.md` — package-level reference (JWT modes, role-binding model, unsupported scope).
222
+ - `packages/3-extensions/supabase/src/runtime/supabase.ts` — the authoritative options/type surface (`SupabaseOptions`, `RoleBoundDb`, `ServiceRoleDb`).
223
+
224
+ ## Checklist
225
+
226
+ - [ ] `extensions: [supabasePack]` (the `pack` export) in `ormConfig({...})` inside `definePrismaConfig({ orm: ... })`.
227
+ - [ ] Cross-space FK typed `supabase:auth.AuthUser` with explicit `fields` / `references` (+ `onDelete` if wanted).
228
+ - [ ] Every policy target model carries `@@rls`; predicates quote camelCase columns and cast for `auth.uid()`.
229
+ - [ ] `db.ts` uses `await supabase({ contract, url, jwksUrl | jwtSecret })`, with `contract` from `contractFromJson<Contract>(contractJson)` of `@internal/postgres/static` — exactly one JWT key source; `jwksUrl` for current projects, `jwtSecret` only for legacy HS256.
230
+ - [ ] Queries go through a `RoleBoundDb` from `asUser` / `asAnon` / `asServiceRole`; `asUser` is awaited.
231
+ - [ ] `auth.*` / `storage.*` reads go through `asServiceRole().supabase` only, after the one-time narrow grant (`GRANT USAGE ON SCHEMA auth` + `GRANT SELECT` on the tables you read).
232
+ - [ ] No per-table grants added for your own `public` tables — Supabase default privileges cover them; RLS does the protecting.
233
+ - [ ] Connection is session-capable: session pooler or direct connection — never the 6543 transaction pooler.
234
+ - [ ] Did NOT confabulate a `/control` subpath, a top-level `db.sql`, `.supabase` on non-service roles, or grant authoring in the contract.
@@ -0,0 +1,102 @@
1
+ # Upgrade Prisma 8 (user app)
2
+
3
+ This reference upgrades a project that **consumes** Prisma 8 via the public package API (`@prisma/orm-postgres`, `@prisma/orm-mongo`, `@prisma/orm-sqlite`, the contract files in `prisma/`, etc.). Package names below are the published `@prisma/orm-*` names, which is what `package.json`, the lockfile, and the registry use; the other references in this skill spell import paths as `@internal/<target>`, and SKILL.md explains that mapping. If the project is itself a Prisma 8 *extension*, use [`upgrade-extension.md`](upgrade-extension.md) instead — or both, if the repo contains both an app and an extension package.
4
+
5
+ The per-transition instructions this reference reads live under [`../upgrading/app/upgrades/`](../upgrading/app/upgrades/).
6
+
7
+ ## Step 0 — Upgrade to the newest instructions, then re-read
8
+
9
+ The upgrade instructions ship inside the installed Prisma packages, so the copy on disk describes the version currently installed — not the version being upgraded *to*. Bug fixes to *old* per-transition instructions ship with each release as part of the cumulative set, so the newest copy is the one to run.
10
+
11
+ Do the version bump first (step 1 of the per-step flow below), re-sync the skills from the newly installed packages (`prisma skills sync`), and re-read this reference and the per-transition instructions before applying any code translation. If the agent runtime supports an in-session refresh, perform it after the sync; otherwise finish the session's reasoning against the re-read files.
12
+
13
+ ## Pre-flight — extension compatibility
14
+
15
+ Before changing any code, refuse to upgrade past any installed extension's pinned Prisma 8 version. Extensions in Prisma 8 pin every `@prisma/orm-*` dependency to a single exact version (no carets, no ranges); that pin is the highest version the extension has been validated against. Upgrading the user app past that pin would silently desynchronise the extension's type identity from the app's.
16
+
17
+ Steps:
18
+
19
+ 1. **Read `prisma.config.ts`** (or its TS-discoverable equivalent at the project root) and enumerate the list of extension packages it imports. Each `extensions: [...]` entry corresponds to an installed npm package.
20
+ 2. **For each extension**, read its installed `package.json` from `node_modules/<extension-package-name>/package.json` and find every `@prisma/orm-*` entry under `dependencies`, `peerDependencies`, or `optionalDependencies` (`@prisma/orm-framework`, `@prisma/orm-family-sql` or `@prisma/orm-family-mongo`, `@prisma/orm-toolchain`, and a `@prisma/orm-target-*` peer). By construction those entries are exact-version pins (e.g. `"8.0.0-rc.11"`), set when the extension author last ran their own upgrade.
21
+ 3. **Compute the lowest pinned version across all extensions.** That is the highest Prisma 8 version reachable by this app on its current extension set.
22
+ 4. **Compare to the user's target.** If the target exceeds the lowest pin, halt with a structured message naming each lagging extension and its pinned version, and offer two paths:
23
+ - (a) Wait for the lagging extension to publish a compatible release, then re-run.
24
+ - (b) Re-run with `--to=<highest-reachable>` (or whatever flag/option the user is using to set the target).
25
+
26
+ Do not auto-downgrade the target; do not skip the lagging extension; do not bump past it. If the user explicitly overrides the halt, surface the risk clearly first.
27
+
28
+ If `prisma.config.ts` is absent or names no extensions, skip the pre-flight.
29
+
30
+ ## Role detection
31
+
32
+ This flow applies when the project **consumes** Prisma 8:
33
+
34
+ - `package.json` declares `@prisma/orm-postgres`, `@prisma/orm-mongo`, or `@prisma/orm-sqlite` under `dependencies` / `devDependencies`, and
35
+ - the package is *not* itself an extension (no `@prisma/orm-framework` or other SPI package under `dependencies`/`peerDependencies`; name does not match `^@.*/extension-`; not referenced from a sibling app's `prisma.config.ts`).
36
+
37
+ If the project also matches the extension-author role, run **this** flow first and then [`upgrade-extension.md`](upgrade-extension.md) in the same session. If detection is ambiguous, ask the user.
38
+
39
+ ## Version detection
40
+
41
+ - **From-version.** Read the currently-installed Prisma 8 version from `pnpm-lock.yaml` (or `package-lock.json` / `yarn.lock`) by inspecting the resolved version of the app's Prisma packages: `@prisma/orm-postgres`, `@prisma/orm-mongo`, or `@prisma/orm-sqlite`. Do not read it from a `@prisma/orm-extension-*` package; extensions carry their own version and are handled by the pre-flight above. Compare full semver strings, prerelease identifier included: `8.0.0-rc.10` and `8.0.0-rc.11` are different versions and different steps in the chain below. If the lockfile shows the app's Prisma packages at different versions (already broken), the **lowest** is the from-version.
42
+ - **To-version.** Either the version the user specified, or whatever `npm view @prisma/orm-postgres dist-tags.latest` reports. Do not assume that is a stable version: while Prisma 8 is a release candidate, `latest` tracks the newest release, `8.0.0-rc.N` included. If the user wants a stable version specifically, they must name it.
43
+
44
+ Report both back to the user before continuing.
45
+
46
+ ## Transition chain
47
+
48
+ If the from-to delta spans more than one release (e.g. `0.6 → 0.8`), build the chain of steps between them:
49
+
50
+ ```text
51
+ 0.6 → 0.7 → 0.8
52
+ ```
53
+
54
+ The [`../upgrading/app/upgrades/`](../upgrading/app/upgrades/) directories name the steps — read the chain off the directory names rather than deriving it arithmetically. Each directory is `<from>-to-<to>`. A step normally spans one stable minor (`0.7-to-0.8`) or one release candidate (`8.0.0-rc.1-to-8.0.0-rc.2`). When intermediate versions were not published, a guide may span a larger hop; follow the available directory chain rather than inventing missing steps. Moving onto the RC line from the last stable minor is a single step of its own (`0.17-to-8.0.0-rc.1`).
55
+
56
+ Apply each step in order, fully: bump, install, run instructions, validate, commit — before moving to the next. Halt the chain on the first failed step; do not skip ahead.
57
+
58
+ The chain order does not depend on which extensions are installed; the pre-flight has already established the target is reachable.
59
+
60
+ ## Per-step flow
61
+
62
+ For each `(from, to)` step in the chain:
63
+
64
+ 1. **Bump the app's Prisma packages.** Rewrite every `@prisma/orm-postgres`, `@prisma/orm-mongo`, and `@prisma/orm-sqlite` entry in the project's `package.json` to the exact `<to>` version (no caret, no tilde). All entries advance to the same version. Cover `dependencies` and `devDependencies`. Leave `@prisma/orm-extension-*` entries unchanged: each extension pins its own Prisma version, and the pre-flight has already confirmed every installed extension supports `<to>`. The skill itself ships inside the Prisma packages, so bumping them is what updates it; there is no separate skill package to bump.
65
+
66
+ 2. **Install.** Run `pnpm install` (or the project's lockfile-managing command). The project's code is now broken against the new types — the upgrade instructions for `<from> → <to>` exist to fix it.
67
+
68
+ 3. **Read the upgrade instructions.** Re-sync the skills (`prisma skills sync`) so the tree matches the version just installed, then load `../upgrading/app/upgrades/<from>-to-<to>/instructions.md`. Parse the YAML frontmatter and pay particular attention to its `changes[]` array.
69
+
70
+ 4. **Apply each change.** When the guide's body has a section that orders the steps, such as `Order of the steps`, apply the changes in that order: it says which script runs before which, and when to sign the databases and when to plan and apply a migration. Where an entry's prose says to sign or migrate, do it at the step that section names. Otherwise take the entries in the order of `changes[]`. For each entry in `changes[]`:
71
+ - If the entry has a `detection` block (glob + content predicate), run it; skip the change if no files match. No `detection` → apply unconditionally. Run the glob over the project's own files: skip `node_modules`, and build output such as `dist`, `build`, `.next` or `out` (whatever directories the project's build writes). A match there is generated code, which the next build rewrites; editing it changes nothing. Migration snapshots under `migrations/snapshots/` are committed files, not build output, so keep them.
72
+ - How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time; each `contains` entry is a plain substring. A file is a hit when any entry matches it. Patterns may span lines, and some look at the whole file (for example, to skip a file that declares something elsewhere in it), so a line-by-line search such as `grep` or `rg` without `-U` is not the same test and can report files the pattern excludes. From a shell, `rg -U --pcre2 -l -e '<pattern>' <files>` tests whole files and gives the same hits.
73
+ - If the entry names a `script:` (a relative path next to `instructions.md`), invoke it from the project root:
74
+ - `*.ts` → the command the guide's prose gives, such as `node <script>` (Node 24 or later runs TypeScript directly); with no command in the prose, `pnpm exec tsx <skill>/upgrading/app/upgrades/<from>-to-<to>/<script>`
75
+ - `*.sh` → `bash <skill>/upgrading/app/upgrades/<from>-to-<to>/<script>`
76
+ - codemods → invoke per the script's own prose.
77
+
78
+ No `script` → follow the prose body directly.
79
+
80
+ Empty `changes[]` (placeholder shape for transitions with no user-side breaking changes) is a no-op — proceed to validation.
81
+
82
+ 5. **Validate.** Run `pnpm typecheck && pnpm test` (or the project's equivalent — the `scripts` field of the project's `package.json` is the discovery surface). If anything is red, halt the chain. Do **not** auto-roll-back; surface the failure to the user with the failing change's `id` (from the frontmatter), the file paths the change operated on, and the inferred remediation.
83
+
84
+ 6. **Commit.** One commit per step containing the `package.json` bump, lockfile churn, and any source rewrites:
85
+
86
+ ```text
87
+ chore: upgrade @prisma/orm-* to <to-version>
88
+ ```
89
+
90
+ (Or the project's own commit-message convention.) Never squash steps. The user may squash on merge; the in-flight history must be per-step so a failed step is bisectable.
91
+
92
+ Then move on to the next step.
93
+
94
+ ## When the chain is done
95
+
96
+ Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups (e.g. tests that were already red before the upgrade and still are).
97
+
98
+ ## Failure surfaces
99
+
100
+ When a step fails: surface a structured error with code `PN-UPGRADE-NNNN`, the failing change's `id`, the file paths touched (or the lockfile, or the validation command), and the inferred remediation. Do not retry automatically; do not auto-roll-back. The user can revert if they want a clean slate.
101
+
102
+ If a pre-flight halt fires, do not bump anything; the project is left unchanged.
@@ -0,0 +1,108 @@
1
+ # Upgrade Prisma 8 (extension)
2
+
3
+ This reference upgrades a project that **is** a Prisma 8 extension — a package that consumes the framework SPI (`@prisma/orm-framework`, `@prisma/orm-family-sql` or `@prisma/orm-family-mongo`, `@prisma/orm-toolchain`, with a `@prisma/orm-target-*` peer) and exposes contract / middleware / codec / migration surfaces that downstream apps install via `prisma.config.ts`.
4
+
5
+ If the project you are upgrading is a consumer **app** (it depends on `@prisma/orm-postgres`, `@prisma/orm-mongo`, or `@prisma/orm-sqlite` from its application code), use [`upgrade-app.md`](upgrade-app.md) instead — or both, if the repo contains both a consumer app and an extension package, in which case run the app flow first then this one in the same session.
6
+
7
+ The per-transition instructions this reference reads live under [`../upgrading/extension/upgrades/`](../upgrading/extension/upgrades/).
8
+
9
+ ## Step 0 — Upgrade to the newest instructions, then re-read
10
+
11
+ The upgrade instructions ship inside the installed Prisma packages, so the copy on disk describes the version currently installed — not the version being upgraded *to*. Bug fixes to *old* per-transition instructions ship with each release as part of the cumulative set, so the newest copy is the one to run.
12
+
13
+ Do the version bump first (step 1 of the per-step flow below), re-sync the skills from the newly installed packages (`prisma skills sync`), and re-read this reference and the per-transition instructions before applying any code translation.
14
+
15
+ ## Role detection
16
+
17
+ This flow applies when the project **is** a Prisma 8 extension. Heuristics:
18
+
19
+ - `package.json` declares `@prisma/orm-framework` (or another `@prisma/orm-*` SPI package) under `dependencies` or `peerDependencies`, and
20
+ - the package's `name` matches `^@.*/extension-` (the convention used by `@prisma/orm-extension-pgvector`, etc.), or
21
+ - the package is referenced as an `extensions` entry from a sibling app's `prisma.config.ts` in the same monorepo.
22
+
23
+ If the project additionally consumes Prisma 8 from its own app code, run [`upgrade-app.md`](upgrade-app.md) first, then this flow in the same session.
24
+
25
+ If detection is ambiguous, ask the user which role to operate under.
26
+
27
+ ## Version detection
28
+
29
+ - **From-version.** Read the currently-installed Prisma 8 version from `pnpm-lock.yaml` (or `package-lock.json` / `yarn.lock`) by inspecting the resolved version of any `@prisma/orm-*` SPI package (`@prisma/orm-framework`, `@prisma/orm-family-*`, `@prisma/orm-target-*`, `@prisma/orm-toolchain`). Do not read it from a `@prisma/orm-extension-*` dependency; another extension carries its own version. Compare full semver strings, prerelease identifier included: `8.0.0-rc.10` and `8.0.0-rc.11` are different versions and different steps in the chain below. If the lockfile shows the SPI packages at different versions, the lowest is the from-version.
30
+ - **To-version.** Either the version the user specified, or whatever `npm view @prisma/orm-framework dist-tags.latest` reports. Do not assume that is a stable version: while Prisma 8 is a release candidate, `latest` tracks the newest release, `8.0.0-rc.N` included. If the user wants a stable version specifically, they must name it.
31
+
32
+ Report both back to the user before continuing.
33
+
34
+ ## Transition chain
35
+
36
+ If the from-to delta spans more than one release (e.g. `0.6 → 0.8`), build the chain of steps between them:
37
+
38
+ ```text
39
+ 0.6 → 0.7 → 0.8
40
+ ```
41
+
42
+ The [`../upgrading/extension/upgrades/`](../upgrading/extension/upgrades/) directories name the steps — read the chain off the directory names rather than deriving it arithmetically. Each directory is `<from>-to-<to>`. A step normally spans one stable minor (`0.7-to-0.8`) or one release candidate (`8.0.0-rc.1-to-8.0.0-rc.2`). When intermediate versions were not published, a guide may span a larger hop; follow the available directory chain rather than inventing missing steps. Moving onto the RC line from the last stable minor is a single step of its own (`0.17-to-8.0.0-rc.1`).
43
+
44
+ Apply each step in order, fully: bump, install, run instructions, check pins, validate, commit — before moving to the next. Halt the chain on the first failed step.
45
+
46
+ ## Per-step flow
47
+
48
+ This flow assumes you are an **external extension author** — your extension lives in its own repo and consumes `@prisma/orm-*` from npm. (Extensions inside the `prisma/prisma` monorepo itself are bumped via `pnpm bump-version` / `scripts/set-version.ts`, which rewrites every `workspace:<X.Y.Z>` spec in lockstep with the root version; they do not run this skill.)
49
+
50
+ For each `(from, to)` step in the chain:
51
+
52
+ 1. **Bump `@prisma/orm-*` deps.** Rewrite every `@prisma/orm-*` entry other than `@prisma/orm-extension-*` in the extension's `package.json` to the exact `<to>` version (e.g. `"8.0.0-rc.11"` — no caret, no tilde, no range, no `workspace:` specifier; the exact-pin rule below details why). All entries advance to the same version. Cover whichever dep field(s) the extension uses today — `dependencies` and/or `peerDependencies` — and any `optionalDependencies`. The skill itself ships inside the Prisma packages, so bumping them is what updates it; there is no separate skill package to bump.
53
+
54
+ 2. **Install.** Run `pnpm install` (or the project's lockfile-managing command). The extension's source is now broken against the new SPI — the upgrade instructions for `<from> → <to>` exist to fix it.
55
+
56
+ 3. **Check pins.** Every `@prisma/orm-*` entry other than `@prisma/orm-extension-*` across `dependencies`, `peerDependencies`, and `optionalDependencies` must now be the single exact string `<to>`. This prints any entry that is not, and exits 1:
57
+
58
+ ```bash
59
+ node -e 'const p=require("./package.json");const to=process.argv[1];const bad=[];for(const f of ["dependencies","peerDependencies","optionalDependencies"])for(const [n,v] of Object.entries(p[f]??{}))if(n.startsWith("@prisma/orm-")&&!n.startsWith("@prisma/orm-extension-")&&v!==to)bad.push(f+": "+n+"@"+v);if(bad.length){console.error(bad.join("\n"));process.exit(1)}' <to>
60
+ ```
61
+
62
+ If it fails, the bump step did not rewrite every spec — fix the offending entries and re-run before proceeding.
63
+
64
+ 4. **Read the upgrade instructions.** Re-sync the skills (`prisma skills sync`) so the tree matches the version just installed, then load `../upgrading/extension/upgrades/<from>-to-<to>/instructions.md`. Parse the YAML frontmatter and pay particular attention to its `changes[]` array.
65
+
66
+ 5. **Apply each change.** When the guide's body has a section that orders the steps, such as `Order of the steps`, apply the changes in that order: it says which script runs before which, and when to sign the databases and when to plan and apply a migration. Where an entry's prose says to sign or migrate, do it at the step that section names. Otherwise take the entries in the order of `changes[]`. For each entry in `changes[]`:
67
+ - If the entry has a `detection` block (a glob + content predicate), run it. If no files match, skip this change. Run the glob over the project's own files: skip `node_modules`, and build output such as `dist`, `build`, `.next` or `out` (whatever directories the project's build writes). A match there is generated code, which the next build rewrites; editing it changes nothing. Migration snapshots under `migrations/snapshots/` are committed files, not build output, so keep them.
68
+ - How a `detection` block runs: `glob` selects files relative to the project root. Each `matches` entry, once read from the YAML, is a JavaScript regular expression, built as `new RegExp(pattern)` with no flags and tested against the whole content of one file at a time; each `contains` entry is a plain substring. A file is a hit when any entry matches it. Patterns may span lines, and some look at the whole file (for example, to skip a file that declares something elsewhere in it), so a line-by-line search such as `grep` or `rg` without `-U` is not the same test and can report files the pattern excludes. From a shell, `rg -U --pcre2 -l -e '<pattern>' <files>` tests whole files and gives the same hits.
69
+ - If the entry has no `detection`, apply unconditionally.
70
+ - If the entry names a `script:` (a relative path next to `instructions.md`), invoke it from the project root:
71
+ - `*.ts` → the command the guide's prose gives, such as `node <script>` (Node 24 or later runs TypeScript directly); with no command in the prose, `pnpm exec tsx <skill>/upgrading/extension/upgrades/<from>-to-<to>/<script>`
72
+ - `*.sh` → `bash <skill>/upgrading/extension/upgrades/<from>-to-<to>/<script>`
73
+ - codemods → invoke per the script's own `instructions.md` prose.
74
+ - If the entry has no `script`, follow the prose body in `instructions.md` directly.
75
+
76
+ If `changes[]` is empty (the placeholder shape for transitions with no extension-side breaking changes), this sub-step is a no-op — proceed to validation.
77
+
78
+ 6. **Validate.** Run `pnpm build && pnpm test` (or the project's equivalent — the `scripts` field of the extension's `package.json` is the discovery surface). If anything is red, halt the chain. Do **not** auto-roll-back; surface the failure to the user with the failing change's `id` (from the frontmatter), the file paths the change operated on, and the inferred remediation.
79
+
80
+ 7. **Commit.** Create one commit containing this step's changes: the `package.json` bump, the lockfile churn from `pnpm install`, and any source-file rewrites from the applied changes. Use the message:
81
+
82
+ ```text
83
+ chore: upgrade @prisma/orm-* to <to-version>
84
+ ```
85
+
86
+ (Or the extension's own commit-message convention, if it has one.) One commit per step — never squash steps.
87
+
88
+ Move on to the next step. Repeat.
89
+
90
+ ## Exact-pin rule
91
+
92
+ Prisma 8 extensions pin every `@prisma/orm-*` SPI dependency (everything except `@prisma/orm-extension-*`) to a single **exact** version (no `^`, no `~`, no range, no wildcard, no `workspace:` specifier in the published `package.json`). All of those entries share the same version. The pin advances after each successful upgrade step, release-candidate steps included.
93
+
94
+ The version is the one the application's database package (`@prisma/orm-postgres`, `@prisma/orm-mongo`, …) uses. Values and registries made by one copy of Prisma ORM are not recognised by another, so they must never cross between copies. A host may load two copies on purpose, as Prisma Composer's boot wrapper does beside the application bundle, but the application, its extensions and the `prisma` CLI must share one. When an extension pins a different version, the package manager installs a second copy beside the application's, and the extension's values then cross between copies. The target package (such as `@prisma/orm-target-postgres`) is therefore a **peer dependency**, so npm refuses a mismatched install instead of adding a copy. The framework and family packages are ordinary dependencies at the same version. pnpm and bun only warn about a mismatched peer, so a second copy can still be installed. `npm ls @prisma/orm-framework`, `pnpm why @prisma/orm-framework` or `bun why @prisma/orm-framework` lists every copy and the package that brought it.
95
+
96
+ The one-line check in step 3 of the per-step flow enforces the rule; the `prisma-8-check-pins` guard the monorepo uses for its own extensions is not published. Wire the check into the extension's CI alongside the build/test step so an accidental range pin fails the PR before it lands.
97
+
98
+ ## When the chain is done
99
+
100
+ Report back to the user: the number of steps applied, the SHAs of the commits you made, and any open follow-ups.
101
+
102
+ ## Failure surfaces
103
+
104
+ When a step fails:
105
+
106
+ - Surface a structured error with code `PN-UPGRADE-NNNN`, the failing change's `id`, the file paths the change touched (or the lockfile, or the pin check, or the validation command), and the inferred remediation.
107
+ - Do not retry automatically.
108
+ - Do not auto-roll-back the commit. The user can revert if they want a clean slate.
@@ -0,0 +1,56 @@
1
+ ---
2
+ from: "0.10"
3
+ to: "0.11"
4
+ changes:
5
+ - id: insert-single-row-wrap-in-array
6
+ summary: Wrap single-row `.insert({...})` call sites in an array — `.insert([{...}])`. The single-object overload is removed; `.insert()` now exclusively accepts an array of row objects.
7
+ detection:
8
+ glob: "**/*.{ts,tsx}"
9
+ contains:
10
+ - ".insert("
11
+ anyMatch: true
12
+ ---
13
+
14
+ # 0.10 → 0.11 — User upgrade instructions
15
+
16
+ ## `insert-single-row-wrap-in-array`
17
+
18
+ Starting at the 0.11 release, the `.insert()` method on the SQL builder accepts **only** an array of row objects. The single-object overload that previously allowed `.insert({ field: value })` is removed.
19
+
20
+ Before 0.11:
21
+
22
+ ```ts
23
+ await runtime.execute(db.sql.user.insert({ email: 'alice@example.com' }).build());
24
+ ```
25
+
26
+ Starting at 0.11:
27
+
28
+ ```ts
29
+ await runtime.execute(db.sql.user.insert([{ email: 'alice@example.com' }]).build());
30
+ ```
31
+
32
+ Walk every `.ts` / `.tsx` file matched by the `detection.glob` above. For each call site that passes a plain object directly to `.insert(...)`, wrap the argument in an array:
33
+
34
+ - `.insert(row)` → `.insert([row])`
35
+ - `.insert({ field: value })` → `.insert([{ field: value }])`
36
+
37
+ Variable references to a row object are safe to wrap directly:
38
+
39
+ ```ts
40
+ // Before
41
+ for (const item of items) {
42
+ await runtime.execute(db.sql.table.insert(item).build());
43
+ }
44
+ // After
45
+ for (const item of items) {
46
+ await runtime.execute(db.sql.table.insert([item]).build());
47
+ }
48
+ ```
49
+
50
+ If a call site already passes an array (`.insert([row1, row2])`), it is already correct — leave it unchanged.
51
+
52
+ TypeScript will flag bare-object call sites as type errors after the bump, providing a reliable compile-time signal for every affected site.
53
+
54
+ ### Validation
55
+
56
+ After applying the rule above, run `pnpm typecheck && pnpm test` (or your application's equivalent). The change is mechanical — every affected call site is flagged at compile time.