@prisma/orm-target-postgres 8.0.0-rc.24-dev.28 → 8.0.0-rc.24-dev.30

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 (236) hide show
  1. package/README.md +2 -0
  2. package/dist/{adapter-B2zr93n1-DA67Xn-f.mjs → adapter-VDAs5CMq-OezO60C5.mjs} +6 -6
  3. package/dist/{adapter-B2zr93n1-DA67Xn-f.mjs.map → adapter-VDAs5CMq-OezO60C5.mjs.map} +1 -1
  4. package/dist/{adapter-BQExUKg6.d.mts → adapter-XucRgedT.d.mts} +13 -13
  5. package/dist/{adapter-BQExUKg6.d.mts.map → adapter-XucRgedT.d.mts.map} +1 -1
  6. package/dist/adapter.d.mts +5 -5
  7. package/dist/adapter.mjs +5 -5
  8. package/dist/adapter__adapter.d.mts +1 -1
  9. package/dist/adapter__adapter.mjs +2 -2
  10. package/dist/adapter__control.d.mts +3 -3
  11. package/dist/adapter__control.mjs +4 -4
  12. package/dist/adapter__control.mjs.map +1 -1
  13. package/dist/adapter__runtime.mjs +5 -5
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.mjs +1 -1
  16. package/dist/adapter__types.d.mts +2 -2
  17. package/dist/{aggregates-C2c48ORM.d.mts → aggregates-CJGvlOCM.d.mts} +12 -12
  18. package/dist/{aggregates-C2c48ORM.d.mts.map → aggregates-CJGvlOCM.d.mts.map} +1 -1
  19. package/dist/{authoring-DPwc7x9U-BZkXpPSH.mjs → authoring-4dCWsSXg-DeIEoQWg.mjs} +7 -7
  20. package/dist/authoring-4dCWsSXg-DeIEoQWg.mjs.map +1 -0
  21. package/dist/{autoincrement-widths-PwZcc5Co-1O2WEMYq.mjs → autoincrement-widths-BZUr8bLa-Dqtjwcf-.mjs} +3 -3
  22. package/dist/{autoincrement-widths-PwZcc5Co-1O2WEMYq.mjs.map → autoincrement-widths-BZUr8bLa-Dqtjwcf-.mjs.map} +1 -1
  23. package/dist/{check-expressions-Ch-A_NJN-BscDa8xT.mjs → check-expressions-cvFP1EFS-CPLt6x-O.mjs} +3 -3
  24. package/dist/{check-expressions-Ch-A_NJN-BscDa8xT.mjs.map → check-expressions-cvFP1EFS-CPLt6x-O.mjs.map} +1 -1
  25. package/dist/{codec-registry-B0LsFn7Z-ej9yKwTq.mjs → codec-registry-FvoD6sJj-ClHgHbyf.mjs} +4 -4
  26. package/dist/{codec-registry-B0LsFn7Z-ej9yKwTq.mjs.map → codec-registry-FvoD6sJj-ClHgHbyf.mjs.map} +1 -1
  27. package/dist/{codec-type-map-C_5OBkHw-DZ0UDSJr.d.mts → codec-type-map-CE_EveiY-S4IH6WPx.d.mts} +3 -3
  28. package/dist/{codec-type-map-C_5OBkHw-DZ0UDSJr.d.mts.map → codec-type-map-CE_EveiY-S4IH6WPx.d.mts.map} +1 -1
  29. package/dist/{codec-types-xyW4TiJD-CRDK7QcS.d.mts → codec-types-B-OBDw_P-CBflZnmD.d.mts} +4 -4
  30. package/dist/{codec-types-xyW4TiJD-CRDK7QcS.d.mts.map → codec-types-B-OBDw_P-CBflZnmD.d.mts.map} +1 -1
  31. package/dist/codec-types-V7HlwAkU.d.mts +2 -0
  32. package/dist/{codecs-Bzj3M0Q3-C2oFSIGs.mjs → codecs-B2C2j2Un-Dc-aGN1s.mjs} +12 -11
  33. package/dist/codecs-B2C2j2Un-Dc-aGN1s.mjs.map +1 -0
  34. package/dist/{codecs-BZ74mlUI.d.mts → codecs-B6fSK4Rr.d.mts} +2 -2
  35. package/dist/{codecs-BZ74mlUI.d.mts.map → codecs-B6fSK4Rr.d.mts.map} +1 -1
  36. package/dist/{codecs-3AVVZDao-C0sUjmuO.d.mts → codecs-BttOxm7v-Bg7ybHIE.d.mts} +3 -3
  37. package/dist/{codecs-3AVVZDao-C0sUjmuO.d.mts.map → codecs-BttOxm7v-Bg7ybHIE.d.mts.map} +1 -1
  38. package/dist/{contract-contributions-Bc0_64Gr-KE0qggZv.mjs → contract-contributions-DG0aJRRu-31YCQkp-.mjs} +54 -39
  39. package/dist/contract-contributions-DG0aJRRu-31YCQkp-.mjs.map +1 -0
  40. package/dist/{contract-free-DiRem1nw.mjs → contract-free-dQ4A6kPg.mjs} +3 -3
  41. package/dist/{contract-free-DiRem1nw.mjs.map → contract-free-dQ4A6kPg.mjs.map} +1 -1
  42. package/dist/{control-B-0_CuJt.d.mts → control-Bbb6l2oc.d.mts} +3 -3
  43. package/dist/{control-B-0_CuJt.d.mts.map → control-Bbb6l2oc.d.mts.map} +1 -1
  44. package/dist/{control-j5GEV5-D.d.mts → control-BhtDvy9Z.d.mts} +2 -2
  45. package/dist/{control-j5GEV5-D.d.mts.map → control-BhtDvy9Z.d.mts.map} +1 -1
  46. package/dist/{control-policy-DKnVhEWD-xuJIvCy9.mjs → control-policy-Crcjg7Vz-39_fO8yR.mjs} +11 -11
  47. package/dist/{control-policy-DKnVhEWD-xuJIvCy9.mjs.map → control-policy-Crcjg7Vz-39_fO8yR.mjs.map} +1 -1
  48. package/dist/{data-transform-2o0tpMs8-DADYIvEZ.d.mts → data-transform-BZ6kzJY4-DZBRydhx.d.mts} +3 -3
  49. package/dist/{data-transform-2o0tpMs8-DADYIvEZ.d.mts.map → data-transform-BZ6kzJY4-DZBRydhx.d.mts.map} +1 -1
  50. package/dist/data-transform-Cg3syfOe.d.mts +1 -0
  51. package/dist/{data-type-entries-CVxsfjF3-Bd0cSfuG.mjs → data-type-entries-CKHtbfmn-DBNF36FF.mjs} +3 -3
  52. package/dist/{data-type-entries-CVxsfjF3-Bd0cSfuG.mjs.map → data-type-entries-CKHtbfmn-DBNF36FF.mjs.map} +1 -1
  53. package/dist/{data-types-DWfwErIu-DF85cgmu.mjs → data-types-DgYRia-g-B_BFlAC3.mjs} +8 -9
  54. package/dist/data-types-DgYRia-g-B_BFlAC3.mjs.map +1 -0
  55. package/dist/{date-time-now-generators-BORO1_nc-BdCe3ppq.mjs → date-time-now-generators-DylEKfQR-CYbXE0y0.mjs} +5 -8
  56. package/dist/date-time-now-generators-DylEKfQR-CYbXE0y0.mjs.map +1 -0
  57. package/dist/{ddl-DCQLfg18-BgWGYC7L.mjs → ddl-Cy_8QS23-D9EVihrI.mjs} +3 -3
  58. package/dist/{ddl-DCQLfg18-BgWGYC7L.mjs.map → ddl-Cy_8QS23-D9EVihrI.mjs.map} +1 -1
  59. package/dist/{descriptor-meta-46EhsECb-C5EGe36u.mjs → descriptor-meta-CakMYWwZ-DSQNCwWB.mjs} +13 -12
  60. package/dist/descriptor-meta-CakMYWwZ-DSQNCwWB.mjs.map +1 -0
  61. package/dist/{descriptor-meta-DUDk-DLN-B_WUfFf7.mjs → descriptor-meta-DwXEu6Ap-qDhyaRK4.mjs} +8 -7
  62. package/dist/descriptor-meta-DwXEu6Ap-qDhyaRK4.mjs.map +1 -0
  63. package/dist/{diff-database-schema-BJKAfPAG-LCJmdiQq.mjs → diff-database-schema-CVmwyjFf-DSWPpd4M.mjs} +10 -10
  64. package/dist/{diff-database-schema-BJKAfPAG-LCJmdiQq.mjs.map → diff-database-schema-CVmwyjFf-DSWPpd4M.mjs.map} +1 -1
  65. package/dist/{diff-database-schema-rhLkiByE.d.mts → diff-database-schema-NiGuGt9b.d.mts} +2 -2
  66. package/dist/{diff-database-schema-rhLkiByE.d.mts.map → diff-database-schema-NiGuGt9b.d.mts.map} +1 -1
  67. package/dist/driver.mjs +1 -1
  68. package/dist/driver__runtime.mjs +1 -1
  69. package/dist/{errors-C4-Dp3gI-B5jY5eJj.mjs → errors-DxWL0CMX-BQe7Wfvt.mjs} +8 -7
  70. package/dist/{errors-C4-Dp3gI-B5jY5eJj.mjs.map → errors-DxWL0CMX-BQe7Wfvt.mjs.map} +1 -1
  71. package/dist/{full-text-oDBhUHI5.mjs → full-text-Bu_qI2ue.mjs} +3 -3
  72. package/dist/{full-text-oDBhUHI5.mjs.map → full-text-Bu_qI2ue.mjs.map} +1 -1
  73. package/dist/{full-text-collection-method-CtUV9NT0-CQuFZ4aH.d.mts → full-text-collection-method-Dc6I12lP-BFkF4drB.d.mts} +4 -4
  74. package/dist/full-text-collection-method-Dc6I12lP-BFkF4drB.d.mts.map +1 -0
  75. package/dist/{full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs → full-text-index-definition-MMcQF3_0-wRCz2FDP.mjs} +3 -3
  76. package/dist/{full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs.map → full-text-index-definition-MMcQF3_0-wRCz2FDP.mjs.map} +1 -1
  77. package/dist/{full-text-DGueFVx9.d.mts → full-text-pZNF76pS.d.mts} +3 -3
  78. package/dist/{full-text-DGueFVx9.d.mts.map → full-text-pZNF76pS.d.mts.map} +1 -1
  79. package/dist/{full-text-parsers-BZV74MUg-TfQ8rvPW.mjs → full-text-parsers-m8GS0pst-C6RPRehL.mjs} +4 -4
  80. package/dist/{full-text-parsers-BZV74MUg-TfQ8rvPW.mjs.map → full-text-parsers-m8GS0pst-C6RPRehL.mjs.map} +1 -1
  81. package/dist/{full-text-search-document-BqqvjJoC-HaoeMaM5.mjs → full-text-search-document-B5VCeQFz-D4hKtj-M.mjs} +5 -5
  82. package/dist/{full-text-search-document-BqqvjJoC-HaoeMaM5.mjs.map → full-text-search-document-B5VCeQFz-D4hKtj-M.mjs.map} +1 -1
  83. package/dist/{index-types-DGrgbAd4-DuGWdvol.mjs → index-types-CiM75RsF-DhmXdi38.mjs} +3 -3
  84. package/dist/{index-types-DGrgbAd4-DuGWdvol.mjs.map → index-types-CiM75RsF-DhmXdi38.mjs.map} +1 -1
  85. package/dist/{indexes-ooG0J-V8-CTm1QvmZ.d.mts → indexes-pfYKpulO-BWj-l1W3.d.mts} +8 -4
  86. package/dist/indexes-pfYKpulO-BWj-l1W3.d.mts.map +1 -0
  87. package/dist/{infer-psl-contract-DqtogWJ8-CUXUG-wF.mjs → infer-psl-contract-DgQutzGt-C1wN72ZC.mjs} +9 -9
  88. package/dist/{infer-psl-contract-DqtogWJ8-CUXUG-wF.mjs.map → infer-psl-contract-DgQutzGt-C1wN72ZC.mjs.map} +1 -1
  89. package/dist/{issue-planner-BlN8mK4E.d.mts → issue-planner-GkMubzHu.d.mts} +7 -6
  90. package/dist/issue-planner-GkMubzHu.d.mts.map +1 -0
  91. package/dist/{migration-CovfYOjm.d.mts → migration-BRcETuO-.d.mts} +4 -4
  92. package/dist/migration-BRcETuO-.d.mts.map +1 -0
  93. package/dist/migration-Be_iuIpn.mjs.map +1 -1
  94. package/dist/{native-type-normalizer-PGvExTgu.mjs → native-type-normalizer-DY__fyaa.mjs} +2 -2
  95. package/dist/{native-type-normalizer-PGvExTgu.mjs.map → native-type-normalizer-DY__fyaa.mjs.map} +1 -1
  96. package/dist/{op-factory-call-CG80t74g-D9tjd13N.d.mts → op-factory-call-Bz6ft8sk-JjpSUMTb.d.mts} +22 -6
  97. package/dist/op-factory-call-Bz6ft8sk-JjpSUMTb.d.mts.map +1 -0
  98. package/dist/op-factory-call-COB28WBr.d.mts +1 -0
  99. package/dist/{op-factory-call-THEIwT0J-DQM3Y94S.mjs → op-factory-call-DvezqqJx-KBDyNT08.mjs} +239 -182
  100. package/dist/op-factory-call-DvezqqJx-KBDyNT08.mjs.map +1 -0
  101. package/dist/operation-types-CaLyyiOR.d.mts +1 -0
  102. package/dist/{operation-types-Cnw0XvnJ-BZax8w1C.d.mts → operation-types-Da5h_iSt-Dqe_QrW_.d.mts} +3 -3
  103. package/dist/{operation-types-Cnw0XvnJ-BZax8w1C.d.mts.map → operation-types-Da5h_iSt-Dqe_QrW_.d.mts.map} +1 -1
  104. package/dist/{pack-ReYuY9t5.d.mts → pack-DshiZKVJ.d.mts} +6 -7
  105. package/dist/{pack-ReYuY9t5.d.mts.map → pack-DshiZKVJ.d.mts.map} +1 -1
  106. package/dist/{planner-Bw0tlQWK.d.mts → planner-CTwe5ozf.d.mts} +6 -5
  107. package/dist/{planner-Bw0tlQWK.d.mts.map → planner-CTwe5ozf.d.mts.map} +1 -1
  108. package/dist/{planner-BHH46ndt-Q6-LPhnL.mjs → planner-D2T46plG-BChGUTOA.mjs} +189 -54
  109. package/dist/planner-D2T46plG-BChGUTOA.mjs.map +1 -0
  110. package/dist/{planner-ddl-builders-Ds3Xcsg7-5-bR7xgo.mjs → planner-ddl-builders-Blf3qKKf-BopCSwrT.mjs} +3 -3
  111. package/dist/{planner-ddl-builders-Ds3Xcsg7-5-bR7xgo.mjs.map → planner-ddl-builders-Blf3qKKf-BopCSwrT.mjs.map} +1 -1
  112. package/dist/{planner-identity-values-CQZbvcx0-BpAvjtip.mjs → planner-identity-values-CX3J2pLA-CjCpOnue.mjs} +3 -3
  113. package/dist/{planner-identity-values-CQZbvcx0-BpAvjtip.mjs.map → planner-identity-values-CX3J2pLA-CjCpOnue.mjs.map} +1 -1
  114. package/dist/{planner-produced-postgres-migration-FtUIqqVg-ouPTcZ8X.mjs → planner-produced-postgres-migration-BLKk9Vaz-CsUhcKp1.mjs} +7 -7
  115. package/dist/planner-produced-postgres-migration-BLKk9Vaz-CsUhcKp1.mjs.map +1 -0
  116. package/dist/planner-produced-postgres-migration-CDE9JowN.d.mts +1 -0
  117. package/dist/{planner-produced-postgres-migration-exqzWlvW-DGLu2dQ7.d.mts → planner-produced-postgres-migration-Jizp3q0s-D_Sq7rld.d.mts} +5 -6
  118. package/dist/planner-produced-postgres-migration-Jizp3q0s-D_Sq7rld.d.mts.map +1 -0
  119. package/dist/{planner-sql-checks-BOdYkh9L-hXxekxJX.mjs → planner-sql-checks-CzxowQml-moHPNh20.mjs} +5 -5
  120. package/dist/{planner-sql-checks-BOdYkh9L-hXxekxJX.mjs.map → planner-sql-checks-CzxowQml-moHPNh20.mjs.map} +1 -1
  121. package/dist/{planner-target-details-boDXR2s7-CExrk6rf.d.mts → planner-target-details-DywkQKS4-lZEm-EiF.d.mts} +3 -3
  122. package/dist/planner-target-details-DywkQKS4-lZEm-EiF.d.mts.map +1 -0
  123. package/dist/{postgres-codec-traits-D9YEvK6F-BsKaAhCA.mjs → postgres-codec-traits-YxSb5di3-9F5ofwnG.mjs} +3 -3
  124. package/dist/{postgres-codec-traits-D9YEvK6F-BsKaAhCA.mjs.map → postgres-codec-traits-YxSb5di3-9F5ofwnG.mjs.map} +1 -1
  125. package/dist/{postgres-contract-view-DtsmkyFX-Bas8oQiN.mjs → postgres-contract-view-DhDzWNCN-BA5OpwhY.mjs} +10 -10
  126. package/dist/postgres-contract-view-DhDzWNCN-BA5OpwhY.mjs.map +1 -0
  127. package/dist/{postgres-migration-DEkPcs8x-CLxAKfHm.d.mts → postgres-migration-6nN7HQlZ-Ca0thLBy.d.mts} +5 -5
  128. package/dist/{postgres-migration-DEkPcs8x-CLxAKfHm.d.mts.map → postgres-migration-6nN7HQlZ-Ca0thLBy.d.mts.map} +1 -1
  129. package/dist/{postgres-migration-D5lRerLT-DyYh8UPS.mjs → postgres-migration-DEa-g6j1-CoG3QOV3.mjs} +18 -16
  130. package/dist/postgres-migration-DEa-g6j1-CoG3QOV3.mjs.map +1 -0
  131. package/dist/{postgres-schema-zd_p5Lg2-BdJlG7Cg.mjs → postgres-schema-CIfq1AjC-CGiMjtSX.mjs} +4 -4
  132. package/dist/{postgres-schema-zd_p5Lg2-BdJlG7Cg.mjs.map → postgres-schema-CIfq1AjC-CGiMjtSX.mjs.map} +1 -1
  133. package/dist/{prisma7-binding-BGEW0R_9.mjs → prisma7-binding-BRPindAK.mjs} +7 -7
  134. package/dist/{prisma7-binding-BGEW0R_9.mjs.map → prisma7-binding-BRPindAK.mjs.map} +1 -1
  135. package/dist/{prisma7-binding-DSQpvEBe.d.mts → prisma7-binding-BqClsmwa.d.mts} +6 -7
  136. package/dist/{prisma7-binding-DSQpvEBe.d.mts.map → prisma7-binding-BqClsmwa.d.mts.map} +1 -1
  137. package/dist/{registry-D4AyYsXr-CgiiMuFS.mjs → registry-CWgvB0Fj-Czwmfmzd.mjs} +3 -3
  138. package/dist/{registry-D4AyYsXr-CgiiMuFS.mjs.map → registry-CWgvB0Fj-Czwmfmzd.mjs.map} +1 -1
  139. package/dist/{render-ops-B5Mh0MpJ-Dc_dH1Sk.mjs → render-ops-Bl1R5cz0-CFshOROt.mjs} +4 -4
  140. package/dist/{render-ops-B5Mh0MpJ-Dc_dH1Sk.mjs.map → render-ops-Bl1R5cz0-CFshOROt.mjs.map} +1 -1
  141. package/dist/{render-ops-CEwI8Iyf.d.mts → render-ops-oYwF1MRN.d.mts} +2 -2
  142. package/dist/{render-ops-CEwI8Iyf.d.mts.map → render-ops-oYwF1MRN.d.mts.map} +1 -1
  143. package/dist/{render-typescript-Dqp1Spgn-B4mJhuVr.mjs → render-typescript-B-Igkk6D-CQ-WlBmb.mjs} +9 -24
  144. package/dist/render-typescript-B-Igkk6D-CQ-WlBmb.mjs.map +1 -0
  145. package/dist/{render-typescript-BysdXYpH.d.mts → render-typescript-dgxcyEaj.d.mts} +2 -9
  146. package/dist/render-typescript-dgxcyEaj.d.mts.map +1 -0
  147. package/dist/{resolve-ddl-schema-BwKuzGm--BVgPhp86.mjs → resolve-ddl-schema-C2KTxEX3-D8Jd9Rx1.mjs} +3 -3
  148. package/dist/{resolve-ddl-schema-BwKuzGm--BVgPhp86.mjs.map → resolve-ddl-schema-C2KTxEX3-D8Jd9Rx1.mjs.map} +1 -1
  149. package/dist/{runtime-DPhbi9_3.mjs → runtime-BArZXVRj.mjs} +7 -7
  150. package/dist/{runtime-DPhbi9_3.mjs.map → runtime-BArZXVRj.mjs.map} +1 -1
  151. package/dist/{runtime-BMG3ddkQ.d.mts → runtime-DhK5uy8-.d.mts} +2 -2
  152. package/dist/{runtime-BMG3ddkQ.d.mts.map → runtime-DhK5uy8-.d.mts.map} +1 -1
  153. package/dist/{runtime-Cnam1N0o.mjs → runtime-IkvlhDl7.mjs} +2 -2
  154. package/dist/{runtime-Cnam1N0o.mjs.map → runtime-IkvlhDl7.mjs.map} +1 -1
  155. package/dist/{sql-renderer-Bj41PrUl-Jbs8Ojfr.mjs → sql-renderer-Bj41PrUl-BDN4jKm9.mjs} +3 -3
  156. package/dist/{sql-renderer-Bj41PrUl-Jbs8Ojfr.mjs.map → sql-renderer-Bj41PrUl-BDN4jKm9.mjs.map} +1 -1
  157. package/dist/{sql-utils-Bq4nuPvy.d.mts → sql-utils-CHtt-prW.d.mts} +6 -2
  158. package/dist/{sql-utils-Bq4nuPvy.d.mts.map → sql-utils-CHtt-prW.d.mts.map} +1 -1
  159. package/dist/{sql-utils-CRPhDLp1-wbgQW5TM.mjs → sql-utils-ClKAaUlZ-BdjnkJvV.mjs} +8 -4
  160. package/dist/{sql-utils-CRPhDLp1-wbgQW5TM.mjs.map → sql-utils-ClKAaUlZ-BdjnkJvV.mjs.map} +1 -1
  161. package/dist/target.d.mts +29 -29
  162. package/dist/target.mjs +35 -35
  163. package/dist/target__aggregates.d.mts +1 -1
  164. package/dist/target__codec-types.d.mts +3 -3
  165. package/dist/target__codecs.d.mts +2 -2
  166. package/dist/target__codecs.mjs +3 -3
  167. package/dist/target__contract-free.mjs +3 -3
  168. package/dist/target__control.d.mts +1 -1
  169. package/dist/target__control.mjs +24 -16
  170. package/dist/target__control.mjs.map +1 -1
  171. package/dist/target__data-transform.d.mts +2 -2
  172. package/dist/target__data-types.mjs +2 -2
  173. package/dist/target__diff-database-schema.d.mts +1 -1
  174. package/dist/target__diff-database-schema.mjs +1 -1
  175. package/dist/target__errors.mjs +1 -1
  176. package/dist/target__full-text-index-authoring.mjs +2 -2
  177. package/dist/target__full-text.d.mts +3 -3
  178. package/dist/target__full-text.mjs +2 -2
  179. package/dist/target__issue-planner.d.mts +1 -1
  180. package/dist/target__issue-planner.mjs +1 -1
  181. package/dist/target__migration.d.mts +3 -3
  182. package/dist/target__migration.mjs +1 -1
  183. package/dist/target__native-type-normalizer.mjs +1 -1
  184. package/dist/target__op-factory-call.d.mts +3 -3
  185. package/dist/target__op-factory-call.mjs +2 -2
  186. package/dist/target__operation-types.d.mts +2 -2
  187. package/dist/target__pack.d.mts +2 -2
  188. package/dist/target__pack.mjs +1 -1
  189. package/dist/target__planner-ddl-builders.mjs +1 -1
  190. package/dist/target__planner-identity-values.mjs +1 -1
  191. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  192. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  193. package/dist/target__planner-sql-checks.mjs +1 -1
  194. package/dist/target__planner-target-details.d.mts +1 -1
  195. package/dist/target__planner.d.mts +1 -1
  196. package/dist/target__planner.mjs +2 -2
  197. package/dist/target__prisma7-binding.d.mts +1 -1
  198. package/dist/target__prisma7-binding.mjs +1 -1
  199. package/dist/target__render-ops.d.mts +1 -1
  200. package/dist/target__render-ops.mjs +1 -1
  201. package/dist/target__render-typescript.d.mts +1 -1
  202. package/dist/target__render-typescript.mjs +1 -1
  203. package/dist/target__runtime.d.mts +2 -2
  204. package/dist/target__runtime.mjs +4 -4
  205. package/dist/target__schema-ir-annotations.mjs +1 -1
  206. package/dist/target__sql-utils.d.mts +2 -2
  207. package/dist/target__sql-utils.mjs +4 -4
  208. package/dist/target__types.mjs +2 -2
  209. package/dist/{types-B_HaL8V4.d.mts → types-BxgDP3d4.d.mts} +1 -1
  210. package/package.json +16 -16
  211. package/dist/authoring-DPwc7x9U-BZkXpPSH.mjs.map +0 -1
  212. package/dist/codec-types-FPJG3oQH.d.mts +0 -2
  213. package/dist/codecs-Bzj3M0Q3-C2oFSIGs.mjs.map +0 -1
  214. package/dist/contract-contributions-Bc0_64Gr-KE0qggZv.mjs.map +0 -1
  215. package/dist/data-transform-DX9I716A.d.mts +0 -1
  216. package/dist/data-types-DWfwErIu-DF85cgmu.mjs.map +0 -1
  217. package/dist/date-time-now-generators-BORO1_nc-BdCe3ppq.mjs.map +0 -1
  218. package/dist/descriptor-meta-46EhsECb-C5EGe36u.mjs.map +0 -1
  219. package/dist/descriptor-meta-DUDk-DLN-B_WUfFf7.mjs.map +0 -1
  220. package/dist/full-text-collection-method-CtUV9NT0-CQuFZ4aH.d.mts.map +0 -1
  221. package/dist/indexes-ooG0J-V8-CTm1QvmZ.d.mts.map +0 -1
  222. package/dist/issue-planner-BlN8mK4E.d.mts.map +0 -1
  223. package/dist/migration-CovfYOjm.d.mts.map +0 -1
  224. package/dist/op-factory-call-CG80t74g-D9tjd13N.d.mts.map +0 -1
  225. package/dist/op-factory-call-DRapuFEI.d.mts +0 -1
  226. package/dist/op-factory-call-THEIwT0J-DQM3Y94S.mjs.map +0 -1
  227. package/dist/operation-types-D1F7DwdI.d.mts +0 -1
  228. package/dist/planner-BHH46ndt-Q6-LPhnL.mjs.map +0 -1
  229. package/dist/planner-produced-postgres-migration-CulnCxu2.d.mts +0 -1
  230. package/dist/planner-produced-postgres-migration-FtUIqqVg-ouPTcZ8X.mjs.map +0 -1
  231. package/dist/planner-produced-postgres-migration-exqzWlvW-DGLu2dQ7.d.mts.map +0 -1
  232. package/dist/planner-target-details-boDXR2s7-CExrk6rf.d.mts.map +0 -1
  233. package/dist/postgres-contract-view-DtsmkyFX-Bas8oQiN.mjs.map +0 -1
  234. package/dist/postgres-migration-D5lRerLT-DyYh8UPS.mjs.map +0 -1
  235. package/dist/render-typescript-BysdXYpH.d.mts.map +0 -1
  236. package/dist/render-typescript-Dqp1Spgn-B4mJhuVr.mjs.map +0 -1
@@ -1 +0,0 @@
1
- import "./operation-types-Cnw0XvnJ-BZax8w1C.mjs";
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-BHH46ndt-Q6-LPhnL.mjs","names":["#lowerer"],"sources":["../../../../3-targets/postgres/1-target/dist/planner-BHH46ndt.mjs"],"sourcesContent":["import { a as quoteIdentifier } from \"./sql-utils-CRPhDLp1.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { r as isPostgresSchema, y as PostgresRlsPolicy } from \"./postgres-schema-zd_p5Lg2.mjs\";\nimport { o as PostgresSchemaNodeKind, r as PostgresExtensionSchemaNode, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-OQRI_GIM.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-yFPLQ6U0.mjs\";\nimport { n as emissionSchemaForNamespace, r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-BwKuzGm-.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-BJKAfPAG.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as tableAt, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, p as postgresNodeStorageCoordinate, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-DKnVhEWD.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-Cz9Yoeim.mjs\";\nimport { B as RenameStoredKeyCall, D as DropPostgresRlsPolicyCall, H as ReplaceStoredValueCall, I as RenameConstraintCall, K as SetTableSchemaCall, M as RawSqlCall, N as RemoveStoredKeyCall, O as DropSchemaCall, P as RemoveStoredValueCall, R as RenamePostgresRlsPolicyCall, T as DropNativeEnumTypeCall, _ as DeleteRowsCall, b as DropColumnCall, j as FillStoredKeyCall, k as DropTableCall, l as AlterColumnTypeCall, m as CreateSchemaCall, p as CreatePostgresRlsPolicyCall, r as AddColumnWithTemporaryDefaultCall, t as AddCheckConstraintCall, v as DisableRowLevelSecurityCall, y as DropCheckConstraintCall, z as RenameSchemaCall } from \"./op-factory-call-THEIwT0J.mjs\";\nimport { a as renameTableByHandStatements, c as postgresSchemaTables, d as postgresContractToSchema, i as postgresTableRenameCall, l as pairCheckRenames, n as postgresColumnRenameCall, o as renderRenameTableCall, r as postgresTableRenameByHand, s as createWorkingSchema, u as pairIndexRenames } from \"./postgres-migration-D5lRerLT.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-FtUIqqVg.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { enumValueCoordinateJson, isRenameStatement, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { UNBOUND_PSL_NAMESPACE_NAME } from \"@internal/framework-components/psl-ast\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { UnfilledValue, appliedStatementsInOrder, backfillOfDefaultedField, detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, fieldStatementColumns, otherSpaceDeclaring, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventCalls, planStatements, planStoredRewrites, plannerFailure, sqlTypeLookupsOf, storageNameOfOperation, subjectsOfCalls, unknownCallNames } from \"@internal/family-sql/control\";\nimport { ok } from \"@internal/utils/result\";\nimport { governingControlPolicy } from \"@internal/contract/types\";\n//#region src/core/migrations/constraint-name-renames.ts\n/** The constraint of `nextNodes` the diff pairs with `node` and finds unchanged. */\nfunction unchangedIn(node, nextNodes) {\n\treturn nextNodes.find((next) => next.id === node.id && next.isEqualTo(node));\n}\n/**\n* The renames of the primary key, unique constraints and foreign keys of one table that the end tree keeps otherwise unchanged but names differently. A constraint's name is its stated name, or the one the planner derives from its table; a start tree read from the database states every name. A constraint whose start and end names differ is renamed to the end name. The diff never compares constraint names, so without these the database keeps the old name. A database may already have the new name, as when Prisma 7 created it and the contract only now states it; the rename's postcheck then holds before it runs, and the runner skips it.\n*/\nfunction constraintNameRenames(input) {\n\tconst { schemaName, from, to, previous, next, droppedConstraintNames } = input;\n\tconst rename = (kind, oldName, unchanged, derivedName) => {\n\t\tif (unchanged === void 0 || droppedConstraintNames.has(oldName)) return [];\n\t\tconst newName = unchanged.name ?? derivedName;\n\t\treturn oldName === newName ? [] : [new RenameConstraintCall(schemaName, to, kind, oldName, newName)];\n\t};\n\tconst primaryKey = previous.primaryKey === void 0 ? [] : rename(\"primaryKey\", previous.primaryKey.name ?? defaultPrimaryKeyName(from), unchangedIn(previous.primaryKey, next.primaryKey === void 0 ? [] : [next.primaryKey]), defaultPrimaryKeyName(to));\n\tconst uniques = previous.uniques.flatMap((unique) => rename(\"unique\", unique.name ?? defaultUniqueName(from, unique.columns), unchangedIn(unique, next.uniques), defaultUniqueName(to, unique.columns)));\n\tconst foreignKeys = previous.foreignKeys.flatMap((fk) => rename(\"foreignKey\", fk.name ?? defaultForeignKeyName(from, fk.columns), unchangedIn(fk, next.foreignKeys), defaultForeignKeyName(to, fk.columns)));\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* The constraint renames of a plan: {@link constraintNameRenames} for every table the start tree and the end contract both have, with the start tree as the plan's rename statements left it. The start tree comes from the start contract for `migration plan` and from the database for `db update`, so a database Prisma 8 created under derived names is renamed too once the contract states other names. A constraint one of `plannedCalls` drops is skipped: the plan adds it back under its end name, or not at all.\n*/\nfunction plannedConstraintNameRenames(options, plannedCalls) {\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return [];\n\tPostgresDatabaseSchemaNode.assert(options.schema);\n\tconst startTablesBySchema = new Map(Object.values(options.schema.namespaces).map((namespace) => [namespace.schemaName, namespace.tables]));\n\tconst contract = options.contract;\n\tconst end = postgresContractToSchema(contract, options.frameworkComponents);\n\treturn Object.values(end.namespaces).flatMap((namespace) => {\n\t\tconst startTables = startTablesBySchema.get(namespace.schemaName) ?? {};\n\t\tconst schemaName = resolveNamespaceIdForDdlSchema(contract, namespace.schemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : namespace.schemaName;\n\t\treturn Object.entries(namespace.tables).flatMap(([tableName, next]) => {\n\t\t\tconst previous = startTables[tableName];\n\t\t\tconst droppedConstraintNames = new Set(plannedCalls.flatMap((call) => call.factoryName === \"dropConstraint\" && call.schemaName === schemaName && call.tableName === tableName ? [call.constraintName] : []));\n\t\t\treturn previous === void 0 ? [] : constraintNameRenames({\n\t\t\t\tschemaName,\n\t\t\t\tfrom: tableName,\n\t\t\t\tto: tableName,\n\t\t\t\tprevious,\n\t\t\t\tnext,\n\t\t\t\tdroppedConstraintNames\n\t\t\t});\n\t\t});\n\t});\n}\n//#endregion\n//#region src/core/migrations/operation-subjects.ts\n/**\n* The namespace a schema stands for in the locator's contract, or, for a schema that contract does\n* not declare, such as the new name of a renamed namespace, the schema's own name: a named Postgres\n* namespace's schema is its id.\n*/\nfunction storageNamespaceId(locator, schemaName) {\n\tif (schemaName === UNBOUND_NAMESPACE_ID) return UNBOUND_NAMESPACE_ID;\n\tconst namespaceId = resolveNamespaceIdForDdlSchema(locator.contract, schemaName);\n\treturn namespaceId === UNBOUND_NAMESPACE_ID && schemaName !== \"public\" ? schemaName : namespaceId;\n}\nfunction qualified(schemaName, name) {\n\treturn schemaName === UNBOUND_NAMESPACE_ID ? name : `${schemaName}.${name}`;\n}\nfunction target(locator, schemaName, table, column) {\n\treturn {\n\t\tstorageName: qualified(schemaName, column === void 0 ? table : `${table}.${column}`),\n\t\ttable: {\n\t\t\tnamespaceId: storageNamespaceId(locator, schemaName),\n\t\t\ttable,\n\t\t\tcolumn\n\t\t}\n\t};\n}\nfunction rawSqlTarget(locator, call) {\n\tconst details = call.op.target.details;\n\tif (details === void 0) return {\n\t\tstorageName: call.op.id,\n\t\ttable: void 0\n\t};\n\tif (details.objectType === \"table\") return target(locator, details.schema, details.name, void 0);\n\tif (details.objectType === \"column\" && details.table !== void 0) return target(locator, details.schema, details.table, details.name);\n\treturn {\n\t\tstorageName: storageNameOfOperation(call.op),\n\t\ttable: void 0\n\t};\n}\nfunction knownTarget(locator, call) {\n\tif (call instanceof DropTableCall) return target(locator, call.schemaName, call.tableName, void 0);\n\tif (call instanceof DeleteRowsCall) return {\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\t...ifDefined(\"model\", locator.variantRows?.get(call))\n\t};\n\tif (call instanceof DropColumnCall || call instanceof AlterColumnTypeCall) return target(locator, call.schemaName, call.tableName, call.columnName);\n\tif (call instanceof RemoveStoredKeyCall) return {\n\t\t...target(locator, call.schemaName, call.tableName, call.columnName),\n\t\t...ifDefined(\"valueObjectField\", locator.storedKeys?.get(call))\n\t};\n\tif (call instanceof RemoveStoredValueCall) {\n\t\tconst enumValue = locator.storedValues?.get(call)?.enumValue;\n\t\treturn {\n\t\t\t...target(locator, call.schemaName, call.tableName, call.columnName),\n\t\t\t...ifDefined(\"enumValue\", enumValue)\n\t\t};\n\t}\n\tif (call instanceof RawSqlCall) return rawSqlTarget(locator, call);\n\tconst fieldEvent = locator.fieldEvents.get(call);\n\treturn fieldEvent === void 0 ? void 0 : fieldEventStorage(fieldEvent);\n}\n/**\n* A policy's identity across a replacement: its name, or the prefix of a generated (wire) name,\n* whose hash changes with the policy's body.\n*/\nfunction policyKey(schemaName, tableName, policyName) {\n\treturn JSON.stringify([\n\t\tschemaName,\n\t\ttableName,\n\t\tparseWireName(policyName)?.prefix ?? policyName\n\t]);\n}\n/**\n* The policies the plan creates. A drop of one of them, by name or by generated-name prefix, is\n* half of a replacement, which leaves a policy in place, so it widens no access.\n*/\nfunction createdPolicies(calls) {\n\treturn new Set(calls.flatMap((call) => call instanceof CreatePostgresRlsPolicyCall ? [policyKey(call.schemaName, call.tableName, call.policy.name)] : []));\n}\n/**\n* Disabling row-level security widens access: every role with table privileges then reads and\n* writes every row. Dropping a policy changes access either way, since a permissive policy grants\n* access and a restrictive one limits it, unless the plan creates the policy again.\n*/\nfunction accessChangesOf(locator, call, replaced) {\n\tif (call instanceof DisableRowLevelSecurityCall) return [{\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\twidens: true\n\t}];\n\tif (call instanceof DropPostgresRlsPolicyCall && !replaced.has(policyKey(call.schemaName, call.tableName, call.policyName))) return [{\n\t\t...target(locator, call.schemaName, call.tableName, void 0),\n\t\twidens: false\n\t}];\n\treturn [];\n}\n/** The temporary values a call writes: a new required column's, or a planner-written fill's of a value object field. */\nfunction temporaryValuesOf(locator, call) {\n\tif (call instanceof AddColumnWithTemporaryDefaultCall) return [{\n\t\ttable: call.tableName,\n\t\tcolumn: call.columnName,\n\t\tvalue: call.temporaryDefault\n\t}];\n\tconst valueObjectField = locator.storedKeys?.get(call);\n\tif (!(call instanceof FillStoredKeyCall) || call.value instanceof UnfilledValue || valueObjectField === void 0) return [];\n\treturn [{\n\t\ttable: call.tableName,\n\t\tcolumn: call.columnName,\n\t\tvalue: JSON.stringify(call.value),\n\t\tvalueObjectField\n\t}];\n}\nfunction operationCountOf(call) {\n\treturn \"companions\" in call && Array.isArray(call.companions) ? 1 + call.companions.length : 1;\n}\n/** What each call of a Postgres plan loses, and whose access it changes. */\nfunction postgresCallSubjects(calls, locator) {\n\tconst replaced = createdPolicies(calls);\n\tconst destructive = calls.filter((call) => call.operationClass === \"destructive\");\n\tconst known = new Map(destructive.map((call) => [call, knownTarget(locator, call)]));\n\tconst unknownNames = unknownCallNames(destructive.filter((call) => known.get(call) === void 0));\n\treturn calls.map((call) => {\n\t\tconst lossTarget = known.get(call);\n\t\tconst unknownName = unknownNames.get(call);\n\t\tconst loss = call instanceof AlterColumnTypeCall ? \"typeChange\" : \"drop\";\n\t\treturn {\n\t\t\toperationCount: operationCountOf(call),\n\t\t\tlabel: call.label,\n\t\t\tdataLoss: lossTarget !== void 0 ? [{\n\t\t\t\t...lossTarget,\n\t\t\t\tloss,\n\t\t\t\t...ifDefined(\"keepDataEdit\", locator.storedValues?.get(call)?.keepDataEdit)\n\t\t\t}] : unknownName !== void 0 ? [{\n\t\t\t\tstorageName: unknownName,\n\t\t\t\ttable: void 0,\n\t\t\t\tloss\n\t\t\t}] : [],\n\t\t\taccessChanges: accessChangesOf(locator, call, replaced),\n\t\t\ttemporaryValues: temporaryValuesOf(locator, call)\n\t\t};\n\t});\n}\n//#endregion\n//#region src/core/migrations/stored-value-calls.ts\n/** The calls that carry out a plan's stored value rewrites, each with the rewrite it carries out. */\nfunction postgresStoredValueCalls(rewrites, contract, codecs) {\n\treturn new Map(rewrites.map((rewrite) => {\n\t\tconst schemaName = emissionSchemaForNamespace(contract, rewrite.namespaceId);\n\t\tconst codec = rewrite.codecRef === void 0 ? void 0 : {\n\t\t\tcodecRef: rewrite.codecRef,\n\t\t\tcodecs\n\t\t};\n\t\tconst { member } = rewrite;\n\t\treturn [rewrite.to === void 0 ? new RemoveStoredValueCall(schemaName, rewrite.table, rewrite.column, rewrite.from, rewrite.many, codec, enumValueCoordinateJson(rewrite.enumValue), member?.path, member?.nullable === true ? true : void 0) : new ReplaceStoredValueCall(schemaName, rewrite.table, rewrite.column, rewrite.from, rewrite.to, rewrite.many, codec, member?.path), rewrite];\n\t}));\n}\n/** The calls that carry out a plan's key rewrites of value object fields, each with the rewrite it carries out. */\nfunction postgresStoredKeyCalls(rewrites, contract) {\n\treturn new Map(rewrites.map((rewrite) => {\n\t\tconst schemaName = emissionSchemaForNamespace(contract, rewrite.namespaceId);\n\t\treturn [rewrite.to === void 0 ? new RemoveStoredKeyCall(schemaName, rewrite.table, rewrite.column, rewrite.path) : new RenameStoredKeyCall(schemaName, rewrite.table, rewrite.column, rewrite.path, rewrite.to), rewrite];\n\t}));\n}\n/** The calls that carry out a plan's fills of value object fields, each with the fill it carries out. */\nfunction postgresStoredKeyFillCalls(fills, contract) {\n\treturn new Map(fills.map((fill) => [new FillStoredKeyCall(emissionSchemaForNamespace(contract, fill.namespaceId), fill.table, fill.column, fill.path, fill.value, {\n\t\ttext: fill.field,\n\t\tcheck: void 0\n\t}), fill]));\n}\n/** The calls that carry out a plan's row rewrites of variants, each with the rewrite it carries out. */\nfunction postgresVariantRowCalls(rewrites, contract, codecs) {\n\treturn new Map(rewrites.map((rewrite) => {\n\t\tconst schemaName = emissionSchemaForNamespace(contract, rewrite.namespaceId);\n\t\tconst codec = {\n\t\t\tcodecRef: rewrite.codecRef,\n\t\t\tcodecs\n\t\t};\n\t\treturn [rewrite.to === void 0 ? new DeleteRowsCall(schemaName, rewrite.table, rewrite.column, rewrite.from, codec) : new ReplaceStoredValueCall(schemaName, rewrite.table, rewrite.column, rewrite.from, rewrite.to, false, codec), rewrite];\n\t}));\n}\n/** Puts the stored value calls among the calls the diff plans, which order them. */\nfunction storedValueCallsStrategy(calls) {\n\treturn (issues) => calls.length === 0 ? { kind: \"no_match\" } : {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls\n\t};\n}\n/** How the family's stored value code tells Postgres removals apart and builds replacements. */\nconst postgresStoredValueCallClasses = {\n\tisRemoval: (call) => call instanceof RemoveStoredValueCall,\n\treplacementOf: (removal, { from, to }) => new ReplaceStoredValueCall(removal.schemaName, removal.tableName, removal.columnName, from, to, removal.many, removal.codec, removal.path?.text)\n};\nconst RENDER_ONLY_CODECS = { descriptorFor: () => void 0 };\n/** The removal a failed check's mark describes, in the schema its operation names, as `migration.ts` writes it. */\nfunction postgresMarkedRemoval(schema, mark) {\n\tconst codec = mark.codecRef === void 0 ? void 0 : {\n\t\tcodecRef: mark.codecRef,\n\t\tcodecs: RENDER_ONLY_CODECS\n\t};\n\treturn new RemoveStoredValueCall(schema, mark.table, mark.column, mark.value, false, codec, mark.enumValue, mark.path);\n}\n//#endregion\n//#region src/core/migrations/type-change-checks.ts\nfunction tableIn(tree, ddlSchemaName, tableName) {\n\treturn Object.values(tree.namespaces).find((node) => node.schemaName === ddlSchemaName)?.tables[tableName];\n}\nfunction escapedForPattern(text) {\n\treturn text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n/**\n* Whether a check's predicate names the column, quoted or bare. The predicate is opaque SQL, so this\n* reads its text, and may name a check that does not depend on the column: dropping and adding\n* such a check again changes nothing.\n*/\nfunction mentionsColumn(check, column) {\n\tconst quoted = escapedForPattern(quoteIdentifier(column));\n\tconst bare = escapedForPattern(column);\n\treturn new RegExp(`${quoted}|(?<![\\\\w$\"])${bare}(?![\\\\w$\"])`, \"i\").test(check.expression);\n}\n/**\n* Puts a drop of each check that names a column a type change alters before the first such type\n* change, and the check back after the last. Postgres stores a check bound to the column's old type,\n* such as `array_position(tags, NULL::integer)`, and re-checks it while it alters the type, so a\n* check left in place can fail the alter; a check that names two retyped columns can only be added\n* back once both have their new types. Only checks the plan keeps unchanged are moved: one the plan\n* drops or adds is already planned around the alter. The check is added back as the destination\n* contract writes it.\n*/\nfunction withChecksAroundTypeChanges(input) {\n\tconst moved = /* @__PURE__ */ new Map();\n\tinput.calls.forEach((call, index) => {\n\t\tif (!(call instanceof AlterColumnTypeCall)) return;\n\t\tconst ddlSchemaName = input.ddlSchemaOf(call.schemaName);\n\t\tconst kept = tableIn(input.actual, ddlSchemaName, call.tableName)?.checks ?? [];\n\t\tfor (const check of tableIn(input.expected, ddlSchemaName, call.tableName)?.checks ?? []) {\n\t\t\tif (!mentionsColumn(check, call.columnName)) continue;\n\t\t\tif (!kept.some(({ name }) => name === check.name)) continue;\n\t\t\tconst key = JSON.stringify([\n\t\t\t\tddlSchemaName,\n\t\t\t\tcall.tableName,\n\t\t\t\tcheck.name\n\t\t\t]);\n\t\t\tconst entry = moved.get(key);\n\t\t\tif (entry === void 0) moved.set(key, {\n\t\t\t\tschemaName: call.schemaName,\n\t\t\t\ttableName: call.tableName,\n\t\t\t\tcheck,\n\t\t\t\tfirst: index,\n\t\t\t\tlast: index\n\t\t\t});\n\t\t\telse entry.last = index;\n\t\t}\n\t});\n\tconst entries = [...moved.values()];\n\treturn input.calls.flatMap((call, index) => [\n\t\t...entries.filter(({ first }) => first === index).map(({ schemaName, tableName, check }) => new DropCheckConstraintCall(schemaName, tableName, check.name)),\n\t\tcall,\n\t\t...entries.filter(({ last }) => last === index).map(({ schemaName, tableName, check }) => new AddCheckConstraintCall(schemaName, tableName, check.name, check.expression))\n\t]);\n}\n//#endregion\n//#region src/core/migrations/verify-postgres-namespaces.ts\n/**\n* Resolves the live-database schema name for a given namespace\n* coordinate. Mirrors `resolveDdlSchemaForNamespace` in\n* `planner-strategies.ts` so the verifier's projection and the\n* planner's projection always agree — Postgres-aware namespaces (the\n* production path) dispatch to `ddlSchemaName(storage)`, and bare\n* object payloads (used by some tests) fall back to the coordinate\n* itself.\n*/\nfunction resolveDdlSchemaName(storage, namespaceId) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n/**\n* Reads the introspected list of schema names from the database-root schema\n* node. `existingSchemas` is database-level, so it lives on the\n* `PostgresDatabaseSchemaNode` root — not on the per-schema namespace nodes.\n*\n* Defaults to the always-present `public` schema when the node is not the\n* database root — a fresh Postgres database always carries `public` (unless an\n* operator dropped it manually), so any verifier path that runs without an\n* enriched introspection still suppresses the redundant `CREATE SCHEMA\n* \"public\"`.\n*\n* Production introspection (`PostgresControlAdapter.introspect`) is the\n* authoritative source: it queries `pg_namespace` and sets `existingSchemas`\n* on the returned root. Tests that want to assert against a richer initial\n* state construct a `PostgresDatabaseSchemaNode` explicitly.\n*/\nfunction existingSchemasFromSchema(schema) {\n\tif (PostgresDatabaseSchemaNode.is(schema)) return schema.existingSchemas;\n\treturn [DEFAULT_NAMESPACE_ID];\n}\n/**\n* Emits a `postgres-namespace` `not-found` diff issue for every\n* contract-declared Postgres namespace whose live container does not yet\n* exist. The planner prepends these (node-typed, synthesized) to the\n* relational diff issues so a multi-schema plan emits `CREATE SCHEMA`\n* before the tables that need it — a planner-only concern (verify already\n* rejects via the `not-found` table issues a missing schema already\n* produces), so this is not part of the shared diff.\n*\n* A namespace's live container is the schema returned by its\n* polymorphic `ddlSchemaName(storage)` method — named schemas resolve\n* to their own id; the unbound singleton returns `UNBOUND_NAMESPACE_ID`\n* and is skipped explicitly (late-bound namespaces have no fixed DDL\n* schema). Issues are emitted only when the resolved name is a real,\n* creatable schema (not the unbound sentinel) and is missing from the\n* introspected list. `public` is suppressed implicitly because the\n* introspection (or its sensible default) always carries it.\n*\n* Each emitted issue's path is `['database', ddlName]` — an ancestor of\n* every table path under that schema, so it must never be run through\n* `coalesceSubtreeIssues` alongside the table diff (it would swallow the\n* table-level `not-found` issues that drive `CREATE TABLE`); the planner\n* adds these AFTER coalescing the relational issues, and they are not\n* subject to sibling-space ownership scoping (mirrors the retired\n* coordinate walk, which prepended namespace issues after that filter).\n*/\nfunction verifyPostgresNamespacePresence(input) {\n\tconst { contract, schema } = input;\n\tconst existing = new Set(existingSchemasFromSchema(schema));\n\tconst issues = [];\n\tconst namespaceIds = Object.keys(contract.storage.namespaces).sort();\n\tfor (const namespaceId of namespaceIds) {\n\t\tif (namespaceId === UNBOUND_NAMESPACE_ID) continue;\n\t\tconst ddlName = resolveDdlSchemaName(contract.storage, namespaceId);\n\t\tif (ddlName === UNBOUND_NAMESPACE_ID) continue;\n\t\tif (existing.has(ddlName)) continue;\n\t\tconst namespace = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlName,\n\t\t\ttables: {}\n\t\t});\n\t\tissues.push({\n\t\t\tpath: [\"database\", ddlName],\n\t\t\texpected: namespace\n\t\t});\n\t}\n\treturn issues;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction partitionPostgresCallsByControlPolicy(calls, contract) {\n\treturn partitionCallsByControlPolicy({\n\t\tcalls,\n\t\tcontract,\n\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, contract),\n\t\tresolveFactoryName: (call) => call.factoryName\n\t});\n}\nfunction createPostgresMigrationPlanner(lowerer) {\n\treturn new PostgresMigrationPlanner(lowerer);\n}\n/**\n* Postgres migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the target contract against the live schema via the one\n* differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the unified `postgresPlannerStrategies`\n* list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook\n* storage types, component-declared dependency installs, and\n* shared-temp-default / empty-table-guarded NOT-NULL add-column. The same\n* strategy list runs for `migration plan`, `db update`, and `db init`;\n* behavior diverges purely on `policy.allowedOperationClasses` (the\n* data-safe strategies short-circuit when `'data'` is excluded). The issue\n* planner applies operation-class policy gates and emits a single\n* `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via\n* `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy\n* drift (the structural half of the same one-differ tree) is handled\n* separately via `planPostgresSchemaDiff`.\n*/\nvar PostgresMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(blindCast(options));\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderablePostgresMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst schemaName = options.schemaName ?? Object.keys(options.contract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tconst packExtensions = extensionsDeclaredByPacks(options);\n\t\tif (packExtensions.length > 0) return plannerFailure(packExtensions);\n\t\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst statements = this.planStatements(options, options.schema);\n\t\tif (!statements.ok) return plannerFailure([statements.failure]);\n\t\tconst { schema } = statements.value;\n\t\tconst removedSchemas = removedNamespaceSchemas(options, schema);\n\t\tconst { issues: rawIssues, expected: expectedSchema } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: schema,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\toriginSchemas: originSchemaNames(options.fromContract),\n\t\t\toriginExtensions: originExtensionNames(options.fromContract)\n\t\t});\n\t\tconst droppedTables = rawIssues.filter((issue) => issueOutcome(issue) === \"not-expected\" && issueNode(issue)?.nodeKind === PostgresSchemaNodeKind.table);\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue) && !droppedTables.some((table) => isWithin(issue.path, table.path)));\n\t\tconst relationalDiffIssues = rawIssues.filter((issue) => !isPolicyDiffIssue(issue));\n\t\tconst strict = options.policy.allowedOperationClasses.includes(\"widening\") || options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(relationalDiffIssues.filter((issue) => !isOriginNamespaceIssue(issue, originSchemaNames(options.fromContract)))), options.ownership, (ddlSchemaName) => namespaceIdOfSchema(options, ddlSchemaName));\n\t\tconst gated = strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\");\n\t\tconst schemaIssues = [...verifyPostgresNamespacePresence({\n\t\t\tcontract: options.contract,\n\t\t\tschema\n\t\t}), ...gated];\n\t\tconst indexRenames = pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = pairCheckRenames(options, schemaIssues);\n\t\tconst renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);\n\t\tconst plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst types = sqlTypeLookupsOf(options.frameworkComponents);\n\t\tconst storedRewrites = planStoredRewrites({\n\t\t\tstatements: options.statements,\n\t\t\tfromContract: options.fromContract,\n\t\t\tcontract: options.contract,\n\t\t\ttables: postgresSchemaTables(schema, options.contract),\n\t\t\ttypes,\n\t\t\tpolicy: options.policy,\n\t\t\tcalls: {\n\t\t\t\tstoredKeyCalls: (rewrites) => postgresStoredKeyCalls(rewrites, options.contract),\n\t\t\t\tstoredKeyFillCalls: (fills) => postgresStoredKeyFillCalls(fills, options.contract),\n\t\t\t\tstoredValueCalls: (rewrites) => postgresStoredValueCalls(rewrites, options.contract, types.codecLookup),\n\t\t\t\tvariantRowCalls: (rewrites) => postgresVariantRowCalls(rewrites, options.contract, types.codecLookup),\n\t\t\t\tstoredValueClasses: postgresStoredValueCallClasses\n\t\t\t}\n\t\t});\n\t\tif (!storedRewrites.ok) return plannerFailure([storedRewrites.failure]);\n\t\tconst relationalSchema = relationalNamespaceNode(schema, schemaName);\n\t\tconst issuePartition = partitionIssuesByControlPolicy({\n\t\t\tissues: plannableIssues,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (issue) => resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),\n\t\t\tresolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName\n\t\t});\n\t\tconst caseChangeConflicts = detectTableNameCaseChanges({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttableOf: (issue) => {\n\t\t\t\tconst node = issueNode(issue);\n\t\t\t\treturn node !== void 0 && PostgresTableSchemaNode.is(node) ? node : void 0;\n\t\t\t},\n\t\t\tnamespaceIdOf: (issue) => resolveNamespaceIdForDdlSchema(options.contract, issueSchemaName(issue) ?? schemaName),\n\t\t\trenameByHandStatements: (rename) => renameTableByHandStatements(options.contract, rename),\n\t\t\trenameTableCall: renderRenameTableCall,\n\t\t\tcontract: options.contract,\n\t\t\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID\n\t\t});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\n\t\tconst defaultedBackfill = backfillOfDefaultedField(options.statements, options.fromContract, options.contract);\n\t\tif (defaultedBackfill !== void 0) return plannerFailure([defaultedBackfill]);\n\t\tconst result = planIssues({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttoContract: options.contract,\n\t\t\tfromContract: options.fromContract,\n\t\t\tschemaName,\n\t\t\tcodecHooks,\n\t\t\ttypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tstartTree: schema,\n\t\t\tendTree: expectedSchema,\n\t\t\tforeignKeyDropAuthority: (ddlSchemaName, tableName, foreignKey) => {\n\t\t\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(options.contract, ddlSchemaName);\n\t\t\t\tif ((tableAt(options.contract.storage, namespaceId, tableName) === void 0 && options.ownership?.declaresEntity({\n\t\t\t\t\tnamespaceId,\n\t\t\t\t\tentityKind: \"table\",\n\t\t\t\t\tentityName: tableName\n\t\t\t\t})) === true) return \"otherSpace\";\n\t\t\t\tconst { plannable } = partitionIssuesByControlPolicy({\n\t\t\t\t\tissues: [{\n\t\t\t\t\t\tpath: [\n\t\t\t\t\t\t\t\"database\",\n\t\t\t\t\t\t\tddlSchemaName,\n\t\t\t\t\t\t\ttableName,\n\t\t\t\t\t\t\tforeignKey.id\n\t\t\t\t\t\t],\n\t\t\t\t\t\tactual: foreignKey\n\t\t\t\t\t}],\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\tresolveControlPolicySubject: (issue) => resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),\n\t\t\t\t\tresolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName\n\t\t\t\t});\n\t\t\t\treturn plannable.length === 1 ? \"allowed\" : \"controlPolicy\";\n\t\t\t},\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstatementColumns: fieldStatementColumns(options.statements, options.contract),\n\t\t\tstrategies: [\n\t\t\t\t...postgresPlannerStrategies,\n\t\t\t\tdropRemovedSchemasStrategy(removedSchemas.filter((schemaName) => !keptSchema(options, schemaName))),\n\t\t\t\tstoredValueCallsStrategy(storedRewrites.value.calls)\n\t\t\t]\n\t\t});\n\t\tconst schemaDiff = this.planPostgresSchemaDiff(options, policyDiffIssues);\n\t\tif (!result.ok || schemaDiff.conflicts.length > 0) return plannerFailure([...result.ok ? [] : result.failure, ...schemaDiff.conflicts]);\n\t\tconst renamePartition = partitionPostgresCallsByControlPolicy([\n\t\t\t...indexRenames.calls,\n\t\t\t...checkRenames.calls,\n\t\t\t...plannedConstraintNameRenames({\n\t\t\t\t...options,\n\t\t\t\tschema\n\t\t\t}, result.value.calls)\n\t\t], options.contract);\n\t\tconst schemaDiffPartition = partitionPostgresCallsByControlPolicy(schemaDiff.calls, options.contract);\n\t\tconst fieldEventCalls = planFieldEventCalls({\n\t\t\tpriorContract: options.origin === null ? null : options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks,\n\t\t\ttableRenames: statements.value.tableRenames,\n\t\t\tcolumnRenames: statements.value.columnRenames,\n\t\t\tdataTypes: types.dataTypeLookup\n\t\t});\n\t\tconst fieldEventPartition = partitionPostgresCallsByControlPolicy(blindCast(fieldEventCalls.map(({ call }) => call)), options.contract);\n\t\tconst ordered = movePolicyDropsBeforeBlockedDdl(withChecksAroundTypeChanges({\n\t\t\tcalls: result.value.calls,\n\t\t\texpected: expectedSchema,\n\t\t\tactual: schema,\n\t\t\tddlSchemaOf: (name) => name === UNBOUND_NAMESPACE_ID ? resolveDdlSchemaForNamespaceStorage(options.contract.storage, UNBOUND_NAMESPACE_ID) : name\n\t\t}), schemaDiffPartition.kept);\n\t\tconst calls = [\n\t\t\t...statements.value.calls,\n\t\t\t...ordered.structural,\n\t\t\t...renamePartition.kept,\n\t\t\t...ordered.policyCalls,\n\t\t\t...fieldEventPartition.kept\n\t\t];\n\t\tconst seenWarnings = /* @__PURE__ */ new Set();\n\t\tconst warnings = [\n\t\t\t...issuePartition.suppressions,\n\t\t\t...renamePartition.suppressions,\n\t\t\t...schemaDiff.suppressions,\n\t\t\t...schemaDiffPartition.suppressions,\n\t\t\t...fieldEventPartition.suppressions\n\t\t].map((record) => renderPostgresSuppression(record, options.contract)).filter((warning) => {\n\t\t\tconst key = JSON.stringify(warning);\n\t\t\tif (seenWarnings.has(key)) return false;\n\t\t\tseenWarnings.add(key);\n\t\t\treturn true;\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderablePostgresMigration(calls, {\n\t\t\t\tfrom: options.origin?.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\tappliedStatements: appliedStatementsInOrder(options.statements, statements.value.plannedStatements, (statement) => storedRewrites.value.operationIndexes(calls, statement)),\n\t\t\t...subjectsOfCalls(postgresCallSubjects(calls, {\n\t\t\t\tcontract: options.fromContract ?? options.contract,\n\t\t\t\tfieldEvents: new Map(fieldEventCalls.map((fieldEvent) => [fieldEvent.call, fieldEvent])),\n\t\t\t\tstoredValues: storedRewrites.value.storedValues,\n\t\t\t\tstoredKeys: storedRewrites.value.storedKeys,\n\t\t\t\tvariantRows: storedRewrites.value.variantRows\n\t\t\t}), {\n\t\t\t\tfromContract: options.fromContract,\n\t\t\t\tcontract: options.contract,\n\t\t\t\torigins: statements.value.origins,\n\t\t\t\tbyHand: postgresTableRenameByHand(options.contract),\n\t\t\t\tremovedVariants: storedRewrites.value.removedVariants\n\t\t\t}),\n\t\t\tnamespaces: {\n\t\t\t\tremoved: removedSchemas.map((schemaName) => namespaceIdOfSchema(options, schemaName)),\n\t\t\t\tadded: addedNamespaceIds(options)\n\t\t\t},\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Maps the RLS policy findings of the one combined tree diff\n\t* (`buildPostgresPlanDiff`, already ownership-filtered) into\n\t* `CREATE POLICY` / `DROP POLICY` / `ALTER POLICY … RENAME TO` ops — a\n\t* `not-equal` finding (an exact-named policy whose content drifted)\n\t* becomes drop + create, or a disallowed-call conflict when the policy\n\t* forbids the drop, which is `widening`. It\n\t* does not re-diff — it consumes exactly the policy-node subset of the\n\t* shared diff's issues. Enablement is NOT decided here: `ENABLE`/`DISABLE\n\t* ROW LEVEL SECURITY` derive from the table's marker-driven `rlsEnabled`\n\t* attribute diff on the relational side.\n\t*\n\t* Rename post-pass (the index pass's structure): hash pairing pairs a\n\t* `not-found` and a `not-expected` policy on the SAME table whose\n\t* wire-name content hashes match but prefixes differ (prefix-only rename);\n\t* content pairing then pairs remaining wire-named-missing policies against remaining\n\t* extras of any name shape by verbatim content (the node-owned `contentEquals` —\n\t* exact→wire adoption). Multi-candidate groups pair deterministically\n\t* by sorted name; leftovers proceed as create/drop; an exact-named\n\t* missing policy never content-pairs.\n\t*\n\t* The pairing runs only when the policy allows `widening` (rename's\n\t* class). Without it (db-init's additive-only set), pairing degrades\n\t* deliberately to the additive half: the new name is CREATEd and the old\n\t* policy survives live until a plan that allows `widening` runs —\n\t* emitting an ungated widening rename would only fail at the runner's\n\t* class re-enforcement.\n\t*/\n\tplanPostgresSchemaDiff(options, filteredDiffIssues) {\n\t\tconst allowsWidening = options.policy.allowedOperationClasses.includes(\"widening\");\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tconst changed = [];\n\t\tfor (const issue of filteredDiffIssues) if (issueOutcome(issue) === \"not-equal\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tchanged.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-found\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tmissing.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-expected\") {\n\t\t\tconst actual = issue.actual;\n\t\t\tPostgresPolicySchemaNode.assert(actual);\n\t\t\textra.push({\n\t\t\t\tnode: actual,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, actual.namespaceId)\n\t\t\t});\n\t\t}\n\t\tconst calls = [];\n\t\tconst conflicts = [];\n\t\tconst suppressions = [];\n\t\tconst renamedExtras = /* @__PURE__ */ new Set();\n\t\tconst renamedMissing = /* @__PURE__ */ new Set();\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.schemaForTable,\n\t\t\tfinding.node.tableName,\n\t\t\thash\n\t\t]);\n\t\tif (allowsWidening) {\n\t\t\tconst extrasByGroup = /* @__PURE__ */ new Map();\n\t\t\tfor (const finding of extra) {\n\t\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\t\tconst group = extrasByGroup.get(key) ?? [];\n\t\t\t\tgroup.push(finding);\n\t\t\t\textrasByGroup.set(key, group);\n\t\t\t}\n\t\t\tfor (const group of extrasByGroup.values()) group.sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tconst sortedMissing = [...missing].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst candidate = extrasByGroup.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t\tconst sortedExtras = [...extra].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tif (renamedMissing.has(missingFinding)) continue;\n\t\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\t\tconst candidate = sortedExtras.find((extraFinding) => !renamedExtras.has(extraFinding) && extraFinding.schemaForTable === missingFinding.schemaForTable && extraFinding.node.tableName === missingFinding.node.tableName && missingFinding.node.contentEquals(extraFinding.node));\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t}\n\t\tfor (const finding of changed) {\n\t\t\tconst replacement = {\n\t\t\t\tdrop: new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name),\n\t\t\t\tcreate: new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node))\n\t\t\t};\n\t\t\tconst graded = gradePolicyReplacement(replacement, options.contract, options.policy.allowedOperationClasses);\n\t\t\tif (graded.disposition === \"suppress\") {\n\t\t\t\tsuppressions.push(graded.record);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (graded.disposition === \"conflict\") {\n\t\t\t\tconflicts.push(graded.conflict);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcalls.push(replacement.drop);\n\t\t\tcalls.push(replacement.create);\n\t\t}\n\t\tfor (const finding of missing) {\n\t\t\tif (renamedMissing.has(finding)) continue;\n\t\t\tcalls.push(new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node)));\n\t\t}\n\t\tif (allowsWidening) for (const finding of extra) {\n\t\t\tif (renamedExtras.has(finding)) continue;\n\t\t\tcalls.push(new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconflicts,\n\t\t\tsuppressions\n\t\t};\n\t}\n\t/**\n\t* Plans the statements against a working copy of `schema`, in order, so each rename's companions\n\t* are computed against the schema the earlier statements left. The diff then runs on that schema.\n\t*/\n\tplanStatements(options, schema) {\n\t\tconst working = createWorkingSchema(schema);\n\t\tconst ddlSchemaOf = (namespaceId) => resolveDdlSchemaForNamespaceStorage(options.contract.storage, namespaceId);\n\t\tconst planned = planStatements({\n\t\t\tstatements: options.statements.filter(isRenameStatement),\n\t\t\tfromContract: options.fromContract,\n\t\t\tcontract: options.contract,\n\t\t\tpolicy: options.policy,\n\t\t\townership: {\n\t\t\t\toracle: options.ownership,\n\t\t\t\tspaceId: options.spaceId\n\t\t\t},\n\t\t\ttarget: {\n\t\t\t\ttables: () => postgresSchemaTables(working.current, options.contract),\n\t\t\t\tnamespaces: {\n\t\t\t\t\tcreateNamespaceCalls: (namespaceId) => {\n\t\t\t\t\t\tconst schemaName = ddlSchemaOf(namespaceId);\n\t\t\t\t\t\treturn working.current.existingSchemas.includes(schemaName) ? [] : [new CreateSchemaCall(schemaName)];\n\t\t\t\t\t},\n\t\t\t\t\tmoveTableCall: (move) => {\n\t\t\t\t\t\tif (options.fromContract === null) throw new InternalError(\"A table move is planned only from an origin contract\");\n\t\t\t\t\t\treturn new SetTableSchemaCall(emissionSchemaForNamespace(options.contract.storage.namespaces[move.from] === void 0 ? options.fromContract : options.contract, move.from), move.table, ddlSchemaOf(move.to));\n\t\t\t\t\t},\n\t\t\t\t\tnamespaceRenameRefusal: postgresNamespaceRenameRefusal,\n\t\t\t\t\trenameNamespaceCall: (rename) => {\n\t\t\t\t\t\tif (options.fromContract === null) throw new InternalError(\"A namespace rename is planned only from an origin contract\");\n\t\t\t\t\t\treturn new RenameSchemaCall(resolveDdlSchemaForNamespaceStorage(options.fromContract.storage, rename.from), ddlSchemaOf(rename.to));\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\trenameTableCall: (rename) => postgresTableRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\trenameColumnCall: (rename) => postgresColumnRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\tapply: (call) => working.apply(call),\n\t\t\t\t...postgresTableRenameByHand(options.contract)\n\t\t\t}\n\t\t});\n\t\tif (!planned.ok) return planned;\n\t\treturn ok({\n\t\t\t...planned.value,\n\t\t\tschema: working.current\n\t\t});\n\t}\n\tensureAdditivePolicy(policy) {\n\t\tif (!policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\treturn null;\n\t}\n};\n/** Whether `path` lies under `ancestor`: a dropped table's policies go with it. */\nfunction isWithin(path, ancestor) {\n\treturn path.length > ancestor.length && ancestor.every((segment, index) => path[index] === segment);\n}\n/**\n* The DDL schemas in which the origin contract declares tables; none without an origin contract.\n* A namespace with no tables, such as the `public` the target always adds, owns nothing.\n*/\nfunction originSchemaNames(fromContract) {\n\tif (fromContract === null) return [];\n\treturn Object.entries(fromContract.storage.namespaces).filter(([namespaceId, namespace]) => namespaceId !== UNBOUND_NAMESPACE_ID && Object.keys(namespace.entries.table ?? {}).length > 0).map(([namespaceId]) => resolveDdlSchemaForNamespaceStorage(fromContract.storage, namespaceId));\n}\n/** The extensions the origin contract declares, in any namespace; none without an origin contract. */\nfunction originExtensionNames(fromContract) {\n\tif (fromContract === null) return [];\n\treturn Object.values(fromContract.storage.namespaces).flatMap((namespace) => Object.keys(namespace.entries[\"extension\"] ?? {}));\n}\n/**\n* The namespaces the destination declares and the origin does not, other than `public` and those a\n* statement renames a namespace to: the new names a rename of a removed namespace may give it.\n*/\nfunction addedNamespaceIds(options) {\n\tconst { fromContract } = options;\n\tif (fromContract === null) return [];\n\tconst renamedTo = new Set(options.statements.flatMap((statement) => statement.kind === \"rename\" && statement.entity === \"namespace\" ? [statement.to] : []));\n\treturn Object.keys(options.contract.storage.namespaces).filter((namespaceId) => namespaceId !== UNBOUND_NAMESPACE_ID && namespaceId !== \"public\" && !renamedTo.has(namespaceId) && !Object.hasOwn(fromContract.storage.namespaces, namespaceId));\n}\n/** Every DDL schema the contract declares, with or without tables. */\nfunction declaredSchemaNames(contract) {\n\treturn new Set(Object.keys(contract.storage.namespaces).filter((namespaceId) => namespaceId !== UNBOUND_NAMESPACE_ID).map((namespaceId) => resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId)));\n}\n/**\n* The live schemas the origin contract declares and the destination does not: each is dropped,\n* its tables first, each table a data-loss question.\n*/\nfunction removedNamespaceSchemas(options, schema) {\n\tconst destination = declaredSchemaNames(options.contract);\n\treturn originSchemaNames(options.fromContract).filter((schemaName) => schemaName !== \"public\" && !destination.has(schemaName) && schema.namespaces[schemaName] !== void 0);\n}\n/**\n* The issue a schema of the origin contract raises for itself when the destination declares no\n* tables there, which would cover the issues of its tables: they are kept instead, so each table is\n* dropped and asked about on its own, and a removed schema is dropped after them.\n*/\nfunction isOriginNamespaceIssue(issue, originSchemas) {\n\tconst node = issueNode(issue);\n\treturn node !== void 0 && node.nodeKind === PostgresSchemaNodeKind.namespace && originSchemas.includes(issue.path[1] ?? \"\");\n}\n/** A removed schema that stays because another contract space declares it. */\nfunction keptSchema(options, schemaName) {\n\tif (options.fromContract === null) return true;\n\tconst namespaceId = resolveNamespaceIdForDdlSchema(options.fromContract, schemaName);\n\treturn otherSpaceDeclaring({\n\t\toracle: options.ownership,\n\t\tspaceId: options.spaceId\n\t}, namespaceId) !== void 0;\n}\nfunction dropRemovedSchemasStrategy(schemaNames) {\n\treturn (issues) => schemaNames.length === 0 ? { kind: \"no_match\" } : {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls: schemaNames.map((name) => new DropSchemaCall(name))\n\t};\n}\n/**\n* Why a namespace cannot be renamed: `public` is the default schema Prisma owns and Postgres puts\n* on every search path, and a schema another contract space declares would be renamed for it too.\n*/\nfunction postgresNamespaceRenameRefusal(rename) {\n\tconst reason = `\"${DEFAULT_NAMESPACE_ID}\" is the default schema of every Postgres database`;\n\tif (rename.from === \"public\") return {\n\t\treason,\n\t\tfix: `Prisma owns schema \"${rename.from}\", and Postgres puts it on every search path, so a migration does not rename it. Move each model to the new namespace with --rename <Model>:${rename.to}.<Model> instead.`\n\t};\n\tif (rename.to === \"public\") return {\n\t\treason,\n\t\tfix: `Every Postgres database already has schema \"${rename.to}\", so no schema can be renamed to it. Move each model with --rename ${rename.from}.<Model>:<Model> instead.`\n\t};\n}\n/**\n* A diff issue whose node is an RLS policy — the structural half of the one\n* combined tree diff, routed to `planPostgresSchemaDiff` instead of\n* `planIssues`.\n*/\nfunction isPolicyDiffIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && PostgresPolicySchemaNode.is(node);\n}\n/**\n* Postgres refuses these statements while a policy uses the object they touch:\n* - dropping a column (2BP01) or changing its type (0A000);\n* - dropping a table that a policy on another table uses (2BP01); a table's own policies go with it;\n* - dropping a native enum type (2BP01);\n* - a destructive codec type operation (a `RawSqlCall` on a type), such as dropping or rebuilding\n* the type (2BP01) or changing a composite type's attribute type (0A000). Additive and widening\n* type operations, such as adding an enum value or renaming the type, go through.\n*\n* So every policy drop moves to just before the first structural call that a policy can block.\n* Without such a call, the policy calls keep their place after the structural calls.\n*/\nfunction movePolicyDropsBeforeBlockedDdl(structural, policyCalls) {\n\tconst firstBlockable = structural.findIndex(policyCanBlock);\n\tif (firstBlockable === -1) return {\n\t\tstructural,\n\t\tpolicyCalls\n\t};\n\tconst isPolicyDrop = (call) => call instanceof DropPostgresRlsPolicyCall;\n\treturn {\n\t\tstructural: [\n\t\t\t...structural.slice(0, firstBlockable),\n\t\t\t...policyCalls.filter(isPolicyDrop),\n\t\t\t...structural.slice(firstBlockable)\n\t\t],\n\t\tpolicyCalls: policyCalls.filter((call) => !isPolicyDrop(call))\n\t};\n}\nfunction policyCanBlock(call) {\n\tif (call instanceof RawSqlCall) return call.operationClass === \"destructive\" && call.op.target.details?.objectType === \"type\";\n\treturn call instanceof DropColumnCall || call instanceof AlterColumnTypeCall || call instanceof DropTableCall || call instanceof DropNativeEnumTypeCall;\n}\n/**\n* Drops a `not-expected` issue when it is a whole extra storage entity (a table\n* or a native enum) that some space in the composition owns. Each such node\n* yields its own storage coordinate (see {@link postgresNodeStorageCoordinate}),\n* so `declaresEntity` answers over the whole composition on one uniform\n* coordinate: a positive answer means a sibling owns this entity here — leave\n* it; a negative answer means a genuine orphan — drop it. A node with no storage\n* coordinate (a namespace, or a deeper column/constraint drift on an owned\n* table) is this space's own and is always kept. No oracle ⇒ keep everything.\n*/\n/**\n* The namespace a live schema stands for: the destination's, or, for a schema only the origin\n* declares, such as one the destination removed, the origin's.\n*/\nfunction namespaceIdOfSchema(options, ddlSchemaName) {\n\tconst namespaceId = resolveNamespaceIdForDdlSchema(options.contract, ddlSchemaName);\n\tif (namespaceId !== UNBOUND_NAMESPACE_ID || ddlSchemaName === \"public\" || options.fromContract === null) return namespaceId;\n\treturn resolveNamespaceIdForDdlSchema(options.fromContract, ddlSchemaName);\n}\nfunction retainUnownedExtras(issues, ownership, namespaceIdOf) {\n\tif (ownership === void 0) return issues;\n\treturn issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0) return true;\n\t\tconst coordinate = postgresNodeStorageCoordinate(node);\n\t\tif (coordinate === void 0) return true;\n\t\tif (PostgresExtensionSchemaNode.is(node)) {\n\t\t\tif (ownership.declaresEntity({\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\t\t...coordinate\n\t\t\t})) return false;\n\t\t\tif (node.location.kind === \"searchPath\") return true;\n\t\t\treturn !ownership.declaresEntity({\n\t\t\t\tnamespaceId: namespaceIdOf(node.location.schemaName),\n\t\t\t\t...coordinate\n\t\t\t});\n\t\t}\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId: namespaceIdOf(ddlSchemaName),\n\t\t\t...coordinate\n\t\t});\n\t});\n}\n/**\n* Refuses each extension this contract declares in a named namespace that another contract space declares in the unbound namespace: an extension is declared once, and the pack that declares it installs it.\n*/\nfunction extensionsDeclaredByPacks(options) {\n\tconst { ownership } = options;\n\tif (ownership === void 0) return [];\n\treturn Object.values(options.contract.storage.namespaces).flatMap((namespace) => namespace.id === UNBOUND_NAMESPACE_ID ? [] : Object.keys(namespace.entries[\"extension\"] ?? {}).filter((name) => ownership.declaresEntity({\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\tentityKind: \"extension\",\n\t\tentityName: name\n\t})).map((name) => ({\n\t\tkind: \"unsupportedOperation\",\n\t\tsummary: `Extension \"${name}\" is declared in namespace \"${namespace.id}\" by this contract, and an extension pack declares it in namespace \"${UNBOUND_PSL_NAMESPACE_NAME}\".`,\n\t\twhy: \"Remove this declaration from the contract; the pack installs the extension.\"\n\t})));\n}\n/**\n* Returns the one namespace node the relational strategy layer probes for\n* live-table existence and reads codec-hook context off — the namespace\n* matching the planner's resolved schema name, or the first namespace when\n* none matches. `undefined` when the tree has no namespaces, so the strategy\n* context uses its empty-schema default.\n*\n* The relational strategies key tables by bare name, so they can only probe one\n* namespace at a time; probing across every namespace at once is future work.\n*\n* Returns the real `PostgresNamespaceSchemaNode` reference rather than a\n* projection: `storageTypePlanCallStrategy` hands this same value to codec\n* `planTypeOperations` hooks as `schema`, and hooks read the Postgres-specific\n* `nativeEnums` field off it (via `PostgresNamespaceSchemaNode.is`) to decide\n* whether a native enum type already exists — a projection that only copies\n* `tables` would silently drop that signal. `StrategyContext.schema`'s\n* declared type (`SqlSchemaIR`, shared with SQLite's flat shape) doesn't\n* capture this, so the return is `blindCast` the same way `namespaceSchemaNodes`\n* in the family's relational walk already treats a namespace node as a\n* structurally-`SqlSchemaIR`-shaped value.\n*/\nfunction relationalNamespaceNode(schema, schemaName) {\n\tconst namespaceNodes = Object.values(schema.namespaces);\n\tconst namespaceNode = namespaceNodes.find((node) => node.schemaName === schemaName) ?? namespaceNodes[0];\n\tif (namespaceNode === void 0) return void 0;\n\treturn blindCast(namespaceNode);\n}\n/**\n* Grades a {@link PolicyReplacement} as one unit against the table's\n* control policy, BEFORE the pair becomes calls or a conflict. This runs\n* ahead of `partitionCallsByControlPolicy`, which later re-grades the\n* surviving calls per-call — a no-op here, since only managed units\n* survive this grading.\n*\n* A replacement is deliberately STRICTER than the shared\n* `callAllowedUnderControlPolicy` rule: `tolerated` permits whole-object\n* creation, but a replacement's create is the second half of a repair of\n* an existing object, not a new object — so ANY non-managed control\n* (external, observed, tolerated) suppresses the whole unit. Drift on an\n* object the plan does not manage is reported, never repaired; the\n* suppression subject names the drifted policy (`rlsPolicy`) so the\n* report says which policy drifted, matching the conflict path's\n* `location.rlsPolicy`.\n*/\nfunction gradePolicyReplacement(replacement, contract, allowedOperationClasses) {\n\tconst subject = resolvePostgresCallControlPolicySubject(replacement.drop, contract);\n\tconst controlPolicy = governingControlPolicy(subject, contract.defaultControlPolicy);\n\tif (controlPolicy !== \"managed\") return {\n\t\tdisposition: \"suppress\",\n\t\trecord: {\n\t\t\tsubject: subject === void 0 ? void 0 : {\n\t\t\t\t...subject,\n\t\t\t\trlsPolicy: replacement.drop.policyName\n\t\t\t},\n\t\t\tpolicy: controlPolicy,\n\t\t\tfactoryName: void 0,\n\t\t\tcreatesNewObject: false\n\t\t}\n\t};\n\tif (!allowedOperationClasses.includes(\"widening\")) return {\n\t\tdisposition: \"conflict\",\n\t\tconflict: conflictForDisallowedCall(replacement.drop, allowedOperationClasses)\n\t};\n\treturn { disposition: \"plan\" };\n}\n/**\n* Rebuilds the `PostgresRlsPolicy` contract entity `CreatePostgresRlsPolicyCall`\n* carries (its `renderTypeScript`/`createRlsPolicy` paths serialize the whole\n* entity, `namespaceId` included). This reconstructs rather than looking the\n* original up in the contract on purpose: the diff node's `namespaceId` is the\n* *resolved DDL schema* (set when the expected tree was built), which is the\n* value the emitted op must carry; the contract-stored entity holds the raw,\n* pre-resolution coordinate, so a lookup would change the migration output.\n*/\nfunction policyNodeToContractPolicy(node) {\n\treturn new PostgresRlsPolicy({\n\t\tnaming: namingOf(node.name, node.prefix),\n\t\ttableName: node.tableName,\n\t\tnamespaceId: node.namespaceId,\n\t\toperation: node.operation,\n\t\troles: [...node.roles],\n\t\tusing: node.using,\n\t\twithCheck: node.withCheck,\n\t\tpermissive: node.permissive\n\t});\n}\n//#endregion\nexport { postgresMarkedRemoval as n, postgresStoredValueCallClasses as r, createPostgresMigrationPlanner as t };\n\n//# sourceMappingURL=planner-BHH46ndt.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,YAAY,MAAM,WAAW;CACrC,OAAO,UAAU,MAAM,SAAS,KAAK,OAAO,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;AAC5E;;;;AAIA,SAAS,sBAAsB,OAAO;CACrC,MAAM,EAAE,YAAY,MAAM,IAAI,UAAU,MAAM,2BAA2B;CACzE,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB;EACzD,IAAI,cAAc,KAAK,KAAK,uBAAuB,IAAI,OAAO,GAAG,OAAO,CAAC;EACzE,MAAM,UAAU,UAAU,QAAQ;EAClC,OAAO,YAAY,UAAU,CAAC,IAAI,CAAC,IAAI,qBAAqB,YAAY,IAAI,MAAM,SAAS,OAAO,CAAC;CACpG;CACA,MAAM,aAAa,SAAS,eAAe,KAAK,IAAI,CAAC,IAAI,OAAO,cAAc,SAAS,WAAW,QAAQ,sBAAsB,IAAI,GAAG,YAAY,SAAS,YAAY,KAAK,eAAe,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,GAAG,sBAAsB,EAAE,CAAC;CACvP,MAAM,UAAU,SAAS,QAAQ,SAAS,WAAW,OAAO,UAAU,OAAO,QAAQ,kBAAkB,MAAM,OAAO,OAAO,GAAG,YAAY,QAAQ,KAAK,OAAO,GAAG,kBAAkB,IAAI,OAAO,OAAO,CAAC,CAAC;CACvM,MAAM,cAAc,SAAS,YAAY,SAAS,OAAO,OAAO,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AuB,aAAa,UAAU,yBAAyB;CAC/E,MAAM,UAAU,wCAAwC,YAAY,MAAM,QAAQ;CAClF,MAAM,gBAAgB,uBAAuB,SAAS,SAAS,oBAAoB;CACnF,IAAI,kBAAkB,WAAW,OAAO;EACvC,aAAa;EACb,QAAQ;GACP,SAAS,YAAY,KAAK,IAAI,KAAK,IAAI;IACtC,GAAG;IACH,WAAW,YAAY,KAAK;GAC7B;GACA,QAAQ;GACR,aAAa,KAAK;GAClB,kBAAkB;EACnB;CACD;CACA,IAAI,CAAC,wBAAwB,SAAS,UAAU,GAAG,OAAO;EACzD,aAAa;EACb,UAAU,0BAA0B,YAAY,MAAM,uBAAuB;CAC9E;CACA,OAAO,EAAE,aAAa,OAAO;AAC9B;;;;;;;;;;AAUA,SAAS,2BAA2B,MAAM;CACzC,OAAO,IAAI,kBAAkB;EAC5B,QAAQ,SAAS,KAAK,MAAM,KAAK,MAAM;EACvC,WAAW,KAAK;EAChB,aAAa,KAAK;EAClB,WAAW,KAAK;EAChB,OAAO,CAAC,GAAG,KAAK,KAAK;EACrB,OAAO,KAAK;EACZ,WAAW,KAAK;EAChB,YAAY,KAAK;CAClB,CAAC;AACF"}
@@ -1 +0,0 @@
1
- import "./planner-produced-postgres-migration-exqzWlvW-DGLu2dQ7.mjs";
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-FtUIqqVg-ouPTcZ8X.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/postgres/1-target/dist/planner-produced-postgres-migration-FtUIqqVg.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-D5lRerLT.mjs\";\nimport { t as renderOps } from \"./render-ops-B5Mh0MpJ.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Dqp1Spgn.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-FtUIqqVg.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-exqzWlvW-DGLu2dQ7.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/planner-produced-postgres-migration-exqzWlvW.d.mts"],"mappings":";;;;;;;;;cAQc,8CAA8C,6BAA6B;;EAEvF,YAAY,gBAAgB,iBAAiB,MAAM,eAAe,iBAAiB,6BAA6B,UAAU;MACtH,wBAAwB,0BAA0B,6BAA6B,QAAQ,0BAA0B;EACrH,YAAY;;;;;;MAMR;EACJ,iBAAiB,wBAAwB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-target-details-boDXR2s7-CExrk6rf.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/planner-target-details-boDXR2s7.d.mts"],"mappings":";;KACK;;UAEK;WACC;WACA,YAAY;WACZ;WACA;;;UAGD;WACC;WACA;WACA;WACA;;KAEN,4BAA4B,8BAA8B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"postgres-contract-view-DtsmkyFX-Bas8oQiN.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-contract-view-DtsmkyFX.mjs"],"sourcesContent":["import { T as PG_TEXT_CODEC_ID, v as PG_INT_CODEC_ID } from \"./codec-ids-2htdtS66.mjs\";\nimport { u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport { K as postgresTextDataTypes, t as createPostgresBuiltinDataTypeLookup } from \"./data-types-DWfwErIu.mjs\";\nimport { r as createPostgresBuiltinCodecLookup } from \"./codec-registry-B0LsFn7Z.mjs\";\nimport { n as assertFullTextIndexes } from \"./full-text-index-definition-DzRCaPjb.mjs\";\nimport { t as postgresCodecTraitsOf } from \"./postgres-codec-traits-D9YEvK6F.mjs\";\nimport { a as extensionEntityKind, c as rlsEnablementEntityKind, l as roleEntityKind, o as nativeEnumEntityKind, s as policyEntityKind, t as PostgresSchema } from \"./postgres-schema-zd_p5Lg2.mjs\";\nimport { n as postgresAuthoringEntityTypes } from \"./authoring-DPwc7x9U.mjs\";\nimport { requiredSchemaKeys } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_CODEC_LOOKUP = createPostgresBuiltinCodecLookup();\n/** The context entity hydration runs in. Hydration reads stored contract JSON and never a written value, so its data types carry no authoring entries, which keeps the PSL readers out of the runtime. */\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tcodecLookup: POSTGRES_CODEC_LOOKUP,\n\tdataTypes: {\n\t\tentries: {},\n\t\tlookup: createPostgresBuiltinDataTypeLookup(),\n\t\tdataTypeOfCodec: (codecId) => POSTGRES_CODEC_LOOKUP.descriptorFor(codecId)?.dataType,\n\t\ttextDataTypes: postgresTextDataTypes\n\t},\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction requiredKeysOf(schema) {\n\tconst keys = requiredSchemaKeys(schema);\n\tif (keys === void 0) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn keys;\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\textensionEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\tconst schema = new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t\tfor (const table of Object.values(schema.table)) assertFullTextIndexes(table, postgresCodecTraitsOf);\n\t\treturn schema;\n\t}\n\thydrateSqlStorage(validated) {\n\t\tconst hydrated = super.hydrateSqlStorage(validated);\n\t\tassertExtensionsInOneNamespace(hydrated.storage);\n\t\treturn hydrated;\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\nfunction assertExtensionsInOneNamespace(storage) {\n\tconst namespacesByExtension = /* @__PURE__ */ new Map();\n\tfor (const namespace of Object.values(storage.namespaces)) {\n\t\tif (!(namespace instanceof PostgresSchema)) continue;\n\t\tfor (const name of Object.keys(namespace.extension)) namespacesByExtension.set(name, [...namespacesByExtension.get(name) ?? [], namespace.id]);\n\t}\n\tfor (const [name, namespaceIds] of namespacesByExtension) {\n\t\tif (namespaceIds.length < 2) continue;\n\t\tconst namespaces = [...namespaceIds].sort();\n\t\tthrow postgresError(\"CONTRACT.NAME_DUPLICATE\", `Extension \"${name}\" is declared in namespaces ${namespaces.map((id) => `\"${id}\"`).join(\" and \")}. An extension's name is unique in the database, so a contract declares it in one namespace only.`, {\n\t\t\tfix: \"Re-emit the contract from its source, which refuses one extension declared in two namespaces.\",\n\t\t\tmeta: {\n\t\t\t\tkind: \"extension\",\n\t\t\t\tname,\n\t\t\t\tnamespaces\n\t\t\t}\n\t\t});\n\t}\n}\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-DtsmkyFX.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,wBAAwB,iCAAiC;;AAE/D,MAAM,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Q,UAAU,KAAK,GAAG;GAC7B,MAAM,WAAW,CAAC;GAClB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,KAAK,GAAG,SAAS,QAAQ,KAAK,oBAAoB,KAAK;GAC1G,WAAW,WAAW;EACvB;EACA,OAAO,UAAU;GAChB,GAAG;GACH,SAAS;EACV,CAAC;CACF;AACD;AACA,SAAS,+BAA+B,SAAS;CAChD,MAAM,wCAAwC,IAAI,IAAI;CACtD,KAAK,MAAM,aAAa,OAAO,OAAO,QAAQ,UAAU,GAAG;EAC1D,IAAI,EAAE,qBAAqB,iBAAiB;EAC5C,KAAK,MAAM,QAAQ,OAAO,KAAK,UAAU,SAAS,GAAG,sBAAsB,IAAI,MAAM,CAAC,GAAG,sBAAsB,IAAI,IAAI,KAAK,CAAC,GAAG,UAAU,EAAE,CAAC;CAC9I;CACA,KAAK,MAAM,CAAC,MAAM,iBAAiB,uBAAuB;EACzD,IAAI,aAAa,SAAS,GAAG;EAC7B,MAAM,aAAa,CAAC,GAAG,YAAY,CAAC,CAAC,KAAK;EAC1C,MAAM,cAAc,2BAA2B,cAAc,KAAK,8BAA8B,WAAW,KAAK,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,KAAK,OAAO,EAAE,oGAAoG;GACnP,KAAK;GACL,MAAM;IACL,MAAM;IACN;IACA;GACD;EACD,CAAC;CACF;AACD;AAGA,MAAM,uBAAuB;;CAE5B,KAAK,UAAU;EACd,OAAO,4BAA4B,QAAQ;CAC5C;;CAEA,SAAS,MAAM;EACd,OAAO,4BAA4B,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,IAAI,CAAC;CAC9F;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"postgres-migration-D5lRerLT-DyYh8UPS.mjs","names":["#current","#endView","#startView","#renames"],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-migration-D5lRerLT.mjs"],"sourcesContent":["import { r as errorPostgresMigrationStackMissing, u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport { y as PostgresRlsPolicy } from \"./postgres-schema-zd_p5Lg2.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { o as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-OQRI_GIM.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-yFPLQ6U0.mjs\";\nimport { n as emissionSchemaForNamespace, r as resolveDdlSchemaForNamespaceStorage, t as ddlSchemaOfCallSchema } from \"./resolve-ddl-schema-BwKuzGm-.mjs\";\nimport { r as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from \"./diff-database-schema-BJKAfPAG.mjs\";\nimport { c as issueNode, n as resolveNamespaceIdForDdlSchema } from \"./control-policy-DKnVhEWD.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-Cz9Yoeim.mjs\";\nimport { i as hasAutoincrementDefault } from \"./autoincrement-widths-PwZcc5Co.mjs\";\nimport { A as EnableRowLevelSecurityCall, B as RenameStoredKeyCall, C as DropExtensionCall, D as DropPostgresRlsPolicyCall, E as DropNotNullCall, F as RenameColumnCall, G as SetNotNullCall, H as ReplaceStoredValueCall, I as RenameConstraintCall, K as SetTableSchemaCall, L as RenameIndexCall, N as RemoveStoredKeyCall, O as DropSchemaCall, P as RemoveStoredValueCall, R as RenamePostgresRlsPolicyCall, S as DropDefaultCall, T as DropNativeEnumTypeCall, U as SetDefaultCall, V as RenameTableCall, W as SetExtensionSchemaCall, Z as renameTableStatement, _ as DeleteRowsCall, a as AddNativeEnumValueCall, b as DropColumnCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddForeignKeyCall, j as FillStoredKeyCall, k as DropTableCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddPrimaryKeyCall, p as CreatePostgresRlsPolicyCall, q as alterColumnTypeCallText, r as AddColumnWithTemporaryDefaultCall, rt as installExtension, s as AddRequiredColumnToEmptyTableCall, t as AddCheckConstraintCall, u as CreateExtensionCall, v as DisableRowLevelSecurityCall, w as DropIndexCall, x as DropConstraintCall, y as DropCheckConstraintCall, z as RenameSchemaCall } from \"./op-factory-call-THEIwT0J.mjs\";\nimport { a as stackDataTypes, o as writtenColumnType } from \"./planner-sql-checks-BOdYkh9L.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-DtsmkyFX.mjs\";\nimport { t as dataTransform } from \"./data-transform-h9agBu_c.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { nameOf, namingOf, namingOfLiveName, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { sqlTextOf } from \"@internal/sql-relational-core/contract-free\";\nimport { resolveColumnRenameAgainst, resolveTableRenameAgainst, scalarTypeNamesOf, sqlTypeLookupsOf, unmatchedColumnRename, unmatchedTableRename } from \"@internal/family-sql/control\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR, sqlColumnTypesEqual } from \"@internal/sql-schema-ir/types\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\nimport { errorMigrationOperationOptionRemoved } from \"@internal/errors/migration\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-contract-to-schema.ts\n/**\n* The Postgres schema tree a contract describes, as the planner's \"from\" side:\n* the target descriptor's `migrations.contractToSchema` hook and the trees\n* `renameTable` compares to find its companion renames both go through here,\n* so they are built with the same type lookups and default resolver.\n*/\nfunction postgresContractToSchema(contract, frameworkComponents) {\n\tconst types = sqlTypeLookupsOf(frameworkComponents);\n\treturn contractToPostgresDatabaseSchemaNode(blindCast(contract), {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n}\n//#endregion\n//#region src/core/migrations/index-and-check-renames.ts\n/**\n* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n* deterministic by sorted names — the same structure as the policy pass\n* below (which stays untouched: policies pair by hash only).\n*\n* Hash pairing (prefix-only renames): extras whose live names parse as\n* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n* in sorted-name order consume the sorted-name-first candidate.\n*\n* Content pairing (exact→wire convergence), after hash pairing has\n* consumed its matches: the remaining wire-named-missing nodes\n* (`prefix` defined) against the remaining extras of any name shape,\n* paired iff content-equal (columns ordered-strict both-defined-or-\n* both-undefined, `unique`/`type` strict, `options` loose, bodies\n* byte-equal).\n*\n* Leftovers proceed as create/drop exactly as before; without the\n* widening allowance the pass is skipped and pairing degrades to the\n* additive half, like the policy pass.\n*/\nfunction pairIndexRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst rename = (missingFinding, candidate) => {\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t};\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\tconst sortedExtras = [...extra].sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\tconst candidate = sortedExtras.find((extraFinding) => !consumed.has(extraFinding.issue) && extraFinding.ddlSchema === missingFinding.ddlSchema && extraFinding.tableName === missingFinding.tableName && missingFinding.node.contentEquals(extraFinding.node, {\n\t\t\tcolumnPresence: \"matching\",\n\t\t\tbodies: \"verbatim\"\n\t\t}));\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n/**\n* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n* check on the same table whose wire-name content hashes match but whose\n* prefixes differ is a prefix-only rename, and collapses into one\n* `ALTER TABLE … RENAME CONSTRAINT`.\n*\n* This is the index pass's hash-pairing phase and nothing else. There is\n* deliberately no content-pairing phase: a live check body is whatever\n* Postgres reprinted, so it never byte-matches the authored text, and\n* pairing an exact-named live check by content would bless whatever\n* predicate is actually live. Adoption of an old exact-named check stays\n* drop + add.\n*\n* Runs only when the policy allows `widening` (rename's class). Without it\n* the pass no-ops and the pair degrades to an add and a drop, and the drop,\n* which is `widening` too, is refused as a conflict.\n*/\nfunction pairCheckRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, \"checkConstraint\", candidate.node.name, missingFinding.node.name));\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n//#endregion\n//#region src/core/migrations/schema-tables.ts\n/**\n* The tables of a Postgres schema, addressed by `contract`'s namespace ids, each mapped to its DDL\n* schema.\n*/\nfunction postgresSchemaTables(schema, contract) {\n\tconst tableIn = (namespaceId, table) => schema.namespaces[resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId)]?.tables[table];\n\tconst hasTable = (namespaceId, table) => tableIn(namespaceId, table) !== void 0;\n\treturn {\n\t\thasTable,\n\t\thasColumn: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column),\n\t\ttablesNamed: (namespaceId, table) => hasTable(namespaceId, table) ? [table] : [],\n\t\tcolumnsNamed: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column) ? [column] : [],\n\t\thasNamespace: (namespaceId) => {\n\t\t\tconst schemaName = resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId);\n\t\t\treturn schema.existingSchemas.includes(schemaName);\n\t\t},\n\t\tnamespacesWithTable: (table) => Object.keys(contract.storage.namespaces).filter((namespaceId) => hasTable(namespaceId, table))\n\t};\n}\n//#endregion\n//#region src/core/migrations/table-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a table rename. Each primary key, unique constraint and\n* foreign key of the renamed table is paired with the destination constraint of the same kind on\n* the same columns, and for a foreign key the same referenced columns. Foreign keys pair first\n* with destination keys to the same referenced table, and the rest then pair with keys to another\n* table, because a later rename in the same plan may change that table and a foreign key's derived\n* name never depends on it. A paired constraint is renamed to the destination's explicit name, or else\n* to the name the planner derives from the new table name, when that differs from its name in the\n* database. Each destination constraint pairs with at most one constraint, in order. An unpaired\n* constraint is being dropped or changed and keeps its name. Indexes and checks are not handled\n* here: their wire names pair by content hash in the index and check rename passes.\n*/\nfunction constraintRenamesForTableRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: true,\n\t\tonColumns: () => true\n\t});\n}\n/**\n* The renames of the constraints in `scope` that pair with a destination constraint of the same\n* kind on the same columns, to the destination's explicit name or else the derived one.\n*/\nfunction pairedConstraintRenames(input, scope) {\n\tconst { schemaName, previous, next } = input;\n\tconst table = next.name;\n\tconst rename = (kind, actualName, target) => {\n\t\tassertDefined(actualName, `the table \"${previous.name}\" has a ${kind} that has no name; the working schema names every primary key, unique and foreign key a rename can change`);\n\t\treturn target === void 0 || target === actualName ? [] : [new RenameConstraintCall(schemaName, table, kind, actualName, target)];\n\t};\n\tconst nextPrimaryKey = next.primaryKey;\n\tconst primaryKey = previous.primaryKey === void 0 || !scope.primaryKey ? [] : rename(\"primaryKey\", previous.primaryKey.name, nextPrimaryKey !== void 0 && isArrayEqual(previous.primaryKey.columns, nextPrimaryKey.columns) ? nextPrimaryKey.name ?? defaultPrimaryKeyName(table) : void 0);\n\tconst pairedUniques = /* @__PURE__ */ new Set();\n\tconst uniques = previous.uniques.filter((unique) => scope.onColumns(unique.columns)).flatMap((unique) => {\n\t\tconst paired = next.uniques.find((candidate) => !pairedUniques.has(candidate) && isArrayEqual(candidate.columns, unique.columns));\n\t\tif (paired !== void 0) pairedUniques.add(paired);\n\t\treturn rename(\"unique\", unique.name, paired === void 0 ? void 0 : paired.name ?? defaultUniqueName(table, paired.columns));\n\t});\n\tconst previousForeignKeys = previous.foreignKeys.filter((fk) => scope.onColumns(fk.columns));\n\tconst pairing = pairForeignKeys(previousForeignKeys, next.foreignKeys);\n\tconst foreignKeys = previousForeignKeys.flatMap((fk) => {\n\t\tconst paired = pairing.get(fk);\n\t\treturn rename(\"foreignKey\", fk.name, paired === void 0 ? void 0 : paired.name ?? defaultForeignKeyName(table, fk.columns));\n\t});\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* Pairs old foreign keys with destination keys on the same columns and referenced columns. Every\n* key to the same referenced table pairs first, so an old key with no such match cannot take the\n* destination key another old key keeps; the remaining keys then pair in order.\n*/\nfunction pairForeignKeys(previous, next) {\n\tconst pairs = /* @__PURE__ */ new Map();\n\tconst taken = /* @__PURE__ */ new Set();\n\tconst pass = (accepts) => {\n\t\tfor (const fk of previous) {\n\t\t\tif (pairs.has(fk)) continue;\n\t\t\tconst paired = next.find((candidate) => !taken.has(candidate) && isArrayEqual(candidate.columns, fk.columns) && isArrayEqual(candidate.referencedColumns, fk.referencedColumns) && accepts(fk, candidate));\n\t\t\tif (paired === void 0) continue;\n\t\t\tpairs.set(fk, paired);\n\t\t\ttaken.add(paired);\n\t\t}\n\t};\n\tpass((fk, candidate) => candidate.referencedTable === fk.referencedTable && candidate.resolvedReferencedNamespace === fk.resolvedReferencedNamespace);\n\tpass(() => true);\n\treturn pairs;\n}\n//#endregion\n//#region src/core/migrations/column-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a column rename. Each unique constraint and foreign key on\n* the renamed column is paired with the destination constraint of the same kind on the same\n* columns, and renamed to the destination's explicit name, or else to the name the planner derives\n* from the table and the new column names, when that differs from its name in the database. The\n* primary key's derived name does not depend on its columns, so it is left alone. `previous` is\n* the table after the column rename, its constraint names as they are in the database.\n*/\nfunction constraintRenamesForColumnRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: false,\n\t\tonColumns: (columns) => columns.includes(input.column)\n\t});\n}\n//#endregion\n//#region src/core/migrations/working-schema.ts\nfunction rewriteRefs(refs, rewrite) {\n\treturn refs?.map(rewrite);\n}\n/**\n* Rewrites the step of `kind` and `id` in a ref that runs through the given table, and the table\n* step itself when `kind` is the table kind.\n*/\nfunction stepRewrite(schemaName, tableName, kind, fromId, toId) {\n\treturn (ref) => {\n\t\tconst namespaceStep = ref[1];\n\t\tconst tableStep = ref[2];\n\t\tif (namespaceStep?.nodeKind !== PostgresSchemaNodeKind.namespace || namespaceStep.id !== schemaName || tableStep?.nodeKind !== PostgresSchemaNodeKind.table || tableStep.id !== tableName) return ref;\n\t\treturn ref.map((step, index) => index >= 2 && step.nodeKind === kind && step.id === fromId ? {\n\t\t\tnodeKind: kind,\n\t\t\tid: toId\n\t\t} : step);\n\t};\n}\nfunction withPrimaryKey(primaryKey, name, rewrite, columnName) {\n\treturn new PrimaryKey({\n\t\tcolumns: primaryKey.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(primaryKey.dependsOn, rewrite))\n\t});\n}\nfunction withUnique(unique, name, rewrite, columnName) {\n\treturn new SqlUniqueIR({\n\t\tcolumns: unique.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"annotations\", unique.annotations),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(unique.dependsOn, rewrite))\n\t});\n}\nfunction withForeignKey(fk, overrides, rewrite, columnName) {\n\treturn new SqlForeignKeyIR({\n\t\tcolumns: fk.columns.map(columnName),\n\t\treferencedTable: overrides.referencedTable,\n\t\treferencedColumns: overrides.referencedColumns ?? fk.referencedColumns,\n\t\t...ifDefined(\"referencedSchema\", overrides.referencedSchema ?? fk.referencedSchema),\n\t\t...ifDefined(\"name\", overrides.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t...ifDefined(\"resolvedReferencedNamespace\", overrides.referencedSchema ?? fk.resolvedReferencedNamespace),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(fk.dependsOn, rewrite))\n\t});\n}\n/**\n* An index whose definition carries SQL text, an expression or a predicate, keeps its columns as\n* they are: a column named inside the text cannot be renamed here, so the diff plans the index.\n*/\nfunction withIndex(index, naming, rewrite, columnName) {\n\tconst columnsFollow = index.expression === void 0 && index.where === void 0;\n\tconst base = {\n\t\tnaming,\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.partial,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: index.annotations,\n\t\tdependsOn: rewriteRefs(index.dependsOn, rewrite)\n\t};\n\treturn new SqlIndexIR(index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: (index.columns ?? []).map(columnsFollow ? columnName : (c) => c)\n\t});\n}\nfunction withCheck(check, naming, rewrite) {\n\treturn new SqlCheckConstraintIR({\n\t\tnaming,\n\t\texpression: check.expression,\n\t\tdependsOn: rewriteRefs(check.dependsOn, rewrite)\n\t});\n}\nfunction withPolicy(policy, overrides, rewrite) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: overrides.naming,\n\t\ttableName: overrides.tableName,\n\t\tnamespaceId: overrides.namespaceId ?? policy.namespaceId,\n\t\toperation: policy.operation,\n\t\troles: policy.roles,\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: rewriteRefs(policy.dependsOn, rewrite)\n\t});\n}\nfunction unchangedEdit(table) {\n\treturn {\n\t\tname: table.name,\n\t\tprimaryKeyName: (primaryKey) => primaryKey.name,\n\t\tuniqueName: (unique) => unique.name,\n\t\tforeignKey: (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable\n\t\t}),\n\t\tcolumnName: (column) => column,\n\t\tindexNaming: (index) => namingOf(index.name, index.prefix),\n\t\tcheckNaming: (check) => namingOf(check.name, check.prefix),\n\t\tpolicy: (policy) => ({\n\t\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\t\ttableName: policy.tableName\n\t\t})\n\t};\n}\nfunction rebuildTable(table, edit, rewrite) {\n\tconst { columnName } = edit;\n\treturn new PostgresTableSchemaNode({\n\t\tname: edit.name,\n\t\tcolumns: Object.fromEntries(Object.values(table.columns).map((column) => {\n\t\t\tconst name = columnName(column.name);\n\t\t\treturn [name, name === column.name ? column : column.withName(name)];\n\t\t})),\n\t\t...ifDefined(\"primaryKey\", table.primaryKey === void 0 ? void 0 : withPrimaryKey(table.primaryKey, edit.primaryKeyName(table.primaryKey), rewrite, columnName)),\n\t\tuniques: table.uniques.map((unique) => withUnique(unique, edit.uniqueName(unique), rewrite, columnName)),\n\t\tforeignKeys: table.foreignKeys.map((fk) => withForeignKey(fk, edit.foreignKey(fk), rewrite, columnName)),\n\t\tindexes: table.indexes.map((index) => withIndex(index, edit.indexNaming(index), rewrite, columnName)),\n\t\t...ifDefined(\"checks\", table.checks?.map((check) => withCheck(check, edit.checkNaming(check), rewrite))),\n\t\t...ifDefined(\"annotations\", table.annotations),\n\t\tpolicies: table.policies.map((policy) => withPolicy(policy, edit.policy(policy), rewrite)),\n\t\trlsEnabled: table.rlsEnabled\n\t});\n}\n/**\n* Rebuilds every table of the schema: `editFor` returns the edit for a table, or `undefined` to\n* only rewrite its dependencies.\n*/\nfunction mapTables(schema, rewrite, editFor) {\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: Object.fromEntries(Object.entries(schema.namespaces).map(([key, namespace]) => [key, new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: namespace.schemaName,\n\t\t\tnativeEnums: namespace.nativeEnums,\n\t\t\ttables: Object.fromEntries(Object.values(namespace.tables).map((table) => {\n\t\t\t\tconst rebuilt = rebuildTable(table, editFor(namespace.schemaName, table) ?? unchangedEdit(table), rewrite);\n\t\t\t\treturn [rebuilt.name, rebuilt];\n\t\t\t}))\n\t\t})])),\n\t\troles: schema.roles,\n\t\textensions: schema.extensions,\n\t\texistingSchemas: schema.existingSchemas,\n\t\tpgVersion: schema.pgVersion\n\t});\n}\n/**\n* The schema with one table under its new name. Foreign keys anywhere that reference the table\n* follow it, its policies and every dependency that names it move with it, and row-level security\n* is carried. Constraint, index, check and policy names do not change: a primary key, unique\n* constraint or foreign key whose name was derived from the old table name gets that name spelled\n* out, since it no longer derives from the table it is on.\n*/\nfunction renameTableInPostgresSchema(schema, rename) {\n\tconst { schemaName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, from, PostgresSchemaNodeKind.table, from, to);\n\tconst referencesRenamed = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === from;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: referencesRenamed(tableSchema, fk) ? to : fk.referencedTable\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== from) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tname: to,\n\t\t\tprimaryKeyName: (primaryKey) => primaryKey.name ?? defaultPrimaryKeyName(from),\n\t\t\tuniqueName: (unique) => unique.name ?? defaultUniqueName(from, unique.columns),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? defaultForeignKeyName(from, fk.columns)\n\t\t\t}),\n\t\t\tpolicy: (policy) => ({\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\ttableName: to\n\t\t\t})\n\t\t};\n\t});\n}\n/**\n* The schema with one table moved to another schema, as `ALTER TABLE … SET SCHEMA` moves it: its\n* constraints, indexes and policies move with it, foreign keys anywhere that reference it follow\n* it, and every dependency that names it moves with it. The destination schema is added when the\n* schema has no node for it.\n*/\nfunction moveTableInPostgresSchema(schema, move) {\n\tconst { table: tableName, from, to } = move;\n\tconst rewrite = (ref) => {\n\t\tconst namespaceStep = ref[1];\n\t\tconst tableStep = ref[2];\n\t\tif (namespaceStep?.nodeKind !== PostgresSchemaNodeKind.namespace || namespaceStep.id !== from || tableStep?.nodeKind !== PostgresSchemaNodeKind.table || tableStep.id !== tableName) return ref;\n\t\treturn ref.map((step, index) => index === 1 ? {\n\t\t\tnodeKind: step.nodeKind,\n\t\t\tid: to\n\t\t} : step);\n\t};\n\tconst rewritten = mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst isMoved = tableSchema === from && table.name === tableName;\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => isMoved ? {\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\tnamespaceId: to\n\t\t\t} : unchanged.policy(policy),\n\t\t\tforeignKey: (fk) => {\n\t\t\t\tconst referencedSchema = fk.resolvedReferencedNamespace ?? tableSchema;\n\t\t\t\tif (referencedSchema === from && fk.referencedTable === tableName) return {\n\t\t\t\t\t...unchanged.foreignKey(fk),\n\t\t\t\t\treferencedSchema: to\n\t\t\t\t};\n\t\t\t\treturn isMoved && fk.resolvedReferencedNamespace === void 0 ? {\n\t\t\t\t\t...unchanged.foreignKey(fk),\n\t\t\t\t\treferencedSchema\n\t\t\t\t} : unchanged.foreignKey(fk);\n\t\t\t}\n\t\t};\n\t});\n\tconst source = rewritten.namespaces[from];\n\tconst moved = source?.tables[tableName];\n\tif (source === void 0 || moved === void 0) return rewritten;\n\tconst destination = rewritten.namespaces[to];\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {\n\t\t\t...rewritten.namespaces,\n\t\t\t[from]: new PostgresNamespaceSchemaNode({\n\t\t\t\tschemaName: source.schemaName,\n\t\t\t\tnativeEnums: source.nativeEnums,\n\t\t\t\ttables: Object.fromEntries(Object.entries(source.tables).filter(([name]) => name !== tableName))\n\t\t\t}),\n\t\t\t[to]: new PostgresNamespaceSchemaNode({\n\t\t\t\tschemaName: to,\n\t\t\t\tnativeEnums: destination?.nativeEnums ?? [],\n\t\t\t\ttables: {\n\t\t\t\t\t...destination?.tables,\n\t\t\t\t\t[tableName]: moved\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\troles: rewritten.roles,\n\t\textensions: rewritten.extensions,\n\t\texistingSchemas: rewritten.existingSchemas,\n\t\tpgVersion: rewritten.pgVersion\n\t});\n}\n/**\n* The schema with one schema renamed, as `ALTER SCHEMA … RENAME TO` renames it: its tables and\n* their policies keep their place in it, and foreign keys and dependencies that name it follow.\n*/\nfunction renameSchemaInPostgresSchema(schema, rename) {\n\tconst { from, to } = rename;\n\tconst rewrite = (ref) => ref[1]?.nodeKind === PostgresSchemaNodeKind.namespace && ref[1].id === from ? ref.map((step, index) => index === 1 ? {\n\t\tnodeKind: step.nodeKind,\n\t\tid: to\n\t} : step) : ref;\n\tconst rewritten = mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => tableSchema === from ? {\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\tnamespaceId: to\n\t\t\t} : unchanged.policy(policy),\n\t\t\tforeignKey: (fk) => (fk.resolvedReferencedNamespace ?? tableSchema) === from ? {\n\t\t\t\t...unchanged.foreignKey(fk),\n\t\t\t\treferencedSchema: to\n\t\t\t} : unchanged.foreignKey(fk)\n\t\t};\n\t});\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: Object.fromEntries(Object.entries(rewritten.namespaces).filter(([key]) => key !== to).map(([key, namespace]) => key === from ? [to, new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: to,\n\t\t\tnativeEnums: namespace.nativeEnums,\n\t\t\ttables: namespace.tables\n\t\t})] : [key, namespace])),\n\t\troles: rewritten.roles,\n\t\textensions: rewritten.extensions,\n\t\texistingSchemas: rewritten.existingSchemas.map((name) => name === from ? to : name),\n\t\tpgVersion: rewritten.pgVersion\n\t});\n}\nfunction withSchema(schema, schemaName) {\n\tif (schema.existingSchemas.includes(schemaName)) return schema;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: schema.namespaces,\n\t\troles: schema.roles,\n\t\textensions: schema.extensions,\n\t\texistingSchemas: [...schema.existingSchemas, schemaName],\n\t\tpgVersion: schema.pgVersion\n\t});\n}\n/**\n* The schema with one column under its new name. The table's primary key, unique constraints,\n* foreign keys and plain column indexes name it under the new name, foreign keys anywhere that\n* reference it follow it, and every dependency that names it moves with it. An index with an\n* expression or a predicate, and a check, keep their SQL text. Constraint and index names do not\n* change: a unique constraint or foreign key on the column whose name was derived from the old\n* column name gets that name spelled out.\n*/\nfunction renameColumnInPostgresSchema(schema, rename) {\n\tconst { schemaName, table: tableName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.column, `column:${from}`, `column:${to}`);\n\tconst renamed = (column) => column === from ? to : column;\n\tconst referencesTable = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === tableName;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable,\n\t\t\treferencedColumns: referencesTable(tableSchema, fk) ? fk.referencedColumns.map(renamed) : fk.referencedColumns\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tcolumnName: renamed,\n\t\t\tuniqueName: (unique) => unique.name ?? (unique.columns.includes(from) ? defaultUniqueName(tableName, unique.columns) : void 0),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? (fk.columns.includes(from) ? defaultForeignKeyName(tableName, fk.columns) : void 0)\n\t\t\t})\n\t\t};\n\t});\n}\nfunction renamedNaming(previous, name) {\n\treturn previous.prefix === void 0 ? namingOf(name, void 0) : namingOfLiveName(name);\n}\nfunction renameConstraint(schema, call) {\n\tconst schemaName = ddlSchemaOfCallSchema(call.schemaName);\n\tconst { tableName, oldConstraintName, newConstraintName } = call;\n\tconst renamed = (name, derived) => (name ?? derived) === oldConstraintName ? newConstraintName : name;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.check, `check:${oldConstraintName}`, `check:${newConstraintName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\tswitch (call.kind) {\n\t\t\tcase \"primaryKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tprimaryKeyName: (primaryKey) => renamed(primaryKey.name, defaultPrimaryKeyName(tableName))\n\t\t\t};\n\t\t\tcase \"unique\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tuniqueName: (unique) => renamed(unique.name, defaultUniqueName(tableName, unique.columns))\n\t\t\t};\n\t\t\tcase \"foreignKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tforeignKey: (fk) => ({\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\tname: renamed(fk.name, defaultForeignKeyName(tableName, fk.columns))\n\t\t\t\t})\n\t\t\t};\n\t\t\tcase \"checkConstraint\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tcheckNaming: (check) => check.name === oldConstraintName ? renamedNaming(check, newConstraintName) : unchanged.checkNaming(check)\n\t\t\t};\n\t\t}\n\t});\n}\nfunction renameIndex(schema, call) {\n\tconst schemaName = ddlSchemaOfCallSchema(call.schemaName);\n\tconst { tableName, oldIndexName, newIndexName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.index, `index:${oldIndexName}`, `index:${newIndexName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tindexNaming: (index) => index.name === oldIndexName ? renamedNaming(index, newIndexName) : unchanged.indexNaming(index)\n\t\t};\n\t});\n}\nfunction renamePolicy(schema, call) {\n\tconst schemaName = ddlSchemaOfCallSchema(call.schemaName);\n\tconst { tableName, oldPolicyName, newPolicyName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, PostgresSchemaNodeKind.policy, oldPolicyName, newPolicyName), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => policy.name === oldPolicyName ? {\n\t\t\t\tnaming: renamedNaming(policy, newPolicyName),\n\t\t\t\ttableName: policy.tableName\n\t\t\t} : unchanged.policy(policy)\n\t\t};\n\t});\n}\nfunction applied(schema, call) {\n\tif (call instanceof CreateSchemaCall) return withSchema(schema, call.schemaName);\n\tif (call instanceof RenameSchemaCall) return renameSchemaInPostgresSchema(schema, {\n\t\tfrom: call.schemaName,\n\t\tto: call.toSchemaName\n\t});\n\tif (call instanceof SetTableSchemaCall) return moveTableInPostgresSchema(schema, {\n\t\ttable: call.tableName,\n\t\tfrom: ddlSchemaOfCallSchema(call.schemaName),\n\t\tto: call.toSchemaName\n\t});\n\tif (call instanceof RenameTableCall) {\n\t\tconst renamed = renameTableInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOfCallSchema(call.schemaName),\n\t\t\tfrom: call.oldTableName,\n\t\t\tto: call.tableName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameColumnCall) {\n\t\tconst renamed = renameColumnInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOfCallSchema(call.schemaName),\n\t\t\ttable: call.tableName,\n\t\t\tfrom: call.oldColumnName,\n\t\t\tto: call.columnName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameConstraintCall) return renameConstraint(schema, call);\n\tif (call instanceof RenameIndexCall) return renameIndex(schema, call);\n\treturn renamePolicy(schema, call);\n}\n/** The working schema of a plan or a migration, starting from `initial`. */\nfunction createWorkingSchema(initial) {\n\treturn new WorkingSchemaImpl(initial);\n}\nvar WorkingSchemaImpl = class {\n\t#current;\n\tconstructor(initial) {\n\t\tthis.#current = initial;\n\t}\n\tget current() {\n\t\treturn this.#current;\n\t}\n\tapply(call) {\n\t\tthis.#current = applied(this.#current, call);\n\t}\n};\n//#endregion\n//#region src/core/migrations/table-rename-calls.ts\nconst RENAME_POLICY = { allowedOperationClasses: [\"widening\"] };\n/**\n* The `renameTable` call a user writes in `migration.ts` for `rename`. `schema` names the namespace\n* the facade resolves the table in, and is left out for the unbound namespace or when not given.\n*/\nfunction renderRenameTableCall(rename) {\n\treturn new RenameTableCall(rename.namespaceId ?? UNBOUND_NAMESPACE_ID, rename.from, rename.to, []).renderTypeScript();\n}\n/** The SQL a user runs against the database to rename the table by hand. */\nfunction renameTableByHandStatements(contract, rename) {\n\treturn [renameTableStatement(emissionSchemaForNamespace(contract, rename.namespaceId), rename.from, rename.to)];\n}\n/** How a user renames a table of `contract` by hand on Postgres. */\nfunction postgresTableRenameByHand(contract) {\n\treturn {\n\t\trenderTableRename: renderRenameTableCall,\n\t\ttableRenameByHand: (rename) => renameTableByHandStatements(contract, rename)\n\t};\n}\nfunction tableNode(schema, ddlSchema, tableName) {\n\tconst table = schema.namespaces[ddlSchema]?.tables[tableName];\n\tassertDefined(table, `a resolved rename names table \"${tableName}\" in schema \"${ddlSchema}\"`);\n\treturn table;\n}\n/**\n* The call that renames a table, carrying as companions the renames of the objects on the table\n* whose names derive from the table name: each primary key, unique constraint and foreign key the\n* destination keeps, named as the destination names it, and each wire-named index and check whose\n* prefix changes. `previous` is the schema before the rename; the renamed copy is diffed against\n* the destination built from `contract`.\n*/\nfunction postgresTableRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameTableInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst onRenamedTable = (call) => call.schemaName === schemaName && call.tableName === rename.to;\n\tconst pairing = {\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t};\n\treturn new RenameTableCall(schemaName, rename.from, rename.to, [\n\t\t...constraintRenamesForTableRename({\n\t\t\tschemaName,\n\t\t\tprevious: tableNode(renamed, ddlSchema, rename.to),\n\t\t\tnext: tableNode(expected, ddlSchema, rename.to)\n\t\t}),\n\t\t...pairIndexRenames(pairing, issues).calls.filter(onRenamedTable),\n\t\t...pairCheckRenames(pairing, issues).calls.filter(onRenamedTable)\n\t]);\n}\n/**\n* The call that renames a column, carrying as companions the renames of the objects on its table\n* whose names derive from the column name: each unique constraint and foreign key on the column\n* the destination keeps, named as the destination names it, and each index on the column renamed\n* to the destination's wire name. `previous` is the schema before the rename; the renamed copy is\n* diffed against the destination built from `contract`. A check on the column keeps its name: its\n* expression names the column, so the diff replaces it.\n*/\nfunction postgresColumnRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameColumnInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\ttable: rename.table,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst table = tableNode(renamed, ddlSchema, rename.table);\n\tconst destination = expected.namespaces[ddlSchema]?.tables[rename.table];\n\tconst indexesOnColumn = new Set(table.indexes.filter((index) => index.columns?.includes(rename.to)).map((index) => index.name));\n\tconst indexRenames = pairIndexRenames({\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t}, issues).calls.filter((call) => call.schemaName === schemaName && call.tableName === rename.table && indexesOnColumn.has(call.oldIndexName));\n\treturn new RenameColumnCall(schemaName, rename.table, rename.from, rename.to, [...destination === void 0 ? [] : constraintRenamesForColumnRename({\n\t\tschemaName,\n\t\tcolumn: rename.to,\n\t\tprevious: table,\n\t\tnext: destination\n\t}), ...indexRenames]);\n}\n//#endregion\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method that creates, changes or drops a table, column, index, constraint, type or policy requires an explicit `schema`; a migration does not leave those to whatever `search_path` the connection carries. The one exception is an extension declared in the unbound namespace: `createExtension` and `dropExtension` take an optional `schema`, and without it the extension goes into the connection's current schema, unless the extension's control file names a schema, and the search path finds it (ADR 321).\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t/** The rename calls this read of `operations` has made so far, in order. */\n\t#renames = [];\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? blindCast(stack.adapter.create(stack)) : void 0;\n\t}\n\tframeworkComponents() {\n\t\tconst stack = this.stack;\n\t\tif (stack === void 0) return [];\n\t\treturn [\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t];\n\t}\n\t/** The value object field a key fill fills, checked against the end contract with the stack's codecs, data types and type names; a check needs a stack. */\n\tstoredKeyFillField(operation, text) {\n\t\tif (text === void 0) return void 0;\n\t\tthis.controlAdapterFor(operation);\n\t\tconst typeNamespace = this.stack?.authoringContributions.type ?? {};\n\t\treturn {\n\t\t\ttext,\n\t\t\tcheck: {\n\t\t\t\tcontract: this.endContract,\n\t\t\t\ttypes: {\n\t\t\t\t\t...sqlTypeLookupsOf(this.frameworkComponents()),\n\t\t\t\t\tscalarTypeName: scalarTypeNamesOf(typeNamespace)\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t/** The codec `codecRef` names, built from the stack's codecs; a codec needs a stack. */\n\tstoredValueCodec(operation, codecRef) {\n\t\tif (codecRef === void 0) return void 0;\n\t\tthis.controlAdapterFor(operation);\n\t\treturn {\n\t\t\tcodecRef,\n\t\t\tcodecs: sqlTypeLookupsOf(this.frameworkComponents()).codecLookup\n\t\t};\n\t}\n\tdataTypes() {\n\t\treturn stackDataTypes(this.frameworkComponents());\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit an `ALTER TABLE … SET SCHEMA` operation that moves `table` from `schema` to the schema\n\t* `to`. Leave out `schema` for a table of the unbound namespace. Indexes, constraints and owned\n\t* sequences move with the table, and foreign keys from other tables keep pointing at it. Later\n\t* rename calls find the table in its new schema.\n\t*/\n\tsetTableSchema(options) {\n\t\tconst call = new SetTableSchemaCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.to);\n\t\tconst op = call.toOp(this.controlAdapterFor(\"setTableSchema\"));\n\t\tthis.#renames.push(call);\n\t\treturn op;\n\t}\n\t/**\n\t* Emit an `ALTER SCHEMA … RENAME TO` operation. Everything in the schema keeps its place in it,\n\t* and later rename calls find its tables under the new name.\n\t*/\n\trenameSchema(options) {\n\t\tconst call = new RenameSchemaCall(options.schema, options.to);\n\t\tconst op = call.toOp(this.controlAdapterFor(\"renameSchema\"));\n\t\tthis.#renames.push(call);\n\t\treturn op;\n\t}\n\t/**\n\t* Emit a `DROP SCHEMA` operation, without `CASCADE`. Drop or move the schema's tables first: the\n\t* operation fails its precheck while the schema still holds anything.\n\t*/\n\tdropSchema(options) {\n\t\treturn new DropSchemaCall(options.schema).toOp(this.controlAdapterFor(\"dropSchema\"));\n\t}\n\t/**\n\t* Emit an `UPDATE` operation that changes the stored value `from` to `to` in `column`, in every row that holds it. With `many`, the column is a list column and the value changes inside every list that holds it. Values are stored values, as the column's codec writes them, and are passed as parameters. Without `codecRef`, pass each value in the form the column stores it, or no row matches. Leave out `schema` for a table of the unbound namespace.\n\t*/\n\treplaceStoredValue(options) {\n\t\treturn new ReplaceStoredValueCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.column, options.from, options.to, options.many === true, this.storedValueCodec(\"replaceStoredValue\", options.codecRef), options.path).toOp();\n\t}\n\t/**\n\t* Emit an `UPDATE` operation that removes the stored value `value` from `column`: it sets the column to NULL in every row that holds it, or, with `many`, takes the value out of every list that holds it. On a scalar column that takes no NULL, its check fails while any row holds the value. The operation is destructive.\n\t*/\n\tremoveStoredValue(options) {\n\t\treturn new RemoveStoredValueCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.column, options.value, options.many === true, this.storedValueCodec(\"removeStoredValue\", options.codecRef), options.enumValue, options.path, options.nullable).toOp();\n\t}\n\t/**\n\t* Emit an `UPDATE` operation that renames the key at the end of `path` to `to`, in every object of `column` the path reaches. `path` is an RFC 9535 JSONPath of member names (`.lat`, `['lat']`) and wildcards (`[*]`, `.*`, each selecting the elements of a list and the member values of an object) from the column's value, `$`, and ends at the key: `'$[*].lat'` renames `lat` in each object of a list. Only rows that hold the key are written. Its check fails, and nothing changes, while an object holds both keys.\n\t*/\n\trenameStoredKey(options) {\n\t\treturn Promise.resolve(new RenameStoredKeyCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.column, options.path, options.to).toOp());\n\t}\n\t/**\n\t* Emit an `UPDATE` operation that removes the key at the end of `path` from every object of `column` the path reaches. `path` is written as for `renameStoredKey`. Only rows that hold the key are written. The operation is destructive.\n\t*/\n\tremoveStoredKey(options) {\n\t\treturn Promise.resolve(new RemoveStoredKeyCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.column, options.path).toOp());\n\t}\n\t/**\n\t* Emit an `UPDATE` operation that sets the key at the end of `path` to `value`, in every object of `column` the path reaches that lacks the key or holds JSON `null` there. `path` is written as for `renameStoredKey`; `value` is a JSON value, passed as a parameter. Only rows with such an object are written.\n\t*/\n\tfillStoredKey(options) {\n\t\treturn Promise.resolve(new FillStoredKeyCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.column, options.path, options.value, this.storedKeyFillField(\"fillStoredKey\", options.field)).toOp());\n\t}\n\t/**\n\t* Emit a `DELETE` operation that deletes the rows whose `column` holds the stored value `value`. The value is a stored value, as for `replaceStoredValue`, and is passed as a parameter. Foreign keys that reference the rows act as they do for any `DELETE`. The operation is destructive.\n\t*/\n\tdeleteRows(options) {\n\t\treturn new DeleteRowsCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.column, options.value, this.storedValueCodec(\"deleteRows\", options.codecRef)).toOp();\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\tconst adapter = this.controlAdapterFor(\"addColumn\");\n\t\treturn new AddColumnCall(options.schema, options.table, options.column, this.dataTypes()).toOp(adapter);\n\t}\n\t/**\n\t* Adds a required column of `type` to a table that may have rows. Every existing row takes\n\t* `temporaryDefault`, SQL such as `''` or `0`, and the default is dropped once the column is added.\n\t*/\n\taddColumnWithTemporaryDefault(options) {\n\t\tconst adapter = this.controlAdapterFor(\"addColumnWithTemporaryDefault\");\n\t\treturn new AddColumnWithTemporaryDefaultCall(options.schema, options.table, options.column, options.type, sqlTextOf(options.temporaryDefault, `addColumnWithTemporaryDefault ${JSON.stringify(options.table)}.${JSON.stringify(options.column)} temporaryDefault`), this.dataTypes()).toOp(adapter);\n\t}\n\t/** Adds a required column of `type` with no default, checking first that the table is empty. */\n\taddRequiredColumnToEmptyTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"addRequiredColumnToEmptyTable\");\n\t\treturn new AddRequiredColumnToEmptyTableCall(options.schema, options.table, options.column, options.type, this.dataTypes()).toOp(adapter);\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, sqlTextOf(options.expression, `addCheckConstraint ${JSON.stringify(options.constraint)} expression`)).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\trenameCheckConstraint(options) {\n\t\treturn this.renameConstraint({\n\t\t\t...options,\n\t\t\tkind: \"checkConstraint\"\n\t\t});\n\t}\n\trenameConstraint(options) {\n\t\tconst call = new RenameConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.kind, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameConstraint\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\t/**\n\t* Emit the operations that rename a table: the table rename, then a rename of each primary key,\n\t* unique constraint, foreign key, index and check whose name was derived from the old table name.\n\t* The old name is resolved against the schema as this migration's earlier rename calls\n\t* (`renameTable`, `renameIndex`, `renameConstraint`, `renameRlsPolicy`) leave it, and the new\n\t* name against the end contract, so the companions start from names an earlier rename gave.\n\t* Spread the result into `operations`:\n\t* `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`. `schema` names the table's\n\t* namespace when more than one declares the table. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when\n\t* the table does not exist at that point of the migration or the end contract lacks the new name.\n\t*/\n\trenameTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameTable\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\tfrom: options.table,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedTableRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveTableRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresTableRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* Emit the operations that rename a column: the column rename, then a rename of each unique\n\t* constraint, foreign key and index on the column whose name was derived from the old column\n\t* name, to the name the end contract gives it. The column is resolved against the schema as this\n\t* migration's earlier rename calls leave it, so a column of a table an earlier `renameTable`\n\t* renamed is named on the table's new name. Spread the result into `operations`:\n\t* `...this.renameColumn({ table: 'User', column: 'name', to: 'fullName' })`. `schema` names the\n\t* table's namespace when more than one declares the table. Throws\n\t* `MIGRATION.COLUMN_RENAME_UNMATCHED` when the table or column does not exist at that point of\n\t* the migration, the table already has the new column, or the end contract lacks it.\n\t*/\n\trenameColumn(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameColumn\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\ttable: options.table,\n\t\t\tfrom: options.column,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedColumnRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveColumnRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresColumnRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* The start contract's schema with this read's rename calls applied in order. It is built only\n\t* when a rename or a `setDefault` needs it, so a migration that calls neither never reads its\n\t* start contract.\n\t*/\n\tschemaAfterRenames(startContract) {\n\t\tconst working = createWorkingSchema(postgresContractToSchema(startContract, this.frameworkComponents()));\n\t\tfor (const call of this.#renames) working.apply(call);\n\t\treturn working.current;\n\t}\n\tbeginOperationsRead() {\n\t\tthis.#renames = [];\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\trefuseInvalidAlterColumnTypeOptions(options);\n\t\tconst adapter = this.controlAdapterFor(\"alterColumnType\");\n\t\tconst using = optionalSqlTextOf(options.using, `alterColumnType ${JSON.stringify(options.table)}.${JSON.stringify(options.column)} using`);\n\t\tconst call = new AlterColumnTypeCall({\n\t\t\tschemaName: options.schema,\n\t\t\ttableName: options.table,\n\t\t\tcolumnName: options.column,\n\t\t\ttype: options.type,\n\t\t\t...ifDefined(\"raw\", options.raw),\n\t\t\t...ifDefined(\"using\", using === void 0 ? void 0 : {\n\t\t\t\tkind: \"sql\",\n\t\t\t\tsql: using\n\t\t\t}),\n\t\t\tdataTypes: this.dataTypes(),\n\t\t\t...ifDefined(\"operationClass\", options.operationClass),\n\t\t\townsAutoincrementSequence: this.startColumnHasAutoincrementDefault(options.schema, options.table, options.column)\n\t\t});\n\t\tif (using !== void 0) this.refuseUnchangedTypeConversion(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tstartColumnHasAutoincrementDefault(schema, table, column) {\n\t\tconst startColumn = this.startColumnAfterRenames(schema, table, column);\n\t\treturn startColumn !== void 0 && hasAutoincrementDefault(startColumn);\n\t}\n\t/** The column in the start contract's schema after this migration's earlier renames. */\n\tstartColumnAfterRenames(schema, table, column) {\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) return void 0;\n\t\treturn this.schemaAfterRenames(startContract).namespaces[ddlSchemaOfCallSchema(schema)]?.tables[table]?.columns[column];\n\t}\n\t/**\n\t* Refuses an `alterColumnType` with `using` to the type the start contract, after this migration's earlier renames, already gives the column. Its postcheck compares only the type, which already holds, so the runner would skip the conversion. Other earlier operations of the migration, such as an earlier `alterColumnType`, are not applied to the start contract.\n\t*/\n\trefuseUnchangedTypeConversion(call) {\n\t\tconst column = this.startColumnAfterRenames(call.schemaName, call.tableName, call.columnName);\n\t\tif (column === void 0) return;\n\t\tconst written = writtenColumnType(call.type, this.dataTypes());\n\t\tif (written === void 0 || !sqlColumnTypesEqual(column, written)) return;\n\t\tconst where = alterColumnTypeCallText(call.schemaName, call.tableName, call.columnName);\n\t\tthrow postgresError(\"MIGRATION.ALTER_COLUMN_TYPE_USING_WITHOUT_TYPE_CHANGE\", `${where}: the start contract, after the earlier renames in this migration, already gives the column the type ${JSON.stringify(call.type)}, so the conversion in using would never run`, {\n\t\t\twhy: \"The runner skips an operation whose postchecks already hold. alterColumnType checks only that the column has the new type, which holds before it runs, so the values would never be converted.\",\n\t\t\tfix: \"Write the conversion as a dataTransform, which checks the rows themselves, or change the column to another type.\",\n\t\t\tmeta: {\n\t\t\t\twhere,\n\t\t\t\ttype: call.type\n\t\t\t}\n\t\t});\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\t/**\n\t* Emit an `ALTER COLUMN … SET DEFAULT` operation. It is widening when this migration's start contract, after the renames made earlier in the migration, gives the column a default, and additive otherwise.\n\t*/\n\tsetDefault(options) {\n\t\trefuseEarlierSetDefaultOptions(options);\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, this.columnHasDefaultAfterRenames(options.schema, options.table, options.column.name) ? \"widening\" : \"additive\").toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\t/**\n\t* Whether the column, found by schema, table and column name in the start contract after this migration's earlier renames, has a default.\n\t*/\n\tcolumnHasDefaultAfterRenames(schema, table, column) {\n\t\treturn this.startColumnAfterRenames(schema, table, column)?.resolvedDefault !== void 0;\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: sqlTextOf(options.expression, `createIndex ${JSON.stringify(options.index)} expression`) }, options.extras === void 0 ? void 0 : createIndexExtrasOf(options.extras, options.index)).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\tconst call = new RenameIndexCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameIndex\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\t/**\n\t* Emit a `CREATE EXTENSION … WITH SCHEMA …` migration operation, checked to find the extension absent before and present after. Without `schema`, the extension goes into the connection's current schema, unless the extension's control file names a schema.\n\t*/\n\tcreateExtension(options) {\n\t\treturn new CreateExtensionCall(options.schema, options.extension).toOp(this.controlAdapterFor(\"createExtension\"));\n\t}\n\t/** Emit a `DROP EXTENSION` migration operation, without `CASCADE`. */\n\tdropExtension(options) {\n\t\treturn new DropExtensionCall(options.schema, options.extension).toOp(this.controlAdapterFor(\"dropExtension\"));\n\t}\n\t/** Emit an `ALTER EXTENSION … SET SCHEMA …` migration operation. */\n\tsetExtensionSchema(options) {\n\t\treturn new SetExtensionSchemaCall(options.extension, options.schema).toOp(this.controlAdapterFor(\"setExtensionSchema\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\tconst policyName = JSON.stringify(nameOf(options.policy.naming));\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: optionalSqlTextOf(options.policy.using, `createRlsPolicy ${policyName} using`),\n\t\t\twithCheck: optionalSqlTextOf(options.policy.withCheck, `createRlsPolicy ${policyName} withCheck`)\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\tconst call = new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameRlsPolicy\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n};\n/**\n* `setDefault` options an earlier version wrote carry the column's name in `column` and its default as SQL text in `defaultSql`.\n*/\nfunction refuseEarlierSetDefaultOptions(options) {\n\tconst column = options.column;\n\tconst columnIsName = typeof column === \"string\";\n\tif (!columnIsName && !Object.hasOwn(options, \"defaultSql\")) return;\n\tthrow errorMigrationOperationOptionRemoved({\n\t\toperation: \"setDefault\",\n\t\toption: \"defaultSql\",\n\t\tsubject: `column ${JSON.stringify(columnIsName ? column : options.column.name)} of table ${JSON.stringify(options.table)}`,\n\t\trewrite: \"Pass the column as `col(name, type, { default, codecRef })`, with its default written as `lit(value)` or `fn(expression)`, in place of its name and `defaultSql`.\",\n\t\tupgradeEntry: \"migration-ts-column-defaults\"\n\t});\n}\n/**\n* `alterColumnType` options as a hand-written `migration.ts` may pass them, which `node migration.ts` does not type-check: the\n* `options` object an earlier version wrote, or no `type`.\n*/\nfunction refuseInvalidAlterColumnTypeOptions(options) {\n\tif (Object.hasOwn(options, \"options\")) throw errorMigrationOperationOptionRemoved({\n\t\toperation: \"alterColumnType\",\n\t\toption: \"options\",\n\t\tsubject: `column ${JSON.stringify(options.column)} of table ${JSON.stringify(options.table)}`,\n\t\trewrite: \"Pass `{ schema, table, column, type, using? }`: move `options.qualifiedTargetType` to `type` and `options.using` to `using`, and drop the other options.\",\n\t\tupgradeEntry: \"postgres-alter-column-type-plain-options\"\n\t});\n\tconst type = options.type;\n\tif (typeof type === \"string\") return;\n\tconst where = alterColumnTypeCallText(options.schema, options.table, options.column);\n\tthrow postgresError(\"MIGRATION.COLUMN_TYPE_UNREADABLE\", `${where}: it has no \\`type\\``, {\n\t\twhy: \"A column type change needs the new type, and node migration.ts does not check the types of the options it is given.\",\n\t\tfix: \"Pass `{ schema, table, column, type, using? }`, with `type` written as a migration writes it, such as int4 or varchar(20).\",\n\t\tmeta: {\n\t\t\ttype: String(type),\n\t\t\twhere\n\t\t}\n\t});\n}\nfunction optionalSqlTextOf(value, what) {\n\treturn value === void 0 ? void 0 : sqlTextOf(value, what);\n}\nfunction createIndexExtrasOf(extras, index) {\n\tconst { where, ...rest } = extras;\n\tconst what = `createIndex ${JSON.stringify(index)} where`;\n\treturn {\n\t\t...rest,\n\t\t...ifDefined(\"where\", optionalSqlTextOf(where, what))\n\t};\n}\n//#endregion\nexport { renameTableByHandStatements as a, postgresSchemaTables as c, postgresContractToSchema as d, postgresTableRenameCall as i, pairCheckRenames as l, postgresColumnRenameCall as n, renderRenameTableCall as o, postgresTableRenameByHand as r, createWorkingSchema as s, PostgresMigration as t, pairIndexRenames as u };\n\n//# sourceMappingURL=postgres-migration-D5lRerLT.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,yBAAyB,UAAU,qBAAqB;CAChE,MAAM,QAAQ,iBAAiB,mBAAmB;CAClD,OAAO,qCAAqC,UAAU,QAAQ,GAAG;EAChE,qBAAqB;EACrB,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,gBAAgB;CACjB,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,iBAAiB,SAAS,QAAQ;CAC1C,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,CAAC;CACf,IAAI,CAAC,QAAQ,OAAO,wBAAwB,SAAS,UAAU,GAAG,OAAO;EACxE;EACA;CACD;CACA,MAAM,UAAU,CAAC;CACjB,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,SAAS,QAAQ;EAC3B,MAAM,OAAO,UAAU,KAAK;EAC5B,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,QAAQ,OAAO,QAAQ,MAAM;CACnF,MAAM,cAAc,oCAAoC,GAAG,MAAM,uBAAuB;EACvF,KAAK;EACL,KAAK;EACL,MAAM;GACL,MAAM,OAAO,IAAI;GACjB;EACD;CACD,CAAC;AACF;AACA,SAAS,kBAAkB,OAAO,MAAM;CACvC,OAAO,UAAU,KAAK,IAAI,KAAK,IAAI,UAAU,OAAO,IAAI;AACzD;AACA,SAAS,oBAAoB,QAAQ,OAAO;CAC3C,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,MAAM,OAAO,eAAe,KAAK,UAAU,KAAK,EAAE;CAClD,OAAO;EACN,GAAG;EACH,GAAG,UAAU,SAAS,kBAAkB,OAAO,IAAI,CAAC;CACrD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-typescript-BysdXYpH.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/render-typescript.d.mts"],"mappings":";;;;UAGU;WACC;WACA;;WAEA;;;;;;;WAOA,yBAAyB;;iBAEnB,wBAAwB,OAAO,cAAc,gBAAgB,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-typescript-Dqp1Spgn-B4mJhuVr.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/render-typescript-Dqp1Spgn.mjs"],"sourcesContent":["import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from \"@internal/framework-components/control\";\nimport { renderImports } from \"@internal/ts-render\";\nimport { resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\n//#region src/core/migrations/render-typescript.ts\n/**\n* Polymorphic TypeScript emitter for the Postgres migration IR.\n*\n* Each `OpFactoryCall` renders itself via `renderTypeScript()` and\n* declares its own `importRequirements()`; this file just composes the module\n* source around those contributions. The design mirrors the Mongo target's\n* `render-typescript.ts` deliberately — byte-for-byte alignment isn't required\n* (different factory module specifiers, different base-class name) but the\n* shape is, so future consolidation to a framework-level helper is mechanical.\n*/\n/**\n* Always-present base imports for the rendered scaffold. Both come from\n* `@internal/postgres/migration` so an authored Postgres\n* `migration.ts` only needs a single dependency for its base class and\n* its CLI entrypoint:\n*\n* - `Migration` — the facade re-export fixes the `SqlMigration`\n* generic to `PostgresPlanTargetDetails` and the abstract `targetId`\n* to `'postgres'`, so user-authored migrations don't need to thread\n* target-details or redeclare `targetId`.\n* - `MigrationCLI` — the migration-file CLI entrypoint, re-exported from\n* `@internal/cli/migration-cli`. Loads `prisma.config.ts`,\n* assembles a `ControlStack`, and instantiates the migration class.\n* The migration file owns this dependency directly: pulling CLI\n* machinery in at script run time is acceptable because the script's\n* whole purpose is to be invoked from the project that owns the\n* config.\n*/\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: \"@internal/postgres/migration\",\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: \"@internal/postgres/migration\",\n\tsymbol: \"MigrationCLI\"\n}];\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => renderCall(c)).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`export default class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction renderCall(call) {\n\treturn call.renderTypeScript();\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\treturn renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));\n}\n/**\n* The committed contract-JSON imports the scaffold reads its from/to identity\n* from, resolved to the deduplicated snapshot store under\n* `meta.snapshotsImportPath`. The end snapshot is always present; the start\n* snapshot is added only for a non-baseline migration (`meta.from !== null`).\n* The matching `Contract` type imports (aliased `Start`/`End`) feed the\n* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with\n* no start imports — `never` is the honest \"no prior contract\" Start.\n*/\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\nexport { renderCallsToTypeScript as t };\n\n//# sourceMappingURL=render-typescript-Dqp1Spgn.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,eAAe,CAAC;CACrB,iBAAiB;CACjB,QAAQ;AACT,GAAG;CACF,iB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