@prisma/orm-target-mysql 8.0.0-rc.23-dev.6 → 8.0.0-rc.23-dev.8

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 (226) hide show
  1. package/dist/adapter-D0qXT1lj.d.mts +57 -0
  2. package/dist/adapter-D0qXT1lj.d.mts.map +1 -0
  3. package/dist/adapter.d.mts +6 -6
  4. package/dist/adapter.mjs +3 -3
  5. package/dist/adapter__adapter.d.mts +2 -2
  6. package/dist/adapter__adapter.mjs +2 -2
  7. package/dist/adapter__codec-types.d.mts +2 -2
  8. package/dist/adapter__control.d.mts +2 -2
  9. package/dist/adapter__control.mjs +2 -2
  10. package/dist/adapter__runtime.d.mts +1 -1
  11. package/dist/adapter__runtime.mjs +9 -9
  12. package/dist/adapter__runtime.mjs.map +1 -1
  13. package/dist/{codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs → codec-descriptor-3xp1XvVH-DfPKpYeP.mjs} +2 -2
  14. package/dist/codec-descriptor-3xp1XvVH-DfPKpYeP.mjs.map +1 -0
  15. package/dist/codec-descriptor-BRcKIX3h.d.mts +2 -0
  16. package/dist/{codec-descriptor-DXyubAS6-siA0R8Ow.d.mts → codec-descriptor-DXyubAS6-XDBj6Yet.d.mts} +2 -2
  17. package/dist/codec-descriptor-DXyubAS6-XDBj6Yet.d.mts.map +1 -0
  18. package/dist/codec-descriptor-J3TP08l8-BmdgkIU6.d.mts +1 -0
  19. package/dist/{codec-ids-CrR9Xi7r-CarpqbNM.mjs → codec-ids-CrR9Xi7r-CjbGCS3o.mjs} +2 -2
  20. package/dist/codec-ids-CrR9Xi7r-CjbGCS3o.mjs.map +1 -0
  21. package/dist/{codec-ids-Dgh5IpML-76oBMuwK.d.mts → codec-ids-Dgh5IpML-DGXIq6j8.d.mts} +2 -2
  22. package/dist/codec-ids-Dgh5IpML-DGXIq6j8.d.mts.map +1 -0
  23. package/dist/codec-types-BS-lWfda.d.mts +1 -0
  24. package/dist/{codec-types-Bai_CFkk-Blx2GxCH.d.mts → codec-types-Bai_CFkk-DmZ74URd.d.mts} +5 -5
  25. package/dist/codec-types-Bai_CFkk-DmZ74URd.d.mts.map +1 -0
  26. package/dist/codec-types-Dk2h5dBB.d.mts +1 -0
  27. package/dist/{codecs-BMidk26M-DsKq6wt5.d.mts → codecs-BMidk26M-B_iWNti6.d.mts} +5 -5
  28. package/dist/codecs-BMidk26M-B_iWNti6.d.mts.map +1 -0
  29. package/dist/{codecs-C_twedMx.d.mts → codecs-CIJRyUd3.d.mts} +4 -4
  30. package/dist/codecs-CIJRyUd3.d.mts.map +1 -0
  31. package/dist/{codecs-BfiB79-5.mjs → codecs-wVJlFapM.mjs} +7 -7
  32. package/dist/codecs-wVJlFapM.mjs.map +1 -0
  33. package/dist/{contract-free-Cw9Mjcro.d.mts → contract-free-BnJBWENn.d.mts} +3 -3
  34. package/dist/contract-free-BnJBWENn.d.mts.map +1 -0
  35. package/dist/{contract-free-BvCdx_Ee.mjs → contract-free-DekbHRyr.mjs} +4 -4
  36. package/dist/contract-free-DekbHRyr.mjs.map +1 -0
  37. package/dist/control-BBuy6yt5.mjs +73 -0
  38. package/dist/control-BBuy6yt5.mjs.map +1 -0
  39. package/dist/control-BiZaCqna.mjs +89 -0
  40. package/dist/control-BiZaCqna.mjs.map +1 -0
  41. package/dist/{control-BBhWaGnH.mjs → control-CyGJDPay.mjs} +102 -77
  42. package/dist/control-CyGJDPay.mjs.map +1 -0
  43. package/dist/control-D7_IpeiU.d.mts +31 -0
  44. package/dist/control-D7_IpeiU.d.mts.map +1 -0
  45. package/dist/{control-BvSM7mGR.d.mts → control-Dj8nIA1M.d.mts} +13 -4
  46. package/dist/control-Dj8nIA1M.d.mts.map +1 -0
  47. package/dist/{control-MoPFgSaQ.d.mts → control-WNuLF2Wh.d.mts} +29 -56
  48. package/dist/control-WNuLF2Wh.d.mts.map +1 -0
  49. package/dist/{control-tables-CHw2F-rg.d.mts → control-tables-CWJyQ3dZ.d.mts} +2 -2
  50. package/dist/control-tables-CWJyQ3dZ.d.mts.map +1 -0
  51. package/dist/{control-tables-CcQ77JE7-CxTQYoQJ.mjs → control-tables-CcQ77JE7-DKb3ubVU.mjs} +2 -2
  52. package/dist/control-tables-CcQ77JE7-DKb3ubVU.mjs.map +1 -0
  53. package/dist/{data-type-entries-C7VH2IHc-D1d5I8zF.mjs → data-type-entries-C7VH2IHc-DM6TbTaz.mjs} +3 -3
  54. package/dist/data-type-entries-C7VH2IHc-DM6TbTaz.mjs.map +1 -0
  55. package/dist/{data-types-C-rfxpgB.d.mts → data-types-65iVc7q1.d.mts} +3 -3
  56. package/dist/data-types-65iVc7q1.d.mts.map +1 -0
  57. package/dist/{data-types-D2HAT-Qf-CRI506c0.d.mts → data-types-D2HAT-Qf-CSdDz1Pk.d.mts} +2 -2
  58. package/dist/data-types-D2HAT-Qf-CSdDz1Pk.d.mts.map +1 -0
  59. package/dist/{data-types-DOaaPS93-DBkMJyh1.mjs → data-types-DOaaPS93-lycGybNk.mjs} +4 -4
  60. package/dist/data-types-DOaaPS93-lycGybNk.mjs.map +1 -0
  61. package/dist/{date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs → date-time-now-generators-DY-8Bodc-DpQ5Se1u.mjs} +4 -4
  62. package/dist/date-time-now-generators-DY-8Bodc-DpQ5Se1u.mjs.map +1 -0
  63. package/dist/ddl-Bobm-S7I.d.mts +1 -0
  64. package/dist/{ddl-DDmMHyA_-Bb8sXoS0.mjs → ddl-DDmMHyA_-grdUmU3J.mjs} +3 -3
  65. package/dist/ddl-DDmMHyA_-grdUmU3J.mjs.map +1 -0
  66. package/dist/{default-normalizer-C8pc7SbL-CKgOEnGl.mjs → default-normalizer-C8pc7SbL-BXd70q02.mjs} +3 -3
  67. package/dist/default-normalizer-C8pc7SbL-BXd70q02.mjs.map +1 -0
  68. package/dist/{default-normalizer-CGIwQiKB.d.mts → default-normalizer-D-8Ii0df.d.mts} +2 -2
  69. package/dist/default-normalizer-D-8Ii0df.d.mts.map +1 -0
  70. package/dist/{descriptor-meta-CsMPRsxp-DhK87vlc.mjs → descriptor-meta-CsMPRsxp-QVV7vNY8.mjs} +6 -6
  71. package/dist/descriptor-meta-CsMPRsxp-QVV7vNY8.mjs.map +1 -0
  72. package/dist/descriptor-meta-pVdZBI-g-BJN4T_on.mjs +32 -0
  73. package/dist/descriptor-meta-pVdZBI-g-BJN4T_on.mjs.map +1 -0
  74. package/dist/driver.d.mts +3 -3
  75. package/dist/driver.mjs +3 -2
  76. package/dist/driver__control.d.mts +2 -2
  77. package/dist/driver__control.mjs +2 -2
  78. package/dist/driver__runtime.d.mts +2 -2
  79. package/dist/driver__runtime.mjs +2 -564
  80. package/dist/{errors-Cng94tYg-D02Eud2d.mjs → errors-Cng94tYg-DTH51xWG.mjs} +2 -2
  81. package/dist/errors-Cng94tYg-DTH51xWG.mjs.map +1 -0
  82. package/dist/{errors-DfrC_yfG.d.mts → errors-DjCkC9IM.d.mts} +2 -2
  83. package/dist/errors-DjCkC9IM.d.mts.map +1 -0
  84. package/dist/{marker-lock-Bwew7cAs-CZ20Y_tA.mjs → marker-lock-Bwew7cAs-ElLxlCQp.mjs} +3 -3
  85. package/dist/marker-lock-Bwew7cAs-ElLxlCQp.mjs.map +1 -0
  86. package/dist/{marker-lock-su6IxinO.d.mts → marker-lock-Px2qK06F.d.mts} +2 -2
  87. package/dist/marker-lock-Px2qK06F.d.mts.map +1 -0
  88. package/dist/{marker-read-Cf80LSbG-CUp3v1e5.mjs → marker-read-D1hp62hF-3-4fEgDD.mjs} +6 -23
  89. package/dist/marker-read-D1hp62hF-3-4fEgDD.mjs.map +1 -0
  90. package/dist/{migration-DmlblTTw.d.mts → migration-DILkj7kB.d.mts} +41 -29
  91. package/dist/migration-DILkj7kB.d.mts.map +1 -0
  92. package/dist/{mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs → mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs} +4 -4
  93. package/dist/mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs.map +1 -0
  94. package/dist/{mysql-database-CHl9-oSL-CWZLDXt6.mjs → mysql-database-CHl9-oSL-B1arvq6Q.mjs} +5 -5
  95. package/dist/mysql-database-CHl9-oSL-B1arvq6Q.mjs.map +1 -0
  96. package/dist/{nodes-CvcX47ot-B-ZaUYRj.mjs → nodes-CvcX47ot-CcCy0Oh4.mjs} +2 -2
  97. package/dist/nodes-CvcX47ot-CcCy0Oh4.mjs.map +1 -0
  98. package/dist/{nodes-xc0cR0_c-2YbhgEjb.d.mts → nodes-xc0cR0_c-CLET35o0.d.mts} +2 -2
  99. package/dist/nodes-xc0cR0_c-CLET35o0.d.mts.map +1 -0
  100. package/dist/{now-expression-DVD18CUc-00buJUto.mjs → now-expression-DVD18CUc-DJqdZY96.mjs} +3 -3
  101. package/dist/now-expression-DVD18CUc-DJqdZY96.mjs.map +1 -0
  102. package/dist/{pack-BXvLVBWP.d.mts → pack-COnjX17N.d.mts} +6 -6
  103. package/dist/pack-COnjX17N.d.mts.map +1 -0
  104. package/dist/{planner-target-details-D6g2uSp--C5NKHmCc.d.mts → planner-target-details-D6g2uSp--6VJKSGxe.d.mts} +2 -2
  105. package/dist/planner-target-details-D6g2uSp--6VJKSGxe.d.mts.map +1 -0
  106. package/dist/{require-temporal-DeDQhbTn-Bxc65WbA.mjs → require-temporal-DeDQhbTn-CdpjEWCB.mjs} +3 -3
  107. package/dist/require-temporal-DeDQhbTn-CdpjEWCB.mjs.map +1 -0
  108. package/dist/{runner-C39AEe6--BVG3xPYw.mjs → runner-BIjAWX-E-BgTmrD8f.mjs} +146 -124
  109. package/dist/runner-BIjAWX-E-BgTmrD8f.mjs.map +1 -0
  110. package/dist/runtime-BGF0cSIt.mjs +569 -0
  111. package/dist/runtime-BGF0cSIt.mjs.map +1 -0
  112. package/dist/{runtime-ClRDfPiY.d.mts → runtime-Cm-T3hbP.d.mts} +4 -4
  113. package/dist/runtime-Cm-T3hbP.d.mts.map +1 -0
  114. package/dist/{runtime-BGyTXcQH.d.mts → runtime-DN20lWEg.d.mts} +7 -5
  115. package/dist/runtime-DN20lWEg.d.mts.map +1 -0
  116. package/dist/{runtime-CrB5DXx4.d.mts → runtime-sPIp-JgC.d.mts} +2 -2
  117. package/dist/runtime-sPIp-JgC.d.mts.map +1 -0
  118. package/dist/{sql-utils-bD4SfgX0.mjs → sql-utils-BE8tDXHs.mjs} +3 -3
  119. package/dist/sql-utils-BE8tDXHs.mjs.map +1 -0
  120. package/dist/{sql-utils-Cmv_TVa8-BetrIUcj.mjs → sql-utils-Cmv_TVa8-CNW3UmfQ.mjs} +3 -3
  121. package/dist/sql-utils-Cmv_TVa8-CNW3UmfQ.mjs.map +1 -0
  122. package/dist/{sql-utils-BOS1c2QT.d.mts → sql-utils-DBvre8Ar.d.mts} +2 -2
  123. package/dist/sql-utils-DBvre8Ar.d.mts.map +1 -0
  124. package/dist/{statement-DC62oiSx-Buzptbpk.mjs → statement-CT5tB4uX-CHqHFM3z.mjs} +17 -14
  125. package/dist/statement-CT5tB4uX-CHqHFM3z.mjs.map +1 -0
  126. package/dist/target.d.mts +24 -24
  127. package/dist/target.mjs +22 -21
  128. package/dist/target__codec-descriptor.d.mts +2 -2
  129. package/dist/target__codec-descriptor.mjs +1 -1
  130. package/dist/target__codec-ids.d.mts +1 -1
  131. package/dist/target__codec-ids.mjs +1 -1
  132. package/dist/target__codec-types.d.mts +2 -2
  133. package/dist/target__codecs.d.mts +2 -2
  134. package/dist/target__codecs.mjs +2 -2
  135. package/dist/target__contract-free.d.mts +1 -1
  136. package/dist/target__contract-free.mjs +2 -2
  137. package/dist/target__control-tables.d.mts +1 -1
  138. package/dist/target__control-tables.mjs +1 -1
  139. package/dist/target__control.d.mts +3 -3
  140. package/dist/target__control.mjs +3 -64
  141. package/dist/target__data-types.d.mts +2 -2
  142. package/dist/target__data-types.mjs +2 -2
  143. package/dist/target__ddl.d.mts +2 -2
  144. package/dist/target__ddl.mjs +1 -1
  145. package/dist/target__default-normalizer.d.mts +1 -1
  146. package/dist/target__default-normalizer.mjs +1 -1
  147. package/dist/target__errors.d.mts +1 -1
  148. package/dist/target__errors.mjs +1 -1
  149. package/dist/target__marker-lock.d.mts +1 -1
  150. package/dist/target__marker-lock.mjs +1 -1
  151. package/dist/target__migration.d.mts +2 -2
  152. package/dist/target__migration.mjs +2 -2
  153. package/dist/target__pack.d.mts +1 -1
  154. package/dist/target__pack.mjs +1 -1
  155. package/dist/target__runtime.d.mts +1 -1
  156. package/dist/target__runtime.mjs +3 -3
  157. package/dist/target__runtime.mjs.map +1 -1
  158. package/dist/target__sql-utils.d.mts +1 -1
  159. package/dist/target__sql-utils.mjs +2 -2
  160. package/dist/target__types.d.mts +1 -1
  161. package/dist/target__types.mjs +1 -1
  162. package/dist/{types-CgrFHUdk.d.mts → types-gXYDzQXs.d.mts} +2 -2
  163. package/dist/types-gXYDzQXs.d.mts.map +1 -0
  164. package/package.json +10 -10
  165. package/dist/adapter-Dl4Wwz1I.d.mts +0 -29
  166. package/dist/adapter-Dl4Wwz1I.d.mts.map +0 -1
  167. package/dist/codec-descriptor-3xp1XvVH-yVLnNzZ8.mjs.map +0 -1
  168. package/dist/codec-descriptor-DXyubAS6-siA0R8Ow.d.mts.map +0 -1
  169. package/dist/codec-descriptor-J3TP08l8-ekLvUVxW.d.mts +0 -1
  170. package/dist/codec-descriptor-oLRh9E29.d.mts +0 -2
  171. package/dist/codec-ids-CrR9Xi7r-CarpqbNM.mjs.map +0 -1
  172. package/dist/codec-ids-Dgh5IpML-76oBMuwK.d.mts.map +0 -1
  173. package/dist/codec-types-BH5moCD9.d.mts +0 -1
  174. package/dist/codec-types-Bai_CFkk-Blx2GxCH.d.mts.map +0 -1
  175. package/dist/codec-types-zzVcrnbk.d.mts +0 -1
  176. package/dist/codecs-BMidk26M-DsKq6wt5.d.mts.map +0 -1
  177. package/dist/codecs-BfiB79-5.mjs.map +0 -1
  178. package/dist/codecs-C_twedMx.d.mts.map +0 -1
  179. package/dist/contract-contributions-ChiX6W0F-CAng98bZ.mjs +0 -15
  180. package/dist/contract-contributions-ChiX6W0F-CAng98bZ.mjs.map +0 -1
  181. package/dist/contract-free-BvCdx_Ee.mjs.map +0 -1
  182. package/dist/contract-free-Cw9Mjcro.d.mts.map +0 -1
  183. package/dist/control-5eVF1TXc.mjs +0 -74
  184. package/dist/control-5eVF1TXc.mjs.map +0 -1
  185. package/dist/control-BBhWaGnH.mjs.map +0 -1
  186. package/dist/control-BvSM7mGR.d.mts.map +0 -1
  187. package/dist/control-DHkZbo58.d.mts +0 -25
  188. package/dist/control-DHkZbo58.d.mts.map +0 -1
  189. package/dist/control-MoPFgSaQ.d.mts.map +0 -1
  190. package/dist/control-tables-CHw2F-rg.d.mts.map +0 -1
  191. package/dist/control-tables-CcQ77JE7-CxTQYoQJ.mjs.map +0 -1
  192. package/dist/data-type-entries-C7VH2IHc-D1d5I8zF.mjs.map +0 -1
  193. package/dist/data-types-C-rfxpgB.d.mts.map +0 -1
  194. package/dist/data-types-D2HAT-Qf-CRI506c0.d.mts.map +0 -1
  195. package/dist/data-types-DOaaPS93-DBkMJyh1.mjs.map +0 -1
  196. package/dist/date-time-now-generators-DY-8Bodc-DcQ3h4Fg.mjs.map +0 -1
  197. package/dist/ddl-CT6DPEqg.d.mts +0 -1
  198. package/dist/ddl-DDmMHyA_-Bb8sXoS0.mjs.map +0 -1
  199. package/dist/default-normalizer-C8pc7SbL-CKgOEnGl.mjs.map +0 -1
  200. package/dist/default-normalizer-CGIwQiKB.d.mts.map +0 -1
  201. package/dist/descriptor-meta-CsMPRsxp-DhK87vlc.mjs.map +0 -1
  202. package/dist/driver__runtime.mjs.map +0 -1
  203. package/dist/errors-Cng94tYg-D02Eud2d.mjs.map +0 -1
  204. package/dist/errors-DfrC_yfG.d.mts.map +0 -1
  205. package/dist/marker-lock-Bwew7cAs-CZ20Y_tA.mjs.map +0 -1
  206. package/dist/marker-lock-su6IxinO.d.mts.map +0 -1
  207. package/dist/marker-read-Cf80LSbG-CUp3v1e5.mjs.map +0 -1
  208. package/dist/migration-DmlblTTw.d.mts.map +0 -1
  209. package/dist/mysql-contract-serializer-BnTKRSsN-B2O3EreV.mjs.map +0 -1
  210. package/dist/mysql-database-CHl9-oSL-CWZLDXt6.mjs.map +0 -1
  211. package/dist/nodes-CvcX47ot-B-ZaUYRj.mjs.map +0 -1
  212. package/dist/nodes-xc0cR0_c-2YbhgEjb.d.mts.map +0 -1
  213. package/dist/now-expression-DVD18CUc-00buJUto.mjs.map +0 -1
  214. package/dist/pack-BXvLVBWP.d.mts.map +0 -1
  215. package/dist/planner-target-details-D6g2uSp--C5NKHmCc.d.mts.map +0 -1
  216. package/dist/require-temporal-DeDQhbTn-Bxc65WbA.mjs.map +0 -1
  217. package/dist/runner-C39AEe6--BVG3xPYw.mjs.map +0 -1
  218. package/dist/runtime-BGyTXcQH.d.mts.map +0 -1
  219. package/dist/runtime-ClRDfPiY.d.mts.map +0 -1
  220. package/dist/runtime-CrB5DXx4.d.mts.map +0 -1
  221. package/dist/sql-utils-BOS1c2QT.d.mts.map +0 -1
  222. package/dist/sql-utils-Cmv_TVa8-BetrIUcj.mjs.map +0 -1
  223. package/dist/sql-utils-bD4SfgX0.mjs.map +0 -1
  224. package/dist/statement-DC62oiSx-Buzptbpk.mjs.map +0 -1
  225. package/dist/target__control.mjs.map +0 -1
  226. package/dist/types-CgrFHUdk.d.mts.map +0 -1
@@ -1,9 +1,9 @@
1
- import { s as mysqlError } from "./errors-Cng94tYg-D02Eud2d.mjs";
2
- import { n as quoteIdentifier } from "./sql-utils-Cmv_TVa8-BetrIUcj.mjs";
3
- import { t as CONTROL_TABLE_NAMES } from "./control-tables-CcQ77JE7-CxTQYoQJ.mjs";
4
- import { t as createTable } from "./ddl-DDmMHyA_-Bb8sXoS0.mjs";
5
- import { t as mysqlResolveDefault } from "./default-normalizer-C8pc7SbL-CKgOEnGl.mjs";
6
- import { i as withMarkerLock } from "./marker-lock-Bwew7cAs-CZ20Y_tA.mjs";
1
+ import { s as mysqlError } from "./errors-Cng94tYg-DTH51xWG.mjs";
2
+ import { n as quoteIdentifier } from "./sql-utils-Cmv_TVa8-CNW3UmfQ.mjs";
3
+ import { t as CONTROL_TABLE_NAMES } from "./control-tables-CcQ77JE7-DKb3ubVU.mjs";
4
+ import { t as createTable } from "./ddl-DDmMHyA_-grdUmU3J.mjs";
5
+ import { t as mysqlResolveDefault } from "./default-normalizer-C8pc7SbL-BXd70q02.mjs";
6
+ import { i as withMarkerLock } from "./marker-lock-Bwew7cAs-ElLxlCQp.mjs";
7
7
  import { dataTypeParams } from "@prisma/orm-framework/components/codec";
8
8
  import { blindCast } from "@prisma/orm-framework/utils/casts";
9
9
  import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -15,14 +15,14 @@ import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, diffSche
15
15
  import { UNBOUND_NAMESPACE_ID, entityAt } from "@prisma/orm-framework/components/ir";
16
16
  import { NO_RENAMED_ORIGINS, contractToSchemaIR, createSqlTextSources, plannerFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, subjectsOfCalls } from "@prisma/orm-family-sql/family/control";
17
17
  import { RelationalSchemaNodeKind, SqlSchemaIR, sqlColumnTypesEqual } from "@prisma/orm-family-sql/schema-ir/types";
18
- import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
19
18
  import { TsExpression, jsonToTsSource, renderImports } from "@prisma/orm-framework/ts-render";
20
19
  import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
20
+ import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
21
21
  import { Migration } from "@prisma/orm-family-sql/family/migration";
22
22
  import { isThenable } from "@prisma/orm-framework/utils/promise";
23
- import { resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
23
+ import { keepInternalSpecifiers, resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
24
24
  import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
25
- //#region ../../../3-targets/mysql/1-target/dist/runner-C39AEe6-.mjs
25
+ //#region ../../../3-targets/mysql/1-mysql/1-target/dist/runner-BIjAWX-E.mjs
26
26
  /**
27
27
  * The schema IR a contract describes on MySQL: one flat tree of tables, each column typed by the data type its codec represents. A MySQL database holds no schemas, so foreign keys name no referenced schema, as introspection reports them.
28
28
  */
@@ -59,42 +59,6 @@ function diffMysqlSchema(input) {
59
59
  namespacePairs: namespacesWithTables.map(() => ({ actual }))
60
60
  };
61
61
  }
62
- /** The type DDL writes for a column node: the type it is stored as, with the parameters the contract writes, as MySQL reports it in `COLUMN_TYPE`. */
63
- function columnTypeSql(column) {
64
- const type = column.storedType;
65
- if (type === void 0 || !isSqlDataType(type)) throw new InternalError(`column "${column.name}" has no data type; the expected tree must be derived via contractToSchemaIR for planning`);
66
- return renderSqlTypeName(type, dataTypeParams(type, column.codecRef?.typeParams));
67
- }
68
- function ddlDefaultOf(columnDefault) {
69
- if (columnDefault === void 0) return void 0;
70
- return columnDefault.kind === "literal" ? new LiteralColumnDefault(columnDefault.value) : new FunctionColumnDefault(opaqueSql(columnDefault.expression));
71
- }
72
- /** The default a column node's DDL writes: the one the contract authored, which `resolvedDefault` normalises for the diff. */
73
- function columnDefaultOf(column) {
74
- return column.authoredDefault ?? column.resolvedDefault;
75
- }
76
- /** The `DdlColumn` of a column node. An `autoincrement()` default stays a function default, which the adapter writes as `AUTO_INCREMENT`. */
77
- function ddlColumnFromNode(column) {
78
- const columnDefault = ddlDefaultOf(columnDefaultOf(column));
79
- return new DdlColumn({
80
- name: column.name,
81
- type: columnTypeSql(column),
82
- ...column.nullable ? {} : { notNull: true },
83
- ...columnDefault === void 0 ? {} : { default: columnDefault },
84
- ...column.codecRef === void 0 ? {} : { codecRef: column.codecRef }
85
- });
86
- }
87
- /** The name a unique constraint is created and dropped by; MySQL names an unnamed one after its first column, which the contract never leaves to it. */
88
- function uniqueName(table, unique) {
89
- return unique.name ?? `${table}_${unique.columns.join("_")}_key`;
90
- }
91
- /** The constraints `CREATE TABLE` writes for a table node: its primary key and unique constraints. Foreign keys are added after every table exists, so tables can reference each other. */
92
- function tableConstraintsFromNode(table) {
93
- return [...table.primaryKey === void 0 ? [] : [new PrimaryKeyConstraint({ columns: table.primaryKey.columns })], ...table.uniques.map((unique) => new UniqueConstraint({
94
- columns: unique.columns,
95
- name: uniqueName(table.name, unique)
96
- }))];
97
- }
98
62
  function step(description, sql, params, expectation) {
99
63
  return {
100
64
  description,
@@ -181,7 +145,10 @@ function buildTargetDetails(objectType, name, table) {
181
145
  ...ifDefined("table", table)
182
146
  };
183
147
  }
184
- const TARGET_MIGRATION_MODULE = "@internal/mysql/migration";
148
+ /** The module every MySQL `migration.ts` imports its base class and helpers from. */
149
+ const MYSQL_MIGRATION_MODULE = "@internal/mysql/migration";
150
+ /** The module call nodes name in their import requirements. `renderCallsToTypeScript` replaces it with the migration module of the target the scaffold is for. */
151
+ const MIGRATION_MODULE_PLACEHOLDER = MYSQL_MIGRATION_MODULE;
185
152
  /** The refusal of a `MysqlMigration` operation that needs the control adapter, on an instance built without a control stack. */
186
153
  function mysqlMigrationStackMissing(operation) {
187
154
  return mysqlError("MIGRATION.MYSQL_CONTROL_STACK_MISSING", `MysqlMigration.${operation} requires a control adapter`, {
@@ -201,6 +168,10 @@ var MysqlOpFactoryCallNode = class extends TsExpression {
201
168
  if (lowerer === void 0) throw mysqlMigrationStackMissing(this.factoryName);
202
169
  return lowerer;
203
170
  }
171
+ targetIdFor(targetId) {
172
+ if (targetId === void 0) throw new InternalError(`${this.factoryName}: an operation cannot be built without a target id; pass the id of the target the migration is for.`);
173
+ return targetId;
174
+ }
204
175
  };
205
176
  /** Whether `call` is one of this target's calls. */
206
177
  function isMysqlOpFactoryCall(call) {
@@ -234,7 +205,7 @@ function columnImports(columns) {
234
205
  if (column.default?.kind === "function") symbols.add("fn");
235
206
  }
236
207
  return [...symbols].map((symbol) => ({
237
- moduleSpecifier: TARGET_MIGRATION_MODULE,
208
+ moduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,
238
209
  symbol
239
210
  }));
240
211
  }
@@ -253,7 +224,7 @@ var CreateTableCall = class extends MysqlOpFactoryCallNode {
253
224
  this.label = `Create table ${tableName}`;
254
225
  this.freeze();
255
226
  }
256
- async toOp(lowerer) {
227
+ async toOp(lowerer, targetId) {
257
228
  const statement = await this.lowererFor(lowerer).lowerToExecuteRequest(createTable({
258
229
  table: this.tableName,
259
230
  columns: this.columns,
@@ -266,7 +237,7 @@ var CreateTableCall = class extends MysqlOpFactoryCallNode {
266
237
  summary: `Creates table ${this.tableName} with its columns, primary key and unique constraints`,
267
238
  operationClass: "additive",
268
239
  target: {
269
- id: "mysql",
240
+ id: this.targetIdFor(targetId),
270
241
  details: buildTargetDetails("table", this.tableName)
271
242
  },
272
243
  precheck: [table.absent(`ensure table "${this.tableName}" does not exist`)],
@@ -281,12 +252,12 @@ var CreateTableCall = class extends MysqlOpFactoryCallNode {
281
252
  return this.#written().imports;
282
253
  }
283
254
  #written() {
284
- const sql = createSqlTextSources(TARGET_MIGRATION_MODULE);
255
+ const sql = createSqlTextSources(MIGRATION_MODULE_PLACEHOLDER);
285
256
  const columns = this.columns.map((column) => renderColumn(column, sql)).join(", ");
286
257
  const constraints = this.constraints.map(renderConstraint);
287
258
  const source = `this.createTable({ table: ${jsonToTsSource(this.tableName)}, columns: [${columns}]${constraints.length > 0 ? `, constraints: [${constraints.join(", ")}]` : ""} })`;
288
259
  const constraintImports = [...new Set(this.constraints.map((c) => c.kind === "primary-key" ? "primaryKey" : "unique"))].map((symbol) => ({
289
- moduleSpecifier: TARGET_MIGRATION_MODULE,
260
+ moduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,
290
261
  symbol
291
262
  }));
292
263
  return {
@@ -310,7 +281,7 @@ var DropTableCall = class extends MysqlOpFactoryCallNode {
310
281
  this.label = `Drop table ${tableName}`;
311
282
  this.freeze();
312
283
  }
313
- toOp() {
284
+ toOp(_lowerer, targetId) {
314
285
  const table = tableChecks(this.tableName);
315
286
  return {
316
287
  id: `dropTable.${this.tableName}`,
@@ -318,7 +289,7 @@ var DropTableCall = class extends MysqlOpFactoryCallNode {
318
289
  summary: `Drops table ${this.tableName} which is not in the contract`,
319
290
  operationClass: "destructive",
320
291
  target: {
321
- id: "mysql",
292
+ id: this.targetIdFor(targetId),
322
293
  details: buildTargetDetails("table", this.tableName)
323
294
  },
324
295
  precheck: [table.present(`ensure table "${this.tableName}" exists`)],
@@ -345,7 +316,7 @@ var AddColumnCall = class extends MysqlOpFactoryCallNode {
345
316
  this.label = `Add column ${column.name} on ${tableName}`;
346
317
  this.freeze();
347
318
  }
348
- async toOp(lowerer) {
319
+ async toOp(lowerer, targetId) {
349
320
  const definition = await columnDefinitionSql(this.column, this.tableName, this.lowererFor(lowerer));
350
321
  const column = columnChecks(this.tableName, this.columnName);
351
322
  return {
@@ -354,7 +325,7 @@ var AddColumnCall = class extends MysqlOpFactoryCallNode {
354
325
  summary: `Adds column ${this.columnName} to ${this.tableName}`,
355
326
  operationClass: "additive",
356
327
  target: {
357
- id: "mysql",
328
+ id: this.targetIdFor(targetId),
358
329
  details: buildTargetDetails("column", this.columnName, this.tableName)
359
330
  },
360
331
  precheck: [tableChecks(this.tableName).present(`ensure table "${this.tableName}" exists`), column.absent(`ensure column "${this.columnName}" is missing on "${this.tableName}"`)],
@@ -369,7 +340,7 @@ var AddColumnCall = class extends MysqlOpFactoryCallNode {
369
340
  return this.#written().imports;
370
341
  }
371
342
  #written() {
372
- const sql = createSqlTextSources(TARGET_MIGRATION_MODULE);
343
+ const sql = createSqlTextSources(MIGRATION_MODULE_PLACEHOLDER);
373
344
  return {
374
345
  source: `this.addColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${renderColumn(this.column, sql)} })`,
375
346
  imports: [...columnImports([this.column]), ...sql.imports()]
@@ -389,7 +360,7 @@ var DropColumnCall = class extends MysqlOpFactoryCallNode {
389
360
  this.label = `Drop column ${columnName} on ${tableName}`;
390
361
  this.freeze();
391
362
  }
392
- toOp() {
363
+ toOp(_lowerer, targetId) {
393
364
  const column = columnChecks(this.tableName, this.columnName);
394
365
  return {
395
366
  id: `dropColumn.${this.tableName}.${this.columnName}`,
@@ -397,7 +368,7 @@ var DropColumnCall = class extends MysqlOpFactoryCallNode {
397
368
  summary: `Drops column ${this.columnName} on ${this.tableName} which is not in the contract`,
398
369
  operationClass: "destructive",
399
370
  target: {
400
- id: "mysql",
371
+ id: this.targetIdFor(targetId),
401
372
  details: buildTargetDetails("column", this.columnName, this.tableName)
402
373
  },
403
374
  precheck: [column.present(`ensure column "${this.columnName}" exists on "${this.tableName}"`)],
@@ -426,7 +397,7 @@ var CreateIndexCall = class extends MysqlOpFactoryCallNode {
426
397
  this.label = `Create ${unique ? "unique " : ""}index ${indexName} on ${tableName}`;
427
398
  this.freeze();
428
399
  }
429
- toOp() {
400
+ toOp(_lowerer, targetId) {
430
401
  const index = indexChecks(this.tableName, this.indexName);
431
402
  return {
432
403
  id: `index.${this.tableName}.${this.indexName}`,
@@ -434,7 +405,7 @@ var CreateIndexCall = class extends MysqlOpFactoryCallNode {
434
405
  summary: `Creates ${this.unique ? "unique " : ""}index ${this.indexName} on ${this.tableName}`,
435
406
  operationClass: "additive",
436
407
  target: {
437
- id: "mysql",
408
+ id: this.targetIdFor(targetId),
438
409
  details: buildTargetDetails("index", this.indexName, this.tableName)
439
410
  },
440
411
  precheck: [index.absent(`ensure index "${this.indexName}" is missing`)],
@@ -459,7 +430,7 @@ var DropIndexCall = class extends MysqlOpFactoryCallNode {
459
430
  this.label = `Drop index ${indexName} on ${tableName}`;
460
431
  this.freeze();
461
432
  }
462
- toOp() {
433
+ toOp(_lowerer, targetId) {
463
434
  const index = indexChecks(this.tableName, this.indexName);
464
435
  return {
465
436
  id: `dropIndex.${this.tableName}.${this.indexName}`,
@@ -467,7 +438,7 @@ var DropIndexCall = class extends MysqlOpFactoryCallNode {
467
438
  summary: `Drops index ${this.indexName} on ${this.tableName} which is not in the contract`,
468
439
  operationClass: "widening",
469
440
  target: {
470
- id: "mysql",
441
+ id: this.targetIdFor(targetId),
471
442
  details: buildTargetDetails("index", this.indexName, this.tableName)
472
443
  },
473
444
  precheck: [index.present(`ensure index "${this.indexName}" exists`)],
@@ -494,7 +465,7 @@ var AddUniqueCall = class extends MysqlOpFactoryCallNode {
494
465
  this.label = `Add unique constraint ${constraintName} on ${tableName}`;
495
466
  this.freeze();
496
467
  }
497
- toOp() {
468
+ toOp(_lowerer, targetId) {
498
469
  const constraint = constraintChecks(this.tableName, this.constraintName, "UNIQUE");
499
470
  return {
500
471
  id: `unique.${this.tableName}.${this.constraintName}`,
@@ -502,7 +473,7 @@ var AddUniqueCall = class extends MysqlOpFactoryCallNode {
502
473
  summary: `Adds unique constraint ${this.constraintName} on ${this.tableName}`,
503
474
  operationClass: "additive",
504
475
  target: {
505
- id: "mysql",
476
+ id: this.targetIdFor(targetId),
506
477
  details: buildTargetDetails("unique", this.constraintName, this.tableName)
507
478
  },
508
479
  precheck: [constraint.absent(`ensure unique constraint "${this.constraintName}" is missing`)],
@@ -527,7 +498,7 @@ var DropUniqueCall = class extends MysqlOpFactoryCallNode {
527
498
  this.label = `Drop unique constraint ${constraintName} on ${tableName}`;
528
499
  this.freeze();
529
500
  }
530
- toOp() {
501
+ toOp(_lowerer, targetId) {
531
502
  const constraint = constraintChecks(this.tableName, this.constraintName, "UNIQUE");
532
503
  return {
533
504
  id: `dropUnique.${this.tableName}.${this.constraintName}`,
@@ -535,7 +506,7 @@ var DropUniqueCall = class extends MysqlOpFactoryCallNode {
535
506
  summary: `Drops unique constraint ${this.constraintName} on ${this.tableName} which is not in the contract`,
536
507
  operationClass: "widening",
537
508
  target: {
538
- id: "mysql",
509
+ id: this.targetIdFor(targetId),
539
510
  details: buildTargetDetails("unique", this.constraintName, this.tableName)
540
511
  },
541
512
  precheck: [constraint.present(`ensure unique constraint "${this.constraintName}" exists`)],
@@ -560,7 +531,7 @@ var AddForeignKeyCall = class extends MysqlOpFactoryCallNode {
560
531
  this.label = `Add foreign key ${foreignKey.name} on ${tableName}`;
561
532
  this.freeze();
562
533
  }
563
- toOp() {
534
+ toOp(_lowerer, targetId) {
564
535
  const { name, columns, references } = this.foreignKey;
565
536
  const constraint = constraintChecks(this.tableName, name, "FOREIGN KEY");
566
537
  return {
@@ -569,7 +540,7 @@ var AddForeignKeyCall = class extends MysqlOpFactoryCallNode {
569
540
  summary: `Adds foreign key ${name} on ${this.tableName} referencing ${references.table}`,
570
541
  operationClass: "additive",
571
542
  target: {
572
- id: "mysql",
543
+ id: this.targetIdFor(targetId),
573
544
  details: buildTargetDetails("foreignKey", name, this.tableName)
574
545
  },
575
546
  precheck: [constraint.absent(`ensure foreign key "${name}" is missing`)],
@@ -602,7 +573,7 @@ var DropForeignKeyCall = class extends MysqlOpFactoryCallNode {
602
573
  this.label = `Drop foreign key ${constraintName} on ${tableName}`;
603
574
  this.freeze();
604
575
  }
605
- toOp() {
576
+ toOp(_lowerer, targetId) {
606
577
  const constraint = constraintChecks(this.tableName, this.constraintName, "FOREIGN KEY");
607
578
  return {
608
579
  id: `dropForeignKey.${this.tableName}.${this.constraintName}`,
@@ -610,7 +581,7 @@ var DropForeignKeyCall = class extends MysqlOpFactoryCallNode {
610
581
  summary: `Drops foreign key ${this.constraintName} on ${this.tableName} which is not in the contract`,
611
582
  operationClass: "widening",
612
583
  target: {
613
- id: "mysql",
584
+ id: this.targetIdFor(targetId),
614
585
  details: buildTargetDetails("foreignKey", this.constraintName, this.tableName)
615
586
  },
616
587
  precheck: [constraint.present(`ensure foreign key "${this.constraintName}" exists`)],
@@ -643,13 +614,13 @@ var RawSqlCall = class extends MysqlOpFactoryCallNode {
643
614
  }
644
615
  importRequirements() {
645
616
  return [{
646
- moduleSpecifier: TARGET_MIGRATION_MODULE,
617
+ moduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,
647
618
  symbol: "rawSql"
648
619
  }];
649
620
  }
650
621
  };
651
622
  /** The table rename a user writes by hand on MySQL, which the planner does not plan yet. */
652
- function renameTableByHandOp(from, to) {
623
+ function renameTableByHandOp(from, to, targetId) {
653
624
  const fromTable = tableChecks(from);
654
625
  const toTable = tableChecks(to);
655
626
  return {
@@ -657,7 +628,7 @@ function renameTableByHandOp(from, to) {
657
628
  label: `Rename table ${from} to ${to}`,
658
629
  operationClass: "widening",
659
630
  target: {
660
- id: "mysql",
631
+ id: targetId,
661
632
  details: buildTargetDetails("table", to)
662
633
  },
663
634
  precheck: [fromTable.present(`ensure table "${from}" exists`), toTable.absent(`ensure table "${to}" does not exist`)],
@@ -677,6 +648,42 @@ function foreignKeySpecOf(fk, table) {
677
648
  ...ifDefined("onUpdate", fk.onUpdate)
678
649
  };
679
650
  }
651
+ /** The type DDL writes for a column node: the type it is stored as, with the parameters the contract writes, as MySQL reports it in `COLUMN_TYPE`. */
652
+ function columnTypeSql(column) {
653
+ const type = column.storedType;
654
+ if (type === void 0 || !isSqlDataType(type)) throw new InternalError(`column "${column.name}" has no data type; the expected tree must be derived via contractToSchemaIR for planning`);
655
+ return renderSqlTypeName(type, dataTypeParams(type, column.codecRef?.typeParams));
656
+ }
657
+ function ddlDefaultOf(columnDefault) {
658
+ if (columnDefault === void 0) return void 0;
659
+ return columnDefault.kind === "literal" ? new LiteralColumnDefault(columnDefault.value) : new FunctionColumnDefault(opaqueSql(columnDefault.expression));
660
+ }
661
+ /** The default a column node's DDL writes: the one the contract authored, which `resolvedDefault` normalises for the diff. */
662
+ function columnDefaultOf(column) {
663
+ return column.authoredDefault ?? column.resolvedDefault;
664
+ }
665
+ /** The `DdlColumn` of a column node. An `autoincrement()` default stays a function default, which the adapter writes as `AUTO_INCREMENT`. */
666
+ function ddlColumnFromNode(column) {
667
+ const columnDefault = ddlDefaultOf(columnDefaultOf(column));
668
+ return new DdlColumn({
669
+ name: column.name,
670
+ type: columnTypeSql(column),
671
+ ...column.nullable ? {} : { notNull: true },
672
+ ...columnDefault === void 0 ? {} : { default: columnDefault },
673
+ ...column.codecRef === void 0 ? {} : { codecRef: column.codecRef }
674
+ });
675
+ }
676
+ /** The name a unique constraint is created and dropped by; MySQL names an unnamed one after its first column, which the contract never leaves to it. */
677
+ function uniqueName(table, unique) {
678
+ return unique.name ?? `${table}_${unique.columns.join("_")}_key`;
679
+ }
680
+ /** The constraints `CREATE TABLE` writes for a table node: its primary key and unique constraints. Foreign keys are added after every table exists, so tables can reference each other. */
681
+ function tableConstraintsFromNode(table) {
682
+ return [...table.primaryKey === void 0 ? [] : [new PrimaryKeyConstraint({ columns: table.primaryKey.columns })], ...table.uniques.map((unique) => new UniqueConstraint({
683
+ columns: unique.columns,
684
+ name: uniqueName(table.name, unique)
685
+ }))];
686
+ }
680
687
  /**
681
688
  * Drops each issue under a missing or extra node: the call for a table or column accounts for everything beneath it.
682
689
  */
@@ -712,8 +719,8 @@ function placeOf(issue, at) {
712
719
  function notYetSupported(kind, change, issue, conflictLocation) {
713
720
  return {
714
721
  kind,
715
- summary: `${change} is not yet supported on MySQL (${placeOf(issue, conflictLocation)})`,
716
- why: "The MySQL planner creates and drops tables, columns, indexes, unique constraints and foreign keys; it does not change a column, a default, a primary key or a CHECK constraint yet. Use `migration new` to write this change by hand.",
722
+ summary: `${change} is not yet supported by the migration planner (${placeOf(issue, conflictLocation)})`,
723
+ why: "The migration planner creates and drops tables, columns, indexes, unique constraints and foreign keys; it does not change a column, a default, a primary key or a CHECK constraint yet. Use `migration new` to write this change by hand.",
717
724
  ...conflictLocation === void 0 ? {} : { location: conflictLocation }
718
725
  };
719
726
  }
@@ -884,8 +891,8 @@ function placeText(at) {
884
891
  function longNameConflicts(call) {
885
892
  return namesGiven(call).filter(({ name }) => Array.from(name).length > MAX_IDENTIFIER_CHARACTERS).map(({ name, at }) => ({
886
893
  kind: "unsupportedOperation",
887
- summary: `The name ${name} is longer than the ${MAX_IDENTIFIER_CHARACTERS} characters MySQL allows (${placeText(at)})`,
888
- why: `MySQL refuses a table, column, index or constraint name longer than ${MAX_IDENTIFIER_CHARACTERS} characters. Give it a shorter name in the contract.`,
894
+ summary: `The name ${name} is longer than the ${MAX_IDENTIFIER_CHARACTERS} characters the database allows (${placeText(at)})`,
895
+ why: `The database refuses a table, column, index or constraint name longer than ${MAX_IDENTIFIER_CHARACTERS} characters. Give it a shorter name in the contract.`,
889
896
  location: at
890
897
  }));
891
898
  }
@@ -898,8 +905,8 @@ function autoincrementKeyConflicts(call) {
898
905
  const keyLeaders = new Set(call.constraints.flatMap((constraint) => constraint.kind === "primary-key" || constraint.kind === "unique" ? constraint.columns.slice(0, 1) : []));
899
906
  return call.columns.filter((column) => isAutoincrement(column) && !column.primaryKey && !keyLeaders.has(column.name)).map((column) => ({
900
907
  kind: "unsupportedOperation",
901
- summary: `An autoincrement column that is not the first column of the primary key or a unique constraint is not supported on MySQL (${call.tableName}.${column.name})`,
902
- why: "MySQL requires an AUTO_INCREMENT column to be the first column of a key, and refuses the table otherwise.",
908
+ summary: `An autoincrement column that is not the first column of the primary key or a unique constraint is not supported by the database (${call.tableName}.${column.name})`,
909
+ why: "The database requires an AUTO_INCREMENT column to be the first column of a key, and refuses the table otherwise.",
903
910
  location: location(call.tableName, column.name)
904
911
  }));
905
912
  }
@@ -969,8 +976,8 @@ function conflictForIndexAKeyUses(dropped, expected, protectedKeys) {
969
976
  if (key === void 0) return void 0;
970
977
  return {
971
978
  kind: "indexIncompatible",
972
- summary: `Dropping index ${dropped.indexName}, which foreign key ${foreignKeySpecOf(key, tableName).name} uses, is not yet supported on MySQL (${tableName})`,
973
- why: "MySQL refuses to drop an index a foreign key uses. Keep an index whose first columns are the foreign key's columns, or use `migration new` to drop the foreign key, drop the index and add the foreign key again.",
979
+ summary: `Dropping index ${dropped.indexName}, which foreign key ${foreignKeySpecOf(key, tableName).name} uses, is not yet supported by the migration planner (${tableName})`,
980
+ why: "The database refuses to drop an index a foreign key uses. Keep an index whose first columns are the foreign key's columns, or use `migration new` to drop the foreign key, drop the index and add the foreign key again.",
974
981
  location: {
975
982
  entityKind: "table",
976
983
  entityName: tableName,
@@ -1016,10 +1023,9 @@ function planIssues(input) {
1016
1023
  ]);
1017
1024
  }
1018
1025
  /**
1019
- * The base class of a MySQL `migration.ts`. Each protected method returns the operation its name says, rendered through the MySQL control adapter the migration CLI builds from `prisma.config.ts`.
1026
+ * The base class of a `migration.ts` for MySQL or a target that extends it, such as MariaDB. Each protected method returns the operation its name says, for the target `targetId` names, rendered through the control adapter the migration CLI builds from `prisma.config.ts`.
1020
1027
  */
1021
- var MysqlMigration = class extends Migration {
1022
- targetId = "mysql";
1028
+ var MysqlMigrationBase = class extends Migration {
1023
1029
  controlAdapter;
1024
1030
  constructor(stack) {
1025
1031
  super(stack);
@@ -1030,28 +1036,28 @@ var MysqlMigration = class extends Migration {
1030
1036
  return this.controlAdapter;
1031
1037
  }
1032
1038
  createTable(options) {
1033
- return new CreateTableCall(options.table, options.columns, options.constraints ?? []).toOp(this.adapterFor("createTable"));
1039
+ return new CreateTableCall(options.table, options.columns, options.constraints ?? []).toOp(this.adapterFor("createTable"), this.targetId);
1034
1040
  }
1035
1041
  dropTable(options) {
1036
- return new DropTableCall(options.table).toOp();
1042
+ return new DropTableCall(options.table).toOp(void 0, this.targetId);
1037
1043
  }
1038
1044
  addColumn(options) {
1039
- return new AddColumnCall(options.table, options.column).toOp(this.adapterFor("addColumn"));
1045
+ return new AddColumnCall(options.table, options.column).toOp(this.adapterFor("addColumn"), this.targetId);
1040
1046
  }
1041
1047
  dropColumn(options) {
1042
- return new DropColumnCall(options.table, options.column).toOp();
1048
+ return new DropColumnCall(options.table, options.column).toOp(void 0, this.targetId);
1043
1049
  }
1044
1050
  createIndex(options) {
1045
- return new CreateIndexCall(options.table, options.index, options.columns, options.unique === true).toOp();
1051
+ return new CreateIndexCall(options.table, options.index, options.columns, options.unique === true).toOp(void 0, this.targetId);
1046
1052
  }
1047
1053
  dropIndex(options) {
1048
- return new DropIndexCall(options.table, options.index).toOp();
1054
+ return new DropIndexCall(options.table, options.index).toOp(void 0, this.targetId);
1049
1055
  }
1050
1056
  addUnique(options) {
1051
- return new AddUniqueCall(options.table, options.name, options.columns).toOp();
1057
+ return new AddUniqueCall(options.table, options.name, options.columns).toOp(void 0, this.targetId);
1052
1058
  }
1053
1059
  dropUnique(options) {
1054
- return new DropUniqueCall(options.table, options.name).toOp();
1060
+ return new DropUniqueCall(options.table, options.name).toOp(void 0, this.targetId);
1055
1061
  }
1056
1062
  addForeignKey(options) {
1057
1063
  return new AddForeignKeyCall(options.table, {
@@ -1060,38 +1066,42 @@ var MysqlMigration = class extends Migration {
1060
1066
  references: options.references,
1061
1067
  ...ifDefined("onDelete", options.onDelete),
1062
1068
  ...ifDefined("onUpdate", options.onUpdate)
1063
- }).toOp();
1069
+ }).toOp(void 0, this.targetId);
1064
1070
  }
1065
1071
  dropForeignKey(options) {
1066
- return new DropForeignKeyCall(options.table, options.name).toOp();
1072
+ return new DropForeignKeyCall(options.table, options.name).toOp(void 0, this.targetId);
1067
1073
  }
1068
1074
  };
1069
- function assertMysqlOp(op, factoryName) {
1075
+ /** The base class of a MySQL `migration.ts`. */
1076
+ var MysqlMigration = class extends MysqlMigrationBase {
1077
+ targetId = "mysql";
1078
+ };
1079
+ function assertTargetOp(op, factoryName, expectedTargetId) {
1070
1080
  const targetId = blindCast(op).target?.id;
1071
- if (targetId !== "mysql") throw new InternalError(`renderOps: expected a mysql operation but got target.id="${String(targetId)}" for op.id="${op.id}" (factoryName="${factoryName}").`);
1081
+ if (targetId !== expectedTargetId) throw new InternalError(`renderOps: expected a ${expectedTargetId} operation but got target.id="${String(targetId)}" for op.id="${op.id}" (factoryName="${factoryName}").`);
1072
1082
  }
1073
- function checkedOp(opOrPromise, factoryName) {
1083
+ function checkedOp(opOrPromise, factoryName, targetId) {
1074
1084
  if (isThenable(opOrPromise)) {
1075
1085
  const checked = opOrPromise.then((op) => {
1076
- assertMysqlOp(op, factoryName);
1086
+ assertTargetOp(op, factoryName, targetId);
1077
1087
  return op;
1078
1088
  });
1079
1089
  checked.catch(() => void 0);
1080
1090
  return checked;
1081
1091
  }
1082
- assertMysqlOp(opOrPromise, factoryName);
1092
+ assertTargetOp(opOrPromise, factoryName, targetId);
1083
1093
  return opOrPromise;
1084
1094
  }
1085
- /** The operations `calls` lower to, in order, each checked to be a MySQL operation. */
1086
- function renderOps(calls, lowerer) {
1087
- return calls.map((call) => checkedOp(isMysqlOpFactoryCall(call) ? call.toOp(lowerer) : blindCast(call).toOp(lowerer), call.factoryName));
1095
+ /** The operations `calls` lower to, in order, each checked to be an operation of the target `targetId` names. */
1096
+ function renderOps(calls, lowerer, targetId) {
1097
+ return calls.map((call) => checkedOp(isMysqlOpFactoryCall(call) ? call.toOp(lowerer, targetId) : blindCast(call).toOp(lowerer), call.factoryName, targetId));
1088
1098
  }
1089
- /** The base class and the CLI entrypoint every scaffold imports, both from the MySQL facade's `migration` module. */
1099
+ /** The base class and the CLI entrypoint every scaffold imports, both from the facade's `migration` module. */
1090
1100
  const BASE_IMPORTS = [{
1091
- moduleSpecifier: "@internal/mysql/migration",
1101
+ moduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,
1092
1102
  symbol: "Migration"
1093
1103
  }, {
1094
- moduleSpecifier: "@internal/mysql/migration",
1104
+ moduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,
1095
1105
  symbol: "MigrationCLI"
1096
1106
  }];
1097
1107
  function renderCallsToTypeScript(calls, meta) {
@@ -1121,7 +1131,8 @@ function renderCallsToTypeScript(calls, meta) {
1121
1131
  function buildImports(calls, meta) {
1122
1132
  const requirements = [...BASE_IMPORTS, ...contractImports(meta)];
1123
1133
  for (const call of calls) for (const req of call.importRequirements()) requirements.push(req);
1124
- return renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));
1134
+ const resolve = meta.resolveImportSpecifier ?? keepInternalSpecifiers;
1135
+ return renderImports(resolveRequirementSpecifiers(requirements, (specifier) => resolve(specifier === "@internal/mysql/migration" ? meta.migrationModule : specifier)));
1125
1136
  }
1126
1137
  function contractImports(meta) {
1127
1138
  const reqs = [{
@@ -1156,7 +1167,9 @@ function indent(text, spaces) {
1156
1167
  return text.split("\n").map((line) => line.trim() ? `${pad}${line}` : line).join("\n");
1157
1168
  }
1158
1169
  /** The plan the MySQL planner produces: its operations, and the `migration.ts` that writes them. */
1159
- var TypeScriptRenderableMysqlMigration = class extends MysqlMigration {
1170
+ var TypeScriptRenderableMysqlMigration = class extends MysqlMigrationBase {
1171
+ targetId;
1172
+ #migrationModule;
1160
1173
  #calls;
1161
1174
  #meta;
1162
1175
  #destination;
@@ -1166,6 +1179,8 @@ var TypeScriptRenderableMysqlMigration = class extends MysqlMigration {
1166
1179
  #operationsCache;
1167
1180
  constructor(options) {
1168
1181
  super();
1182
+ this.targetId = options.target.targetId;
1183
+ this.#migrationModule = options.target.migrationModule;
1169
1184
  this.#calls = options.calls;
1170
1185
  this.#meta = options.meta;
1171
1186
  this.#spaceId = options.spaceId;
@@ -1174,7 +1189,7 @@ var TypeScriptRenderableMysqlMigration = class extends MysqlMigration {
1174
1189
  this.#lowerer = options.lowerer;
1175
1190
  }
1176
1191
  get operations() {
1177
- this.#operationsCache ??= renderOps(this.#calls, this.#lowerer);
1192
+ this.#operationsCache ??= renderOps(this.#calls, this.#lowerer, this.targetId);
1178
1193
  return this.#operationsCache;
1179
1194
  }
1180
1195
  describe() {
@@ -1191,14 +1206,17 @@ var TypeScriptRenderableMysqlMigration = class extends MysqlMigration {
1191
1206
  from: this.#meta.from,
1192
1207
  to: this.#meta.to,
1193
1208
  snapshotsImportPath: this.#snapshotsImportPath,
1194
- resolveImportSpecifier
1209
+ resolveImportSpecifier,
1210
+ migrationModule: this.#migrationModule
1195
1211
  });
1196
1212
  }
1197
1213
  };
1198
- const mysqlTableRenameByHand = {
1199
- renderTableRename: (rename) => new RawSqlCall(renameTableByHandOp(rename.from, rename.to)).renderTypeScript(),
1200
- tableRenameByHand: (rename) => [`RENAME TABLE ${quoteIdentifier(rename.from)} TO ${quoteIdentifier(rename.to)}`]
1201
- };
1214
+ function tableRenameByHand(targetId) {
1215
+ return {
1216
+ renderTableRename: (rename) => new RawSqlCall(renameTableByHandOp(rename.from, rename.to, targetId)).renderTypeScript(),
1217
+ tableRenameByHand: (rename) => [`RENAME TABLE ${quoteIdentifier(rename.from)} TO ${quoteIdentifier(rename.to)}`]
1218
+ };
1219
+ }
1202
1220
  function tableTarget(table, column) {
1203
1221
  return {
1204
1222
  storageName: column === void 0 ? table : `${table}.${column}`,
@@ -1237,12 +1255,14 @@ function isTableOwnedElsewhere(issue, ownership) {
1237
1255
  });
1238
1256
  }
1239
1257
  /**
1240
- * The MySQL migration planner. It diffs the contract's schema against the live one and plans creating and dropping tables, columns, indexes, unique constraints and foreign keys. Every other change, and every statement such as a rename, is refused with a conflict that says it is not yet supported on MySQL.
1258
+ * The MySQL migration planner, for MySQL or a target that extends it. It diffs the contract's schema against the live one and plans creating and dropping tables, columns, indexes, unique constraints and foreign keys. Every other change, and every statement such as a rename, is refused with a conflict that says it is not yet supported on MySQL.
1241
1259
  */
1242
1260
  var MysqlMigrationPlanner = class {
1243
1261
  #lowerer;
1244
- constructor(lowerer) {
1262
+ #target;
1263
+ constructor(lowerer, target) {
1245
1264
  this.#lowerer = lowerer;
1265
+ this.#target = target;
1246
1266
  }
1247
1267
  plan(options) {
1248
1268
  return this.#planSql(blindCast(options));
@@ -1256,7 +1276,8 @@ var MysqlMigrationPlanner = class {
1256
1276
  },
1257
1277
  spaceId,
1258
1278
  snapshotsImportPath: context.snapshotsImportPath,
1259
- lowerer: this.#lowerer
1279
+ lowerer: this.#lowerer,
1280
+ target: this.#target
1260
1281
  });
1261
1282
  }
1262
1283
  #planSql(options) {
@@ -1295,14 +1316,15 @@ var MysqlMigrationPlanner = class {
1295
1316
  storageHash: options.contract.storage.storageHash,
1296
1317
  ...options.contract.profileHash === void 0 ? {} : { profileHash: options.contract.profileHash }
1297
1318
  },
1298
- lowerer: this.#lowerer
1319
+ lowerer: this.#lowerer,
1320
+ target: this.#target
1299
1321
  }),
1300
1322
  appliedStatements: [],
1301
1323
  ...subjectsOfCalls(calls.map(callSubjects), {
1302
1324
  fromContract: options.fromContract,
1303
1325
  contract: options.contract,
1304
1326
  origins: NO_RENAMED_ORIGINS,
1305
- byHand: mysqlTableRenameByHand,
1327
+ byHand: tableRenameByHand(this.#target.targetId),
1306
1328
  removedVariants: []
1307
1329
  })
1308
1330
  };
@@ -1311,13 +1333,13 @@ var MysqlMigrationPlanner = class {
1311
1333
  function statementNotYetSupported(statement) {
1312
1334
  return {
1313
1335
  kind: "statementRefused",
1314
- summary: `A ${statement.kind} statement is not yet supported on MySQL`,
1315
- why: "The MySQL planner plans no rename, conversion or backfill yet. Plan the change without the statement, or write it by hand in a migration of its own with `migration new`.",
1336
+ summary: `A ${statement.kind} statement is not yet supported by the migration planner`,
1337
+ why: "The migration planner plans no rename, conversion or backfill yet. Plan the change without the statement, or write it by hand in a migration of its own with `migration new`.",
1316
1338
  refusedStatement: statement
1317
1339
  };
1318
1340
  }
1319
- function createMysqlMigrationPlanner(lowerer) {
1320
- return new MysqlMigrationPlanner(lowerer);
1341
+ function createMysqlMigrationPlanner(lowerer, target) {
1342
+ return new MysqlMigrationPlanner(lowerer, target);
1321
1343
  }
1322
1344
  /** An error without a structured code, such as a driver's socket error, thrown while a space applied: reported as `MIGRATION.EXECUTION_FAILED`, with its own code, when it has one, in `errorCode`. */
1323
1345
  function failureFromThrown(error) {
@@ -1640,6 +1662,6 @@ function createMysqlMigrationRunner(family) {
1640
1662
  return new MysqlMigrationRunner(family);
1641
1663
  }
1642
1664
  //#endregion
1643
- export { diffMysqlSchema as _, CreateTableCall as a, DropIndexCall as c, MysqlMigration as d, MysqlMigrationPlanner as f, createMysqlMigrationRunner as g, createMysqlMigrationPlanner as h, CreateIndexCall as i, DropTableCall as l, TypeScriptRenderableMysqlMigration as m, AddForeignKeyCall as n, DropColumnCall as o, RawSqlCall as p, AddUniqueCall as r, DropForeignKeyCall as s, AddColumnCall as t, DropUniqueCall as u, mysqlContractToSchema as v, rawSql as y };
1665
+ export { createMysqlMigrationPlanner as _, CreateTableCall as a, mysqlContractToSchema as b, DropIndexCall as c, MYSQL_MIGRATION_MODULE as d, MysqlMigration as f, TypeScriptRenderableMysqlMigration as g, RawSqlCall as h, CreateIndexCall as i, DropTableCall as l, MysqlMigrationPlanner as m, AddForeignKeyCall as n, DropColumnCall as o, MysqlMigrationBase as p, AddUniqueCall as r, DropForeignKeyCall as s, AddColumnCall as t, DropUniqueCall as u, createMysqlMigrationRunner as v, rawSql as x, diffMysqlSchema as y };
1644
1666
 
1645
- //# sourceMappingURL=runner-C39AEe6--BVG3xPYw.mjs.map
1667
+ //# sourceMappingURL=runner-BIjAWX-E-BgTmrD8f.mjs.map