@prisma/orm-target-postgres 8.0.0-rc.14-dev.6 → 8.0.0-rc.14-dev.7

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 (191) hide show
  1. package/dist/{adapter-CK9Nv-pg-DiFXST2r.mjs → adapter-Bb_FFDea-O-uPaHCy.mjs} +5 -5
  2. package/dist/{adapter-CK9Nv-pg-DiFXST2r.mjs.map → adapter-Bb_FFDea-O-uPaHCy.mjs.map} +1 -1
  3. package/dist/{adapter-DP_SQYED.d.mts → adapter-WLK_P3mT.d.mts} +3 -3
  4. package/dist/{adapter-DP_SQYED.d.mts.map → adapter-WLK_P3mT.d.mts.map} +1 -1
  5. package/dist/adapter.d.mts +8 -8
  6. package/dist/adapter.mjs +6 -6
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +1 -1
  9. package/dist/adapter__control.d.mts +3 -3
  10. package/dist/adapter__control.mjs +8 -369
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.d.mts +1 -1
  13. package/dist/adapter__runtime.mjs +4 -5
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.d.mts +1 -1
  16. package/dist/adapter__sql-renderer.mjs +1 -1
  17. package/dist/adapter__types.d.mts +3 -3
  18. package/dist/{authoring-BmQxOggr-CK871YR4.mjs → authoring-DKN1ccEX-DgmJWx1r.mjs} +4 -4
  19. package/dist/{authoring-BmQxOggr-CK871YR4.mjs.map → authoring-DKN1ccEX-DgmJWx1r.mjs.map} +1 -1
  20. package/dist/{codec-descriptor-BfoHQP3R-CMRVT-F6.mjs → codec-descriptor-B61d-k4C-BdWVU6Fu.mjs} +4 -3
  21. package/dist/codec-descriptor-B61d-k4C-BdWVU6Fu.mjs.map +1 -0
  22. package/dist/codec-descriptor-D8_e5hpo.d.mts +1 -0
  23. package/dist/{codec-descriptor-DUUGoeyI-WGLGXEoI.d.mts → codec-descriptor-HYqjI24K-CTO3gTEs.d.mts} +11 -5
  24. package/dist/codec-descriptor-HYqjI24K-CTO3gTEs.d.mts.map +1 -0
  25. package/dist/{data-types-Cl18KnNY-5I34Vd6Z.mjs → codec-helpers-D83-1eDB-nqAEMr7N.mjs} +39 -216
  26. package/dist/codec-helpers-D83-1eDB-nqAEMr7N.mjs.map +1 -0
  27. package/dist/{codec-type-map-Cp91lhQd-D6zQ14YE.d.mts → codec-type-map-DMKy_xZb-DymgX4w7.d.mts} +4 -4
  28. package/dist/{codec-type-map-Cp91lhQd-D6zQ14YE.d.mts.map → codec-type-map-DMKy_xZb-DymgX4w7.d.mts.map} +1 -1
  29. package/dist/{codec-types-BQNq7Y1u-CGfS7PuD.d.mts → codec-types-B4-xhn7m-RQS461us.d.mts} +4 -4
  30. package/dist/{codec-types-BQNq7Y1u-CGfS7PuD.d.mts.map → codec-types-B4-xhn7m-RQS461us.d.mts.map} +1 -1
  31. package/dist/codec-types-Ci1nfCYh.d.mts +2 -0
  32. package/dist/{codecs-DQGmsnk3-H6nVRPCC.mjs → codecs-BHNqtI1J-BSS9sL3H.mjs} +263 -69
  33. package/dist/codecs-BHNqtI1J-BSS9sL3H.mjs.map +1 -0
  34. package/dist/{codecs-BKV97Xsa.d.mts → codecs-Ba3gUr67.d.mts} +11 -5
  35. package/dist/{codecs-BKV97Xsa.d.mts.map → codecs-Ba3gUr67.d.mts.map} +1 -1
  36. package/dist/{codecs-BZ87E3MY-Bub4t0ma.d.mts → codecs-Bkmbmo_r-Ct7hFY0S.d.mts} +31 -10
  37. package/dist/{codecs-BZ87E3MY-Bub4t0ma.d.mts.map → codecs-Bkmbmo_r-Ct7hFY0S.d.mts.map} +1 -1
  38. package/dist/{codecs-C4DVdgQG.mjs → codecs-Cytq8Ymj.mjs} +12 -4
  39. package/dist/codecs-Cytq8Ymj.mjs.map +1 -0
  40. package/dist/control-CUzQZfhu.d.mts +399 -0
  41. package/dist/control-CUzQZfhu.d.mts.map +1 -0
  42. package/dist/{control-BwOrmTN-.mjs → control-CYQReJto.mjs} +441 -72
  43. package/dist/control-CYQReJto.mjs.map +1 -0
  44. package/dist/{control-DhZYlj-u.d.mts → control-DoIm71dz.d.mts} +5 -4
  45. package/dist/control-DoIm71dz.d.mts.map +1 -0
  46. package/dist/{control-adapter-BaVlICog-BuVBXKoL.mjs → control-adapter-C6kz--Q4-3C9-f7Uv.mjs} +70 -47
  47. package/dist/control-adapter-C6kz--Q4-3C9-f7Uv.mjs.map +1 -0
  48. package/dist/{control-policy-BYo5QPof-BLT07t1y.mjs → control-policy-voGArjr--BeHlQRg0.mjs} +19 -17
  49. package/dist/control-policy-voGArjr--BeHlQRg0.mjs.map +1 -0
  50. package/dist/{data-type-entries-CvkBtAG--D-5Wtm9_.mjs → data-type-entries-BDSHvsdE-Bbe1cdbR.mjs} +3 -3
  51. package/dist/{data-type-entries-CvkBtAG--D-5Wtm9_.mjs.map → data-type-entries-BDSHvsdE-Bbe1cdbR.mjs.map} +1 -1
  52. package/dist/data-types-BqeC7aZP-CwvA08pH.mjs +200 -0
  53. package/dist/data-types-BqeC7aZP-CwvA08pH.mjs.map +1 -0
  54. package/dist/{default-normalizer-DKE2xbCP-EMLD6yNw.mjs → default-normalizer-Cb7nWBUa-DXchlOUk.mjs} +18 -8
  55. package/dist/default-normalizer-Cb7nWBUa-DXchlOUk.mjs.map +1 -0
  56. package/dist/{descriptor-meta-F1wsOtt2-D014LIGM.mjs → descriptor-meta-BEigA5Gj-By_dcUjB.mjs} +9 -7
  57. package/dist/descriptor-meta-BEigA5Gj-By_dcUjB.mjs.map +1 -0
  58. package/dist/{descriptor-meta-BOx9pvBv-C4TEXck8.mjs → descriptor-meta-DF0hODA0-DnO80XvH.mjs} +4 -4
  59. package/dist/{descriptor-meta-BOx9pvBv-C4TEXck8.mjs.map → descriptor-meta-DF0hODA0-DnO80XvH.mjs.map} +1 -1
  60. package/dist/{diff-database-schema-D835UIq8-BVO7jCE4.mjs → diff-database-schema-MYPfxeRf-DdgnOIIl.mjs} +17 -7
  61. package/dist/diff-database-schema-MYPfxeRf-DdgnOIIl.mjs.map +1 -0
  62. package/dist/{full-text-jDpkANi7.d.mts → full-text-Cth_mXe_.d.mts} +2 -2
  63. package/dist/{full-text-jDpkANi7.d.mts.map → full-text-Cth_mXe_.d.mts.map} +1 -1
  64. package/dist/{full-text-index-expression-PZszha7L-CW7i1TUY.mjs → full-text-index-expression-BM_vGygX-BOuja7X4.mjs} +3 -3
  65. package/dist/{full-text-index-expression-PZszha7L-CW7i1TUY.mjs.map → full-text-index-expression-BM_vGygX-BOuja7X4.mjs.map} +1 -1
  66. package/dist/{full-text-parsers-Dp_ANr31-DVxYUNS-.d.mts → full-text-parsers-CLZpb096-BN1xyHeO.d.mts} +3 -3
  67. package/dist/{full-text-parsers-Dp_ANr31-DVxYUNS-.d.mts.map → full-text-parsers-CLZpb096-BN1xyHeO.d.mts.map} +1 -1
  68. package/dist/{infer-psl-contract-pxmVP3E9-Bvk8NzS0.mjs → infer-psl-contract-D7XJnfJv-Cd_Mf0UH.mjs} +78 -82
  69. package/dist/infer-psl-contract-D7XJnfJv-Cd_Mf0UH.mjs.map +1 -0
  70. package/dist/{issue-planner-D9rRu2pB.d.mts → issue-planner-C4iR-Ik-.d.mts} +2 -2
  71. package/dist/{issue-planner-D9rRu2pB.d.mts.map → issue-planner-C4iR-Ik-.d.mts.map} +1 -1
  72. package/dist/{migration-Du89zGmx.d.mts → migration-BTiY0PPC.d.mts} +3 -3
  73. package/dist/{migration-Du89zGmx.d.mts.map → migration-BTiY0PPC.d.mts.map} +1 -1
  74. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  75. package/dist/{native-type-normalizer-DhbUgdrI.d.mts → native-type-normalizer-BFo5tSyh.d.mts} +2 -5
  76. package/dist/native-type-normalizer-BFo5tSyh.d.mts.map +1 -0
  77. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs +102 -0
  78. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs.map +1 -0
  79. package/dist/op-factory-call-Bi1XxJEv.d.mts +1 -0
  80. package/dist/{op-factory-call-t4k8mlRJ-BgtGXlIC.d.mts → op-factory-call-VLJFI-b_-Du23HNYc.d.mts} +5 -5
  81. package/dist/op-factory-call-VLJFI-b_-Du23HNYc.d.mts.map +1 -0
  82. package/dist/{op-factory-call-BBkvFvKK-7MkUHWJq.mjs → op-factory-call-y5YADY2E-CnhkIujC.mjs} +39 -26
  83. package/dist/op-factory-call-y5YADY2E-CnhkIujC.mjs.map +1 -0
  84. package/dist/{operation-types-DZyRBrnm.d.mts → operation-types-Cj4S6KNP.d.mts} +2 -2
  85. package/dist/{operation-types-DZyRBrnm.d.mts.map → operation-types-Cj4S6KNP.d.mts.map} +1 -1
  86. package/dist/{pack-B8SM_MTs.d.mts → pack-DO2bXv9P.d.mts} +3 -3
  87. package/dist/{pack-B8SM_MTs.d.mts.map → pack-DO2bXv9P.d.mts.map} +1 -1
  88. package/dist/{planner-CquxMKq_-CZQAaWfK.mjs → planner-DMVaXRSK-DCAGfALs.mjs} +6 -6
  89. package/dist/{planner-CquxMKq_-CZQAaWfK.mjs.map → planner-DMVaXRSK-DCAGfALs.mjs.map} +1 -1
  90. package/dist/{planner-o0_69Y9q.d.mts → planner-SLaWpf7q.d.mts} +2 -2
  91. package/dist/{planner-o0_69Y9q.d.mts.map → planner-SLaWpf7q.d.mts.map} +1 -1
  92. package/dist/{planner-ddl-builders-BQ_1YXut.d.mts → planner-ddl-builders-DYLyFXrj.d.mts} +2 -5
  93. package/dist/planner-ddl-builders-DYLyFXrj.d.mts.map +1 -0
  94. package/dist/{planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs → planner-ddl-builders-iE35pyxA-g7b_clbn.mjs} +6 -27
  95. package/dist/planner-ddl-builders-iE35pyxA-g7b_clbn.mjs.map +1 -0
  96. package/dist/planner-produced-postgres-migration-Bi_Otmtx.d.mts +1 -0
  97. package/dist/{planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs → planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs} +3 -3
  98. package/dist/{planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs.map → planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs.map} +1 -1
  99. package/dist/{planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts → planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts} +3 -3
  100. package/dist/planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts.map +1 -0
  101. package/dist/{planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs → planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs} +55 -15
  102. package/dist/planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs.map +1 -0
  103. package/dist/{postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs → postgres-contract-view-BBMpf_qi-8V4vTm9U.mjs} +3 -3
  104. package/dist/{postgres-contract-view-DxcRT-qe-LQBHHgaS.mjs.map → postgres-contract-view-BBMpf_qi-8V4vTm9U.mjs.map} +1 -1
  105. package/dist/{postgres-migration-B7ihBnbW-DOmrgtms.d.mts → postgres-migration-B03W06rR-DTB0R3cj.d.mts} +4 -5
  106. package/dist/{postgres-migration-B7ihBnbW-DOmrgtms.d.mts.map → postgres-migration-B03W06rR-DTB0R3cj.d.mts.map} +1 -1
  107. package/dist/{postgres-migration-qwigEUIO-BWxjALsx.mjs → postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs} +22 -5
  108. package/dist/postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs.map +1 -0
  109. package/dist/{prisma7-binding-B-JcNfUc.mjs → prisma7-binding-D_Q6ou4j.mjs} +7 -6
  110. package/dist/prisma7-binding-D_Q6ou4j.mjs.map +1 -0
  111. package/dist/{prisma7-binding-1CMtcbOk.d.mts → prisma7-binding-c5vWJV6k.d.mts} +3 -3
  112. package/dist/{prisma7-binding-1CMtcbOk.d.mts.map → prisma7-binding-c5vWJV6k.d.mts.map} +1 -1
  113. package/dist/{runtime-aN2tMH8u.d.mts → runtime-Bm1hGqOh.d.mts} +2 -2
  114. package/dist/{runtime-aN2tMH8u.d.mts.map → runtime-Bm1hGqOh.d.mts.map} +1 -1
  115. package/dist/{sql-renderer-DmJ5aZwd.d.mts → sql-renderer-CfXWPuXU.d.mts} +4 -4
  116. package/dist/{sql-renderer-DmJ5aZwd.d.mts.map → sql-renderer-CfXWPuXU.d.mts.map} +1 -1
  117. package/dist/{sql-renderer-CgUgFbU4-CRUChEAY.mjs → sql-renderer-CgUgFbU4-DqTf31OD.mjs} +2 -2
  118. package/dist/{sql-renderer-CgUgFbU4-CRUChEAY.mjs.map → sql-renderer-CgUgFbU4-DqTf31OD.mjs.map} +1 -1
  119. package/dist/target.d.mts +23 -23
  120. package/dist/target.mjs +21 -22
  121. package/dist/target__codec-descriptor.d.mts +2 -2
  122. package/dist/target__codec-descriptor.mjs +1 -1
  123. package/dist/target__codec-types.d.mts +3 -3
  124. package/dist/target__codecs.d.mts +3 -3
  125. package/dist/target__codecs.mjs +3 -4
  126. package/dist/target__control.d.mts +2 -2
  127. package/dist/target__control.mjs +3 -3
  128. package/dist/target__data-types.mjs +2 -2
  129. package/dist/target__default-normalizer.mjs +1 -1
  130. package/dist/target__diff-database-schema.mjs +1 -1
  131. package/dist/target__full-text.d.mts +2 -2
  132. package/dist/target__issue-planner.d.mts +1 -1
  133. package/dist/target__issue-planner.mjs +1 -1
  134. package/dist/target__migration.d.mts +2 -2
  135. package/dist/target__migration.mjs +2 -2
  136. package/dist/target__native-type-normalizer.d.mts +1 -1
  137. package/dist/target__native-type-normalizer.mjs +1 -1
  138. package/dist/target__op-factory-call.d.mts +2 -2
  139. package/dist/target__op-factory-call.mjs +1 -1
  140. package/dist/target__operation-types.d.mts +1 -1
  141. package/dist/target__pack.d.mts +1 -1
  142. package/dist/target__pack.mjs +1 -1
  143. package/dist/target__planner-ddl-builders.d.mts +2 -2
  144. package/dist/target__planner-ddl-builders.mjs +2 -2
  145. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  146. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  147. package/dist/target__planner-sql-checks.mjs +1 -1
  148. package/dist/target__planner.d.mts +1 -1
  149. package/dist/target__planner.mjs +2 -2
  150. package/dist/target__prisma7-binding.d.mts +1 -1
  151. package/dist/target__prisma7-binding.mjs +1 -1
  152. package/dist/target__runtime.mjs +2 -2
  153. package/dist/target__runtime.mjs.map +1 -1
  154. package/dist/target__sql-utils.mjs +1 -1
  155. package/dist/{types-BPubHbiE-mnhvO20x.d.mts → types-BPubHbiE-SaR3Cngi.d.mts} +3 -3
  156. package/dist/{types-BPubHbiE-mnhvO20x.d.mts.map → types-BPubHbiE-SaR3Cngi.d.mts.map} +1 -1
  157. package/dist/types-DvEixgWS.d.mts +2 -0
  158. package/package.json +9 -9
  159. package/dist/codec-descriptor-BfoHQP3R-CMRVT-F6.mjs.map +0 -1
  160. package/dist/codec-descriptor-Cf1qfOwo.d.mts +0 -1
  161. package/dist/codec-descriptor-DUUGoeyI-WGLGXEoI.d.mts.map +0 -1
  162. package/dist/codec-types-BXbWuRzS.d.mts +0 -2
  163. package/dist/codecs-C4DVdgQG.mjs.map +0 -1
  164. package/dist/codecs-DQGmsnk3-H6nVRPCC.mjs.map +0 -1
  165. package/dist/control-BwOrmTN-.mjs.map +0 -1
  166. package/dist/control-CDRHOvkm.d.mts +0 -12
  167. package/dist/control-CDRHOvkm.d.mts.map +0 -1
  168. package/dist/control-DhZYlj-u.d.mts.map +0 -1
  169. package/dist/control-adapter-BaVlICog-BuVBXKoL.mjs.map +0 -1
  170. package/dist/control-policy-BYo5QPof-BLT07t1y.mjs.map +0 -1
  171. package/dist/data-types-Cl18KnNY-5I34Vd6Z.mjs.map +0 -1
  172. package/dist/default-normalizer-DKE2xbCP-EMLD6yNw.mjs.map +0 -1
  173. package/dist/descriptor-meta-F1wsOtt2-D014LIGM.mjs.map +0 -1
  174. package/dist/diff-database-schema-D835UIq8-BVO7jCE4.mjs.map +0 -1
  175. package/dist/infer-psl-contract-pxmVP3E9-Bvk8NzS0.mjs.map +0 -1
  176. package/dist/native-type-normalizer-DWc6cr5r.mjs +0 -94
  177. package/dist/native-type-normalizer-DWc6cr5r.mjs.map +0 -1
  178. package/dist/native-type-normalizer-DhbUgdrI.d.mts.map +0 -1
  179. package/dist/op-factory-call-7Dtfo3GK.d.mts +0 -1
  180. package/dist/op-factory-call-BBkvFvKK-7MkUHWJq.mjs.map +0 -1
  181. package/dist/op-factory-call-t4k8mlRJ-BgtGXlIC.d.mts.map +0 -1
  182. package/dist/planner-ddl-builders-BQ_1YXut.d.mts.map +0 -1
  183. package/dist/planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs.map +0 -1
  184. package/dist/planner-produced-postgres-migration-B0pwyA94.d.mts +0 -1
  185. package/dist/planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts.map +0 -1
  186. package/dist/planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs.map +0 -1
  187. package/dist/postgres-migration-qwigEUIO-BWxjALsx.mjs.map +0 -1
  188. package/dist/prisma7-binding-B-JcNfUc.mjs.map +0 -1
  189. package/dist/registry-ld2ZUt1j-CH85fY3r.mjs +0 -15
  190. package/dist/registry-ld2ZUt1j-CH85fY3r.mjs.map +0 -1
  191. package/dist/types-CS-qi6YZ.d.mts +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"pack-B8SM_MTs.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/pack.d.mts"],"mappings":";;;;;;;;;cAQc;WACH;WACA;WACA,yDAAyD,iBAAiB,uBAAuB;aAC/F;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;;WAEF;aACE;eACE;iBACE;iBACA;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;;mBAEF;qBACE;;;;;aAKR;eACE;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;;eAQd;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;eAG5H;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,+BAA+B;;;eAGpD;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;iBAEO;UACP,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;UAC7H,eAAe,QAAQ;YACrB;;;;eAIG;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;UACP,UAAU,sCAAsC,wBAAwB,yBAAyB,wDAAwD,2BAA2B;UACpL,iBAAiB,QAAQ;YACvB;YACA;;;;;aAKC;eACE;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;;;aAGR;eACE;iBACE;iBACA;iBACA,qCAAqC;iBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;UACtG;UACA,QAAQ;;;eAGH;iBACE;iBACA;iBACA,qCAAqC;iBACrC;iBACA,QAAQ;mBACN;mBACA,WAAW;mBACX;mBACA;mBACA;WACR,wDAAwD;UACzD;YACE;YACA;YACA;YACA;YACA;YACA;YACA;;;;;aAKC,wBAAwB;aACxB,0BAA0B;aAC1B,+BAA+B;aAC/B,2BAA2B;;WAE7B;aACE;eACE;iBACE;iBACA;iBACA;;;;WAIN;WACA;WACA;WACA;WACA;WACA;WACA,eAAe;;cAEZ,qCAAqC;WACxC,eAAe"}
1
+ {"version":3,"file":"pack-DO2bXv9P.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/pack.d.mts"],"mappings":";;;;;;;;;cAQc;WACH;WACA;WACA,yDAAyD,iBAAiB,uBAAuB;aAC/F;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;;WAEF;aACE;eACE;iBACE;iBACA;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;;mBAEF;qBACE;;;;;aAKR;eACE;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;;eAQd;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;eAG5H;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,+BAA+B;;;eAGpD;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;iBAEO;UACP,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;UAC7H,eAAe,QAAQ;YACrB;;;;eAIG;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;UACP,UAAU,sCAAsC,wBAAwB,yBAAyB,wDAAwD,2BAA2B;UACpL,iBAAiB,QAAQ;YACvB;YACA;;;;;aAKC;eACE;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;mBACW;mBACA;;QAEX;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;UACE,0CAA0C;YACxC;4CACgC;;;eAG7B;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;;;aAGR;eACE;iBACE;iBACA;iBACA,qCAAqC;iBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;UACtG;UACA,QAAQ;;;eAGH;iBACE;iBACA;iBACA,qCAAqC;iBACrC;iBACA,QAAQ;mBACN;mBACA,WAAW;mBACX;mBACA;mBACA;WACR,wDAAwD;UACzD;YACE;YACA;YACA;YACA;YACA;YACA;YACA;;;;;aAKC,wBAAwB;aACxB,0BAA0B;aAC1B,+BAA+B;aAC/B,2BAA2B;;WAE7B;aACE;eACE;iBACE;iBACA;iBACA;;;;WAIN;WACA;WACA;WACA;WACA;WACA;WACA,eAAe;;cAEZ,qCAAqC;WACxC,eAAe"}
@@ -3,10 +3,10 @@ import { d as isPostgresSchema, i as PostgresRlsPolicy } from "./postgres-schema
3
3
  import { r as PostgresTableSchemaNode } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
4
4
  import { n as PostgresNamespaceSchemaNode, r as PostgresPolicySchemaNode, t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
5
5
  import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-euaYYSHi-DM7kyWEw.mjs";
6
- import { A as RenameIndexCall, C as DropNativeEnumTypeCall, E as DropTableCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from "./op-factory-call-BBkvFvKK-7MkUHWJq.mjs";
7
- import { a as planIssues, c as renderPostgresSuppression, d as resolvePostgresNodeIssueControlPolicySubject, f as resolvePostgresNodeIssueCreationFactoryName, i as issueSchemaName, l as resolveNamespaceIdForDdlSchema, n as conflictForDisallowedCall, o as postgresNodeStorageCoordinate, r as issueNode, s as postgresPlannerStrategies, t as coalesceSubtreeIssues, u as resolvePostgresCallControlPolicySubject } from "./control-policy-BYo5QPof-BLT07t1y.mjs";
8
- import { t as buildPostgresPlanDiff } from "./diff-database-schema-D835UIq8-BVO7jCE4.mjs";
9
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs";
6
+ import { A as RenameIndexCall, C as DropNativeEnumTypeCall, E as DropTableCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from "./op-factory-call-y5YADY2E-CnhkIujC.mjs";
7
+ import { a as planIssues, c as renderPostgresSuppression, d as resolvePostgresNodeIssueControlPolicySubject, f as resolvePostgresNodeIssueCreationFactoryName, i as issueSchemaName, l as resolveNamespaceIdForDdlSchema, n as conflictForDisallowedCall, o as postgresNodeStorageCoordinate, r as issueNode, s as postgresPlannerStrategies, t as coalesceSubtreeIssues, u as resolvePostgresCallControlPolicySubject } from "./control-policy-voGArjr--BeHlQRg0.mjs";
8
+ import { n as buildPostgresPlanDiff } from "./diff-database-schema-MYPfxeRf-DdgnOIIl.mjs";
9
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
11
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
12
12
  import { issueOutcome } from "@prisma/orm-framework/components/control";
@@ -14,7 +14,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
14
14
  import { namingOf, parseWireName } from "@prisma/orm-family-sql/schema-ir/naming";
15
15
  import { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from "@prisma/orm-family-sql/family/control";
16
16
  import { SqlCheckConstraintIR, SqlIndexIR } from "@prisma/orm-family-sql/schema-ir/types";
17
- //#region ../../../3-targets/3-targets/postgres/dist/planner-CquxMKq_.mjs
17
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-DMVaXRSK.mjs
18
18
  /**
19
19
  * Resolves the live-database schema name for a given namespace
20
20
  * coordinate. Mirrors `resolveDdlSchemaForNamespace` in
@@ -711,4 +711,4 @@ function policyNodeToContractPolicy(node) {
711
711
  //#endregion
712
712
  export { createPostgresMigrationPlanner as t };
713
713
 
714
- //# sourceMappingURL=planner-CquxMKq_-CZQAaWfK.mjs.map
714
+ //# sourceMappingURL=planner-DMVaXRSK-DCAGfALs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-CquxMKq_-CZQAaWfK.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-CquxMKq_.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-yugFGBdS.mjs\";\nimport { t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-euaYYSHi.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-D835UIq8.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as postgresNodeStorageCoordinate, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-BYo5QPof.mjs\";\nimport { A as RenameIndexCall, C as DropNativeEnumTypeCall, E as DropTableCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from \"./op-factory-call-BBkvFvKK.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-DEJQPRjI.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { SqlCheckConstraintIR, SqlIndexIR } from \"@internal/sql-schema-ir/types\";\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 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\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst { issues: rawIssues } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: options.schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));\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), options.ownership, options.contract);\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: options.schema\n\t\t}), ...gated];\n\t\tconst indexRenames = this.pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = this.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 storageTypes = options.contract.storage.types ?? {};\n\t\tconst relationalSchema = relationalNamespaceNode(options.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});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\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\tstorageTypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: postgresPlannerStrategies\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 indexRenamePartition = partitionCallsByControlPolicy({\n\t\t\tcalls: [...indexRenames.calls, ...checkRenames.calls],\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst schemaDiffPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: schemaDiff.calls,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst fieldEventPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: blindCast(planFieldEventOperations({\n\t\t\t\tpriorContract: options.fromContract,\n\t\t\t\tnewContract: options.contract,\n\t\t\t\tcodecHooks\n\t\t\t})),\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst ordered = movePolicyDropsBeforeBlockedDdl(result.value.calls, schemaDiffPartition.kept);\n\t\tconst calls = [\n\t\t\t...ordered.structural,\n\t\t\t...indexRenamePartition.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...indexRenamePartition.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.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n\t* deterministic by sorted names — the same structure as the policy pass\n\t* below (which stays untouched: policies pair by hash only).\n\t*\n\t* Hash pairing (prefix-only renames): extras whose live names parse as\n\t* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n\t* in sorted-name order consume the sorted-name-first candidate.\n\t*\n\t* Content pairing (exact→wire convergence), after hash pairing has\n\t* consumed its matches: the remaining wire-named-missing nodes\n\t* (`prefix` defined) against the remaining extras of any name shape,\n\t* paired iff content-equal (columns ordered-strict both-defined-or-\n\t* both-undefined, `unique`/`type` strict, `options` loose, bodies\n\t* byte-equal).\n\t*\n\t* Leftovers proceed as create/drop exactly as before; without the\n\t* widening allowance the pass is skipped and pairing degrades to the\n\t* additive half, like the policy pass.\n\t*/\n\tpairIndexRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst rename = (missingFinding, candidate) => {\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t};\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\tconst sortedExtras = [...extra].sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\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\t\tcolumnPresence: \"matching\",\n\t\t\t\tbodies: \"verbatim\"\n\t\t\t}));\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t}\n\t/**\n\t* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n\t* check on the same table whose wire-name content hashes match but whose\n\t* prefixes differ is a prefix-only rename, and collapses into one\n\t* `ALTER TABLE … RENAME CONSTRAINT`.\n\t*\n\t* This is the index pass's hash-pairing phase and nothing else. There is\n\t* deliberately no content-pairing phase: a live check body is whatever\n\t* Postgres reprinted, so it never byte-matches the authored text, and\n\t* pairing an exact-named live check by content would bless whatever\n\t* predicate is actually live. Adoption of an old exact-named check stays\n\t* drop + add.\n\t*\n\t* Runs only when the policy allows `widening` (rename's class). Without it\n\t* the pass no-ops and the pair degrades to the slice-1 behavior: an add,\n\t* plus a drop when `destructive` is allowed too.\n\t*/\n\tpairCheckRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameCheckConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\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 destructive drop. 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 widening/destructive-allowed plan 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 allowsDestructive = options.policy.allowedOperationClasses.includes(\"destructive\");\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 (allowsDestructive) 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\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/**\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*/\nfunction retainUnownedExtras(issues, ownership, contract) {\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\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t});\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 = controlPolicyForCall(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(\"destructive\")) 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 { createPostgresMigrationPlanner as t };\n\n//# sourceMappingURL=planner-CquxMKq_.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,qBAAqB,SAAS,aAAa;CACnD,MAAM,YAAY,QAAQ,WAAW;CACrC,IAAI,iBAAiB,SAAS,GAAG,OAAO,UAAU,cAAc,OAAO;CACvE,OAAO;AACR;;;;;;;;;;;;;;;;;AAiBA,SAAS,0BAA0B,QAAQ;CAC1C,IAAI,2BAA2B,GAAG,MAAM,GAAG,OAAO,OAAO;CACzD,OAAO,CAAC,oBAAoB;AAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,gCAAgC,OAAO;CAC/C,MAAM,EAAE,UAAU,WAAW;CAC7B,MAAM,WAAW,IAAI,IAAI,0BAA0B,MAAM,CAAC;CAC1D,MAAM,SAAS,CAAC;CAChB,MAAM,eAAe,OAAO,KAAK,SAAS,QAAQ,UAAU,CAAC,CAAC,KAAK;CACnE,KAAK,MAAM,eAAe,cAAc;EACvC,IAAI,gBAAgB,sBAAsB;EAC1C,MAAM,UAAU,qBAAqB,SAAS,SAAS,WAAW;EAClE,IAAI,YAAY,sBAAsB;EACtC,IAAI,SAAS,IAAI,OAAO,GAAG;EAC3B,MAAM,YAAY,IAAI,4BAA4B;GACjD,YAAY;GACZ,QAAQ,CAAC;EACV,CAAC;EACD,OAAO,KAAK;GACX,MAAM,CAAC,YAAY,OAAO;GAC1B,UAAU;EACX,CAAC;CACF;CACA,OAAO;AACR;AAGA,SAAS,+BAA+B,SAAS;CACh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b,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
+ {"version":3,"file":"planner-DMVaXRSK-DCAGfALs.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-DMVaXRSK.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-yugFGBdS.mjs\";\nimport { t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-euaYYSHi.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-MYPfxeRf.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as postgresNodeStorageCoordinate, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-voGArjr-.mjs\";\nimport { A as RenameIndexCall, C as DropNativeEnumTypeCall, E as DropTableCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from \"./op-factory-call-y5YADY2E.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-C8TUIl2Z.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { SqlCheckConstraintIR, SqlIndexIR } from \"@internal/sql-schema-ir/types\";\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 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\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst { issues: rawIssues } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: options.schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));\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), options.ownership, options.contract);\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: options.schema\n\t\t}), ...gated];\n\t\tconst indexRenames = this.pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = this.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 storageTypes = options.contract.storage.types ?? {};\n\t\tconst relationalSchema = relationalNamespaceNode(options.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});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\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\tstorageTypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: postgresPlannerStrategies\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 indexRenamePartition = partitionCallsByControlPolicy({\n\t\t\tcalls: [...indexRenames.calls, ...checkRenames.calls],\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst schemaDiffPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: schemaDiff.calls,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst fieldEventPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: blindCast(planFieldEventOperations({\n\t\t\t\tpriorContract: options.fromContract,\n\t\t\t\tnewContract: options.contract,\n\t\t\t\tcodecHooks\n\t\t\t})),\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst ordered = movePolicyDropsBeforeBlockedDdl(result.value.calls, schemaDiffPartition.kept);\n\t\tconst calls = [\n\t\t\t...ordered.structural,\n\t\t\t...indexRenamePartition.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...indexRenamePartition.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.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n\t* deterministic by sorted names — the same structure as the policy pass\n\t* below (which stays untouched: policies pair by hash only).\n\t*\n\t* Hash pairing (prefix-only renames): extras whose live names parse as\n\t* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n\t* in sorted-name order consume the sorted-name-first candidate.\n\t*\n\t* Content pairing (exact→wire convergence), after hash pairing has\n\t* consumed its matches: the remaining wire-named-missing nodes\n\t* (`prefix` defined) against the remaining extras of any name shape,\n\t* paired iff content-equal (columns ordered-strict both-defined-or-\n\t* both-undefined, `unique`/`type` strict, `options` loose, bodies\n\t* byte-equal).\n\t*\n\t* Leftovers proceed as create/drop exactly as before; without the\n\t* widening allowance the pass is skipped and pairing degrades to the\n\t* additive half, like the policy pass.\n\t*/\n\tpairIndexRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst rename = (missingFinding, candidate) => {\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t};\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\tconst sortedExtras = [...extra].sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\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\t\tcolumnPresence: \"matching\",\n\t\t\t\tbodies: \"verbatim\"\n\t\t\t}));\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t}\n\t/**\n\t* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n\t* check on the same table whose wire-name content hashes match but whose\n\t* prefixes differ is a prefix-only rename, and collapses into one\n\t* `ALTER TABLE … RENAME CONSTRAINT`.\n\t*\n\t* This is the index pass's hash-pairing phase and nothing else. There is\n\t* deliberately no content-pairing phase: a live check body is whatever\n\t* Postgres reprinted, so it never byte-matches the authored text, and\n\t* pairing an exact-named live check by content would bless whatever\n\t* predicate is actually live. Adoption of an old exact-named check stays\n\t* drop + add.\n\t*\n\t* Runs only when the policy allows `widening` (rename's class). Without it\n\t* the pass no-ops and the pair degrades to the slice-1 behavior: an add,\n\t* plus a drop when `destructive` is allowed too.\n\t*/\n\tpairCheckRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameCheckConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\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 destructive drop. 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 widening/destructive-allowed plan 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 allowsDestructive = options.policy.allowedOperationClasses.includes(\"destructive\");\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 (allowsDestructive) 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\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/**\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*/\nfunction retainUnownedExtras(issues, ownership, contract) {\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\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t});\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 = controlPolicyForCall(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(\"destructive\")) 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 { createPostgresMigrationPlanner as t };\n\n//# sourceMappingURL=planner-DMVaXRSK.mjs.map"],"mappings":";;;;;;;;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AAC;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { t as PostgresDatabaseSchemaNode } from "./postgres-database-schema-node-Cv8usVNX-BP4GzjSf.mjs";
2
2
  import { t as PostgresContract } from "./postgres-schema-Xsjt3RKO-Buv2X8ai.mjs";
3
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.mjs";
3
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.mjs";
4
4
  import { MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationScaffoldContext, SchemaOwnership } from "@prisma/orm-framework/components/control";
5
5
  import { ContractToSchemaIROptions, MigrationOperationPolicy, SqlPlannerConflict, SqlPlannerFailureResult } from "@prisma/orm-family-sql/family/control";
6
6
  import { Contract } from "@prisma/orm-framework/contract/types";
@@ -178,4 +178,4 @@ declare class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postg
178
178
  }
179
179
  //#endregion
180
180
  export { createPostgresMigrationPlanner as n, contractToPostgresDatabaseSchemaNode as t };
181
- //# sourceMappingURL=planner-o0_69Y9q.d.mts.map
181
+ //# sourceMappingURL=planner-SLaWpf7q.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-o0_69Y9q.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BiB,qCAAqC,UAAU,yBAAyB,SAAS,4BAA4B;;;iBAG7G,+BAA+B,SAAS,wBAAwB;;;;;;;;KAQ5E;WACM;WACA,MAAM;WACN,oBAAoB;IAC3B;;;;;;;;;;;;;;;;;;;cAmBU,oCAAoC;;EAEhD,YAAY,UAAU;EACtB,KAAK;aACM;aACA;aACA,QAAQ;;;;;;;;;;;;;;;aAeR,cAAc;aACd;aACA,qBAAqB,cAAc;;;;;;aAMnC;;;;;aAKA,YAAY;;;;;;aAMZ;MACP;EACJ,eAAe,SAAS,0BAA0B,kBAAkB;UAC5D;;;;;;;;;;;;;;;;;;;;;UAqBA;;;;;;;;;;;;;;;;;;UAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BA;UACA"}
1
+ {"version":3,"file":"planner-SLaWpf7q.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BiB,qCAAqC,UAAU,yBAAyB,SAAS,4BAA4B;;;iBAG7G,+BAA+B,SAAS,wBAAwB;;;;;;;;KAQ5E;WACM;WACA,MAAM;WACN,oBAAoB;IAC3B;;;;;;;;;;;;;;;;;;;cAmBU,oCAAoC;;EAEhD,YAAY,UAAU;EACtB,KAAK;aACM;aACA;aACA,QAAQ;;;;;;;;;;;;;;;aAeR,cAAc;aACd;aACA,qBAAqB,cAAc;;;;;;aAMnC;;;;;aAKA,YAAY;;;;;;aAMZ;MACP;EACJ,eAAe,SAAS,0BAA0B,kBAAkB;UAC5D;;;;;;;;;;;;;;;;;;;;;UAqBA;;;;;;;;;;;;;;;;;;UAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BA;UACA"}
@@ -1,4 +1,3 @@
1
- import { t as PostgresColumnDefault } from "./types-ue6jkJyF-BQJzjx1P.mjs";
2
1
  import { StorageColumn, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
3
2
  import { CodecControlHooks } from "@prisma/orm-family-sql/family/control";
4
3
  //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders.d.mts
@@ -30,9 +29,7 @@ declare function buildColumnTypeSql(column: Pick<StorageColumn, 'nativeType' | '
30
29
  type DefaultColumn = Pick<StorageColumn, 'many' | 'nativeType'> & {
31
30
  readonly dataTypeId?: string | undefined;
32
31
  };
33
- /** Autoincrement columns use SERIAL types, so this returns empty for them. */
34
- declare function buildColumnDefaultSql(columnDefault: PostgresColumnDefault | undefined, column?: DefaultColumn): string;
35
32
  declare function renderDefaultLiteral(value: unknown, column?: DefaultColumn): string;
36
33
  //#endregion
37
- export { renderDefaultLiteral as a, postgresDateTimeDdlText as i, buildColumnTypeSql as n, isPostgresDateTimeDataType as r, buildColumnDefaultSql as t };
38
- //# sourceMappingURL=planner-ddl-builders-BQ_1YXut.d.mts.map
34
+ export { renderDefaultLiteral as i, isPostgresDateTimeDataType as n, postgresDateTimeDdlText as r, buildColumnTypeSql as t };
35
+ //# sourceMappingURL=planner-ddl-builders-DYLyFXrj.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-ddl-builders-DYLyFXrj.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders.d.mts"],"mappings":";;;;;iBAIiB,2BAA2B;;;;;;;;iBAQ3B,wBAAwB,mBAAmB;;;;;;;;;;iBAU3C,mBAAmB,QAAQ,KAAK,0FAA0F,YAAY,oBAAoB,oBAAoB,eAAe,eAAe,sBAAsB;;;;;KAK9O,gBAAgB,KAAK;WACf;;iBAEM,qBAAqB,gBAAgB,SAAS"}
@@ -1,11 +1,10 @@
1
1
  import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
- import { G as pgTime, Y as pgTimestamptz, Z as pgTimetz, f as pgDate, k as pgInterval, q as pgTimestamp } from "./data-types-Cl18KnNY-5I34Vd6Z.mjs";
3
- import { i as isPgEnumParams } from "./codecs-DQGmsnk3-H6nVRPCC.mjs";
4
- import { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-Bh-mnsSY-D6hnFPrP.mjs";
2
+ import { E as pgTimetz, S as pgTimestamp, a as pgDate, b as pgTime, m as pgInterval, w as pgTimestamptz } from "./data-types-BqeC7aZP-CwvA08pH.mjs";
3
+ import { o as isPgEnumParams } from "./codecs-BHNqtI1J-BSS9sL3H.mjs";
4
+ import { i as quoteQualifiedName, t as escapeLiteral } from "./sql-utils-Bh-mnsSY-D6hnFPrP.mjs";
5
5
  import { t as resolveColumnTypeMetadata } from "./planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
- import { checkSqlDefaultBody } from "@prisma/orm-family-sql/family/control";
8
- //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-GTcVPpwb.mjs
7
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-iE35pyxA.mjs
9
8
  const DATE_TIME_TYPES = /* @__PURE__ */ new Set([
10
9
  pgDate.id,
11
10
  pgTime.id,
@@ -50,14 +49,6 @@ function assertSafeNativeType(nativeType) {
50
49
  if (!SAFE_NATIVE_TYPE_PATTERN.test(nativeType)) throw postgresError("CONTRACT.NATIVE_TYPE_INVALID", `Unsafe native type name in contract: "${nativeType}". Native type names must match /^[a-zA-Z][a-zA-Z0-9_ ]*(\\[\\])?\$/`, { meta: { nativeType } });
51
50
  }
52
51
  /**
53
- * Sanity check against accidental SQL injection from malformed contract files.
54
- * Rejects semicolons, SQL comment tokens, and dollar-quoting.
55
- * Not a comprehensive security boundary — the contract is developer-authored.
56
- */
57
- function assertSafeDefaultExpression(expression) {
58
- if (checkSqlDefaultBody(expression) !== void 0) throw postgresError("CONTRACT.DEFAULT_INVALID", `Unsafe default expression in contract: "${expression}". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression } });
59
- }
60
- /**
61
52
  * Renders the SQL type for a column in DDL context.
62
53
  *
63
54
  * @param allowPseudoTypes - When true (default), autoincrement integer columns
@@ -105,18 +96,6 @@ function expandParameterizedTypeSql(column, codecHooks) {
105
96
  });
106
97
  return expanded !== column.nativeType ? expanded : null;
107
98
  }
108
- /** Autoincrement columns use SERIAL types, so this returns empty for them. */
109
- function buildColumnDefaultSql(columnDefault, column) {
110
- if (!columnDefault) return "";
111
- switch (columnDefault.kind) {
112
- case "literal": return `DEFAULT ${renderDefaultLiteral(columnDefault.value, column)}`;
113
- case "function":
114
- if (columnDefault.expression === "autoincrement()") return "";
115
- assertSafeDefaultExpression(columnDefault.expression);
116
- return `DEFAULT (${columnDefault.expression})`;
117
- case "sequence": return `DEFAULT nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`;
118
- }
119
- }
120
99
  function renderDefaultLiteral(value, column) {
121
100
  if (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value, column.nativeType, column.dataTypeId);
122
101
  if ((column?.nativeType === "json" || column?.nativeType === "jsonb") && typeof value === "object" && value !== null && !(value instanceof Date)) return `'${escapeLiteral(JSON.stringify(value))}'::${column.nativeType}`;
@@ -144,6 +123,6 @@ function renderArrayLiteralDefault(elements, nativeType, dataTypeId) {
144
123
  return `${rendered}::${nativeType.endsWith("[]") ? nativeType : `${nativeType}[]`}`;
145
124
  }
146
125
  //#endregion
147
- export { renderDefaultLiteral as a, postgresDateTimeDdlText as i, buildColumnTypeSql as n, isPostgresDateTimeDataType as r, buildColumnDefaultSql as t };
126
+ export { renderDefaultLiteral as i, isPostgresDateTimeDataType as n, postgresDateTimeDdlText as r, buildColumnTypeSql as t };
148
127
 
149
- //# sourceMappingURL=planner-ddl-builders-GTcVPpwb-ClvrXb26.mjs.map
128
+ //# sourceMappingURL=planner-ddl-builders-iE35pyxA-g7b_clbn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-ddl-builders-iE35pyxA-g7b_clbn.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-iE35pyxA.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { E as pgTimetz, S as pgTimestamp, a as pgDate, b as pgTime, m as pgInterval, w as pgTimestamptz } from \"./data-types-BqeC7aZP.mjs\";\nimport { n as isPgEnumParams } from \"./codecs-BHNqtI1J.mjs\";\nimport { i as quoteQualifiedName, t as escapeLiteral } from \"./sql-utils-Bh-mnsSY.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/date-time-ddl-text.ts\nconst DATE_TIME_TYPES = /* @__PURE__ */ new Set([\n\tpgDate.id,\n\tpgTime.id,\n\tpgTimetz.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id,\n\tpgInterval.id\n]);\nconst TYPES_WITH_A_YEAR = /* @__PURE__ */ new Set([\n\tpgDate.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id\n]);\n/** Whether a data type is one of this target's date and time types, whose defaults DDL writes as text. */\nfunction isPostgresDateTimeDataType(dataTypeId) {\n\treturn dataTypeId !== void 0 && DATE_TIME_TYPES.has(dataTypeId);\n}\n/**\n* The text DDL writes for a default of a date or time type, from its canonical form (ADR 254). A\n* year from 1 to 9999 stays as it is. PostgreSQL has no year 0 and reads no signed year, so a later\n* year loses its sign and leading zeros (`10000-01-01`) and a year at or before 0 is written as the\n* year before Christ (`0044-03-15 BC`). Every Postgres DDL path writes a date or time default\n* through this function.\n*/\nfunction postgresDateTimeDdlText(canonical, dataTypeId) {\n\tif (dataTypeId === void 0 || !TYPES_WITH_A_YEAR.has(dataTypeId)) return canonical;\n\tconst match = /^([+-]\\d{6}|\\d{4})(-.*)$/.exec(canonical);\n\tif (match === null) return canonical;\n\tconst [, yearDigits = \"\", rest = \"\"] = match;\n\tconst year = Number(yearDigits);\n\tif (year >= 1 && year <= 9999) return canonical;\n\tif (year > 9999) return `${year}${rest}`;\n\treturn `${String(1 - year).padStart(4, \"0\")}${rest} BC`;\n}\n//#endregion\n//#region src/core/migrations/planner-ddl-builders.ts\n/**\n* Pattern for safe PostgreSQL type names.\n* Allows letters, digits, underscores, spaces (for \"double precision\", \"character varying\"),\n* and trailing [] for array types.\n*/\nconst SAFE_NATIVE_TYPE_PATTERN = /^[a-zA-Z][a-zA-Z0-9_ ]*(\\[\\])?$/;\nfunction assertSafeNativeType(nativeType) {\n\tif (!SAFE_NATIVE_TYPE_PATTERN.test(nativeType)) throw postgresError(\"CONTRACT.NATIVE_TYPE_INVALID\", `Unsafe native type name in contract: \"${nativeType}\". Native type names must match /^[a-zA-Z][a-zA-Z0-9_ ]*(\\\\[\\\\])?\\$/`, { meta: { nativeType } });\n}\n/**\n* Renders the SQL type for a column in DDL context.\n*\n* @param allowPseudoTypes - When true (default), autoincrement integer columns\n* produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts\n* like ALTER COLUMN TYPE where pseudo-types are invalid.\n*/\nfunction buildColumnTypeSql(column, codecHooks, storageTypes = {}, allowPseudoTypes = true) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (allowPseudoTypes) {\n\t\tconst columnDefault = column.default;\n\t\tif (columnDefault?.kind === \"function\" && columnDefault.expression === \"autoincrement()\") {\n\t\t\tif (resolved.nativeType === \"int4\" || resolved.nativeType === \"integer\") return \"SERIAL\";\n\t\t\tif (resolved.nativeType === \"int8\" || resolved.nativeType === \"bigint\") return \"BIGSERIAL\";\n\t\t\tif (resolved.nativeType === \"int2\" || resolved.nativeType === \"smallint\") return \"SMALLSERIAL\";\n\t\t}\n\t}\n\tif (isPgEnumParams(resolved.typeParams)) {\n\t\tconst quoted = quoteQualifiedName(resolved.nativeType);\n\t\treturn column.many ? `${quoted}[]` : quoted;\n\t}\n\tconst expanded = expandParameterizedTypeSql(resolved, codecHooks);\n\tif (expanded !== null) return column.many ? `${expanded}[]` : expanded;\n\tif (column.typeRef) {\n\t\tconst base = quoteQualifiedName(resolved.nativeType);\n\t\treturn column.many ? `${base}[]` : base;\n\t}\n\tassertSafeNativeType(resolved.nativeType);\n\treturn column.many ? `${resolved.nativeType}[]` : resolved.nativeType;\n}\nfunction expandParameterizedTypeSql(column, codecHooks) {\n\tif (!column.typeParams || Object.keys(column.typeParams).length === 0) return null;\n\tif (!column.codecId) throw postgresError(\"CONTRACT.CODEC_DESCRIPTOR_MISSING\", `Column declares typeParams for nativeType \"${column.nativeType}\" but has no codecId. Ensure the column is associated with a codec.`, { meta: { nativeType: column.nativeType } });\n\tconst hooks = codecHooks.get(column.codecId);\n\tif (!hooks?.expandNativeType) {\n\t\tif (hooks?.planTypeOperations) return null;\n\t\tthrow postgresError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Column declares typeParams for nativeType \"${column.nativeType}\" but no expandNativeType hook is registered for codecId \"${column.codecId}\". Ensure the extension providing this codec is included in extensions.`, { meta: {\n\t\t\tcodecId: column.codecId,\n\t\t\tnativeType: column.nativeType\n\t\t} });\n\t}\n\tconst expanded = hooks.expandNativeType({\n\t\tnativeType: column.nativeType,\n\t\tcodecId: column.codecId,\n\t\t...ifDefined(\"typeParams\", column.typeParams)\n\t});\n\treturn expanded !== column.nativeType ? expanded : null;\n}\nfunction renderDefaultLiteral(value, column) {\n\tif (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value, column.nativeType, column.dataTypeId);\n\tif ((column?.nativeType === \"json\" || column?.nativeType === \"jsonb\") && typeof value === \"object\" && value !== null && !(value instanceof Date)) return `'${escapeLiteral(JSON.stringify(value))}'::${column.nativeType}`;\n\treturn renderScalarLiteral(value, column?.dataTypeId);\n}\n/** A date or time value is written through the one function every DDL path uses for it. */\nfunction renderScalarLiteral(value, dataTypeId) {\n\tif (value instanceof Date) return `'${escapeLiteral(value.toISOString())}'`;\n\tif (typeof value === \"string\") return `'${escapeLiteral(postgresDateTimeDdlText(value, dataTypeId))}'`;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (value === null) return \"NULL\";\n\treturn `'${escapeLiteral(JSON.stringify(value))}'`;\n}\n/**\n* An `ARRAY[...]` of quoted elements has type `text[]`, which Postgres does not assign to a list of\n* numbers, decimals, timestamps or enums, so the constructor is cast to the list type. Each element\n* is the text Postgres reads for its type: an `int8` or `numeric` value as decimal text, a date or\n* time value in its type's canonical form. `nativeType` is the element type or the list type,\n* written as SQL, so a user-defined type name arrives already quoted.\n*/\nfunction renderArrayLiteralDefault(elements, nativeType, dataTypeId) {\n\tif (elements.length === 0) return \"'{}'\";\n\tconst rendered = `ARRAY[${elements.map((el) => renderScalarLiteral(el, dataTypeId)).join(\", \")}]`;\n\tif (nativeType === \"\") return rendered;\n\treturn `${rendered}::${nativeType.endsWith(\"[]\") ? nativeType : `${nativeType}[]`}`;\n}\n//#endregion\nexport { postgresDateTimeDdlText as i, renderDefaultLiteral as n, isPostgresDateTimeDataType as r, buildColumnTypeSql as t };\n\n//# sourceMappingURL=planner-ddl-builders-iE35pyxA.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,kCAAkC,IAAI,IAAI;CAC/C,OAAO;CACP,OAAO;CACP,SAAS;CACT,YAAY;CACZ,cAAc;CACd,WAAW;AACZ,CAAC;AACD,MAAM,oCAAoC,IAAI,IAAI;CACjD,OAAO;CACP,YAAY;CACZ,cAAc;AACf,CAAC;;AAED,SAAS,2BAA2B,YAAY;CAC/C,OAAO,eAAe,KAAK,KAAK,gBAAgB,IAAI,UAAU;AAC/D;;;;;;;;AAQA,SAAS,wBAAwB,WAAW,YAAY;CACvD,IAAI,eAAe,KAAK,KAAK,CAAC,kBAAkB,IAAI,UAAU,GAAG,OAAO;CACxE,MAAM,QAAQ,2BAA2B,KAAK,SAAS;CACvD,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,GAAG,aAAa,IAAI,OAAO,MAAM;CACvC,MAAM,OAAO,OAAO,UAAU;CAC9B,IAAI,QAAQ,KAAK,QAAQ,MAAM,OAAO;CACtC,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAClC,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,KAAK;AACpD;;;;;;AAQA,MAAM,2BAA2B;AACjC,SAAS,qBAAqB,YAAY;CACzC,IAAI,CAAC,yBAAyB,KAAK,UAAU,GAAG,MAAM,cAAc,gCAAgC,yCAAyC,WAAW,uEAAuE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACxP;;;;;;;;AAQA,SAAS,mBAAmB,QAAQ,YAAY,eAAe,CAAC,GAA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,7 +1,7 @@
1
- import { t as PostgresMigration } from "./postgres-migration-qwigEUIO-BWxjALsx.mjs";
1
+ import { t as PostgresMigration } from "./postgres-migration-UzDaU7Or-Dvc0Cdv5.mjs";
2
2
  import { t as renderOps } from "./render-ops-D2vJApKB-B281fzmn.mjs";
3
3
  import { t as renderCallsToTypeScript } from "./render-typescript-Dqp1Spgn-B128r1qw.mjs";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-DEJQPRjI.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-C8TUIl2Z.mjs
5
5
  var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
6
6
  #calls;
7
7
  #meta;
@@ -44,4 +44,4 @@ var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
44
44
  //#endregion
45
45
  export { TypeScriptRenderablePostgresMigration as t };
46
46
 
47
- //# sourceMappingURL=planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs.map
47
+ //# sourceMappingURL=planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-DEJQPRjI-C9GuvVOY.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-DEJQPRjI.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-qwigEUIO.mjs\";\nimport { t as renderOps } from \"./render-ops-D2vJApKB.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-DEJQPRjI.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
+ {"version":3,"file":"planner-produced-postgres-migration-C8TUIl2Z-DHjubKQ-.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-C8TUIl2Z.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-UzDaU7Or.mjs\";\nimport { t as renderOps } from \"./render-ops-D2vJApKB.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-C8TUIl2Z.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,11 +1,11 @@
1
1
  import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-_xPQVPF0.mjs";
2
- import { t as PostgresMigration } from "./postgres-migration-B7ihBnbW-DOmrgtms.mjs";
2
+ import { t as PostgresMigration } from "./postgres-migration-B03W06rR-DTB0R3cj.mjs";
3
3
  import { MigrationPlanWithAuthoringSurface, OpFactoryCall } from "@prisma/orm-framework/components/control";
4
4
  import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
5
5
  import { MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
6
6
  import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
7
7
  import { ExecuteRequestLowerer } from "@prisma/orm-family-sql/family/control-adapter";
8
- //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-Xd83anY_.d.mts
8
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-CoOcn-b9.d.mts
9
9
  //#region src/core/migrations/planner-produced-postgres-migration.d.ts
10
10
  declare class TypeScriptRenderablePostgresMigration extends PostgresMigration implements MigrationPlanWithAuthoringSurface {
11
11
  #private;
@@ -22,4 +22,4 @@ declare class TypeScriptRenderablePostgresMigration extends PostgresMigration im
22
22
  }
23
23
  //#endregion
24
24
  export { TypeScriptRenderablePostgresMigration as t };
25
- //# sourceMappingURL=planner-produced-postgres-migration-Xd83anY_-vp2DJ5fk.d.mts.map
25
+ //# sourceMappingURL=planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-produced-postgres-migration-CoOcn-b9-8kOq82_P.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-CoOcn-b9.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,7 +1,8 @@
1
1
  import { r as quoteIdentifier } from "./sql-utils-Bh-mnsSY-D6hnFPrP.mjs";
2
2
  import { h as postgresCreateNamespace } from "./postgres-schema-yugFGBdS-5cY1PCmb.mjs";
3
+ import { n as normalizeSchemaNativeType, r as withLengthOneWhenBare } from "./native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs";
3
4
  import { t as resolveColumnTypeMetadata } from "./planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-Bd8nN9P8.mjs
5
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-ZMXeCK6W.mjs
5
6
  /**
6
7
  * String-keyed entry points the migration ops use to render
7
8
  * schema-qualified DDL and catalog checks. The `schema` argument is
@@ -19,18 +20,57 @@ function qualifyTableName(schema, table) {
19
20
  entries: { table: {} }
20
21
  }).qualifyTable(table);
21
22
  }
23
+ /** Each type `format_type` displays under another name: that name, and the words it writes after the type's modifier. */
22
24
  const FORMAT_TYPE_DISPLAY = /* @__PURE__ */ new Map([
23
- ["int2", "smallint"],
24
- ["int4", "integer"],
25
- ["int8", "bigint"],
26
- ["float4", "real"],
27
- ["float8", "double precision"],
28
- ["bool", "boolean"],
29
- ["timestamp", "timestamp without time zone"],
30
- ["timestamptz", "timestamp with time zone"],
31
- ["time", "time without time zone"],
32
- ["timetz", "time with time zone"]
25
+ ["int2", {
26
+ name: "smallint",
27
+ after: ""
28
+ }],
29
+ ["int4", {
30
+ name: "integer",
31
+ after: ""
32
+ }],
33
+ ["int8", {
34
+ name: "bigint",
35
+ after: ""
36
+ }],
37
+ ["float4", {
38
+ name: "real",
39
+ after: ""
40
+ }],
41
+ ["float8", {
42
+ name: "double precision",
43
+ after: ""
44
+ }],
45
+ ["bool", {
46
+ name: "boolean",
47
+ after: ""
48
+ }],
49
+ ["timestamp", {
50
+ name: "timestamp",
51
+ after: " without time zone"
52
+ }],
53
+ ["timestamptz", {
54
+ name: "timestamp",
55
+ after: " with time zone"
56
+ }],
57
+ ["time", {
58
+ name: "time",
59
+ after: " without time zone"
60
+ }],
61
+ ["timetz", {
62
+ name: "time",
63
+ after: " with time zone"
64
+ }]
33
65
  ]);
66
+ const TYPE_NAME_PARTS = /^([a-z][a-z0-9 ]*?)(\([^)]*\))?$/;
67
+ /** A type named as introspection reports it, as `format_type` displays it: `int4` as `integer`, and `timestamptz(3)` as `timestamp(3) with time zone`. */
68
+ function formatTypeDisplay(typeName) {
69
+ const parts = TYPE_NAME_PARTS.exec(typeName);
70
+ const display = parts === null ? void 0 : FORMAT_TYPE_DISPLAY.get(parts[1] ?? "");
71
+ if (parts === null || display === void 0) return typeName;
72
+ return `${display.name}${parts[2] ?? ""}${display.after}`;
73
+ }
34
74
  const UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;
35
75
  const POSTGRES_RESERVED_IDENTIFIER_WORDS = /* @__PURE__ */ new Set([
36
76
  "all",
@@ -137,16 +177,16 @@ function buildExpectedFormatType(column, codecHooks, storageTypes = {}) {
137
177
  const resolved = resolveColumnTypeMetadata(column, storageTypes);
138
178
  if (resolved.typeParams && resolved.codecId) {
139
179
  const hooks = codecHooks.get(resolved.codecId);
140
- if (hooks?.expandNativeType) return hooks.expandNativeType({
180
+ if (hooks?.expandNativeType) return formatTypeDisplay(normalizeSchemaNativeType(hooks.expandNativeType({
141
181
  nativeType: resolved.nativeType,
142
182
  codecId: resolved.codecId,
143
183
  typeParams: resolved.typeParams
144
- });
184
+ })));
145
185
  }
146
186
  if (column.typeRef) return formatUserDefinedTypeName(resolved.nativeType);
147
- return FORMAT_TYPE_DISPLAY.get(resolved.nativeType) ?? resolved.nativeType;
187
+ return formatTypeDisplay(withLengthOneWhenBare(normalizeSchemaNativeType(resolved.nativeType)));
148
188
  }
149
189
  //#endregion
150
190
  export { qualifyTableName as n, buildExpectedFormatType as t };
151
191
 
152
- //# sourceMappingURL=planner-sql-checks-Bd8nN9P8-Cd98iEee.mjs.map
192
+ //# sourceMappingURL=planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-sql-checks-ZMXeCK6W-D1VMBywZ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks-ZMXeCK6W.mjs"],"sourcesContent":["import { r as quoteIdentifier } from \"./sql-utils-Bh-mnsSY.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-yugFGBdS.mjs\";\nimport { n as normalizeSchemaNativeType, r as withLengthOneWhenBare } from \"./native-type-normalizer-CW6g9Fut.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\n//#region src/core/migrations/planner-sql-checks.ts\n/**\n* String-keyed entry points the migration ops use to render\n* schema-qualified DDL and catalog checks. The `schema` argument is\n* interpreted as a namespace coordinate: the framework `__unbound__`\n* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton\n* (which elides the qualifier so `search_path` decides at runtime); any\n* other id materialises a `PostgresSchema(id)` whose qualifier is the\n* named schema. Helpers route through these `Namespace` concretions so\n* the unbound branch lives in the polymorphic override, not the call\n* site.\n*/\nfunction qualifyTableName(schema, table) {\n\treturn postgresCreateNamespace({\n\t\tid: schema,\n\t\tentries: { table: {} }\n\t}).qualifyTable(table);\n}\n/** Each type `format_type` displays under another name: that name, and the words it writes after the type's modifier. */\nconst FORMAT_TYPE_DISPLAY = /* @__PURE__ */ new Map([\n\t[\"int2\", {\n\t\tname: \"smallint\",\n\t\tafter: \"\"\n\t}],\n\t[\"int4\", {\n\t\tname: \"integer\",\n\t\tafter: \"\"\n\t}],\n\t[\"int8\", {\n\t\tname: \"bigint\",\n\t\tafter: \"\"\n\t}],\n\t[\"float4\", {\n\t\tname: \"real\",\n\t\tafter: \"\"\n\t}],\n\t[\"float8\", {\n\t\tname: \"double precision\",\n\t\tafter: \"\"\n\t}],\n\t[\"bool\", {\n\t\tname: \"boolean\",\n\t\tafter: \"\"\n\t}],\n\t[\"timestamp\", {\n\t\tname: \"timestamp\",\n\t\tafter: \" without time zone\"\n\t}],\n\t[\"timestamptz\", {\n\t\tname: \"timestamp\",\n\t\tafter: \" with time zone\"\n\t}],\n\t[\"time\", {\n\t\tname: \"time\",\n\t\tafter: \" without time zone\"\n\t}],\n\t[\"timetz\", {\n\t\tname: \"time\",\n\t\tafter: \" with time zone\"\n\t}]\n]);\nconst TYPE_NAME_PARTS = /^([a-z][a-z0-9 ]*?)(\\([^)]*\\))?$/;\n/** A type named as introspection reports it, as `format_type` displays it: `int4` as `integer`, and `timestamptz(3)` as `timestamp(3) with time zone`. */\nfunction formatTypeDisplay(typeName) {\n\tconst parts = TYPE_NAME_PARTS.exec(typeName);\n\tconst display = parts === null ? void 0 : FORMAT_TYPE_DISPLAY.get(parts[1] ?? \"\");\n\tif (parts === null || display === void 0) return typeName;\n\treturn `${display.name}${parts[2] ?? \"\"}${display.after}`;\n}\nconst UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;\nconst POSTGRES_RESERVED_IDENTIFIER_WORDS = /* @__PURE__ */ new Set([\n\t\"all\",\n\t\"analyse\",\n\t\"analyze\",\n\t\"and\",\n\t\"any\",\n\t\"array\",\n\t\"as\",\n\t\"asc\",\n\t\"asymmetric\",\n\t\"authorization\",\n\t\"between\",\n\t\"binary\",\n\t\"both\",\n\t\"case\",\n\t\"cast\",\n\t\"check\",\n\t\"collate\",\n\t\"column\",\n\t\"constraint\",\n\t\"create\",\n\t\"current_catalog\",\n\t\"current_date\",\n\t\"current_role\",\n\t\"current_time\",\n\t\"current_timestamp\",\n\t\"current_user\",\n\t\"default\",\n\t\"deferrable\",\n\t\"desc\",\n\t\"distinct\",\n\t\"do\",\n\t\"else\",\n\t\"end\",\n\t\"except\",\n\t\"false\",\n\t\"fetch\",\n\t\"for\",\n\t\"foreign\",\n\t\"freeze\",\n\t\"from\",\n\t\"full\",\n\t\"grant\",\n\t\"group\",\n\t\"having\",\n\t\"ilike\",\n\t\"in\",\n\t\"initially\",\n\t\"inner\",\n\t\"intersect\",\n\t\"into\",\n\t\"is\",\n\t\"isnull\",\n\t\"join\",\n\t\"lateral\",\n\t\"leading\",\n\t\"left\",\n\t\"like\",\n\t\"limit\",\n\t\"localtime\",\n\t\"localtimestamp\",\n\t\"natural\",\n\t\"not\",\n\t\"notnull\",\n\t\"null\",\n\t\"offset\",\n\t\"on\",\n\t\"only\",\n\t\"or\",\n\t\"order\",\n\t\"outer\",\n\t\"overlaps\",\n\t\"placing\",\n\t\"primary\",\n\t\"references\",\n\t\"right\",\n\t\"select\",\n\t\"session_user\",\n\t\"similar\",\n\t\"some\",\n\t\"symmetric\",\n\t\"table\",\n\t\"then\",\n\t\"to\",\n\t\"trailing\",\n\t\"true\",\n\t\"union\",\n\t\"unique\",\n\t\"user\",\n\t\"using\",\n\t\"variadic\",\n\t\"verbose\",\n\t\"when\",\n\t\"where\",\n\t\"window\",\n\t\"with\"\n]);\nfunction formatUserDefinedTypeName(identifier) {\n\tif (UNQUOTED_POSTGRES_IDENTIFIER_PATTERN.test(identifier) && !POSTGRES_RESERVED_IDENTIFIER_WORDS.has(identifier)) return identifier;\n\treturn quoteIdentifier(identifier);\n}\nfunction buildExpectedFormatType(column, codecHooks, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (resolved.typeParams && resolved.codecId) {\n\t\tconst hooks = codecHooks.get(resolved.codecId);\n\t\tif (hooks?.expandNativeType) return formatTypeDisplay(normalizeSchemaNativeType(hooks.expandNativeType({\n\t\t\tnativeType: resolved.nativeType,\n\t\t\tcodecId: resolved.codecId,\n\t\t\ttypeParams: resolved.typeParams\n\t\t})));\n\t}\n\tif (column.typeRef) return formatUserDefinedTypeName(resolved.nativeType);\n\treturn formatTypeDisplay(withLengthOneWhenBare(normalizeSchemaNativeType(resolved.nativeType)));\n}\n//#endregion\nexport { qualifyTableName as n, buildExpectedFormatType as t };\n\n//# sourceMappingURL=planner-sql-checks-ZMXeCK6W.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,OAAO,wBAAwB;EAC9B,IAAI;EACJ,SAAS,EAAE,OAAO,CAAC,EAAE;CACtB,CAAC,CAAC,CAAC,aAAa,KAAK;AACtB;;AAEA,MAAM,sCAAsC,IAAI,IAAI;CACnD,CAAC,QAAQ;EACR,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,QAAQ;EACR,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,QAAQ;EACR,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,UAAU;EACV,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,UAAU;EACV,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,QAAQ;EACR,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,aAAa;EACb,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,eAAe;EACf,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,QAAQ;EACR,MAAM;EACN,OAAO;CACR,CAAC;CACD,CAAC,UAAU;EACV,MAAM;EACN,OAAO;CACR,CAAC;AACF,CAAC;AACD,MAAM,kBAAkB;;AAExB,SAAS,kBAAkB,UAAU;CACpC,MAAM,QAAQ,gBAAgB,KAAK,QAAQ;CAC3C,MAAM,UAAU,UAAU,OAAO,KAAK,IAAI,oBAAoB,IAAI,MAAM,MAAM,EAAE;CAChF,IAAI,UAAU,QAAQ,YAAY,KAAK,GAAG,OAAO;CACjD,OAAO,GAAG,QAAQ,OAAO,MAAM,MAAM,KAAK,QAAQ;AACnD;AACA,MAAM,uCAAuC;AAC7C,MAAM,qDAAqD,IAAI,IAAI;CAClE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,0BAA0B,YAAY;CAC9C,IAAI,qCAAqC,KAAK,UAAU,KAAK,CAAC,mCAAmC,IAAI,UAAU,GAAG,OAAO;CACzH,OAAO,gBAAgB,UAAU;AAClC;AACA,SAAS,wBAAwB,QAAQ,YAAY,eAAe,CAAC,GAAG;CACvE,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,IAAI,SAAS,cAAc,SAAS,SAAS;EAC5C,MAAM,QAAQ,WAAW,IAAI,SAAS,OAAO;EAC7C,IAAI,OAAO,kBAAkB,OAAO,kBAAkB,0BAA0B,MAAM,iBAAiB;GACtG,YAAY,SAAS;GACrB,SAAS,SAAS;GAClB,YAAY,SAAS;EACtB,CAAC,CAAC,CAAC;CACJ;CACA,IAAI,OAAO,SAAS,OAAO,0BAA0B,SAAS,UAAU;CACxE,OAAO,kBAAkB,sBAAsB,0BAA0B,SAAS,UAAU,CAAC,CAAC;AAC/F"}