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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/{adapter-DzNbNJ24.d.mts → adapter-BOi8Qpb_.d.mts} +6 -4
  2. package/dist/adapter-BOi8Qpb_.d.mts.map +1 -0
  3. package/dist/{adapter-BNrSLsxC-CXrTrSvP.mjs → adapter-DwUKamWE-9wPlFOdx.mjs} +23 -12
  4. package/dist/adapter-DwUKamWE-9wPlFOdx.mjs.map +1 -0
  5. package/dist/adapter.d.mts +7 -7
  6. package/dist/adapter.mjs +7 -7
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +1 -1
  9. package/dist/adapter__control.d.mts +2 -2
  10. package/dist/adapter__control.mjs +10 -16
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.d.mts +1 -1
  13. package/dist/adapter__runtime.mjs +9 -6
  14. package/dist/adapter__runtime.mjs.map +1 -1
  15. package/dist/adapter__sql-renderer.d.mts +1 -1
  16. package/dist/adapter__sql-renderer.mjs +1 -1
  17. package/dist/adapter__types.d.mts +3 -3
  18. package/dist/{authoring-C5Ch8RNG-Qgq9GiOY.mjs → authoring-BarDKx1G-BKhOsXKo.mjs} +20 -65
  19. package/dist/authoring-BarDKx1G-BKhOsXKo.mjs.map +1 -0
  20. package/dist/{check-expressions-DJNIFTHB-C86_fR5c.mjs → check-expressions-BRuSxJ5d-CC5OFfR1.mjs} +3 -3
  21. package/dist/{check-expressions-DJNIFTHB-C86_fR5c.mjs.map → check-expressions-BRuSxJ5d-CC5OFfR1.mjs.map} +1 -1
  22. package/dist/{codec-descriptor-B61d-k4C-BdWVU6Fu.mjs → codec-descriptor-CZAGhM_O-DK9auM7J.mjs} +5 -18
  23. package/dist/codec-descriptor-CZAGhM_O-DK9auM7J.mjs.map +1 -0
  24. package/dist/codec-descriptor-DAQDOwCJ.d.mts +1 -0
  25. package/dist/{codec-descriptor-HYqjI24K-CTO3gTEs.d.mts → codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts} +9 -10
  26. package/dist/codec-descriptor-DkeVTJ3N-XTfZgDGp.d.mts.map +1 -0
  27. package/dist/{codec-helpers-BmUrP6U9-DuO9gpqZ.mjs → codec-helpers-BKrVHgYc-DFnb5u9l.mjs} +4 -6
  28. package/dist/codec-helpers-BKrVHgYc-DFnb5u9l.mjs.map +1 -0
  29. package/dist/{codecs-CWXNVl1P.mjs → codec-registry-CCCOytGc-BFC0dvlt.mjs} +28 -12
  30. package/dist/codec-registry-CCCOytGc-BFC0dvlt.mjs.map +1 -0
  31. package/dist/{codec-type-map-Br7wS7DK-DmphGfZE.d.mts → codec-type-map-B9MLL97E-RMa5Y4R4.d.mts} +4 -4
  32. package/dist/{codec-type-map-Br7wS7DK-DmphGfZE.d.mts.map → codec-type-map-B9MLL97E-RMa5Y4R4.d.mts.map} +1 -1
  33. package/dist/{codec-types-DBeKvpNs-D9JlxBzY.d.mts → codec-types-Du6N0o5U-DMAI6jag.d.mts} +4 -4
  34. package/dist/{codec-types-DBeKvpNs-D9JlxBzY.d.mts.map → codec-types-Du6N0o5U-DMAI6jag.d.mts.map} +1 -1
  35. package/dist/codec-types-uq3Il6e3.d.mts +2 -0
  36. package/dist/{codecs-CnbVrlil--FxLKWM5.mjs → codecs-BzCRfsit-BbLlbudt.mjs} +35 -228
  37. package/dist/codecs-BzCRfsit-BbLlbudt.mjs.map +1 -0
  38. package/dist/{codecs-DxqbAhl0.d.mts → codecs-C0zx-UlM.d.mts} +10 -14
  39. package/dist/codecs-C0zx-UlM.d.mts.map +1 -0
  40. package/dist/{codecs-BU-eLMQi-BB2afWsO.d.mts → codecs-Ckpsj4IT-C7kgMiKv.d.mts} +16 -90
  41. package/dist/codecs-Ckpsj4IT-C7kgMiKv.d.mts.map +1 -0
  42. package/dist/{contract-free-DeK6m1dy.mjs → contract-free-DAGgx1J-.mjs} +8 -5
  43. package/dist/contract-free-DAGgx1J-.mjs.map +1 -0
  44. package/dist/{control-CyiVFspE.mjs → control-C0mAPRzk.mjs} +75 -117
  45. package/dist/control-C0mAPRzk.mjs.map +1 -0
  46. package/dist/{control-xWtRBAPw.d.mts → control-aDBKB9hQ.d.mts} +5 -10
  47. package/dist/control-aDBKB9hQ.d.mts.map +1 -0
  48. package/dist/{control-adapter-Du0EcG5G-CT4qBFrG.mjs → control-adapter-cjnLE0mN-BmNP2taw.mjs} +14 -18
  49. package/dist/control-adapter-cjnLE0mN-BmNP2taw.mjs.map +1 -0
  50. package/dist/control-fp7Azf3F.d.mts +733 -0
  51. package/dist/control-fp7Azf3F.d.mts.map +1 -0
  52. package/dist/{control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs → control-policy-CuJvncMq-C5yshGZP.mjs} +52 -52
  53. package/dist/control-policy-CuJvncMq-C5yshGZP.mjs.map +1 -0
  54. package/dist/{data-type-entries-cjspFU7A-BBOIqLij.mjs → data-type-entries-DYgNhsVx-BWJJHCQR.mjs} +5 -4
  55. package/dist/data-type-entries-DYgNhsVx-BWJJHCQR.mjs.map +1 -0
  56. package/dist/data-types-DzUVlWeo-CBMHoFoH.mjs +366 -0
  57. package/dist/data-types-DzUVlWeo-CBMHoFoH.mjs.map +1 -0
  58. package/dist/data-types-E1wms1_i.d.mts +96 -0
  59. package/dist/data-types-E1wms1_i.d.mts.map +1 -0
  60. package/dist/{ddl-BQFDVert-CcDdETee.mjs → ddl-BzsT_-qY-Cdzm0YIK.mjs} +3 -3
  61. package/dist/{ddl-BQFDVert-CcDdETee.mjs.map → ddl-BzsT_-qY-Cdzm0YIK.mjs.map} +1 -1
  62. package/dist/{default-normalizer-ByDD_gRm-CKeWEb0x.mjs → default-normalizer-C68YhUBS-BjOeKRhS.mjs} +3 -3
  63. package/dist/{default-normalizer-ByDD_gRm-CKeWEb0x.mjs.map → default-normalizer-C68YhUBS-BjOeKRhS.mjs.map} +1 -1
  64. package/dist/{descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs → descriptor-meta-CUmf1G9P-GAdC3zfT.mjs} +9 -7
  65. package/dist/descriptor-meta-CUmf1G9P-GAdC3zfT.mjs.map +1 -0
  66. package/dist/{descriptor-meta-BEigA5Gj-eY7nV4N_.mjs → descriptor-meta-gq4MiUXl-DqqHHHSj.mjs} +4 -90
  67. package/dist/descriptor-meta-gq4MiUXl-DqqHHHSj.mjs.map +1 -0
  68. package/dist/{descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs → descriptor-meta-runtime-D-ZCTI0a-DVgDk2XT.mjs} +5 -3
  69. package/dist/descriptor-meta-runtime-D-ZCTI0a-DVgDk2XT.mjs.map +1 -0
  70. package/dist/{diff-database-schema-D-eMVqv1.d.mts → diff-database-schema-BGcRo8FM.d.mts} +2 -2
  71. package/dist/{diff-database-schema-D-eMVqv1.d.mts.map → diff-database-schema-BGcRo8FM.d.mts.map} +1 -1
  72. package/dist/{diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs → diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs} +18 -26
  73. package/dist/diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs.map +1 -0
  74. package/dist/{errors-1AjGQf6h.d.mts → errors-DZ3zQdpT.d.mts} +2 -2
  75. package/dist/{errors-1AjGQf6h.d.mts.map → errors-DZ3zQdpT.d.mts.map} +1 -1
  76. package/dist/{full-text-DZ_SB64Q.d.mts → full-text-DjD0tAqd.d.mts} +2 -2
  77. package/dist/{full-text-DZ_SB64Q.d.mts.map → full-text-DjD0tAqd.d.mts.map} +1 -1
  78. package/dist/{full-text-index-expression-525ZZWf0-HIGVQbjL.mjs → full-text-index-expression-DKwm2Z9W-CboCsz4N.mjs} +4 -4
  79. package/dist/{full-text-index-expression-525ZZWf0-HIGVQbjL.mjs.map → full-text-index-expression-DKwm2Z9W-CboCsz4N.mjs.map} +1 -1
  80. package/dist/{full-text-parsers-Cg9SDrnx-DA1eBg1b.d.mts → full-text-parsers-DinPC_86-B2P_FyTG.d.mts} +3 -3
  81. package/dist/{full-text-parsers-Cg9SDrnx-DA1eBg1b.d.mts.map → full-text-parsers-DinPC_86-B2P_FyTG.d.mts.map} +1 -1
  82. package/dist/{infer-psl-contract-Burb6YAz-DbKU4cXm.mjs → infer-psl-contract-DBWXA-jx-CmKQgKZJ.mjs} +11 -11
  83. package/dist/infer-psl-contract-DBWXA-jx-CmKQgKZJ.mjs.map +1 -0
  84. package/dist/{issue-planner-BdnqkLvV.d.mts → issue-planner-pmBrIrEN.d.mts} +7 -2
  85. package/dist/issue-planner-pmBrIrEN.d.mts.map +1 -0
  86. package/dist/{migration-D7F66l-1.d.mts → migration-D189kh3f.d.mts} +3 -3
  87. package/dist/{migration-D7F66l-1.d.mts.map → migration-D189kh3f.d.mts.map} +1 -1
  88. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  89. package/dist/{native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs → native-type-normalizer-CwyVR7xB.mjs} +3 -9
  90. package/dist/native-type-normalizer-CwyVR7xB.mjs.map +1 -0
  91. package/dist/{op-factory-call-DkzlLBzN-Bc6l0sYN.mjs → op-factory-call-4IafSIKD-D2wO2iyZ.mjs} +11 -11
  92. package/dist/op-factory-call-4IafSIKD-D2wO2iyZ.mjs.map +1 -0
  93. package/dist/{op-factory-call-CaEALaar-Nh0fSxQY.d.mts → op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts} +6 -5
  94. package/dist/op-factory-call-CqKUB1XP-CsEGx4Jd.d.mts.map +1 -0
  95. package/dist/op-factory-call-D5UJ7cDi.d.mts +1 -0
  96. package/dist/{operation-types-sVW52HpK.d.mts → operation-types-DfPl4yzR.d.mts} +2 -2
  97. package/dist/{operation-types-sVW52HpK.d.mts.map → operation-types-DfPl4yzR.d.mts.map} +1 -1
  98. package/dist/{pack-AqcQpXNv.d.mts → pack-Cx7B1N8w.d.mts} +6 -33
  99. package/dist/pack-Cx7B1N8w.d.mts.map +1 -0
  100. package/dist/{planner-D7lEhXHR-8Wz1p_6j.mjs → planner-BWKFZaOu--28k5rC4.mjs} +12 -10
  101. package/dist/planner-BWKFZaOu--28k5rC4.mjs.map +1 -0
  102. package/dist/{planner-DECxo-qa.d.mts → planner-CvUO8Zpn.d.mts} +2 -2
  103. package/dist/{planner-DECxo-qa.d.mts.map → planner-CvUO8Zpn.d.mts.map} +1 -1
  104. package/dist/{planner-ddl-builders-DYLyFXrj.d.mts → planner-ddl-builders-Ckcr8Ov1.d.mts} +10 -8
  105. package/dist/planner-ddl-builders-Ckcr8Ov1.d.mts.map +1 -0
  106. package/dist/planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs +93 -0
  107. package/dist/planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs.map +1 -0
  108. package/dist/planner-identity-values-BTYw1D7D-CzpXx1yD.mjs +72 -0
  109. package/dist/planner-identity-values-BTYw1D7D-CzpXx1yD.mjs.map +1 -0
  110. package/dist/{planner-identity-values-TfEhnoWa.d.mts → planner-identity-values-DvlFit8A.d.mts} +7 -6
  111. package/dist/planner-identity-values-DvlFit8A.d.mts.map +1 -0
  112. package/dist/{planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs → planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs} +3 -3
  113. package/dist/{planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs.map → planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs.map} +1 -1
  114. package/dist/planner-produced-postgres-migration-BI_aepPp.d.mts +1 -0
  115. package/dist/{planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts → planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts} +3 -3
  116. package/dist/planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.d.mts.map +1 -0
  117. package/dist/planner-sql-checks-Cr06nK1--B3gPnC1a.mjs +47 -0
  118. package/dist/planner-sql-checks-Cr06nK1--B3gPnC1a.mjs.map +1 -0
  119. package/dist/{planner-sql-checks-CFgbRTJw.d.mts → planner-sql-checks-iNLJS1dW.d.mts} +8 -3
  120. package/dist/{planner-sql-checks-CFgbRTJw.d.mts.map → planner-sql-checks-iNLJS1dW.d.mts.map} +1 -1
  121. package/dist/{postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs → postgres-contract-view-D60F8OWK-Bi5oJkOx.mjs} +12 -10
  122. package/dist/postgres-contract-view-D60F8OWK-Bi5oJkOx.mjs.map +1 -0
  123. package/dist/{postgres-migration-Dq60Mixq-DYNJokZW.mjs → postgres-migration-PLXsv15e-BruyXuKH.mjs} +21 -20
  124. package/dist/postgres-migration-PLXsv15e-BruyXuKH.mjs.map +1 -0
  125. package/dist/{postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts → postgres-migration-e8UybR1y-C_m4i1jp.d.mts} +3 -3
  126. package/dist/{postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts.map → postgres-migration-e8UybR1y-C_m4i1jp.d.mts.map} +1 -1
  127. package/dist/{postgres-schema-C8slJGZo-CFGUyJPt.mjs → postgres-schema-DXd0mebY-CExd_GcQ.mjs} +3 -3
  128. package/dist/{postgres-schema-C8slJGZo-CFGUyJPt.mjs.map → postgres-schema-DXd0mebY-CExd_GcQ.mjs.map} +1 -1
  129. package/dist/{prisma7-binding-Dm24YoM6.mjs → prisma7-binding-BgMvnMgz.mjs} +30 -30
  130. package/dist/prisma7-binding-BgMvnMgz.mjs.map +1 -0
  131. package/dist/{prisma7-binding-C0GpQxEQ.d.mts → prisma7-binding-D2guML1e.d.mts} +8 -35
  132. package/dist/prisma7-binding-D2guML1e.d.mts.map +1 -0
  133. package/dist/{resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs → resolve-ddl-schema-CadTChyu-C7F31wpN.mjs} +3 -3
  134. package/dist/{resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs.map → resolve-ddl-schema-CadTChyu-C7F31wpN.mjs.map} +1 -1
  135. package/dist/{runtime-4QFzvcCp.d.mts → runtime-aejvKbMy.d.mts} +2 -2
  136. package/dist/{runtime-4QFzvcCp.d.mts.map → runtime-aejvKbMy.d.mts.map} +1 -1
  137. package/dist/{sql-renderer-CgUgFbU4-BY3PCrmG.mjs → sql-renderer-BjJ3MLnI-DQvfiMO6.mjs} +45 -43
  138. package/dist/sql-renderer-BjJ3MLnI-DQvfiMO6.mjs.map +1 -0
  139. package/dist/{sql-renderer-Bd07vbru.d.mts → sql-renderer-D6UgvbqG.d.mts} +6 -5
  140. package/dist/sql-renderer-D6UgvbqG.d.mts.map +1 -0
  141. package/dist/{sql-utils-Bh-mnsSY-D6hnFPrP.mjs → sql-utils-BMXJi06b-CAQOplfq.mjs} +178 -3
  142. package/dist/sql-utils-BMXJi06b-CAQOplfq.mjs.map +1 -0
  143. package/dist/target.d.mts +27 -27
  144. package/dist/target.mjs +28 -28
  145. package/dist/target__codec-descriptor.d.mts +2 -2
  146. package/dist/target__codec-descriptor.mjs +1 -1
  147. package/dist/target__codec-types.d.mts +3 -3
  148. package/dist/target__codecs.d.mts +3 -3
  149. package/dist/target__codecs.mjs +3 -3
  150. package/dist/target__contract-free.mjs +3 -3
  151. package/dist/target__control.d.mts +2 -2
  152. package/dist/target__control.mjs +4 -4
  153. package/dist/target__data-types.d.mts +2 -2
  154. package/dist/target__data-types.mjs +3 -3
  155. package/dist/target__default-normalizer.mjs +1 -1
  156. package/dist/target__diff-database-schema.d.mts +1 -1
  157. package/dist/target__diff-database-schema.mjs +1 -1
  158. package/dist/target__errors.d.mts +1 -1
  159. package/dist/target__full-text.d.mts +2 -2
  160. package/dist/target__issue-planner.d.mts +1 -1
  161. package/dist/target__issue-planner.mjs +1 -1
  162. package/dist/target__migration.d.mts +2 -2
  163. package/dist/target__migration.mjs +2 -2
  164. package/dist/target__native-type-normalizer.mjs +1 -1
  165. package/dist/target__op-factory-call.d.mts +2 -2
  166. package/dist/target__op-factory-call.mjs +1 -1
  167. package/dist/target__operation-types.d.mts +1 -1
  168. package/dist/target__pack.d.mts +1 -1
  169. package/dist/target__pack.mjs +1 -1
  170. package/dist/target__planner-ddl-builders.d.mts +2 -2
  171. package/dist/target__planner-ddl-builders.mjs +1 -1
  172. package/dist/target__planner-identity-values.d.mts +1 -1
  173. package/dist/target__planner-identity-values.mjs +1 -1
  174. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  175. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  176. package/dist/target__planner-sql-checks.d.mts +1 -1
  177. package/dist/target__planner-sql-checks.mjs +1 -1
  178. package/dist/target__planner.d.mts +1 -1
  179. package/dist/target__planner.mjs +2 -2
  180. package/dist/target__prisma7-binding.d.mts +1 -1
  181. package/dist/target__prisma7-binding.mjs +1 -1
  182. package/dist/target__runtime.mjs +3 -3
  183. package/dist/target__runtime.mjs.map +1 -1
  184. package/dist/target__schema-ir-annotations.mjs +1 -1
  185. package/dist/target__sql-utils.mjs +2 -2
  186. package/dist/target__types.mjs +2 -2
  187. package/dist/{types-BPubHbiE-BzhJ05fG.d.mts → types-D6lgKhE5-Cu48rrw9.d.mts} +7 -4
  188. package/dist/types-D6lgKhE5-Cu48rrw9.d.mts.map +1 -0
  189. package/dist/types-LTOC-zv8.d.mts +2 -0
  190. package/package.json +9 -9
  191. package/dist/adapter-BNrSLsxC-CXrTrSvP.mjs.map +0 -1
  192. package/dist/adapter-DzNbNJ24.d.mts.map +0 -1
  193. package/dist/authoring-C5Ch8RNG-Qgq9GiOY.mjs.map +0 -1
  194. package/dist/codec-descriptor-B61d-k4C-BdWVU6Fu.mjs.map +0 -1
  195. package/dist/codec-descriptor-D8_e5hpo.d.mts +0 -1
  196. package/dist/codec-descriptor-HYqjI24K-CTO3gTEs.d.mts.map +0 -1
  197. package/dist/codec-helpers-BmUrP6U9-DuO9gpqZ.mjs.map +0 -1
  198. package/dist/codec-types-Diyz6muR.d.mts +0 -2
  199. package/dist/codecs-BU-eLMQi-BB2afWsO.d.mts.map +0 -1
  200. package/dist/codecs-CWXNVl1P.mjs.map +0 -1
  201. package/dist/codecs-CnbVrlil--FxLKWM5.mjs.map +0 -1
  202. package/dist/codecs-DxqbAhl0.d.mts.map +0 -1
  203. package/dist/contract-free-DeK6m1dy.mjs.map +0 -1
  204. package/dist/control-CyiVFspE.mjs.map +0 -1
  205. package/dist/control-D7_yfEfH.d.mts +0 -402
  206. package/dist/control-D7_yfEfH.d.mts.map +0 -1
  207. package/dist/control-adapter-Du0EcG5G-CT4qBFrG.mjs.map +0 -1
  208. package/dist/control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs.map +0 -1
  209. package/dist/control-xWtRBAPw.d.mts.map +0 -1
  210. package/dist/data-type-entries-cjspFU7A-BBOIqLij.mjs.map +0 -1
  211. package/dist/data-types-BGsYeBpf-B_5bvuEe.mjs +0 -200
  212. package/dist/data-types-BGsYeBpf-B_5bvuEe.mjs.map +0 -1
  213. package/dist/data-types-DZGKP-qZ.d.mts +0 -47
  214. package/dist/data-types-DZGKP-qZ.d.mts.map +0 -1
  215. package/dist/descriptor-meta-BEigA5Gj-eY7nV4N_.mjs.map +0 -1
  216. package/dist/descriptor-meta-Bvq6_NJ8-Cn_M79Lf.mjs.map +0 -1
  217. package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +0 -1
  218. package/dist/diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs.map +0 -1
  219. package/dist/infer-psl-contract-Burb6YAz-DbKU4cXm.mjs.map +0 -1
  220. package/dist/issue-planner-BdnqkLvV.d.mts.map +0 -1
  221. package/dist/native-type-normalizer-CW6g9Fut-C5lMRRjS.mjs.map +0 -1
  222. package/dist/op-factory-call-CaEALaar-Nh0fSxQY.d.mts.map +0 -1
  223. package/dist/op-factory-call-DVz_g8zS.d.mts +0 -1
  224. package/dist/op-factory-call-DkzlLBzN-Bc6l0sYN.mjs.map +0 -1
  225. package/dist/pack-AqcQpXNv.d.mts.map +0 -1
  226. package/dist/planner-D7lEhXHR-8Wz1p_6j.mjs.map +0 -1
  227. package/dist/planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs +0 -128
  228. package/dist/planner-ddl-builders-BZLzBmuq-BrpA53eH.mjs.map +0 -1
  229. package/dist/planner-ddl-builders-DYLyFXrj.d.mts.map +0 -1
  230. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +0 -90
  231. package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +0 -1
  232. package/dist/planner-identity-values-TfEhnoWa.d.mts.map +0 -1
  233. package/dist/planner-produced-postgres-migration-BMfo2BlI.d.mts +0 -1
  234. package/dist/planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts.map +0 -1
  235. package/dist/planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs +0 -192
  236. package/dist/planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs.map +0 -1
  237. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +0 -15
  238. package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +0 -1
  239. package/dist/postgres-contract-view-Da0ymIZE-CBV3OE-k.mjs.map +0 -1
  240. package/dist/postgres-migration-Dq60Mixq-DYNJokZW.mjs.map +0 -1
  241. package/dist/prisma7-binding-C0GpQxEQ.d.mts.map +0 -1
  242. package/dist/prisma7-binding-Dm24YoM6.mjs.map +0 -1
  243. package/dist/sql-renderer-Bd07vbru.d.mts.map +0 -1
  244. package/dist/sql-renderer-CgUgFbU4-BY3PCrmG.mjs.map +0 -1
  245. package/dist/sql-utils-Bh-mnsSY-D6hnFPrP.mjs.map +0 -1
  246. package/dist/types-BPubHbiE-BzhJ05fG.d.mts.map +0 -1
  247. package/dist/types-DQ5Lh5JL.d.mts +0 -2
@@ -1,9 +1,9 @@
1
1
  import { t as PostgresRlsPolicy } from "./postgres-rls-policy-CnDxf3z9-C3LIHAIG.mjs";
2
2
  import { a as PostgresRlsEnablementInput, d as postgresCreateNamespace, i as PostgresRlsEnablement, n as PostgresNativeEnum, o as PostgresRole } from "./postgres-schema-Xsjt3RKO-Buv2X8ai.mjs";
3
3
  import { i as postgresRenderCheckExpressions } from "./check-expressions-CBIgoKhV-D7oTR8lp.mjs";
4
- import { dt as postgresQualifyColumnType } from "./codecs-BU-eLMQi-BB2afWsO.mjs";
4
+ import { dt as postgresQualifyColumnType } from "./codecs-Ckpsj4IT-C7kgMiKv.mjs";
5
5
  import { n as FullTextSearchLanguage } from "./text-search-languages-BzhBMCtK-D26JB2w3.mjs";
6
- import { r as CodecTypes } from "./codec-types-DBeKvpNs-D9JlxBzY.mjs";
6
+ import { r as CodecTypes } from "./codec-types-Du6N0o5U-DMAI6jag.mjs";
7
7
  import { a as policyUsingOnlySpec, c as roleSpec, i as policyBothPredicatesSpec, n as RoleExtensionBlock, o as policyWithCheckOnlySpec, r as nativeEnumSpec, s as postgresLowerEntityHandles, t as RlsPolicyExtensionBlock } from "./authoring-CLNoGwgA-DPDmJeBt.mjs";
8
8
  //#region ../../../3-targets/3-targets/postgres/dist/pack.d.mts
9
9
  //#region src/core/descriptor-meta.d.ts
@@ -30,7 +30,6 @@ declare const postgresTargetDescriptorMetaBase: {
30
30
  readonly documentation: "A PostgreSQL 64-bit integer represented as a JavaScript number within its safe integer range.";
31
31
  readonly output: {
32
32
  readonly codecId: "pg/int8number@1";
33
- readonly nativeType: "int8";
34
33
  };
35
34
  };
36
35
  readonly UnboundedInt: {
@@ -38,12 +37,12 @@ declare const postgresTargetDescriptorMetaBase: {
38
37
  readonly documentation: "An arbitrary-precision integer stored as PostgreSQL numeric and represented as bigint.";
39
38
  readonly output: {
40
39
  readonly codecId: "pg/unboundedint@1";
41
- readonly nativeType: "numeric";
42
40
  };
43
41
  };
44
42
  readonly pg: {
45
43
  readonly enum: {
46
44
  readonly kind: "typeConstructor";
45
+ readonly inferred: true;
47
46
  readonly entityRefArg: {
48
47
  readonly index: 0;
49
48
  readonly entityKind: "native_enum";
@@ -59,63 +58,54 @@ declare const postgresTargetDescriptorMetaBase: {
59
58
  readonly kind: "fieldPreset";
60
59
  readonly output: {
61
60
  readonly codecId: "pg/text@1";
62
- readonly nativeType: "text";
63
61
  };
64
62
  };
65
63
  readonly int: {
66
64
  readonly kind: "fieldPreset";
67
65
  readonly output: {
68
66
  readonly codecId: "pg/int4@1";
69
- readonly nativeType: "int4";
70
67
  };
71
68
  };
72
69
  readonly bigint: {
73
70
  readonly kind: "fieldPreset";
74
71
  readonly output: {
75
72
  readonly codecId: "pg/int8@1";
76
- readonly nativeType: "int8";
77
73
  };
78
74
  };
79
75
  readonly float: {
80
76
  readonly kind: "fieldPreset";
81
77
  readonly output: {
82
78
  readonly codecId: "pg/float8@1";
83
- readonly nativeType: "float8";
84
79
  };
85
80
  };
86
81
  readonly decimal: {
87
82
  readonly kind: "fieldPreset";
88
83
  readonly output: {
89
84
  readonly codecId: "pg/numeric@1";
90
- readonly nativeType: "numeric";
91
85
  };
92
86
  };
93
87
  readonly boolean: {
94
88
  readonly kind: "fieldPreset";
95
89
  readonly output: {
96
90
  readonly codecId: "pg/bool@1";
97
- readonly nativeType: "bool";
98
91
  };
99
92
  };
100
93
  readonly json: {
101
94
  readonly kind: "fieldPreset";
102
95
  readonly output: {
103
96
  readonly codecId: "pg/jsonb@1";
104
- readonly nativeType: "jsonb";
105
97
  };
106
98
  };
107
99
  readonly bytes: {
108
100
  readonly kind: "fieldPreset";
109
101
  readonly output: {
110
102
  readonly codecId: "pg/bytea@1";
111
- readonly nativeType: "bytea";
112
103
  };
113
104
  };
114
105
  readonly dateTime: {
115
106
  readonly kind: "fieldPreset";
116
107
  readonly output: {
117
108
  readonly codecId: "pg/timestamptz-temporal@1";
118
- readonly nativeType: "timestamptz";
119
109
  };
120
110
  };
121
111
  readonly temporal: {
@@ -126,7 +116,6 @@ declare const postgresTargetDescriptorMetaBase: {
126
116
  readonly kind: "number";
127
117
  readonly optional: true;
128
118
  readonly integer: true;
129
- readonly minimum: 0;
130
119
  }, {
131
120
  readonly name: "onCreate";
132
121
  readonly kind: "option";
@@ -140,7 +129,6 @@ declare const postgresTargetDescriptorMetaBase: {
140
129
  }];
141
130
  readonly output: {
142
131
  readonly codecId: "pg/timestamp-temporal@1";
143
- readonly nativeType: "timestamp";
144
132
  readonly typeParams: {
145
133
  readonly precision: {
146
134
  readonly kind: "arg";
@@ -178,7 +166,6 @@ declare const postgresTargetDescriptorMetaBase: {
178
166
  readonly kind: "number";
179
167
  readonly optional: true;
180
168
  readonly integer: true;
181
- readonly minimum: 0;
182
169
  }, {
183
170
  readonly name: "onCreate";
184
171
  readonly kind: "option";
@@ -192,7 +179,6 @@ declare const postgresTargetDescriptorMetaBase: {
192
179
  }];
193
180
  readonly output: {
194
181
  readonly codecId: "pg/timestamptz-temporal@1";
195
- readonly nativeType: "timestamptz";
196
182
  readonly typeParams: {
197
183
  readonly precision: {
198
184
  readonly kind: "arg";
@@ -230,7 +216,6 @@ declare const postgresTargetDescriptorMetaBase: {
230
216
  readonly kind: "number";
231
217
  readonly optional: true;
232
218
  readonly integer: true;
233
- readonly minimum: 0;
234
219
  }, {
235
220
  readonly name: "onCreate";
236
221
  readonly kind: "option";
@@ -244,7 +229,6 @@ declare const postgresTargetDescriptorMetaBase: {
244
229
  }];
245
230
  readonly output: {
246
231
  readonly codecId: "pg/timestamp-string@1";
247
- readonly nativeType: "timestamp";
248
232
  readonly typeParams: {
249
233
  readonly precision: {
250
234
  readonly kind: "arg";
@@ -282,7 +266,6 @@ declare const postgresTargetDescriptorMetaBase: {
282
266
  readonly kind: "number";
283
267
  readonly optional: true;
284
268
  readonly integer: true;
285
- readonly minimum: 0;
286
269
  }, {
287
270
  readonly name: "onCreate";
288
271
  readonly kind: "option";
@@ -296,7 +279,6 @@ declare const postgresTargetDescriptorMetaBase: {
296
279
  }];
297
280
  readonly output: {
298
281
  readonly codecId: "pg/timestamptz-string@1";
299
- readonly nativeType: "timestamptz";
300
282
  readonly typeParams: {
301
283
  readonly precision: {
302
284
  readonly kind: "arg";
@@ -331,7 +313,6 @@ declare const postgresTargetDescriptorMetaBase: {
331
313
  readonly kind: "fieldPreset";
332
314
  readonly output: Omit<{
333
315
  readonly codecId: "pg/timestamptz-string@1";
334
- readonly nativeType: "timestamptz";
335
316
  readonly generatorId: "timestampNow";
336
317
  } & {
337
318
  readonly generatorId?: "timestampNow";
@@ -348,7 +329,6 @@ declare const postgresTargetDescriptorMetaBase: {
348
329
  readonly kind: "fieldPreset";
349
330
  readonly output: Omit<{
350
331
  readonly codecId: "pg/timestamptz-string@1";
351
- readonly nativeType: "timestamptz";
352
332
  readonly generatorId: "timestampNow";
353
333
  } & {
354
334
  readonly generatorId?: "timestampNow";
@@ -369,7 +349,6 @@ declare const postgresTargetDescriptorMetaBase: {
369
349
  readonly kind: "fieldPreset";
370
350
  readonly output: Omit<{
371
351
  readonly codecId: "pg/timestamptz-temporal@1";
372
- readonly nativeType: "timestamptz";
373
352
  readonly generatorId: "instantNow";
374
353
  } & {
375
354
  readonly generatorId?: "instantNow";
@@ -386,7 +365,6 @@ declare const postgresTargetDescriptorMetaBase: {
386
365
  readonly kind: "fieldPreset";
387
366
  readonly output: Omit<{
388
367
  readonly codecId: "pg/timestamptz-temporal@1";
389
- readonly nativeType: "timestamptz";
390
368
  readonly generatorId: "instantNow";
391
369
  } & {
392
370
  readonly generatorId?: "instantNow";
@@ -407,7 +385,6 @@ declare const postgresTargetDescriptorMetaBase: {
407
385
  readonly kind: "fieldPreset";
408
386
  readonly output: Omit<{
409
387
  readonly codecId: "pg/timestamptz-date@1";
410
- readonly nativeType: "timestamptz";
411
388
  readonly generatorId: "timestampNow";
412
389
  } & {
413
390
  readonly generatorId?: "timestampNow";
@@ -424,7 +401,6 @@ declare const postgresTargetDescriptorMetaBase: {
424
401
  readonly kind: "fieldPreset";
425
402
  readonly output: Omit<{
426
403
  readonly codecId: "pg/timestamptz-date@1";
427
- readonly nativeType: "timestamptz";
428
404
  readonly generatorId: "timestampNow";
429
405
  } & {
430
406
  readonly generatorId?: "timestampNow";
@@ -448,7 +424,6 @@ declare const postgresTargetDescriptorMetaBase: {
448
424
  readonly kind: "number";
449
425
  readonly optional: true;
450
426
  readonly integer: true;
451
- readonly minimum: 0;
452
427
  }, {
453
428
  readonly name: "onCreate";
454
429
  readonly kind: "option";
@@ -462,7 +437,6 @@ declare const postgresTargetDescriptorMetaBase: {
462
437
  }];
463
438
  readonly output: {
464
439
  readonly codecId: "pg/timestamptz-date@1";
465
- readonly nativeType: "timestamptz";
466
440
  readonly typeParams: {
467
441
  readonly precision: {
468
442
  readonly kind: "arg";
@@ -498,7 +472,6 @@ declare const postgresTargetDescriptorMetaBase: {
498
472
  readonly kind: "fieldPreset";
499
473
  readonly output: {
500
474
  readonly codecId: "pg/uuid@1";
501
- readonly nativeType: "uuid";
502
475
  };
503
476
  };
504
477
  readonly id: {
@@ -506,7 +479,6 @@ declare const postgresTargetDescriptorMetaBase: {
506
479
  readonly kind: "fieldPreset";
507
480
  readonly output: {
508
481
  readonly codecId: "pg/uuid@1";
509
- readonly nativeType: "uuid";
510
482
  readonly executionDefaults: {
511
483
  readonly onCreate: {
512
484
  readonly kind: "generator";
@@ -520,7 +492,6 @@ declare const postgresTargetDescriptorMetaBase: {
520
492
  readonly kind: "fieldPreset";
521
493
  readonly output: {
522
494
  readonly codecId: "pg/uuid@1";
523
- readonly nativeType: "uuid";
524
495
  readonly executionDefaults: {
525
496
  readonly onCreate: {
526
497
  readonly kind: "generator";
@@ -532,6 +503,7 @@ declare const postgresTargetDescriptorMetaBase: {
532
503
  };
533
504
  };
534
505
  };
506
+ readonly dataTypes: Readonly<Record<string, import("@prisma/orm-framework/components/authoring").DataTypeAuthoringEntry>>;
535
507
  readonly entityTypes: {
536
508
  readonly role: {
537
509
  readonly kind: "entity";
@@ -774,6 +746,7 @@ declare const postgresTargetDescriptorMetaBase: {
774
746
  readonly id: "postgres";
775
747
  readonly version: "0.0.1";
776
748
  readonly capabilities: {};
749
+ readonly dataTypes: readonly import("@prisma/orm-framework/components/codec").DataType[];
777
750
  readonly __codecTypes?: CodecTypes;
778
751
  };
779
752
  declare const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {
@@ -781,4 +754,4 @@ declare const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaB
781
754
  };
782
755
  //#endregion
783
756
  export { postgresTargetDescriptorMeta as t };
784
- //# sourceMappingURL=pack-AqcQpXNv.d.mts.map
757
+ //# sourceMappingURL=pack-Cx7B1N8w.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-Cx7B1N8w.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;;;eAGJ;iBACE;iBACA;iBACA;mBACE;;;eAGJ;iBACE;mBACE;mBACA;mBACA;qBACE;qBACA;;mBAEF;qBACE;;;;;aAKR;eACE;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;iBACA;mBACE;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;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;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;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;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;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;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;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;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA,QAAQ;qBACN;qBACA;;qBAEA;;qBAEA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;;eAQd;iBACE;iBACA;mBACE;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR,WAAW,SAAS,kEAAkE;aACtF;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,mEAAmE;WACnE,eAAe;;cAEZ,qCAAqC;WACxC,eAAe"}
@@ -1,20 +1,20 @@
1
1
  import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
2
- import { d as isPostgresSchema, i as PostgresRlsPolicy } from "./postgres-schema-C8slJGZo-CFGUyJPt.mjs";
2
+ import { d as isPostgresSchema, i as PostgresRlsPolicy } from "./postgres-schema-DXd0mebY-CExd_GcQ.mjs";
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
- import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-Bq4m2dD9-DrlUipYU.mjs";
6
- import { B as renameTableStatement, C as DropNativeEnumTypeCall, E as DropTableCall, M as RenameTableCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from "./op-factory-call-DkzlLBzN-Bc6l0sYN.mjs";
7
- import { c as planIssues, d as renderPostgresSuppression, f as resolveNamespaceIdForDdlSchema, h as resolvePostgresNodeIssueCreationFactoryName, l as postgresNodeStorageCoordinate, m as resolvePostgresNodeIssueControlPolicySubject, n as conflictForDisallowedCall, o as issueNode, p as resolvePostgresCallControlPolicySubject, s as issueSchemaName, t as coalesceSubtreeIssues, u as postgresPlannerStrategies } from "./control-policy-BW5Cgq3Z-Dn2ZVBCP.mjs";
8
- import { n as buildPostgresPlanDiff } from "./diff-database-schema-_bbfF4oI-D_VmL4Ma.mjs";
9
- import { i as pairIndexRenames, n as emissionSchemaForNamespace, r as pairCheckRenames } from "./postgres-migration-Dq60Mixq-DYNJokZW.mjs";
10
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-GZTusMRD-DPb6XqDu.mjs";
5
+ import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-CadTChyu-C7F31wpN.mjs";
6
+ import { B as renameTableStatement, C as DropNativeEnumTypeCall, E as DropTableCall, M as RenameTableCall, O as RawSqlCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from "./op-factory-call-4IafSIKD-D2wO2iyZ.mjs";
7
+ import { c as planIssues, d as renderPostgresSuppression, f as resolveNamespaceIdForDdlSchema, h as resolvePostgresNodeIssueCreationFactoryName, l as postgresNodeStorageCoordinate, m as resolvePostgresNodeIssueControlPolicySubject, n as conflictForDisallowedCall, o as issueNode, p as resolvePostgresCallControlPolicySubject, s as issueSchemaName, t as coalesceSubtreeIssues, u as postgresPlannerStrategies } from "./control-policy-CuJvncMq-C5yshGZP.mjs";
8
+ import { t as buildPostgresPlanDiff } from "./diff-database-schema-BYHT4ZZp-DHQM3yoO.mjs";
9
+ import { i as pairIndexRenames, n as emissionSchemaForNamespace, r as pairCheckRenames } from "./postgres-migration-PLXsv15e-BruyXuKH.mjs";
10
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-B-gWwByI-Cy8tx4pu.mjs";
11
11
  import { blindCast } from "@prisma/orm-framework/utils/casts";
12
12
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
13
13
  import { issueOutcome } from "@prisma/orm-framework/components/control";
14
14
  import { namingOf, parseWireName } from "@prisma/orm-family-sql/schema-ir/naming";
15
15
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
16
- import { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from "@prisma/orm-family-sql/family/control";
17
- //#region ../../../3-targets/3-targets/postgres/dist/planner-D7lEhXHR.mjs
16
+ import { controlPolicyForCall, detectTableNameCaseChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, sqlTypeLookupsOf } from "@prisma/orm-family-sql/family/control";
17
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-BWKFZaOu.mjs
18
18
  /**
19
19
  * Resolves the live-database schema name for a given namespace
20
20
  * coordinate. Mirrors `resolveDdlSchemaForNamespace` in
@@ -163,6 +163,7 @@ var PostgresMigrationPlanner = class {
163
163
  const renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);
164
164
  const plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));
165
165
  const codecHooks = extractCodecControlHooks(options.frameworkComponents);
166
+ const types = sqlTypeLookupsOf(options.frameworkComponents);
166
167
  const storageTypes = options.contract.storage.types ?? {};
167
168
  const relationalSchema = relationalNamespaceNode(options.schema, schemaName);
168
169
  const issuePartition = partitionIssuesByControlPolicy({
@@ -190,6 +191,7 @@ var PostgresMigrationPlanner = class {
190
191
  fromContract: options.fromContract,
191
192
  schemaName,
192
193
  codecHooks,
194
+ types,
193
195
  storageTypes,
194
196
  ...ifDefined("schema", relationalSchema),
195
197
  policy: options.policy,
@@ -529,4 +531,4 @@ function policyNodeToContractPolicy(node) {
529
531
  //#endregion
530
532
  export { createPostgresMigrationPlanner as t };
531
533
 
532
- //# sourceMappingURL=planner-D7lEhXHR-8Wz1p_6j.mjs.map
534
+ //# sourceMappingURL=planner-BWKFZaOu--28k5rC4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-BWKFZaOu--28k5rC4.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-BWKFZaOu.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-DXd0mebY.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-CadTChyu.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-BYHT4ZZp.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, h 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-CuJvncMq.mjs\";\nimport { C as DropNativeEnumTypeCall, E as DropTableCall, M as RenameTableCall, O as RawSqlCall, R as renameTableStatement, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, l as AlterColumnTypeCall, p as CreatePostgresRlsPolicyCall, y as DropColumnCall } from \"./op-factory-call-4IafSIKD.mjs\";\nimport { a as pairCheckRenames, n as emissionSchemaForNamespace, o as pairIndexRenames } from \"./postgres-migration-PLXsv15e.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-B-gWwByI.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, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/migrations/verify-postgres-namespaces.ts\n/**\n* Resolves the live-database schema name for a given namespace\n* coordinate. Mirrors `resolveDdlSchemaForNamespace` in\n* `planner-strategies.ts` so the verifier's projection and the\n* planner's projection always agree — Postgres-aware namespaces (the\n* production path) dispatch to `ddlSchemaName(storage)`, and bare\n* object payloads (used by some tests) fall back to the coordinate\n* itself.\n*/\nfunction resolveDdlSchemaName(storage, namespaceId) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n/**\n* Reads the introspected list of schema names from the database-root schema\n* node. `existingSchemas` is database-level, so it lives on the\n* `PostgresDatabaseSchemaNode` root — not on the per-schema namespace nodes.\n*\n* Defaults to the always-present `public` schema when the node is not the\n* database root — a fresh Postgres database always carries `public` (unless an\n* operator dropped it manually), so any verifier path that runs without an\n* enriched introspection still suppresses the redundant `CREATE SCHEMA\n* \"public\"`.\n*\n* Production introspection (`PostgresControlAdapter.introspect`) is the\n* authoritative source: it queries `pg_namespace` and sets `existingSchemas`\n* on the returned root. Tests that want to assert against a richer initial\n* state construct a `PostgresDatabaseSchemaNode` explicitly.\n*/\nfunction existingSchemasFromSchema(schema) {\n\tif (PostgresDatabaseSchemaNode.is(schema)) return schema.existingSchemas;\n\treturn [DEFAULT_NAMESPACE_ID];\n}\n/**\n* Emits a `postgres-namespace` `not-found` diff issue for every\n* contract-declared Postgres namespace whose live container does not yet\n* exist. The planner prepends these (node-typed, synthesized) to the\n* relational diff issues so a multi-schema plan emits `CREATE SCHEMA`\n* before the tables that need it — a planner-only concern (verify already\n* rejects via the `not-found` table issues a missing schema already\n* produces), so this is not part of the shared diff.\n*\n* A namespace's live container is the schema returned by its\n* polymorphic `ddlSchemaName(storage)` method — named schemas resolve\n* to their own id; the unbound singleton returns `UNBOUND_NAMESPACE_ID`\n* and is skipped explicitly (late-bound namespaces have no fixed DDL\n* schema). Issues are emitted only when the resolved name is a real,\n* creatable schema (not the unbound sentinel) and is missing from the\n* introspected list. `public` is suppressed implicitly because the\n* introspection (or its sensible default) always carries it.\n*\n* Each emitted issue's path is `['database', ddlName]` — an ancestor of\n* every table path under that schema, so it must never be run through\n* `coalesceSubtreeIssues` alongside the table diff (it would swallow the\n* table-level `not-found` issues that drive `CREATE TABLE`); the planner\n* adds these AFTER coalescing the relational issues, and they are not\n* subject to sibling-space ownership scoping (mirrors the retired\n* coordinate walk, which prepended namespace issues after that filter).\n*/\nfunction verifyPostgresNamespacePresence(input) {\n\tconst { contract, schema } = input;\n\tconst existing = new Set(existingSchemasFromSchema(schema));\n\tconst issues = [];\n\tconst namespaceIds = Object.keys(contract.storage.namespaces).sort();\n\tfor (const namespaceId of namespaceIds) {\n\t\tif (namespaceId === UNBOUND_NAMESPACE_ID) continue;\n\t\tconst ddlName = resolveDdlSchemaName(contract.storage, namespaceId);\n\t\tif (ddlName === UNBOUND_NAMESPACE_ID) continue;\n\t\tif (existing.has(ddlName)) continue;\n\t\tconst namespace = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlName,\n\t\t\ttables: {}\n\t\t});\n\t\tissues.push({\n\t\t\tpath: [\"database\", ddlName],\n\t\t\texpected: namespace\n\t\t});\n\t}\n\treturn issues;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction partitionPostgresCallsByControlPolicy(calls, contract) {\n\treturn partitionCallsByControlPolicy({\n\t\tcalls,\n\t\tcontract,\n\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, contract),\n\t\tresolveFactoryName: (call) => call.factoryName\n\t});\n}\nfunction createPostgresMigrationPlanner(lowerer) {\n\treturn new PostgresMigrationPlanner(lowerer);\n}\n/**\n* Postgres migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the target contract against the live schema via the one\n* differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the unified `postgresPlannerStrategies`\n* list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook\n* storage types, component-declared dependency installs, and\n* shared-temp-default / empty-table-guarded NOT-NULL add-column. The same\n* strategy list runs for `migration plan`, `db update`, and `db init`;\n* behavior diverges purely on `policy.allowedOperationClasses` (the\n* data-safe strategies short-circuit when `'data'` is excluded). The issue\n* planner applies operation-class policy gates and emits a single\n* `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via\n* `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy\n* drift (the structural half of the same one-differ tree) is handled\n* separately via `planPostgresSchemaDiff`.\n*/\nvar PostgresMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(blindCast(options));\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderablePostgresMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst schemaName = options.schemaName ?? Object.keys(options.contract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\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 = pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = pairCheckRenames(options, schemaIssues);\n\t\tconst renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);\n\t\tconst plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst types = sqlTypeLookupsOf(options.frameworkComponents);\n\t\tconst 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\trenameByHandStatements: (rename) => [renameTableStatement(emissionSchemaForNamespace(options.contract, rename.namespaceId), rename.from, rename.to)],\n\t\t\trenameTableCall: (rename) => new RenameTableCall(rename.namespaceId ?? UNBOUND_NAMESPACE_ID, rename.from, rename.to).renderTypeScript(),\n\t\t\tcontract: options.contract,\n\t\t\tdefaultNamespaceId: DEFAULT_NAMESPACE_ID\n\t\t});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\n\t\tconst result = planIssues({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttoContract: options.contract,\n\t\t\tfromContract: options.fromContract,\n\t\t\tschemaName,\n\t\t\tcodecHooks,\n\t\t\ttypes,\n\t\t\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 = partitionPostgresCallsByControlPolicy([...indexRenames.calls, ...checkRenames.calls], options.contract);\n\t\tconst schemaDiffPartition = partitionPostgresCallsByControlPolicy(schemaDiff.calls, options.contract);\n\t\tconst fieldEventPartition = partitionPostgresCallsByControlPolicy(blindCast(planFieldEventOperations({\n\t\t\tpriorContract: options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks\n\t\t})), options.contract);\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* 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-BWKFZaOu.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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AW,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,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-DE2Ia9Ba-hYITaAdW.mjs";
3
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-DT3i_p3G-CyQUv3ac.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";
@@ -139,4 +139,4 @@ declare class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postg
139
139
  }
140
140
  //#endregion
141
141
  export { createPostgresMigrationPlanner as n, contractToPostgresDatabaseSchemaNode as t };
142
- //# sourceMappingURL=planner-DECxo-qa.d.mts.map
142
+ //# sourceMappingURL=planner-CvUO8Zpn.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-DECxo-qa.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BA;UACA"}
1
+ {"version":3,"file":"planner-CvUO8Zpn.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6BA;UACA"}
@@ -1,5 +1,5 @@
1
+ import { SqlTypeLookups } from "@prisma/orm-family-sql/contract/data-type";
1
2
  import { StorageColumn, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
2
- import { CodecControlHooks } from "@prisma/orm-family-sql/family/control";
3
3
  //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders.d.mts
4
4
  //#region src/core/date-time-ddl-text.d.ts
5
5
  /** Whether a data type is one of this target's date and time types, whose defaults DDL writes as text. */
@@ -15,21 +15,23 @@ declare function postgresDateTimeDdlText(canonical: string, dataTypeId: string |
15
15
  //#endregion
16
16
  //#region src/core/migrations/planner-ddl-builders.d.ts
17
17
  /**
18
- * Renders the SQL type for a column in DDL context.
18
+ * Renders the SQL type for a column in DDL context: the name its codec's data type is written
19
+ * with, and its parameters. A `typeRef` column is written as a column of the referenced type.
19
20
  *
20
21
  * @param allowPseudoTypes - When true (default), autoincrement integer columns
21
22
  * produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts
22
23
  * like ALTER COLUMN TYPE where pseudo-types are invalid.
23
24
  */
24
- declare function buildColumnTypeSql(column: Pick<StorageColumn, 'nativeType' | 'codecId' | 'many' | 'typeParams' | 'typeRef' | 'default'>, codecHooks: ReadonlyMap<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance>, allowPseudoTypes?: boolean): string;
25
+ declare function buildColumnTypeSql(column: Pick<StorageColumn, 'codecId' | 'many' | 'typeParams' | 'typeRef' | 'default'>, types: SqlTypeLookups, storageTypes?: Record<string, StorageTypeInstance>, allowPseudoTypes?: boolean): string;
25
26
  /**
26
- * The column a default is written for: its type as SQL, whether it is a list, and its data type,
27
- * which decides the text a date or time value is written as. The value arrives in canonical form.
27
+ * The column a default is written for: its type as SQL, whether it is a list, and the id of its
28
+ * data type, which decides whether a JSON value is cast and the text a date or time value is
29
+ * written as. The value arrives in canonical form.
28
30
  */
29
31
  type DefaultColumn = Pick<StorageColumn, 'many' | 'nativeType'> & {
30
- readonly dataTypeId?: string | undefined;
32
+ readonly dataTypeId: string;
31
33
  };
32
34
  declare function renderDefaultLiteral(value: unknown, column?: DefaultColumn): string;
33
35
  //#endregion
34
- export { renderDefaultLiteral as i, isPostgresDateTimeDataType as n, postgresDateTimeDdlText as r, buildColumnTypeSql as t };
35
- //# sourceMappingURL=planner-ddl-builders-DYLyFXrj.d.mts.map
36
+ export { renderDefaultLiteral as a, postgresDateTimeDdlText as i, buildColumnTypeSql as n, isPostgresDateTimeDataType as r, DefaultColumn as t };
37
+ //# sourceMappingURL=planner-ddl-builders-Ckcr8Ov1.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-ddl-builders-Ckcr8Ov1.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders.d.mts"],"mappings":";;;;;iBAIiB,2BAA2B;;;;;;;;iBAQ3B,wBAAwB,mBAAmB;;;;;;;;;;;iBAW3C,mBAAmB,QAAQ,KAAK,2EAA2E,OAAO,gBAAgB,eAAe,eAAe,sBAAsB;;;;;;KAMlM,gBAAgB,KAAK;WACf;;iBAEM,qBAAqB,gBAAgB,SAAS"}
@@ -0,0 +1,93 @@
1
+ import { t as escapeLiteral } from "./sql-utils-BMXJi06b-CAQOplfq.mjs";
2
+ import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, _ as pgInt8, b as pgJsonb, c as pgDate, g as pgInt4, h as pgInt2, v as pgInterval, y as pgJson } from "./data-types-DzUVlWeo-CBMHoFoH.mjs";
3
+ import { dataTypeParams, renderSqlTypeName, sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-O0JqJIBZ.mjs
5
+ const DATE_TIME_TYPES = /* @__PURE__ */ new Set([
6
+ pgDate.id,
7
+ pgTime.id,
8
+ pgTimetz.id,
9
+ pgTimestamp.id,
10
+ pgTimestamptz.id,
11
+ pgInterval.id
12
+ ]);
13
+ const TYPES_WITH_A_YEAR = /* @__PURE__ */ new Set([
14
+ pgDate.id,
15
+ pgTimestamp.id,
16
+ pgTimestamptz.id
17
+ ]);
18
+ /** Whether a data type is one of this target's date and time types, whose defaults DDL writes as text. */
19
+ function isPostgresDateTimeDataType(dataTypeId) {
20
+ return dataTypeId !== void 0 && DATE_TIME_TYPES.has(dataTypeId);
21
+ }
22
+ /**
23
+ * The text DDL writes for a default of a date or time type, from its canonical form (ADR 254). A
24
+ * year from 1 to 9999 stays as it is. PostgreSQL has no year 0 and reads no signed year, so a later
25
+ * year loses its sign and leading zeros (`10000-01-01`) and a year at or before 0 is written as the
26
+ * year before Christ (`0044-03-15 BC`). Every Postgres DDL path writes a date or time default
27
+ * through this function.
28
+ */
29
+ function postgresDateTimeDdlText(canonical, dataTypeId) {
30
+ if (dataTypeId === void 0 || !TYPES_WITH_A_YEAR.has(dataTypeId)) return canonical;
31
+ const match = /^([+-]\d{6}|\d{4})(-.*)$/.exec(canonical);
32
+ if (match === null) return canonical;
33
+ const [, yearDigits = "", rest = ""] = match;
34
+ const year = Number(yearDigits);
35
+ if (year >= 1 && year <= 9999) return canonical;
36
+ if (year > 9999) return `${year}${rest}`;
37
+ return `${String(1 - year).padStart(4, "0")}${rest} BC`;
38
+ }
39
+ const SERIAL_TYPES = /* @__PURE__ */ new Map([
40
+ [pgInt4.id, "SERIAL"],
41
+ [pgInt8.id, "BIGSERIAL"],
42
+ [pgInt2.id, "SMALLSERIAL"]
43
+ ]);
44
+ const JSON_DATA_TYPES = /* @__PURE__ */ new Set([pgJson.id, pgJsonb.id]);
45
+ /**
46
+ * Renders the SQL type for a column in DDL context: the name its codec's data type is written
47
+ * with, and its parameters. A `typeRef` column is written as a column of the referenced type.
48
+ *
49
+ * @param allowPseudoTypes - When true (default), autoincrement integer columns
50
+ * produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts
51
+ * like ALTER COLUMN TYPE where pseudo-types are invalid.
52
+ */
53
+ function buildColumnTypeSql(column, types, storageTypes = {}, allowPseudoTypes = true) {
54
+ const resolved = (column.typeRef === void 0 ? void 0 : storageTypes[column.typeRef]) ?? column;
55
+ const dataType = sqlDataTypeOfCodec(resolved.codecId, types);
56
+ if (allowPseudoTypes) {
57
+ const columnDefault = column.default;
58
+ const serial = SERIAL_TYPES.get(dataType.id);
59
+ if (serial !== void 0 && columnDefault?.kind === "function" && columnDefault.expression === "autoincrement()") return serial;
60
+ }
61
+ const typeSql = renderSqlTypeName(dataType, dataTypeParams(dataType, resolved.typeParams));
62
+ return column.many ? `${typeSql}[]` : typeSql;
63
+ }
64
+ function renderDefaultLiteral(value, column) {
65
+ if (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value, column.nativeType, column.dataTypeId);
66
+ if (column !== void 0 && JSON_DATA_TYPES.has(column.dataTypeId) && typeof value === "object" && value !== null && !(value instanceof Date)) return `'${escapeLiteral(JSON.stringify(value))}'::${column.nativeType}`;
67
+ return renderScalarLiteral(value, column?.dataTypeId);
68
+ }
69
+ /** A date or time value is written through the one function every DDL path uses for it. */
70
+ function renderScalarLiteral(value, dataTypeId) {
71
+ if (value instanceof Date) return `'${escapeLiteral(value.toISOString())}'`;
72
+ if (typeof value === "string") return `'${escapeLiteral(postgresDateTimeDdlText(value, dataTypeId))}'`;
73
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
74
+ if (value === null) return "NULL";
75
+ return `'${escapeLiteral(JSON.stringify(value))}'`;
76
+ }
77
+ /**
78
+ * An `ARRAY[...]` of quoted elements has type `text[]`, which Postgres does not assign to a list of
79
+ * numbers, decimals, timestamps or enums, so the constructor is cast to the list type. Each element
80
+ * is the text Postgres reads for its type: an `int8` or `numeric` value as decimal text, a date or
81
+ * time value in its type's canonical form. `nativeType` is the element type or the list type,
82
+ * written as SQL, so a user-defined type name arrives already quoted.
83
+ */
84
+ function renderArrayLiteralDefault(elements, nativeType, dataTypeId) {
85
+ if (elements.length === 0) return "'{}'";
86
+ const rendered = `ARRAY[${elements.map((el) => renderScalarLiteral(el, dataTypeId)).join(", ")}]`;
87
+ if (nativeType === "") return rendered;
88
+ return `${rendered}::${nativeType.endsWith("[]") ? nativeType : `${nativeType}[]`}`;
89
+ }
90
+ //#endregion
91
+ export { renderDefaultLiteral as i, isPostgresDateTimeDataType as n, postgresDateTimeDdlText as r, buildColumnTypeSql as t };
92
+
93
+ //# sourceMappingURL=planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-ddl-builders-O0JqJIBZ-x7JEHEpU.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-O0JqJIBZ.mjs"],"sourcesContent":["import { t as escapeLiteral } from \"./sql-utils-BMXJi06b.mjs\";\nimport { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, _ as pgInt8, b as pgJsonb, c as pgDate, g as pgInt4, h as pgInt2, v as pgInterval, y as pgJson } from \"./data-types-DzUVlWeo.mjs\";\nimport { dataTypeParams, renderSqlTypeName, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\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\nconst SERIAL_TYPES = /* @__PURE__ */ new Map([\n\t[pgInt4.id, \"SERIAL\"],\n\t[pgInt8.id, \"BIGSERIAL\"],\n\t[pgInt2.id, \"SMALLSERIAL\"]\n]);\nconst JSON_DATA_TYPES = /* @__PURE__ */ new Set([pgJson.id, pgJsonb.id]);\n/**\n* Renders the SQL type for a column in DDL context: the name its codec's data type is written\n* with, and its parameters. A `typeRef` column is written as a column of the referenced type.\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, types, storageTypes = {}, allowPseudoTypes = true) {\n\tconst resolved = (column.typeRef === void 0 ? void 0 : storageTypes[column.typeRef]) ?? column;\n\tconst dataType = sqlDataTypeOfCodec(resolved.codecId, types);\n\tif (allowPseudoTypes) {\n\t\tconst columnDefault = column.default;\n\t\tconst serial = SERIAL_TYPES.get(dataType.id);\n\t\tif (serial !== void 0 && columnDefault?.kind === \"function\" && columnDefault.expression === \"autoincrement()\") return serial;\n\t}\n\tconst typeSql = renderSqlTypeName(dataType, dataTypeParams(dataType, resolved.typeParams));\n\treturn column.many ? `${typeSql}[]` : typeSql;\n}\nfunction renderDefaultLiteral(value, column) {\n\tif (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value, column.nativeType, column.dataTypeId);\n\tif (column !== void 0 && JSON_DATA_TYPES.has(column.dataTypeId) && 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-O0JqJIBZ.mjs.map"],"mappings":";;;;AAIA,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,I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