@prisma/orm-target-postgres 8.0.0-rc.14-dev.29 → 8.0.0-rc.14-dev.31

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 (247) hide show
  1. package/dist/{adapter-DzNbNJ24.d.mts → adapter-BOi8Qpb_.d.mts} +6 -4
  2. package/dist/adapter-BOi8Qpb_.d.mts.map +1 -0
  3. package/dist/{adapter-BNrSLsxC-CXrTrSvP.mjs → adapter-DwUKamWE-9wPlFOdx.mjs} +23 -12
  4. package/dist/adapter-DwUKamWE-9wPlFOdx.mjs.map +1 -0
  5. package/dist/adapter.d.mts +7 -7
  6. package/dist/adapter.mjs +7 -7
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +1 -1
  9. package/dist/adapter__control.d.mts +2 -2
  10. package/dist/adapter__control.mjs +10 -16
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.d.mts +1 -1
  13. package/dist/adapter__runtime.mjs +9 -6
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.d.mts +1 -1
  16. package/dist/adapter__sql-renderer.mjs +1 -1
  17. package/dist/adapter__types.d.mts +3 -3
  18. package/dist/{authoring-C5Ch8RNG-Qgq9GiOY.mjs → authoring-BarDKx1G-BKhOsXKo.mjs} +20 -65
  19. package/dist/authoring-BarDKx1G-BKhOsXKo.mjs.map +1 -0
  20. package/dist/{check-expressions-DJNIFTHB-C86_fR5c.mjs → check-expressions-BRuSxJ5d-CC5OFfR1.mjs} +3 -3
  21. package/dist/{check-expressions-DJNIFTHB-C86_fR5c.mjs.map → check-expressions-BRuSxJ5d-CC5OFfR1.mjs.map} +1 -1
  22. package/dist/{codec-descriptor-B61d-k4C-BdWVU6Fu.mjs → codec-descriptor-CZAGhM_O-DK9auM7J.mjs} +5 -18
  23. package/dist/codec-descriptor-CZAGhM_O-DK9auM7J.mjs.map +1 -0
  24. package/dist/codec-descriptor-DAQDOwCJ.d.mts +1 -0
  25. package/dist/{codec-descriptor-HYqjI24K-CTO3gTEs.d.mts → codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts} +9 -10
  26. package/dist/codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts.map +1 -0
  27. package/dist/{codec-helpers-BmUrP6U9-DuO9gpqZ.mjs → codec-helpers-BKrVHgYc-DFnb5u9l.mjs} +4 -6
  28. package/dist/codec-helpers-BKrVHgYc-DFnb5u9l.mjs.map +1 -0
  29. package/dist/{codecs-CWXNVl1P.mjs → codec-registry-CCCOytGc-BFC0dvlt.mjs} +28 -12
  30. package/dist/codec-registry-CCCOytGc-BFC0dvlt.mjs.map +1 -0
  31. package/dist/{codec-type-map-Br7wS7DK-DmphGfZE.d.mts → codec-type-map-B9MLL97E-RMa5Y4R4.d.mts} +4 -4
  32. package/dist/{codec-type-map-Br7wS7DK-DmphGfZE.d.mts.map → codec-type-map-B9MLL97E-RMa5Y4R4.d.mts.map} +1 -1
  33. package/dist/{codec-types-DBeKvpNs-D9JlxBzY.d.mts → codec-types-Du6N0o5U-DMAI6jag.d.mts} +4 -4
  34. package/dist/{codec-types-DBeKvpNs-D9JlxBzY.d.mts.map → codec-types-Du6N0o5U-DMAI6jag.d.mts.map} +1 -1
  35. package/dist/codec-types-uq3Il6e3.d.mts +2 -0
  36. package/dist/{codecs-CnbVrlil--FxLKWM5.mjs → codecs-BzCRfsit-BbLlbudt.mjs} +35 -228
  37. package/dist/codecs-BzCRfsit-BbLlbudt.mjs.map +1 -0
  38. package/dist/{codecs-DxqbAhl0.d.mts → codecs-C0zx-UlM.d.mts} +10 -14
  39. package/dist/codecs-C0zx-UlM.d.mts.map +1 -0
  40. package/dist/{codecs-BU-eLMQi-BB2afWsO.d.mts → codecs-Ckpsj4IT-C7kgMiKv.d.mts} +16 -90
  41. package/dist/codecs-Ckpsj4IT-C7kgMiKv.d.mts.map +1 -0
  42. package/dist/{contract-free-DeK6m1dy.mjs → contract-free-DAGgx1J-.mjs} +8 -5
  43. package/dist/contract-free-DAGgx1J-.mjs.map +1 -0
  44. package/dist/{control-CyiVFspE.mjs → control-C0mAPRzk.mjs} +75 -117
  45. package/dist/control-C0mAPRzk.mjs.map +1 -0
  46. package/dist/{control-xWtRBAPw.d.mts → control-aDBKB9hQ.d.mts} +5 -10
  47. package/dist/control-aDBKB9hQ.d.mts.map +1 -0
  48. package/dist/{control-adapter-Du0EcG5G-CT4qBFrG.mjs → control-adapter-cjnLE0mN-BmNP2taw.mjs} +14 -18
  49. package/dist/control-adapter-cjnLE0mN-BmNP2taw.mjs.map +1 -0
  50. package/dist/control-fp7Azf3F.d.mts +733 -0
  51. package/dist/control-fp7Azf3F.d.mts.map +1 -0
  52. package/dist/{control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs → control-policy-CuJvncMq-C5yshGZP.mjs} +52 -52
  53. package/dist/control-policy-CuJvncMq-C5yshGZP.mjs.map +1 -0
  54. package/dist/{data-type-entries-cjspFU7A-BBOIqLij.mjs → data-type-entries-DYgNhsVx-BWJJHCQR.mjs} +5 -4
  55. package/dist/data-type-entries-DYgNhsVx-BWJJHCQR.mjs.map +1 -0
  56. package/dist/data-types-DzUVlWeo-CBMHoFoH.mjs +366 -0
  57. package/dist/data-types-DzUVlWeo-CBMHoFoH.mjs.map +1 -0
  58. package/dist/data-types-E1wms1_i.d.mts +96 -0
  59. package/dist/data-types-E1wms1_i.d.mts.map +1 -0
  60. package/dist/{ddl-BQFDVert-CcDdETee.mjs → ddl-BzsT_-qY-Cdzm0YIK.mjs} +3 -3
  61. package/dist/{ddl-BQFDVert-CcDdETee.mjs.map → ddl-BzsT_-qY-Cdzm0YIK.mjs.map} +1 -1
  62. package/dist/{default-normalizer-ByDD_gRm-CKeWEb0x.mjs → default-normalizer-C68YhUBS-BjOeKRhS.mjs} +3 -3
  63. package/dist/{default-normalizer-ByDD_gRm-CKeWEb0x.mjs.map → default-normalizer-C68YhUBS-BjOeKRhS.mjs.map} +1 -1
  64. package/dist/{descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs → descriptor-meta-CUmf1G9P-GAdC3zfT.mjs} +9 -7
  65. package/dist/descriptor-meta-CUmf1G9P-GAdC3zfT.mjs.map +1 -0
  66. package/dist/{descriptor-meta-BEigA5Gj-eY7nV4N_.mjs → descriptor-meta-gq4MiUXl-DqqHHHSj.mjs} +4 -90
  67. package/dist/descriptor-meta-gq4MiUXl-DqqHHHSj.mjs.map +1 -0
  68. package/dist/{descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs → descriptor-meta-runtime-D-ZCTI0a-DVgDk2XT.mjs} +5 -3
  69. package/dist/descriptor-meta-runtime-D-ZCTI0a-DVgDk2XT.mjs.map +1 -0
  70. package/dist/{diff-database-schema-D-eMVqv1.d.mts → diff-database-schema-BGcRo8FM.d.mts} +2 -2
  71. package/dist/{diff-database-schema-D-eMVqv1.d.mts.map → diff-database-schema-BGcRo8FM.d.mts.map} +1 -1
  72. package/dist/{diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs → diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs} +18 -26
  73. package/dist/diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs.map +1 -0
  74. package/dist/{errors-1AjGQf6h.d.mts → errors-DZ3zQdpT.d.mts} +2 -2
  75. package/dist/{errors-1AjGQf6h.d.mts.map → errors-DZ3zQdpT.d.mts.map} +1 -1
  76. package/dist/{full-text-DZ_SB64Q.d.mts → full-text-DjD0tAqd.d.mts} +2 -2
  77. package/dist/{full-text-DZ_SB64Q.d.mts.map → full-text-DjD0tAqd.d.mts.map} +1 -1
  78. package/dist/{full-text-index-expression-525ZZWf0-HIGVQbjL.mjs → full-text-index-expression-DKwm2Z9W-CboCsz4N.mjs} +4 -4
  79. package/dist/{full-text-index-expression-525ZZWf0-HIGVQbjL.mjs.map → full-text-index-expression-DKwm2Z9W-CboCsz4N.mjs.map} +1 -1
  80. package/dist/{full-text-parsers-Cg9SDrnx-DA1eBg1b.d.mts → full-text-parsers-DinPC_86-B2P_FyTG.d.mts} +3 -3
  81. package/dist/{full-text-parsers-Cg9SDrnx-DA1eBg1b.d.mts.map → full-text-parsers-DinPC_86-B2P_FyTG.d.mts.map} +1 -1
  82. package/dist/{infer-psl-contract-Burb6YAz-DbKU4cXm.mjs → infer-psl-contract-DBWXA-jx-CmKQgKZJ.mjs} +11 -11
  83. package/dist/infer-psl-contract-DBWXA-jx-CmKQgKZJ.mjs.map +1 -0
  84. package/dist/{issue-planner-BdnqkLvV.d.mts → issue-planner-pmBrIrEN.d.mts} +7 -2
  85. package/dist/issue-planner-pmBrIrEN.d.mts.map +1 -0
  86. package/dist/{migration-D7F66l-1.d.mts → migration-D189kh3f.d.mts} +3 -3
  87. package/dist/{migration-D7F66l-1.d.mts.map → migration-D189kh3f.d.mts.map} +1 -1
  88. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  89. package/dist/{native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs → native-type-normalizer-CwyVR7xB.mjs} +3 -9
  90. package/dist/native-type-normalizer-CwyVR7xB.mjs.map +1 -0
  91. package/dist/{op-factory-call-DkzlLBzN-Bc6l0sYN.mjs → op-factory-call-4IafSIKD-D2wO2iyZ.mjs} +11 -11
  92. package/dist/op-factory-call-4IafSIKD-D2wO2iyZ.mjs.map +1 -0
  93. package/dist/{op-factory-call-CaEALaar-Nh0fSxQY.d.mts → op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts} +6 -5
  94. package/dist/op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts.map +1 -0
  95. package/dist/op-factory-call-D5UJ7cDi.d.mts +1 -0
  96. package/dist/{operation-types-sVW52HpK.d.mts → operation-types-DfPl4yzR.d.mts} +2 -2
  97. package/dist/{operation-types-sVW52HpK.d.mts.map → operation-types-DfPl4yzR.d.mts.map} +1 -1
  98. package/dist/{pack-AqcQpXNv.d.mts → pack-Cx7B1N8w.d.mts} +6 -33
  99. package/dist/pack-Cx7B1N8w.d.mts.map +1 -0
  100. package/dist/{planner-D7lEhXHR-8Wz1p_6j.mjs → planner-BWKFZaOu--28k5rC4.mjs} +12 -10
  101. package/dist/planner-BWKFZaOu--28k5rC4.mjs.map +1 -0
  102. package/dist/{planner-DECxo-qa.d.mts → planner-CvUO8Zpn.d.mts} +2 -2
  103. package/dist/{planner-DECxo-qa.d.mts.map → planner-CvUO8Zpn.d.mts.map} +1 -1
  104. package/dist/{planner-ddl-builders-DYLyFXrj.d.mts → planner-ddl-builders-Ckcr8Ov1.d.mts} +10 -8
  105. package/dist/planner-ddl-builders-Ckcr8Ov1.d.mts.map +1 -0
  106. package/dist/planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs +93 -0
  107. package/dist/planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs.map +1 -0
  108. package/dist/planner-identity-values-BTYw1D7D-CzpXx1yD.mjs +72 -0
  109. package/dist/planner-identity-values-BTYw1D7D-CzpXx1yD.mjs.map +1 -0
  110. package/dist/{planner-identity-values-TfEhnoWa.d.mts → planner-identity-values-DvlFit8A.d.mts} +7 -6
  111. package/dist/planner-identity-values-DvlFit8A.d.mts.map +1 -0
  112. package/dist/{planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs → planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs} +3 -3
  113. package/dist/{planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs.map → planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs.map} +1 -1
  114. package/dist/planner-produced-postgres-migration-BI_aepPp.d.mts +1 -0
  115. package/dist/{planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts → planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts} +3 -3
  116. package/dist/planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts.map +1 -0
  117. package/dist/planner-sql-checks-Cr06nK1--B3gPnC1a.mjs +47 -0
  118. package/dist/planner-sql-checks-Cr06nK1--B3gPnC1a.mjs.map +1 -0
  119. package/dist/{planner-sql-checks-CFgbRTJw.d.mts → planner-sql-checks-iNLJS1dW.d.mts} +8 -3
  120. package/dist/{planner-sql-checks-CFgbRTJw.d.mts.map → planner-sql-checks-iNLJS1dW.d.mts.map} +1 -1
  121. package/dist/{postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs → postgres-contract-view-D60F8OWK-Bi5oJkOx.mjs} +12 -10
  122. package/dist/postgres-contract-view-D60F8OWK-Bi5oJkOx.mjs.map +1 -0
  123. package/dist/{postgres-migration-Dq60Mixq-DYNJokZW.mjs → postgres-migration-PLXsv15e-BruyXuKH.mjs} +21 -20
  124. package/dist/postgres-migration-PLXsv15e-BruyXuKH.mjs.map +1 -0
  125. package/dist/{postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts → postgres-migration-e8UybR1y-C_m4i1jp.d.mts} +3 -3
  126. package/dist/{postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts.map → postgres-migration-e8UybR1y-C_m4i1jp.d.mts.map} +1 -1
  127. package/dist/{postgres-schema-C8slJGZo-CFGUyJPt.mjs → postgres-schema-DXd0mebY-CExd_GcQ.mjs} +3 -3
  128. package/dist/{postgres-schema-C8slJGZo-CFGUyJPt.mjs.map → postgres-schema-DXd0mebY-CExd_GcQ.mjs.map} +1 -1
  129. package/dist/{prisma7-binding-Dm24YoM6.mjs → prisma7-binding-BgMvnMgz.mjs} +30 -30
  130. package/dist/prisma7-binding-BgMvnMgz.mjs.map +1 -0
  131. package/dist/{prisma7-binding-C0GpQxEQ.d.mts → prisma7-binding-D2guML1e.d.mts} +8 -35
  132. package/dist/prisma7-binding-D2guML1e.d.mts.map +1 -0
  133. package/dist/{resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs → resolve-ddl-schema-CadTChyu-C7F31wpN.mjs} +3 -3
  134. package/dist/{resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs.map → resolve-ddl-schema-CadTChyu-C7F31wpN.mjs.map} +1 -1
  135. package/dist/{runtime-4QFzvcCp.d.mts → runtime-aejvKbMy.d.mts} +2 -2
  136. package/dist/{runtime-4QFzvcCp.d.mts.map → runtime-aejvKbMy.d.mts.map} +1 -1
  137. package/dist/{sql-renderer-CgUgFbU4-BY3PCrmG.mjs → sql-renderer-BjJ3MLnI-DQvfiMO6.mjs} +45 -43
  138. package/dist/sql-renderer-BjJ3MLnI-DQvfiMO6.mjs.map +1 -0
  139. package/dist/{sql-renderer-Bd07vbru.d.mts → sql-renderer-D6UgvbqG.d.mts} +6 -5
  140. package/dist/sql-renderer-D6UgvbqG.d.mts.map +1 -0
  141. package/dist/{sql-utils-Bh-mnsSY-D6hnFPrP.mjs → sql-utils-BMXJi06b-CAQOplfq.mjs} +178 -3
  142. package/dist/sql-utils-BMXJi06b-CAQOplfq.mjs.map +1 -0
  143. package/dist/target.d.mts +27 -27
  144. package/dist/target.mjs +28 -28
  145. package/dist/target__codec-descriptor.d.mts +2 -2
  146. package/dist/target__codec-descriptor.mjs +1 -1
  147. package/dist/target__codec-types.d.mts +3 -3
  148. package/dist/target__codecs.d.mts +3 -3
  149. package/dist/target__codecs.mjs +3 -3
  150. package/dist/target__contract-free.mjs +3 -3
  151. package/dist/target__control.d.mts +2 -2
  152. package/dist/target__control.mjs +4 -4
  153. package/dist/target__data-types.d.mts +2 -2
  154. package/dist/target__data-types.mjs +3 -3
  155. package/dist/target__default-normalizer.mjs +1 -1
  156. package/dist/target__diff-database-schema.d.mts +1 -1
  157. package/dist/target__diff-database-schema.mjs +1 -1
  158. package/dist/target__errors.d.mts +1 -1
  159. package/dist/target__full-text.d.mts +2 -2
  160. package/dist/target__issue-planner.d.mts +1 -1
  161. package/dist/target__issue-planner.mjs +1 -1
  162. package/dist/target__migration.d.mts +2 -2
  163. package/dist/target__migration.mjs +2 -2
  164. package/dist/target__native-type-normalizer.mjs +1 -1
  165. package/dist/target__op-factory-call.d.mts +2 -2
  166. package/dist/target__op-factory-call.mjs +1 -1
  167. package/dist/target__operation-types.d.mts +1 -1
  168. package/dist/target__pack.d.mts +1 -1
  169. package/dist/target__pack.mjs +1 -1
  170. package/dist/target__planner-ddl-builders.d.mts +2 -2
  171. package/dist/target__planner-ddl-builders.mjs +1 -1
  172. package/dist/target__planner-identity-values.d.mts +1 -1
  173. package/dist/target__planner-identity-values.mjs +1 -1
  174. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  175. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  176. package/dist/target__planner-sql-checks.d.mts +1 -1
  177. package/dist/target__planner-sql-checks.mjs +1 -1
  178. package/dist/target__planner.d.mts +1 -1
  179. package/dist/target__planner.mjs +2 -2
  180. package/dist/target__prisma7-binding.d.mts +1 -1
  181. package/dist/target__prisma7-binding.mjs +1 -1
  182. package/dist/target__runtime.mjs +3 -3
  183. package/dist/target__runtime.mjs.map +1 -1
  184. package/dist/target__schema-ir-annotations.mjs +1 -1
  185. package/dist/target__sql-utils.mjs +2 -2
  186. package/dist/target__types.mjs +2 -2
  187. package/dist/{types-BPubHbiE-BzhJ05fG.d.mts → types-D6lgKhE5-Cu48rrw9.d.mts} +7 -4
  188. package/dist/types-D6lgKhE5-Cu48rrw9.d.mts.map +1 -0
  189. package/dist/types-LTOC-zv8.d.mts +2 -0
  190. package/package.json +9 -9
  191. package/dist/adapter-BNrSLsxC-CXrTrSvP.mjs.map +0 -1
  192. package/dist/adapter-DzNbNJ24.d.mts.map +0 -1
  193. package/dist/authoring-C5Ch8RNG-Qgq9GiOY.mjs.map +0 -1
  194. package/dist/codec-descriptor-B61d-k4C-BdWVU6Fu.mjs.map +0 -1
  195. package/dist/codec-descriptor-D8_e5hpo.d.mts +0 -1
  196. package/dist/codec-descriptor-HYqjI24K-CTO3gTEs.d.mts.map +0 -1
  197. package/dist/codec-helpers-BmUrP6U9-DuO9gpqZ.mjs.map +0 -1
  198. package/dist/codec-types-Diyz6muR.d.mts +0 -2
  199. package/dist/codecs-BU-eLMQi-BB2afWsO.d.mts.map +0 -1
  200. package/dist/codecs-CWXNVl1P.mjs.map +0 -1
  201. package/dist/codecs-CnbVrlil--FxLKWM5.mjs.map +0 -1
  202. package/dist/codecs-DxqbAhl0.d.mts.map +0 -1
  203. package/dist/contract-free-DeK6m1dy.mjs.map +0 -1
  204. package/dist/control-CyiVFspE.mjs.map +0 -1
  205. package/dist/control-D7_yfEfH.d.mts +0 -402
  206. package/dist/control-D7_yfEfH.d.mts.map +0 -1
  207. package/dist/control-adapter-Du0EcG5G-CT4qBFrG.mjs.map +0 -1
  208. package/dist/control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs.map +0 -1
  209. package/dist/control-xWtRBAPw.d.mts.map +0 -1
  210. package/dist/data-type-entries-cjspFU7A-BBOIqLij.mjs.map +0 -1
  211. package/dist/data-types-BGsYeBpf-B_5bvuEe.mjs +0 -200
  212. package/dist/data-types-BGsYeBpf-B_5bvuEe.mjs.map +0 -1
  213. package/dist/data-types-DZGKP-qZ.d.mts +0 -47
  214. package/dist/data-types-DZGKP-qZ.d.mts.map +0 -1
  215. package/dist/descriptor-meta-BEigA5Gj-eY7nV4N_.mjs.map +0 -1
  216. package/dist/descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs.map +0 -1
  217. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +0 -1
  218. package/dist/diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs.map +0 -1
  219. package/dist/infer-psl-contract-Burb6YAz-DbKU4cXm.mjs.map +0 -1
  220. package/dist/issue-planner-BdnqkLvV.d.mts.map +0 -1
  221. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs.map +0 -1
  222. package/dist/op-factory-call-CaEALaar-Nh0fSxQY.d.mts.map +0 -1
  223. package/dist/op-factory-call-DVz_g8zS.d.mts +0 -1
  224. package/dist/op-factory-call-DkzlLBzN-Bc6l0sYN.mjs.map +0 -1
  225. package/dist/pack-AqcQpXNv.d.mts.map +0 -1
  226. package/dist/planner-D7lEhXHR-8Wz1p_6j.mjs.map +0 -1
  227. package/dist/planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs +0 -128
  228. package/dist/planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs.map +0 -1
  229. package/dist/planner-ddl-builders-DYLyFXrj.d.mts.map +0 -1
  230. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +0 -90
  231. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +0 -1
  232. package/dist/planner-identity-values-TfEhnoWa.d.mts.map +0 -1
  233. package/dist/planner-produced-postgres-migration-BMfo2BlI.d.mts +0 -1
  234. package/dist/planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts.map +0 -1
  235. package/dist/planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs +0 -192
  236. package/dist/planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs.map +0 -1
  237. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +0 -15
  238. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +0 -1
  239. package/dist/postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs.map +0 -1
  240. package/dist/postgres-migration-Dq60Mixq-DYNJokZW.mjs.map +0 -1
  241. package/dist/prisma7-binding-C0GpQxEQ.d.mts.map +0 -1
  242. package/dist/prisma7-binding-Dm24YoM6.mjs.map +0 -1
  243. package/dist/sql-renderer-Bd07vbru.d.mts.map +0 -1
  244. package/dist/sql-renderer-CgUgFbU4-BY3PCrmG.mjs.map +0 -1
  245. package/dist/sql-utils-Bh-mnsSY-D6hnFPrP.mjs.map +0 -1
  246. package/dist/types-BPubHbiE-BzhJ05fG.d.mts.map +0 -1
  247. package/dist/types-DQ5Lh5JL.d.mts +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-fp7Azf3F.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control.d.mts"],"mappings":";;;;;;;;iBASiB,sBAAsB,KAAK,eAAe,QAAQ,eAAe;;;;;;;;;;cAUpE;WACH;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;;cAID;WACH;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;eAEA;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;iBAEF;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;;;;;cASL;WACH;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;eAEA;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;iBAEF;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;eACA;eACA;eACA;;aAEF;eACE;eACA;iBACE;mBACE;mBACA;;;;;WAKR;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;aACA;eACE;;;;;;cAMD,0BAA0B,uCAAuC,8DAA8D,gDAAgD"}
@@ -1,12 +1,14 @@
1
1
  import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
- import { d as isPostgresSchema } from "./postgres-schema-C8slJGZo-CFGUyJPt.mjs";
2
+ import { _ as pgInt8, f as pgFloat4, g as pgInt4, h as pgInt2, p as pgFloat8 } from "./data-types-DzUVlWeo-CBMHoFoH.mjs";
3
+ import { d as isPostgresSchema } from "./postgres-schema-DXd0mebY-CExd_GcQ.mjs";
3
4
  import { n as PostgresSchemaNodeKind, o as postgresNodeEntityKind, r as PostgresTableSchemaNode, t as PostgresNativeEnumSchemaNode } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
4
- import { t as buildExpectedFormatType } from "./planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs";
5
- import { t as buildColumnTypeSql } from "./planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs";
6
- import { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as buildTargetDetails, I as columnNameOfCall, N as SetDefaultCall, O as RawSqlCall, P as SetNotNullCall, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall, z as postgresDefaultToDdlColumnDefault } from "./op-factory-call-DkzlLBzN-Bc6l0sYN.mjs";
7
- import { n as resolveIdentityValue } from "./planner-identity-values-BmHn5C6U-BYBbUAyR.mjs";
5
+ import { t as buildExpectedFormatType } from "./planner-sql-checks-Cr06nK1--B3gPnC1a.mjs";
6
+ import { t as buildColumnTypeSql } from "./planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs";
7
+ import { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as buildTargetDetails, I as columnNameOfCall, N as SetDefaultCall, O as RawSqlCall, P as SetNotNullCall, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall, z as postgresDefaultToDdlColumnDefault } from "./op-factory-call-4IafSIKD-D2wO2iyZ.mjs";
8
+ import { n as resolveIdentityValue } from "./planner-identity-values-BTYw1D7D-CzpXx1yD.mjs";
8
9
  import { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from "./planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs";
9
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
+ import { sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
10
12
  import { UNBOUND_NAMESPACE_ID, entityAt } from "@prisma/orm-framework/components/ir";
11
13
  import { issueOutcome, orderIssuesByDependencies } from "@prisma/orm-framework/components/control";
12
14
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -14,7 +16,7 @@ import * as contractFree from "@prisma/orm-family-sql/relational-core/contract-f
14
16
  import { RelationalSchemaNodeKind, SqlSchemaIR, contractDefaultRefusal, defaultInCanonicalForm } from "@prisma/orm-family-sql/schema-ir/types";
15
17
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
16
18
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
17
- //#region ../../../3-targets/3-targets/postgres/dist/control-policy-BW5Cgq3Z.mjs
19
+ //#region ../../../3-targets/3-targets/postgres/dist/control-policy-CuJvncMq.mjs
18
20
  /**
19
21
  * The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff
20
22
  * node addresses — a table by its name, a native enum by its physical type
@@ -42,13 +44,9 @@ function postgresNodeStorageCoordinate(node) {
42
44
  * Reconstructs the `StorageColumn`-shaped fields the DDL builder functions
43
45
  * (`buildColumnTypeSql`, `buildExpectedFormatType`, `resolveIdentityValue`)
44
46
  * expect, from a column node's own stamped codec identity (`codecRef` /
45
- * `codecBaseNativeType` / `codecNamedType`, Decision 5) — never the
46
- * contract. The builders were written against `StorageColumn` and are
47
- * unchanged here; only the shape feeding them moves from the contract to
48
- * the node. An empty `storageTypes` catalog is passed alongside: the
49
- * node's fields are already resolved past any `typeRef` indirection, so no
50
- * live lookup is needed, and passing a non-empty catalog would risk a
51
- * false `typeRef` hit against an unrelated storage type.
47
+ * `codecBaseNativeType`, Decision 5) — never the contract. The node's fields
48
+ * are already resolved past any `typeRef` indirection, so the builders get
49
+ * no `storageTypes` catalog.
52
50
  */
53
51
  function columnLike(column) {
54
52
  return {
@@ -63,8 +61,7 @@ function columnTypeLike(owner, identity) {
63
61
  nativeType: identity.codecBaseNativeType,
64
62
  codecId: identity.codecRef.codecId,
65
63
  many: identity.many ?? identity.codecRef.many ? { elementNullable: false } : false,
66
- ...ifDefined("typeParams", identity.codecRef.typeParams !== void 0 ? blindCast(identity.codecRef.typeParams) : void 0),
67
- ...identity.codecNamedType ? { typeRef: "<resolved>" } : {}
64
+ ...ifDefined("typeParams", identity.codecRef.typeParams !== void 0 ? blindCast(identity.codecRef.typeParams) : void 0)
68
65
  };
69
66
  }
70
67
  /**
@@ -86,13 +83,11 @@ function inCanonicalForm(columnName, columnDefault, dataType, many) {
86
83
  }
87
84
  /**
88
85
  * Builds the `CREATE TABLE` / `ADD COLUMN` DDL column for an expected column
89
- * node, resolving type rendering from the node's codec identity against the
90
- * codec hooks the caller holds — the same builder the pre-`plan(start, end)`
91
- * op-path called, so the output is byte-identical.
86
+ * node, writing its type from the data type the node's codec represents.
92
87
  */
93
- function renderColumnDdl(name, column, codecHooks) {
88
+ function renderColumnDdl(name, column, types) {
94
89
  const like = columnLike(column);
95
- const typeSql = buildColumnTypeSql(like, codecHooks, {});
90
+ const typeSql = buildColumnTypeSql(like, types);
96
91
  const ddlDefault = postgresDefaultToDdlColumnDefault(inCanonicalForm(name, like.default, column.dataType, like.many !== false));
97
92
  return contractFree.col(name, typeSql, {
98
93
  ...!column.nullable ? { notNull: true } : {},
@@ -103,11 +98,11 @@ function renderColumnDdl(name, column, codecHooks) {
103
98
  /**
104
99
  * Builds the `ALTER COLUMN … TYPE` operands for an expected column node.
105
100
  */
106
- function renderColumnAlterType(column, codecHooks) {
101
+ function renderColumnAlterType(column, types) {
107
102
  const like = columnLike(column);
108
103
  return {
109
- qualifiedTargetType: buildColumnTypeSql(like, codecHooks, {}, false),
110
- formatTypeExpected: buildExpectedFormatType(like, codecHooks, {})
104
+ qualifiedTargetType: buildColumnTypeSql(like, types, {}, false),
105
+ formatTypeExpected: buildExpectedFormatType(like, types)
111
106
  };
112
107
  }
113
108
  /**
@@ -117,19 +112,19 @@ function renderColumnAlterType(column, codecHooks) {
117
112
  * `null` when the column's type has no built-in/codec-provided identity
118
113
  * value.
119
114
  */
120
- function resolveColumnTemporaryDefault(column, codecHooks) {
121
- return resolveIdentityValue(columnLike(column), codecHooks, {});
115
+ function resolveColumnTemporaryDefault(column, codecHooks, types) {
116
+ return resolveIdentityValue(columnLike(column), codecHooks, types);
122
117
  }
123
118
  /**
124
119
  * The column whose `SET DEFAULT` a column-default diff node asks for, carrying its authored default, or its resolved one when nothing was authored, and its type and codec, from which the adapter writes the clause. `undefined` when the node carries no default, or one DDL does not write, as for an autoincrement column.
125
120
  */
126
- function buildSetDefaultColumn(columnName, defaultNode, codecHooks) {
121
+ function buildSetDefaultColumn(columnName, defaultNode, types) {
127
122
  const authored = defaultNode.authored ?? defaultNode.resolved;
128
123
  if (authored === void 0) return void 0;
129
124
  const typeLike = columnTypeLike("column default", defaultNode);
130
125
  const ddlDefault = postgresDefaultToDdlColumnDefault(inCanonicalForm(columnName, authored, defaultNode.dataType, typeLike.many !== false));
131
126
  if (ddlDefault === void 0) return void 0;
132
- return contractFree.col(columnName, buildColumnTypeSql(typeLike, codecHooks, {}, false), {
127
+ return contractFree.col(columnName, buildColumnTypeSql(typeLike, types, {}, false), {
133
128
  default: ddlDefault,
134
129
  ...ifDefined("codecRef", defaultNode.codecRef)
135
130
  });
@@ -196,7 +191,7 @@ const notNullBackfillCallStrategy = (issues, ctx) => {
196
191
  if (ddlSchemaName === void 0 || tableName === void 0) continue;
197
192
  const schemaName = emissionSchemaName(ctx, ddlSchemaName);
198
193
  matched.push(issue);
199
- const ddl = renderColumnDdl(expected.name, expected, ctx.codecHooks);
194
+ const ddl = renderColumnDdl(expected.name, expected, ctx.types);
200
195
  const nullableSpec = contractFree.col(ddl.name, ddl.type, { ...ddl.codecRef !== void 0 ? { codecRef: ddl.codecRef } : {} });
201
196
  calls.push(new AddColumnCall(schemaName, tableName, nullableSpec), new DataTransformCall(`backfill-${tableName}-${expected.name}`, `backfill-${tableName}-${expected.name}:check`, `backfill-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));
202
197
  }
@@ -209,11 +204,16 @@ const notNullBackfillCallStrategy = (issues, ctx) => {
209
204
  };
210
205
  };
211
206
  const SAFE_WIDENINGS = /* @__PURE__ */ new Set([
212
- "int2→int4",
213
- "int2→int8",
214
- "int4→int8",
215
- "float4→float8"
207
+ `${pgInt2.id}→${pgInt4.id}`,
208
+ `${pgInt2.id}→${pgInt8.id}`,
209
+ `${pgInt4.id}→${pgInt8.id}`,
210
+ `${pgFloat4.id}→${pgFloat8.id}`
216
211
  ]);
212
+ /** The id of the data type a column node's codec represents. */
213
+ function columnDataType(column, types) {
214
+ if (column.codecRef === void 0) throw new InternalError(`Column "${column.name}" carries no codec, so its data type is unknown; a type change is planned only between columns built from contracts.`);
215
+ return sqlDataTypeOfCodec(column.codecRef.codecId, types).id;
216
+ }
217
217
  /**
218
218
  * Handles `not-equal` column issues whose TYPE differs. `fromContract` is
219
219
  * only supplied by `migration plan` — for reconciliation (`db update` /
@@ -241,8 +241,8 @@ const typeChangeCallStrategy = (issues, ctx) => {
241
241
  if (pair === void 0) continue;
242
242
  const { expected, actual } = pair;
243
243
  if (!columnTypeChangedNativeOnly(expected, actual)) continue;
244
- const fromType = actual.nativeType;
245
- const toType = expected.nativeType;
244
+ const fromType = columnDataType(actual, ctx.types);
245
+ const toType = columnDataType(expected, ctx.types);
246
246
  const isSafeWidening = SAFE_WIDENINGS.has(`${fromType}→${toType}`);
247
247
  if (!isSafeWidening && !dataAllowed) continue;
248
248
  const ddlSchemaName = issueSchemaName(issue);
@@ -250,7 +250,7 @@ const typeChangeCallStrategy = (issues, ctx) => {
250
250
  if (ddlSchemaName === void 0 || tableName === void 0) continue;
251
251
  const schemaName = emissionSchemaName(ctx, ddlSchemaName);
252
252
  matched.push(issue);
253
- const { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, ctx.codecHooks);
253
+ const { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, ctx.types);
254
254
  const alterOpts = {
255
255
  qualifiedTargetType,
256
256
  formatTypeExpected,
@@ -373,7 +373,6 @@ const notNullAddColumnCallStrategy = (issues, ctx) => {
373
373
  const matched = [];
374
374
  const calls = [];
375
375
  const schemaLookups = buildSchemaLookupMap(ctx.schema);
376
- const mutableCodecHooks = blindCast(ctx.codecHooks);
377
376
  const mutableStorageTypes = blindCast(ctx.storageTypes);
378
377
  for (const issue of issues) {
379
378
  if (issueOutcome(issue) !== "not-found") continue;
@@ -391,7 +390,7 @@ const notNullAddColumnCallStrategy = (issues, ctx) => {
391
390
  if (!contractTable || !column) continue;
392
391
  const schemaTable = ctx.schema.tables[tableName];
393
392
  if (!schemaTable) continue;
394
- const temporaryDefault = resolveColumnTemporaryDefault(expected, ctx.codecHooks);
393
+ const temporaryDefault = resolveColumnTemporaryDefault(expected, ctx.codecHooks, ctx.types);
395
394
  const schemaLookup = schemaLookups.get(tableName);
396
395
  const canUseSharedTempDefault = temporaryDefault !== null && canUseSharedTemporaryDefaultStrategy({
397
396
  table: contractTable,
@@ -406,13 +405,13 @@ const notNullAddColumnCallStrategy = (issues, ctx) => {
406
405
  tableName,
407
406
  columnName: expected.name,
408
407
  column,
409
- codecHooks: mutableCodecHooks,
408
+ types: ctx.types,
410
409
  storageTypes: mutableStorageTypes,
411
410
  temporaryDefault
412
411
  }));
413
412
  continue;
414
413
  }
415
- calls.push(new AddNotNullColumnDirectCall(schemaName, tableName, expected.name, renderColumnDdl(expected.name, expected, ctx.codecHooks)));
414
+ calls.push(new AddNotNullColumnDirectCall(schemaName, tableName, expected.name, renderColumnDdl(expected.name, expected, ctx.types)));
416
415
  }
417
416
  if (matched.length === 0) return { kind: "no_match" };
418
417
  return {
@@ -657,8 +656,8 @@ function fkSpecFromNode(fk, tableName) {
657
656
  * FK / unique constraints are separate calls (re-bucketed downstream). Every
658
657
  * column's DDL is resolved from its `codecRef` via `renderColumnDdl`.
659
658
  */
660
- function buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, codecHooks) {
661
- const ddlColumns = Object.values(table.columns).map((c) => renderColumnDdl(c.name, c, codecHooks));
659
+ function buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, types) {
660
+ const ddlColumns = Object.values(table.columns).map((c) => renderColumnDdl(c.name, c, types));
662
661
  const primaryKeyConstraints = table.primaryKey ? [contractFree.primaryKey([...table.primaryKey.columns], { ...ifDefined("name", table.primaryKey.name) })] : [];
663
662
  const declaredChecks = (table.checks ?? []).map((c) => contractFree.checkExpression(c.name, c.expression));
664
663
  const allTableConstraints = [...primaryKeyConstraints, ...declaredChecks];
@@ -722,8 +721,8 @@ function mapNativeEnumNodeIssue(issue, ctx) {
722
721
  actualMembers: actual.members
723
722
  })));
724
723
  }
725
- function mapTableNodeIssue(issue, schemaName, ddlSchemaName, codecHooks) {
726
- if (issueOutcome(issue) === "not-found") return ok(buildCreateTableCallsFromNode(schemaName, ddlSchemaName, blindCast(issue.expected), codecHooks));
724
+ function mapTableNodeIssue(issue, schemaName, ddlSchemaName, types) {
725
+ if (issueOutcome(issue) === "not-found") return ok(buildCreateTableCallsFromNode(schemaName, ddlSchemaName, blindCast(issue.expected), types));
727
726
  if (issueOutcome(issue) === "not-expected") return ok([new DropTableCall(schemaName, blindCast(issue.actual).name)]);
728
727
  const expected = blindCast(issue.expected);
729
728
  const actual = blindCast(issue.actual);
@@ -731,17 +730,17 @@ function mapTableNodeIssue(issue, schemaName, ddlSchemaName, codecHooks) {
731
730
  if (!expected.rlsEnabled && actual.rlsEnabled) return ok([new DisableRowLevelSecurityCall(ddlSchemaName, expected.name)]);
732
731
  return notOk(nodeConflict("unsupportedOperation", `unhandled table-attribute drift on "${expected.name}": table not-equal with no rlsEnabled delta (a second table attribute drifted)`));
733
732
  }
734
- function mapColumnNodeIssue(issue, schemaName, tableName, codecHooks) {
733
+ function mapColumnNodeIssue(issue, schemaName, tableName, types) {
735
734
  if (issueOutcome(issue) === "not-found") {
736
735
  const column = blindCast(issue.expected);
737
- return ok([new AddColumnCall(schemaName, tableName, renderColumnDdl(column.name, column, codecHooks))]);
736
+ return ok([new AddColumnCall(schemaName, tableName, renderColumnDdl(column.name, column, types))]);
738
737
  }
739
738
  if (issueOutcome(issue) === "not-expected") return ok([new DropColumnCall(schemaName, tableName, blindCast(issue.actual).name)]);
740
739
  const expected = blindCast(issue.expected);
741
740
  const actual = blindCast(issue.actual);
742
741
  const calls = [];
743
742
  if (columnTypeChanged(expected, actual)) {
744
- const { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, codecHooks);
743
+ const { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, types);
745
744
  calls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, {
746
745
  qualifiedTargetType,
747
746
  formatTypeExpected,
@@ -751,10 +750,10 @@ function mapColumnNodeIssue(issue, schemaName, tableName, codecHooks) {
751
750
  if (expected.nullable !== actual.nullable) calls.push(expected.nullable ? new DropNotNullCall(schemaName, tableName, expected.name) : new SetNotNullCall(schemaName, tableName, expected.name));
752
751
  return ok(calls);
753
752
  }
754
- function mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, codecHooks) {
753
+ function mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, types) {
755
754
  if (issueOutcome(issue) === "not-expected") return ok([new DropDefaultCall(schemaName, tableName, columnName)]);
756
755
  if (issue.expected === void 0) return ok([]);
757
- const column = buildSetDefaultColumn(columnName, blindCast(issue.expected), codecHooks);
756
+ const column = buildSetDefaultColumn(columnName, blindCast(issue.expected), types);
758
757
  if (column === void 0) return ok([]);
759
758
  return ok([new SetDefaultCall(schemaName, tableName, column, issueOutcome(issue) === "not-equal" ? "widening" : "additive")]);
760
759
  }
@@ -836,12 +835,12 @@ function mapNodeIssueToCall(issue, ctx) {
836
835
  if (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict("unsupportedOperation", `Issue has no schema/table in its path: ${issue.path.join("/")}`));
837
836
  const schemaName = emissionSchemaName(ctx, ddlSchemaName);
838
837
  switch (node.nodeKind) {
839
- case PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.codecHooks);
840
- case RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.codecHooks);
838
+ case PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.types);
839
+ case RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.types);
841
840
  case RelationalSchemaNodeKind.columnDefault: {
842
841
  const columnName = issueColumnName(issue);
843
842
  if (columnName === void 0) return notOk(nodeConflict("unsupportedOperation", `Default issue has no column in its path: ${issue.path.join("/")}`));
844
- return mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, ctx.codecHooks);
843
+ return mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, ctx.types);
845
844
  }
846
845
  case RelationalSchemaNodeKind.primaryKey: return mapPrimaryKeyNodeIssue(issue, schemaName, tableName);
847
846
  case RelationalSchemaNodeKind.foreignKey: return mapForeignKeyNodeIssue(issue, schemaName, tableName);
@@ -868,6 +867,7 @@ function planIssues(options) {
868
867
  fromContract: options.fromContract,
869
868
  schemaName: options.schemaName,
870
869
  codecHooks: options.codecHooks,
870
+ types: options.types,
871
871
  storageTypes: options.storageTypes,
872
872
  schema,
873
873
  policy,
@@ -1176,4 +1176,4 @@ function resolvePostgresNodeIssueControlPolicySubject(issue, contract) {
1176
1176
  //#endregion
1177
1177
  export { defaultUniqueName as a, planIssues as c, renderPostgresSuppression as d, resolveNamespaceIdForDdlSchema as f, resolvePostgresNodeIssueCreationFactoryName as h, defaultPrimaryKeyName as i, postgresNodeStorageCoordinate as l, resolvePostgresNodeIssueControlPolicySubject as m, conflictForDisallowedCall as n, issueNode as o, resolvePostgresCallControlPolicySubject as p, defaultForeignKeyName as r, issueSchemaName as s, coalesceSubtreeIssues as t, postgresPlannerStrategies as u };
1178
1178
 
1179
- //# sourceMappingURL=control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs.map
1179
+ //# sourceMappingURL=control-policy-CuJvncMq-C5yshGZP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-policy-CuJvncMq-C5yshGZP.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control-policy-CuJvncMq.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { _ as pgInt8, f as pgFloat4, g as pgInt4, h as pgInt2, p as pgFloat8 } from \"./data-types-DzUVlWeo.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-DXd0mebY.mjs\";\nimport { n as PostgresNativeEnumSchemaNode, o as postgresNodeEntityKind, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as columnNameOfCall, I as postgresDefaultToDdlColumnDefault, L as buildTargetDetails, N as SetDefaultCall, O as RawSqlCall, P as SetNotNullCall, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-4IafSIKD.mjs\";\nimport { t as buildExpectedFormatType } from \"./planner-sql-checks-Cr06nK1-.mjs\";\nimport { t as buildColumnTypeSql } from \"./planner-ddl-builders-O0JqJIBZ.mjs\";\nimport { n as resolveIdentityValue } from \"./planner-identity-values-BTYw1D7D.mjs\";\nimport { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from \"./planner-schema-lookup-kMIVP2y-.mjs\";\nimport { sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport * as contractFree from \"@internal/sql-relational-core/contract-free\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, contractDefaultRefusal, defaultInCanonicalForm } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/schema-ir/node-storage-coordinate.ts\n/**\n* The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff\n* node addresses — a table by its name, a native enum by its physical type\n* name. `undefined` for a node that is not a whole storage entity (a namespace,\n* a column, a policy). Lets ownership/subject resolution treat every entity kind\n* uniformly, the node self-describing its storage identity.\n*/\nfunction postgresNodeStorageCoordinate(node) {\n\tif (PostgresTableSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.name\n\t\t};\n\t}\n\tif (PostgresNativeEnumSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.typeName\n\t\t};\n\t}\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\n/**\n* Reconstructs the `StorageColumn`-shaped fields the DDL builder functions\n* (`buildColumnTypeSql`, `buildExpectedFormatType`, `resolveIdentityValue`)\n* expect, from a column node's own stamped codec identity (`codecRef` /\n* `codecBaseNativeType`, Decision 5) — never the contract. The node's fields\n* are already resolved past any `typeRef` indirection, so the builders get\n* no `storageTypes` catalog.\n*/\nfunction columnLike(column) {\n\treturn {\n\t\t...columnTypeLike(`column \"${column.name}\"`, column),\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"default\", column.authoredDefault ?? column.resolvedDefault)\n\t};\n}\nfunction columnTypeLike(owner, identity) {\n\tif (identity.codecRef === void 0 || identity.codecBaseNativeType === void 0) throw new InternalError(`columnTypeLike: expected ${owner} carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tnativeType: identity.codecBaseNativeType,\n\t\tcodecId: identity.codecRef.codecId,\n\t\tmany: identity.many ?? identity.codecRef.many ? { elementNullable: false } : false,\n\t\t...ifDefined(\"typeParams\", identity.codecRef.typeParams !== void 0 ? blindCast(identity.codecRef.typeParams) : void 0)\n\t};\n}\n/**\n* A literal default in the canonical form of the column's data type, which DDL writes (ADR 254). A\n* default the type refuses, which a contract emitted by an earlier version can hold, is refused\n* here rather than written, since the database would never hold the text the contract states.\n*/\nfunction inCanonicalForm(columnName, columnDefault, dataType, many) {\n\tif (columnDefault?.kind !== \"literal\") return columnDefault;\n\tconst refusal = contractDefaultRefusal(columnDefault, dataType?.toCanonicalForm, many);\n\tif (refusal !== void 0) throw postgresError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${columnName}\": ${refusal}`, { meta: {\n\t\treason: \"default-not-canonical\",\n\t\tcolumn: columnName\n\t} });\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue: defaultInCanonicalForm(columnDefault.value, dataType?.toCanonicalForm, many).value\n\t};\n}\n/**\n* Builds the `CREATE TABLE` / `ADD COLUMN` DDL column for an expected column\n* node, writing its type from the data type the node's codec represents.\n*/\nfunction renderColumnDdl(name, column, types) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, types);\n\tconst ddlDefault = postgresDefaultToDdlColumnDefault(inCanonicalForm(name, like.default, column.dataType, like.many !== false));\n\treturn contractFree.col(name, typeSql, {\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...ifDefined(\"default\", ddlDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef)\n\t});\n}\n/**\n* Builds the `ALTER COLUMN … TYPE` operands for an expected column node.\n*/\nfunction renderColumnAlterType(column, types) {\n\tconst like = columnLike(column);\n\treturn {\n\t\tqualifiedTargetType: buildColumnTypeSql(like, types, {}, false),\n\t\tformatTypeExpected: buildExpectedFormatType(like, types)\n\t};\n}\n/**\n* Resolves the identity value (monoid neutral element) SQL literal used as\n* the temporary default when adding a NOT-NULL column with no contract\n* default (`notNullAddColumnCallStrategy`'s shared-temp-default backfill).\n* `null` when the column's type has no built-in/codec-provided identity\n* value.\n*/\nfunction resolveColumnTemporaryDefault(column, codecHooks, types) {\n\treturn resolveIdentityValue(columnLike(column), codecHooks, types);\n}\n/**\n* The column whose `SET DEFAULT` a column-default diff node asks for, carrying its authored default, or its resolved one when nothing was authored, and its type and codec, from which the adapter writes the clause. `undefined` when the node carries no default, or one DDL does not write, as for an autoincrement column.\n*/\nfunction buildSetDefaultColumn(columnName, defaultNode, types) {\n\tconst authored = defaultNode.authored ?? defaultNode.resolved;\n\tif (authored === void 0) return void 0;\n\tconst typeLike = columnTypeLike(\"column default\", defaultNode);\n\tconst ddlDefault = postgresDefaultToDdlColumnDefault(inCanonicalForm(columnName, authored, defaultNode.dataType, typeLike.many !== false));\n\tif (ddlDefault === void 0) return void 0;\n\treturn contractFree.col(columnName, buildColumnTypeSql(typeLike, types, {}, false), {\n\t\tdefault: ddlDefault,\n\t\t...ifDefined(\"codecRef\", defaultNode.codecRef)\n\t});\n}\n//#endregion\n//#region src/core/migrations/default-constraint-names.ts\n/**\n* The names the planner gives a primary key, unique constraint or foreign key the contract leaves unnamed. They derive from the table name, so renaming the table leaves them stale until the planner renames them too.\n*/\nfunction defaultPrimaryKeyName(tableName) {\n\treturn `${tableName}_pkey`;\n}\nfunction defaultUniqueName(tableName, columns) {\n\treturn `${tableName}_${columns.join(\"_\")}_key`;\n}\nfunction defaultForeignKeyName(tableName, columns) {\n\treturn `${tableName}_${columns.join(\"_\")}_fkey`;\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Look up a storage table by its explicit namespace coordinate. Returns\n* `undefined` when the namespace has no table by that name (or no such\n* namespace exists). Callers that get `undefined` MUST treat it as an\n* explicit conflict — never silently fall back to a global default\n* schema or a name-only walk, because that footgun would resolve a\n* stale or duplicate table name to whichever namespace the iteration\n* order surfaced first (a real data-loss hazard in multi-namespace\n* contracts where two namespaces can carry the same table name).\n*/\nfunction tableAt(storage, namespaceId, tableName) {\n\tconst ns = storage.namespaces[namespaceId];\n\tif (ns === void 0) return void 0;\n\treturn ns.entries.table?.[tableName];\n}\n/**\n* Recovers the contract namespace id for a DDL schema name embedded in a\n* diff-issue path (`path[1]`). The strategies need the CONTRACT column/table\n* (for codec-hook reads and eligibility probes the retained subsystems still\n* run) even though the issue itself only carries the resolved DDL schema —\n* this is the reverse of `resolveDdlSchemaForNamespace`.\n*/\nfunction namespaceIdForDdlSchema(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName);\n}\n/** A `not-equal` column issue whose node pair is narrowed to `SqlColumnIR`. */\nfunction columnNodePair(issue) {\n\tconst node = issueNode(issue);\n\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) return void 0;\n\tif (issue.expected === void 0 || issue.actual === void 0) return void 0;\n\treturn {\n\t\texpected: blindCast(issue.expected),\n\t\tactual: blindCast(issue.actual)\n\t};\n}\nconst notNullBackfillCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tconst ddl = renderColumnDdl(expected.name, expected, ctx.types);\n\t\tconst nullableSpec = contractFree.col(ddl.name, ddl.type, { ...ddl.codecRef !== void 0 ? { codecRef: ddl.codecRef } : {} });\n\t\tcalls.push(new AddColumnCall(schemaName, tableName, nullableSpec), new DataTransformCall(`backfill-${tableName}-${expected.name}`, `backfill-${tableName}-${expected.name}:check`, `backfill-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\nconst SAFE_WIDENINGS = /* @__PURE__ */ new Set([\n\t`${pgInt2.id}→${pgInt4.id}`,\n\t`${pgInt2.id}→${pgInt8.id}`,\n\t`${pgInt4.id}→${pgInt8.id}`,\n\t`${pgFloat4.id}→${pgFloat8.id}`\n]);\n/** The id of the data type a column node's codec represents. */\nfunction columnDataType(column, types) {\n\tif (column.codecRef === void 0) throw new InternalError(`Column \"${column.name}\" carries no codec, so its data type is unknown; a type change is planned only between columns built from contracts.`);\n\treturn sqlDataTypeOfCodec(column.codecRef.codecId, types).id;\n}\n/**\n* Handles `not-equal` column issues whose TYPE differs. `fromContract` is\n* only supplied by `migration plan` — for reconciliation (`db update` /\n* `db init`, `fromContract === null`) this strategy never fires, mirroring\n* the legacy `typeChangeCallStrategy`'s requirement of a prior contract:\n* `mapNodeIssueToCall`'s in-place ALTER covers reconciliation directly.\n*\n* A single node issue can carry BOTH type and nullability drift (Postgres\n* alters in place, so the differ emits one `not-equal` column issue where\n* the legacy coordinate walk emitted two: `type_mismatch` +\n* `nullability_mismatch`). When this strategy consumes the issue for its\n* type portion, it also emits whatever nullability delta the same node pair\n* carries — using the same construction `nullableTighteningCallStrategy` /\n* the mapper's direct dispatch would have used — so the issue is never\n* partially handled.\n*/\nconst typeChangeCallStrategy = (issues, ctx) => {\n\tif (ctx.fromContract === null) return { kind: \"no_match\" };\n\tconst dataAllowed = ctx.policy.allowedOperationClasses.includes(\"data\");\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (!columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tconst fromType = columnDataType(actual, ctx.types);\n\t\tconst toType = columnDataType(expected, ctx.types);\n\t\tconst isSafeWidening = SAFE_WIDENINGS.has(`${fromType}→${toType}`);\n\t\tif (!isSafeWidening && !dataAllowed) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tconst { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, ctx.types);\n\t\tconst alterOpts = {\n\t\t\tqualifiedTargetType,\n\t\t\tformatTypeExpected,\n\t\t\trawTargetTypeForLabel: qualifiedTargetType\n\t\t};\n\t\tif (isSafeWidening) calls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, alterOpts));\n\t\telse calls.push(new DataTransformCall(`typechange-${tableName}-${expected.name}`, `typechange-${tableName}-${expected.name}:check`, `typechange-${tableName}-${expected.name}:run`), new AlterColumnTypeCall(schemaName, tableName, expected.name, alterOpts));\n\t\tif (expected.nullable !== actual.nullable) if (expected.nullable) calls.push(new DropNotNullCall(schemaName, tableName, expected.name));\n\t\telse if (dataAllowed) calls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `handle-nulls-${tableName}-${expected.name}:check`, `handle-nulls-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t\telse calls.push(new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Whether the raw (unresolved) native type differs — the SAME comparison\n* `typeChangeCallStrategy` always used (`fromColumn.nativeType !==\n* toColumn.nativeType`), which for the widenable numeric/float types\n* `SAFE_WIDENINGS` lists is identical to the resolved comparison\n* `columnTypeChanged` (in `issue-planner.ts`) performs.\n*/\nfunction columnTypeChangedNativeOnly(expected, actual) {\n\treturn expected.nativeType !== actual.nativeType;\n}\n/**\n* Handles `not-equal` column issues whose type did NOT change but\n* nullability tightened (contract requires NOT NULL, live column is\n* nullable). A type-changed issue's nullability delta (if any) is already\n* handled by `typeChangeCallStrategy`, which runs first — this strategy\n* only ever sees issues that strategy left behind.\n*/\nconst nullableTighteningCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tif (expected.nullable !== false || actual.nullable !== true) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tcalls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `handle-nulls-${tableName}-${expected.name}:check`, `handle-nulls-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Dispatches codec-typed storage types through their codec's\n* `planTypeOperations` hook (the authoritative source for codec-driven DDL\n* such as custom type creation). Codec extension/type ops are not modeled as\n* diff nodes — this strategy drives entirely off `ctx.toContract.storage.types`\n* + codec hooks, consuming nothing from the node issue list (there is no\n* node-vocabulary equivalent of `type_missing` / `enum_values_changed`).\n*/\nconst storageTypePlanCallStrategy = (issues, ctx) => {\n\tconst storageTypes = ctx.toContract.storage.types ?? {};\n\tif (Object.keys(storageTypes).length === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [typeName, typeInstance] of Object.entries(storageTypes).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst codecInstance = blindCast(typeInstance);\n\t\tconst hook = ctx.codecHooks.get(codecInstance.codecId);\n\t\tif (!hook?.planTypeOperations) continue;\n\t\tconst planResult = hook.planTypeOperations({\n\t\t\ttypeName,\n\t\t\ttypeInstance: codecInstance,\n\t\t\tcontract: ctx.toContract,\n\t\t\tschema: ctx.schema,\n\t\t\tschemaName: ctx.schemaName,\n\t\t\tpolicy: ctx.policy\n\t\t});\n\t\tif (!planResult) continue;\n\t\tfor (const op of planResult.operations) calls.push(new RawSqlCall(blindCast({\n\t\t\t...op,\n\t\t\ttarget: {\n\t\t\t\tid: op.target.id,\n\t\t\t\tdetails: buildTargetDetails(\"type\", typeName, ctx.schemaName)\n\t\t\t}\n\t\t})));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls\n\t};\n};\n/**\n* Handles `not-found` column issues for NOT NULL columns without a contract\n* default. Replaces the legacy `buildAddColumnItem` non-default branches.\n*\n* Two shapes:\n* - Shared-temp-default safe: emit a single atomic composite op (add\n* nullable → backfill identity value → `SET NOT NULL` → `DROP DEFAULT`).\n* The temp-default value is resolved from the column node's `codecRef`\n* (`resolveColumnTemporaryDefault`, wrapping `resolveIdentityValue`).\n* - Empty-table guarded: emit a hand-built op with a `tableIsEmptyCheck`\n* precheck so the failure message is \"table is not empty\" rather than the\n* raw PG NOT NULL violation.\n*\n* \"Normal\" not-found column cases (nullable or has a contract default) are\n* left for `mapNodeIssueToCall`'s default `AddColumnCall` emission.\n*/\nconst notNullAddColumnCallStrategy = (issues, ctx) => {\n\tconst matched = [];\n\tconst calls = [];\n\tconst schemaLookups = buildSchemaLookupMap(ctx.schema);\n\tconst mutableStorageTypes = blindCast(ctx.storageTypes);\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst namespaceId = namespaceIdForDdlSchema(ctx, ddlSchemaName);\n\t\tconst schemaName = namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n\t\tconst contractTable = tableAt(ctx.toContract.storage, namespaceId, tableName);\n\t\tconst column = contractTable?.columns[expected.name];\n\t\tif (!contractTable || !column) continue;\n\t\tconst schemaTable = ctx.schema.tables[tableName];\n\t\tif (!schemaTable) continue;\n\t\tconst temporaryDefault = resolveColumnTemporaryDefault(expected, ctx.codecHooks, ctx.types);\n\t\tconst schemaLookup = schemaLookups.get(tableName);\n\t\tconst canUseSharedTempDefault = temporaryDefault !== null && canUseSharedTemporaryDefaultStrategy({\n\t\t\ttable: contractTable,\n\t\t\tschemaTable,\n\t\t\tschemaLookup,\n\t\t\tcolumnName: expected.name\n\t\t});\n\t\tmatched.push(issue);\n\t\tif (canUseSharedTempDefault && temporaryDefault !== null) {\n\t\t\tcalls.push(new AddNotNullColumnWithTempDefaultCall({\n\t\t\t\tschemaName,\n\t\t\t\ttableName,\n\t\t\t\tcolumnName: expected.name,\n\t\t\t\tcolumn,\n\t\t\t\ttypes: ctx.types,\n\t\t\t\tstorageTypes: mutableStorageTypes,\n\t\t\t\ttemporaryDefault\n\t\t\t}));\n\t\t\tcontinue;\n\t\t}\n\t\tcalls.push(new AddNotNullColumnDirectCall(schemaName, tableName, expected.name, renderColumnDdl(expected.name, expected, ctx.types)));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls\n\t};\n};\nfunction canUseSharedTemporaryDefaultStrategy(options) {\n\tconst { table, schemaTable, schemaLookup, columnName } = options;\n\tif (table.primaryKey?.columns.includes(columnName) && !schemaTable.primaryKey) return false;\n\tfor (const unique of table.uniques) {\n\t\tif (!unique.columns.includes(columnName)) continue;\n\t\tif (!schemaLookup || !hasUniqueConstraint(schemaLookup, unique.columns)) return false;\n\t}\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tif (!foreignKey.source.columns.includes(columnName)) continue;\n\t\tif (!schemaLookup || !hasForeignKey(schemaLookup, foreignKey)) return false;\n\t}\n\treturn true;\n}\n/**\n* Ordered list of Postgres planner strategies, shared by `migration plan`\n* and `db update` / `db init`. The issue planner runs each strategy in\n* order, letting it consume any issues it handles, and routes whatever's\n* left through `mapNodeIssueToCall`. Behavior diverges purely on\n* `policy.allowedOperationClasses`:\n*\n* - When `'data'` is allowed (`migration plan`), the data-safe strategies\n* (`notNullBackfillCallStrategy`, `typeChangeCallStrategy`,\n* `nullableTighteningCallStrategy`) consume their matching issues and emit\n* `DataTransformCall` placeholders or recipe ops.\n*\n* - When `'data'` is not allowed (`db update` / `db init`), the\n* placeholder-emitting strategies short-circuit to `no_match`, leaving\n* the issue for the downstream strategies (`storageTypePlanCallStrategy`,\n* `notNullAddColumnCallStrategy`) or the `mapNodeIssueToCall` default to\n* handle with direct DDL.\n*\n* Codec-typed storage type entries are dispatched through\n* `storageTypePlanCallStrategy`.\n*/\nconst postgresPlannerStrategies = [\n\tnotNullBackfillCallStrategy,\n\ttypeChangeCallStrategy,\n\tnullableTighteningCallStrategy,\n\tstorageTypePlanCallStrategy,\n\tnotNullAddColumnCallStrategy\n];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\n/**\n* Classifies calls into DDL sequencing buckets. The order matches the\n* legacy walk-schema planner's emission order so `db init` and `db update`\n* produce byte-identical plans for the shared shape (deps → drops → tables\n* → columns → alters → PKs → uniques → indexes → FKs).\n*\n* `dropType` (DROP TYPE for a managed native enum) is its own bucket, ordered\n* after the general drop bucket: a type can only be dropped once every table\n* whose column uses it is gone. A column→enum edge would make this precise,\n* but `coalesceSubtreeIssues` removes the column issue under a whole-table\n* drop, so the edge never reaches the graph; the coarse bucket stands in until\n* that edge lands (the coordinate work is a later slice).\n*/\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createExtension\":\n\t\tcase \"createSchema\":\n\t\tcase \"createNativeEnumType\":\n\t\tcase \"addNativeEnumValue\": return \"dep\";\n\t\tcase \"dropNativeEnumType\": return \"dropType\";\n\t\tcase \"dropTable\":\n\t\tcase \"dropColumn\":\n\t\tcase \"dropConstraint\":\n\t\tcase \"dropCheckConstraint\":\n\t\tcase \"dropIndex\":\n\t\tcase \"dropDefault\": return \"drop\";\n\t\tcase \"addCheckConstraint\":\n\t\tcase \"renameConstraint\": return \"unique\";\n\t\tcase \"createTable\":\n\t\tcase \"renameTable\": return \"table\";\n\t\tcase \"enableRowLevelSecurity\":\n\t\tcase \"disableRowLevelSecurity\": return \"rlsEnable\";\n\t\tcase \"createRlsPolicy\": return \"rlsPolicy\";\n\t\tcase \"dropRlsPolicy\": return \"drop\";\n\t\tcase \"addColumn\": return \"column\";\n\t\tcase \"alterColumnType\":\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\":\n\t\tcase \"setDefault\": return \"alter\";\n\t\tcase \"addPrimaryKey\": return \"primaryKey\";\n\t\tcase \"addUnique\": return \"unique\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\": return \"index\";\n\t\tcase \"addForeignKey\": return \"foreignKey\";\n\t\tcase \"rawSql\":\n\t\t\tif (blindCast(call).op?.target?.details?.objectType === \"type\") return \"dep\";\n\t\t\treturn \"alter\";\n\t\tdefault: return \"alter\";\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"alterColumnType\": return \"typeMismatch\";\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\": return \"nullabilityConflict\";\n\t\tcase \"addForeignKey\":\n\t\tcase \"dropConstraint\": return \"foreignKeyConflict\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tcase \"createRlsPolicy\":\n\t\tcase \"dropRlsPolicy\":\n\t\tcase \"renameRlsPolicy\": return \"rlsPolicyIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst anyCall = blindCast(call);\n\tconst location = {};\n\tif (anyCall.tableName) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = anyCall.tableName;\n\t} else if (anyCall.typeName) {\n\t\tlocation.entityKind = \"native_enum\";\n\t\tlocation.entityName = anyCall.typeName;\n\t}\n\tconst columnName = columnNameOfCall(call);\n\tif (columnName) location.column = columnName;\n\tif (anyCall.indexName) location.index = anyCall.indexName;\n\telse if (anyCall.newIndexName) location.index = anyCall.newIndexName;\n\tif (anyCall.constraintName) location.constraint = anyCall.constraintName;\n\telse if (anyCall.newConstraintName) location.constraint = anyCall.newConstraintName;\n\tif (anyCall.policyName) location.rlsPolicy = anyCall.policyName;\n\telse if (anyCall.policy?.name) location.rlsPolicy = anyCall.policy.name;\n\telse if (anyCall.newPolicyName) location.rlsPolicy = anyCall.newPolicyName;\n\treturn Object.keys(location).length > 0 ? blindCast(location) : void 0;\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\trefusedOperationClass: call.operationClass,\n\t\t...location ? { location } : {}\n\t};\n}\n/** The diff node an issue concerns — expected when present, else the actual (extra) node. */\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** DDL schema segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueSchemaName(issue) {\n\treturn issue.path[1];\n}\n/** Table segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueTableName(issue) {\n\treturn issue.path[2];\n}\n/** Column name embedded in a column/default issue path segment (`column:<name>`). */\nfunction issueColumnName(issue) {\n\tconst segment = issue.path[3];\n\tif (segment === void 0 || !segment.startsWith(\"column:\")) return void 0;\n\treturn segment.slice(7);\n}\n/**\n* The DDL schema name to use when EMITTING an op against `ddlSchemaName` (the\n* diff tree's resolved physical schema, `issueSchemaName(issue)`). The\n* unbound namespace's diff-tree identity resolves to `public` (a concrete\n* physical default the differ needs in order to compare its tree against\n* introspection — `resolveDdlSchemaForNamespaceStorage`), but DDL EMISSION\n* must stay unqualified so the live connection's `search_path` resolves it\n* at runtime (`boundSchema`). Recovers the logical namespace id via the\n* contract and substitutes the unbound sentinel back in when it resolves\n* there; every other namespace's `ddlSchemaName` already agrees between the\n* two resolution paths, so it passes through unchanged.\n*/\nfunction emissionSchemaName(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree. `CreateTable`/`DropTable`\n* and `AddColumn`/`DropColumn` already account for the whole subtree, so the\n* nested issues are redundant — coalescing drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path. Run over the\n* relational subset ONLY (policy issues and synthesized namespace issues are\n* handled on their own paths, never coalesced against tables).\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) !== \"not-equal\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction fkSpecFromNode(fk, tableName) {\n\treturn {\n\t\tname: fk.name ?? defaultForeignKeyName(tableName, fk.columns),\n\t\tcolumns: [...fk.columns],\n\t\treferences: {\n\t\t\tschema: fk.referencedSchema ?? \"\",\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: [...fk.referencedColumns]\n\t\t},\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t};\n}\n/**\n* Builds the `CreateTable` + child `CreateIndex` / `AddForeignKey` / `AddUnique`\n* calls for a newly-expected table, reading only the table node's children. The\n* PK and every declared CHECK go inline as table constraints; indexes\n* (declared + FK-backing, already merged and ordered at derivation) and the\n* FK / unique constraints are separate calls (re-bucketed downstream). Every\n* column's DDL is resolved from its `codecRef` via `renderColumnDdl`.\n*/\nfunction buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, types) {\n\tconst ddlColumns = Object.values(table.columns).map((c) => renderColumnDdl(c.name, c, types));\n\tconst primaryKeyConstraints = table.primaryKey ? [contractFree.primaryKey([...table.primaryKey.columns], { ...ifDefined(\"name\", table.primaryKey.name) })] : [];\n\tconst declaredChecks = (table.checks ?? []).map((c) => contractFree.checkExpression(c.name, c.expression));\n\tconst allTableConstraints = [...primaryKeyConstraints, ...declaredChecks];\n\tconst calls = [new CreateTableCall(schemaName, table.name, ddlColumns, allTableConstraints.length > 0 ? allTableConstraints : void 0)];\n\tfor (const index of table.indexes) calls.push(createIndexCallFromNode(index, schemaName, table.name));\n\tfor (const fk of table.foreignKeys) calls.push(new AddForeignKeyCall(schemaName, table.name, fkSpecFromNode(fk, table.name)));\n\tfor (const unique of table.uniques) {\n\t\tconst constraintName = unique.name ?? defaultUniqueName(table.name, unique.columns);\n\t\tcalls.push(new AddUniqueCall(schemaName, table.name, constraintName, [...unique.columns]));\n\t}\n\tif (table.rlsEnabled) calls.push(new EnableRowLevelSecurityCall(ddlSchemaName, table.name));\n\treturn calls;\n}\nfunction nodeConflict(kind, message) {\n\treturn issueConflict(kind, message);\n}\n/**\n* True when `actualMembers` (the live database's ordered members) is a\n* strict, order-preserving prefix of `expectedMembers` (the contract's) —\n* the database already carries every contract member, in declaration\n* order, and the contract declares at least one member the database still\n* lacks. Any other relationship — a renamed value, a removed value, a\n* reordering, or the database holding members the contract lacks — is not\n* a suffix append.\n*/\nfunction isNativeEnumSuffixAppend(actualMembers, expectedMembers) {\n\tif (actualMembers.length >= expectedMembers.length) return false;\n\treturn actualMembers.every((member, index) => member === expectedMembers[index]);\n}\n/** Operator-worded refusal for a native-enum member change beyond a suffix append (design ruling — tests match this verbatim). */\nfunction nativeEnumMemberChangeRefusal(options) {\n\treturn `Native enum type \"${options.ddlSchemaName}\".\"${options.typeName}\" changed beyond appending new values (contract declares [${options.expectedMembers.join(\", \")}], database has [${options.actualMembers.join(\", \")}]). Prisma 8 does not modify a native enum's existing values (rename, removal, reorder) — see https://pris.ly/d/postgres-native-enums. Author the change manually with \\`migration new\\`.`;\n}\n/**\n* Managed native-enum issue -> op lowering. A missing declared type creates\n* it; an unclaimed live type drops it (ownership-scoped upstream by\n* `retainUnownedExtras`, destructiveness gated by the operation-class\n* policy); a paired member-value mismatch lowers to one `ALTER TYPE ... ADD\n* VALUE` per appended member when the database's members are a strict,\n* order-preserving prefix of the contract's — any other change (rename,\n* removal, reorder, or the database holding members the contract lacks) is\n* refused with a NAMED diagnostic, never a silent no-op and never a\n* drop-and-recreate.\n*/\nfunction mapNativeEnumNodeIssue(issue, ctx) {\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tif (ddlSchemaName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Enum issue has no schema in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst expected = blindCast(issue.expected);\n\t\treturn ok([new CreateNativeEnumTypeCall(schemaName, expected.typeName, expected.members)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropNativeEnumTypeCall(schemaName, blindCast(issue.actual).typeName)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (isNativeEnumSuffixAppend(actual.members, expected.members)) return ok(expected.members.slice(actual.members.length).map((value) => new AddNativeEnumValueCall(schemaName, expected.typeName, value)));\n\treturn notOk(nodeConflict(\"unsupportedOperation\", nativeEnumMemberChangeRefusal({\n\t\tddlSchemaName,\n\t\ttypeName: expected.typeName,\n\t\texpectedMembers: expected.members,\n\t\tactualMembers: actual.members\n\t})));\n}\nfunction mapTableNodeIssue(issue, schemaName, ddlSchemaName, types) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCallsFromNode(schemaName, ddlSchemaName, blindCast(issue.expected), types));\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropTableCall(schemaName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (expected.rlsEnabled && !actual.rlsEnabled) return ok([new EnableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\tif (!expected.rlsEnabled && actual.rlsEnabled) return ok([new DisableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", `unhandled table-attribute drift on \"${expected.name}\": table not-equal with no rlsEnabled delta (a second table attribute drifted)`));\n}\nfunction mapColumnNodeIssue(issue, schemaName, tableName, types) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\treturn ok([new AddColumnCall(schemaName, tableName, renderColumnDdl(column.name, column, types))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tconst calls = [];\n\tif (columnTypeChanged(expected, actual)) {\n\t\tconst { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, types);\n\t\tcalls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, {\n\t\t\tqualifiedTargetType,\n\t\t\tformatTypeExpected,\n\t\t\trawTargetTypeForLabel: qualifiedTargetType\n\t\t}));\n\t}\n\tif (expected.nullable !== actual.nullable) calls.push(expected.nullable ? new DropNotNullCall(schemaName, tableName, expected.name) : new SetNotNullCall(schemaName, tableName, expected.name));\n\treturn ok(calls);\n}\nfunction mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, types) {\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropDefaultCall(schemaName, tableName, columnName)]);\n\tif (issue.expected === void 0) return ok([]);\n\tconst column = buildSetDefaultColumn(columnName, blindCast(issue.expected), types);\n\tif (column === void 0) return ok([]);\n\treturn ok([new SetDefaultCall(schemaName, tableName, column, issueOutcome(issue) === \"not-equal\" ? \"widening\" : \"additive\")]);\n}\nfunction mapPrimaryKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst pk = blindCast(issue.expected);\n\t\treturn ok([new AddPrimaryKeyCall(schemaName, tableName, pk.name ?? defaultPrimaryKeyName(tableName), [...pk.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropConstraintCall(schemaName, tableName, blindCast(issue.actual).name ?? defaultPrimaryKeyName(tableName), \"primaryKey\")]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\nfunction mapForeignKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([new AddForeignKeyCall(schemaName, tableName, fkSpecFromNode(blindCast(issue.expected), tableName))]);\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst fk = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, fk.name ?? defaultForeignKeyName(tableName, fk.columns), \"foreignKey\")]);\n\t}\n\treturn notOk(nodeConflict(\"foreignKeyConflict\", issue.path.join(\"/\")));\n}\nfunction mapUniqueNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst unique = blindCast(issue.expected);\n\t\treturn ok([new AddUniqueCall(schemaName, tableName, unique.name ?? defaultUniqueName(tableName, unique.columns), [...unique.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst unique = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, unique.name ?? defaultUniqueName(tableName, unique.columns), \"unique\")]);\n\t}\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The CreateIndexCall for a name-identified index node: the node's own name\n* verbatim, its element list (column tuple or opaque expression), and the\n* unique/type/options/where attributes carried through.\n*/\nfunction createIndexCallFromNode(index, schemaName, tableName) {\n\tconst extras = {};\n\tif (index.type !== void 0) extras.type = index.type;\n\tif (index.options !== void 0) extras.options = index.options;\n\tif (index.where !== void 0) extras.where = index.where;\n\tif (index.unique) extras.unique = true;\n\treturn new CreateIndexCall(schemaName, tableName, index.name, index.columns !== void 0 ? { columns: [...index.columns] } : { expression: index.expression ?? \"\" }, extras);\n}\nfunction mapIndexNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([createIndexCallFromNode(blindCast(issue.expected), schemaName, tableName)]);\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropIndexCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The index treatment: a missing check is added, an undeclared live check is\n* dropped, and a paired divergence is a conflict. `not-equal` is reachable only\n* for an exact-named expected check — a wire-named one compares by name, so a\n* changed predicate re-suffixes the name and arrives as missing + extra\n* instead.\n*/\nfunction mapCheckNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst check = blindCast(issue.expected);\n\t\treturn ok([new AddCheckConstraintCall(schemaName, tableName, check.name, check.expression)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropCheckConstraintCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", issue.path.join(\"/\")));\n}\n/**\n* Maps one node-typed diff issue to its migration call(s), dispatching on the\n* node's `nodeKind` and the issue's presence-derived `issueOutcome`, reading\n* nodes and resolving column DDL from `codecRef` via `column-ddl-rendering.ts`.\n*/\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) {\n\t\tif (issueOutcome(issue) !== \"not-found\") return notOk(nodeConflict(\"unsupportedOperation\", `Unexpected namespace drift: ${issue.path.join(\"/\")}`));\n\t\treturn ok([new CreateSchemaCall(blindCast(issue.expected).schemaName)]);\n\t}\n\tif (node.nodeKind === PostgresSchemaNodeKind.nativeEnum) return mapNativeEnumNodeIssue(issue, ctx);\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tconst tableName = issueTableName(issue);\n\tif (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue has no schema/table in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tswitch (node.nodeKind) {\n\t\tcase PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.types);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.types);\n\t\tcase RelationalSchemaNodeKind.columnDefault: {\n\t\t\tconst columnName = issueColumnName(issue);\n\t\t\tif (columnName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Default issue has no column in its path: ${issue.path.join(\"/\")}`));\n\t\t\treturn mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, ctx.types);\n\t\t}\n\t\tcase RelationalSchemaNodeKind.primaryKey: return mapPrimaryKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.foreignKey: return mapForeignKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.unique: return mapUniqueNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.check: return mapCheckNodeIssue(issue, schemaName, tableName);\n\t\tdefault: return notOk(nodeConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\n/**\n* Runs the ordered strategy list over the node-typed diff issues, maps\n* leftover issues via {@link mapNodeIssueToCall}, applies operation-class\n* policy gating, and buckets calls into the fixed DDL emission order (dep →\n* drop → table → column → recipe → alter → primaryKey → unique → index →\n* foreignKey).\n*/\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst schema = options.schema ?? emptySchemaIR();\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\ttoContract: options.toContract,\n\t\tfromContract: options.fromContract,\n\t\tschemaName: options.schemaName,\n\t\tcodecHooks: options.codecHooks,\n\t\ttypes: options.types,\n\t\tstorageTypes: options.storageTypes,\n\t\tschema,\n\t\tpolicy,\n\t\tframeworkComponents\n\t};\n\tconst strategies = options.strategies ?? postgresPlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketablePatternCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketablePatternCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedDefault = defaultCalls;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketablePatternCalls;\n\tif (policyProvided) {\n\t\tconst keepIfAllowed = (bucket) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tbucket.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedDefaultBucket = [];\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tdefaultCalls.forEach(keepIfAllowed(gatedDefaultBucket));\n\t\trecipeCalls.forEach(keepIfAllowed(gatedRecipeBucket));\n\t\tbucketablePatternCalls.forEach(keepIfAllowed(gatedBucketableBucket));\n\t\tgatedDefault = gatedDefaultBucket;\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combinedBucketable = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combinedBucketable.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"dep\"),\n\t\t...byCategory(\"drop\"),\n\t\t...byCategory(\"dropType\"),\n\t\t...byCategory(\"table\"),\n\t\t...byCategory(\"column\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"alter\"),\n\t\t...byCategory(\"primaryKey\"),\n\t\t...byCategory(\"unique\"),\n\t\t...byCategory(\"index\"),\n\t\t...byCategory(\"foreignKey\"),\n\t\t...byCategory(\"rlsEnable\")\n\t] });\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* Factory calls that create a whole, previously-absent top-level storage\n* object. Used to decide whether `tolerated` permits a call (it only allows\n* creating absent objects, never modifying existing ones).\n*\n* Deliberately an explicit, closed set rather than a `factoryName`\n* create/alter/drop classification: it answers exactly one yes/no question\n* and is fail-closed. Any call not listed here — including future or\n* extension-contributed factories — is treated as NOT object-creation, so it\n* is suppressed under `tolerated` rather than permissively emitted.\n*\n* Lists the creation factories that actually reach the call-side resolver\n* (`resolvePostgresCallControlPolicySubject`) — today only RLS policy\n* creation, from `planPostgresSchemaDiff`. Every other whole-object create\n* (table, schema, native enum, and RLS enablement) is constructed inside\n* `planIssues` and graded on the node side by\n* `resolvePostgresNodeIssueCreationFactoryName`, so none of them are listed\n* here.\n*/\nconst OBJECT_CREATION_FACTORIES = /* @__PURE__ */ new Set([\"createRlsPolicy\"]);\nfunction createsNewTopLevelObject(call) {\n\treturn OBJECT_CREATION_FACTORIES.has(call.factoryName);\n}\nfunction ddlSchemaNameForNamespace(contract, namespaceId) {\n\tconst namespace = contract.storage.namespaces[namespaceId];\n\treturn isPostgresSchema(namespace) ? namespace.ddlSchemaName(contract.storage) : namespaceId;\n}\n/**\n* Resolve the namespace a declared storage entity lives in by walking every\n* namespace for one whose `entries` map actually contains the coordinate —\n* a table by its name, a native enum by its physical type name (see\n* {@link postgresNodeStorageCoordinate}). When `ddlSchemaName` is given, the\n* match must also land in that DDL schema (disambiguates same-named entities\n* declared under different namespaces); when omitted, the first namespace\n* that declares the entity wins. Falls back to {@link UNBOUND_NAMESPACE_ID}\n* when no namespace declares it — e.g. an extra/dropped entity the contract\n* doesn't claim at all.\n*/\nfunction resolveNamespaceIdForEntity(contract, coordinate, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tif (!entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})) continue;\n\t\tif (ddlSchemaName === void 0 || ddlSchemaNameForNamespace(contract, namespaceId) === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction resolveNamespaceIdForTable(contract, tableName, ddlSchemaName) {\n\treturn resolveNamespaceIdForEntity(contract, {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t}, ddlSchemaName);\n}\nfunction resolveNamespaceIdForDdlSchema(contract, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst ns = contract.storage.namespaces[namespaceId];\n\t\tif (isPostgresSchema(ns) && ns.ddlSchemaName(contract.storage) === ddlSchemaName) return namespaceId;\n\t\tif (namespaceId === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction postgresCallFields(call) {\n\treturn {\n\t\t...ifDefined(\"schemaName\", \"schemaName\" in call ? call.schemaName : void 0),\n\t\t...ifDefined(\"tableName\", \"tableName\" in call ? call.tableName : void 0),\n\t\t...ifDefined(\"columnName\", columnNameOfCall(call))\n\t};\n}\nfunction formatSuppressionSubjectLabel(subject, contract) {\n\tif (subject === void 0) return \"unknown\";\n\tconst ddlSchema = ddlSchemaNameForNamespace(contract, subject.namespaceId);\n\tif (subject.entityKind !== void 0 && subject.entityName !== void 0) {\n\t\tconst entityLabel = `${subject.entityKind} \"${ddlSchema}.${subject.entityName}\"`;\n\t\treturn subject.rlsPolicy !== void 0 ? `RLS policy \"${subject.rlsPolicy}\" on ${entityLabel}` : entityLabel;\n\t}\n\treturn `namespace \"${ddlSchema}\"`;\n}\nfunction postgresSuppressionSummary(subjectLabel, subject, policy) {\n\tconst namespace = subject?.namespaceId ?? \"unknown\";\n\tconst declared = subject?.explicitNodeControlPolicy;\n\tif (policy === \"external\" && declared === \"managed\") return `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control 'external' but declared 'managed'`;\n\treturn `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control '${policy}'${declared ? ` but declared '${declared}'` : \"\"}`;\n}\n/**\n* Render one family {@link SuppressionRecord} into a target `SqlPlannerConflict`.\n* The family decides *that* a subject is suppressed and hands over the raw\n* coordinate + policy; the label, message, and location are rendered here,\n* driven entirely by the subject's own `(entityKind, entityName)` coordinate\n* — no target-owned table-vs-enum vocabulary.\n*/\nfunction renderPostgresSuppression(record, contract) {\n\tconst subject = record.subject;\n\treturn {\n\t\tkind: \"controlPolicySuppressedCall\",\n\t\tsummary: postgresSuppressionSummary(formatSuppressionSubjectLabel(subject, contract), subject, record.policy),\n\t\tlocation: {\n\t\t\t...ifDefined(\"namespaceId\", subject?.namespaceId),\n\t\t\t...ifDefined(\"entityKind\", subject?.entityKind),\n\t\t\t...ifDefined(\"entityName\", subject?.entityName),\n\t\t\t...ifDefined(\"column\", subject?.column),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy)\n\t\t},\n\t\tmeta: {\n\t\t\tcontrolPolicy: record.policy,\n\t\t\t...ifDefined(\"factoryName\", record.factoryName),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy),\n\t\t\t...ifDefined(\"declaredControlPolicy\", subject?.explicitNodeControlPolicy)\n\t\t}\n\t};\n}\nfunction resolvePostgresCallControlPolicySubject(call, contract) {\n\tconst callFields = postgresCallFields(call);\n\tconst createsNewObject = createsNewTopLevelObject(call);\n\tif (call.factoryName === \"createSchema\" && callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n\tif (callFields.tableName) {\n\t\tconst namespaceId = resolveNamespaceIdForTable(contract, callFields.tableName, callFields.schemaName);\n\t\tconst tableControlPolicy = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName,\n\t\t\t...ifDefined(\"column\", callFields.columnName),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", tableControlPolicy),\n\t\t\tcreatesNewObject\n\t\t};\n\t}\n\tif (callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n}\n/**\n* Node kinds whose *absence* is the creation of a whole, top-level Postgres\n* object: a namespace, a table, or a native enum. Used by\n* {@link resolvePostgresNodeIssueCreationFactoryName} to decide whether a\n* `tolerated` subject permits the issue to flow into the planner\n* (create-if-absent) and to seed the suppressed-subject warning's\n* `factoryName` when the planner is skipped. RLS policy creation is not\n* listed here — policy issues never reach this issue-based partition (they\n* are routed to `planPostgresSchemaDiff` and gated via the call-based\n* {@link resolvePostgresCallControlPolicySubject} instead).\n*/\nconst POSTGRES_NODE_CREATION_FACTORY = Object.freeze({\n\t[PostgresSchemaNodeKind.namespace]: \"createSchema\",\n\t[PostgresSchemaNodeKind.table]: \"createTable\",\n\t[PostgresSchemaNodeKind.nativeEnum]: \"createNativeEnumType\"\n});\n/**\n* A table `not-equal` issue whose `rlsEnabled` flips OFF→ON (expected on,\n* actual off) is enablement toward `ENABLE ROW LEVEL SECURITY`. It is\n* creation-class on the node side because `isEnablementCreationIssue` and\n* {@link resolvePostgresNodeIssueCreationFactoryName} treat this OFF→ON delta\n* as a creation: enabling RLS establishes the fail-closed guard the declared\n* policy set attaches to, the same grant `tolerated` extends to creating the\n* policies themselves. The opposite direction (`DISABLE`) is a modification\n* and stays managed-only. Keying on the actual delta (not just the expected\n* bit) keeps this correct if a second table attribute ever joins\n* `isEqualTo`: a not-equal with no `rlsEnabled` delta is not enablement, so\n* it is not admitted as creation-class here.\n*/\nfunction isEnablementCreationIssue(issue) {\n\tif (issueOutcome(issue) !== \"not-equal\") return false;\n\tconst { expected, actual } = issue;\n\treturn expected !== void 0 && actual !== void 0 && PostgresTableSchemaNode.is(expected) && PostgresTableSchemaNode.is(actual) && expected.rlsEnabled === true && actual.rlsEnabled === false;\n}\nfunction resolvePostgresNodeIssueCreationFactoryName(issue) {\n\tif (isEnablementCreationIssue(issue)) return \"enableRowLevelSecurity\";\n\tif (issueOutcome(issue) !== \"not-found\") return void 0;\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn POSTGRES_NODE_CREATION_FACTORY[node.nodeKind];\n}\n/**\n* Resolves the control-policy subject for a node-typed {@link SchemaDiffIssue}\n* (the issue-side mirror of `resolvePostgresCallControlPolicySubject`).\n* Storage entities resolve off their node coordinate; a sub-entity issue\n* resolves off the enclosing table read from the issue path; an unclaimed\n* extra falls back to the unbound coordinate. A role always resolves\n* `'external'` — roles are referenced, never owned.\n*/\nfunction resolvePostgresNodeIssueControlPolicySubject(issue, contract) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, blindCast(node).schemaName),\n\t\tcreatesNewObject: issueOutcome(issue) === \"not-found\"\n\t};\n\tif (node.nodeKind === PostgresSchemaNodeKind.role) {\n\t\tconst roleName = issue.path[1];\n\t\treturn {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\texplicitNodeControlPolicy: (roleName === void 0 ? void 0 : entityAt(contract.storage, {\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentityKind: \"role\",\n\t\t\t\tentityName: roleName\n\t\t\t}))?.control ?? \"external\",\n\t\t\tcreatesNewObject: false\n\t\t};\n\t}\n\tconst coordinate = postgresNodeStorageCoordinate(node);\n\tif (coordinate !== void 0) {\n\t\tconst namespaceId = resolveNamespaceIdForEntity(contract, coordinate, issue.path[1]);\n\t\tconst entityControl = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\t...coordinate,\n\t\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", entityControl),\n\t\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t\t};\n\t}\n\tconst tableName = issue.path[2];\n\tif (tableName === void 0) return void 0;\n\tconst ddlSchemaName = issue.path[1];\n\tconst namespaceId = resolveNamespaceIdForTable(contract, tableName, ddlSchemaName);\n\tconst table = entityAt(contract.storage, {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t});\n\treturn {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t...ifDefined(\"explicitNodeControlPolicy\", table?.control),\n\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t};\n}\n//#endregion\nexport { resolvePostgresNodeIssueCreationFactoryName as a, issueNode as c, postgresPlannerStrategies as d, defaultForeignKeyName as f, postgresNodeStorageCoordinate as h, resolvePostgresNodeIssueControlPolicySubject as i, issueSchemaName as l, defaultUniqueName as m, resolveNamespaceIdForDdlSchema as n, coalesceSubtreeIssues as o, defaultPrimaryKeyName as p, resolvePostgresCallControlPolicySubject as r, conflictForDisallowedCall as s, renderPostgresSuppression as t, planIssues as u };\n\n//# sourceMappingURL=control-policy-CuJvncMq.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,8BAA8B,MAAM;CAC5C,IAAI,wBAAwB,GAAG,IAAI,GAAG;EACrC,MAAM,aAAa,uBAAuB,KAAK,QAAQ;EACvD,OAAO,eAAe,KAAK,IAAI,KAAK,IAAI;GACvC;GACA,YAAY,KAAK;EAClB;CACD;CACA,IAAI,6BAA6B,GAAG,IAAI,GAAG;EAC1C,MAAM,aAAa,uBAAuB,KAAK,QAAQ;EACvD,OAAO,eAAe,KAAK,IAAI,KAAK,IAAI;GACvC;GACA,YAAY,KAAK;EAClB;CACD;AACD;;;;;;;;;AAWA,SAAS,WAAW,QAAQ;CAC3B,OAAO;EACN,GAAG,eAAe,WAAW,OAAO,KAAK,IAAI,MAAM;EACnD,UAAU,OAAO;EACjB,GAAG,UAAU,WAAW,OAAO,mBAAmB,OAAO,eAAe;CACz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AAY,MAAM,KAAK;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO,KAAK;CACtC,MAAM,gBAAgB,MAAM,KAAK;CACjC,MAAM,cAAc,2BAA2B,UAAU,WAAW,aAAa;CACjF,MAAM,QAAQ,SAAS,SAAS,SAAS;EACxC;EACA,YAAY;EACZ,YAAY;CACb,CAAC;CACD,OAAO;EACN;EACA,YAAY;EACZ,YAAY;EACZ,GAAG,UAAU,UAAU,gBAAgB,KAAK,CAAC;EAC7C,GAAG,UAAU,6BAA6B,OAAO,OAAO;EACxD,kBAAkB,4CAA4C,KAAK,MAAM,KAAK;CAC/E;AACD"}
@@ -1,7 +1,8 @@
1
- import { _ as pgNumeric, d as pgInt2, f as pgInt4, h as pgJson, n as pgBool, p as pgInt8, v as pgText } from "./data-types-BGsYeBpf-B_5bvuEe.mjs";
2
- import { createNumberClassifier, numeralText, parseJsonBody, printJsonBody, signedRange } from "@prisma/orm-family-sql/relational-core/ast";
1
+ import { _ as pgInt8, g as pgInt4, h as pgInt2, i as pgBool, w as pgText, x as pgNumeric, y as pgJson } from "./data-types-DzUVlWeo-CBMHoFoH.mjs";
3
2
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
4
- //#region ../../../3-targets/3-targets/postgres/dist/data-type-entries-cjspFU7A.mjs
3
+ import { numeralText } from "@prisma/orm-family-sql/contract/data-type";
4
+ import { createNumberClassifier, parseJsonBody, printJsonBody, signedRange } from "@prisma/orm-family-sql/contract/data-type-support";
5
+ //#region ../../../3-targets/3-targets/postgres/dist/data-type-entries-DYgNhsVx.mjs
5
6
  /**
6
7
  * PostgreSQL's own rule for a written number: a whole number takes the narrowest of `int2`, `int4`
7
8
  * and `int8` that holds it, and anything else — a larger whole number, a number with a fraction, or
@@ -98,4 +99,4 @@ function postgresDataTypeEntries() {
98
99
  //#endregion
99
100
  export { postgresDataTypeEntries as t };
100
101
 
101
- //# sourceMappingURL=data-type-entries-cjspFU7A-BBOIqLij.mjs.map
102
+ //# sourceMappingURL=data-type-entries-DYgNhsVx-BWJJHCQR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-type-entries-DYgNhsVx-BWJJHCQR.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-type-entries-DYgNhsVx.mjs"],"sourcesContent":["import { _ as pgInt8, g as pgInt4, h as pgInt2, i as pgBool, w as pgText, x as pgNumeric, y as pgJson } from \"./data-types-DzUVlWeo.mjs\";\nimport { numeralText } from \"@internal/sql-contract/data-type\";\nimport { createNumberClassifier, parseJsonBody, printJsonBody, signedRange } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/data-type-entries.ts\n/**\n* PostgreSQL's own rule for a written number: a whole number takes the narrowest of `int2`, `int4`\n* and `int8` that holds it, and anything else — a larger whole number, a number with a fraction, or\n* one of the three words — is a `numeric`.\n*/\nconst classifyPostgresNumber = createNumberClassifier({\n\tintegers: [\n\t\t{\n\t\t\ttype: pgInt2.id,\n\t\t\tform: \"number\",\n\t\t\t...signedRange(16)\n\t\t},\n\t\t{\n\t\t\ttype: pgInt4.id,\n\t\t\tform: \"number\",\n\t\t\t...signedRange(32)\n\t\t},\n\t\t{\n\t\t\ttype: pgInt8.id,\n\t\t\tform: \"text\",\n\t\t\t...signedRange(64)\n\t\t}\n\t],\n\tlargerWhole: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t},\n\tfraction: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t},\n\twords: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t}\n});\nfunction readBoolean(text) {\n\tif (text === \"true\" || text === \"false\") return text === \"true\";\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not a boolean.`, {\n\t\twhy: \"The only text a boolean reads is true or false.\",\n\t\tfix: \"Use true or false.\"\n\t});\n}\n/** The text of a number-shaped stored value: a number written out, or text taken as it stands. */\nfunction printNumber(value) {\n\treturn typeof value === \"number\" ? numeralText(value) : String(value);\n}\nfunction postgresDataTypeEntries() {\n\treturn {\n\t\t[pgText.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"string\",\n\t\t\t\tparse: (text) => text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Text.\"\n\t\t},\n\t\t[pgBool.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"boolean\",\n\t\t\t\tparse: readBoolean\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A boolean, written true or false.\"\n\t\t},\n\t\t[pgNumeric.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"number\",\n\t\t\t\ttypes: [\n\t\t\t\t\tpgInt2.id,\n\t\t\t\t\tpgInt4.id,\n\t\t\t\t\tpgInt8.id,\n\t\t\t\t\tpgNumeric.id\n\t\t\t\t],\n\t\t\t\tclassify: classifyPostgresNumber\n\t\t\t},\n\t\t\tprint: printNumber,\n\t\t\tdocumentation: \"A number, whose type comes from its own size and precision.\"\n\t\t},\n\t\t[pgJson.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"json\",\n\t\t\t\tparse: parseJsonBody\n\t\t\t},\n\t\t\tprint: printJsonBody,\n\t\t\tdocumentation: \"Reads the text as a JSON document and stores it as the default value.\"\n\t\t}\n\t};\n}\n//#endregion\nexport { postgresDataTypeEntries as t };\n\n//# sourceMappingURL=data-type-entries-DYgNhsVx.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,yBAAyB,uBAAuB;CACrD,UAAU;EACT;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;EACA;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;EACA;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;CACD;CACA,aAAa;EACZ,MAAM,UAAU;EAChB,MAAM;CACP;CACA,UAAU;EACT,MAAM,UAAU;EAChB,MAAM;CACP;CACA,OAAO;EACN,MAAM,UAAU;EAChB,MAAM;CACP;AACD,CAAC;AACD,SAAS,YAAY,MAAM;CAC1B,IAAI,SAAS,UAAU,SAAS,SAAS,OAAO,SAAS;CACzD,MAAM,gBAAgB,yBAAyB,IAAI,KAAK,sBAAsB;EAC7E,KAAK;EACL,KAAK;CACN,CAAC;AACF;;AAEA,SAAS,YAAY,OAAO;CAC3B,OAAO,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,OAAO,KAAK;AACrE;AACA,SAAS,0BAA0B;CAClC,OAAO;GACL,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,QAAQ;IACR,QAAQ,SAAS;GAClB;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO;GACR;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,UAAU,KAAK;GACf,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO;KACN,OAAO;KACP,OAAO;KACP,OAAO;KACP,UAAU;IACX;IACA,UAAU;GACX;GACA,OAAO;GACP,eAAe;EAChB;GACC,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,OAAO;GACP,eAAe;EAChB;CACD;AACD"}