@prisma/orm-target-postgres 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1
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.
- package/README.md +4 -6
- package/dist/adapter-5qylEP__.d.mts +403 -0
- package/dist/adapter-5qylEP__.d.mts.map +1 -0
- package/dist/{adapter-B0xsc80z-sYcF0RVF.mjs → adapter-svGTIjA2-1p-Iw8D2.mjs} +24 -30
- package/dist/adapter-svGTIjA2-1p-Iw8D2.mjs.map +1 -0
- package/dist/adapter.d.mts +11 -13
- package/dist/adapter.mjs +7 -8
- package/dist/adapter__adapter.d.mts +2 -2
- package/dist/adapter__adapter.mjs +3 -2
- package/dist/adapter__column-types.d.mts +2 -2
- package/dist/adapter__column-types.mjs +2 -2
- package/dist/adapter__control.d.mts +4 -5
- package/dist/adapter__control.mjs +11 -423
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +29 -19
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +4 -3
- package/dist/aggregates-CEqqEg8k.d.mts +318 -0
- package/dist/aggregates-CEqqEg8k.d.mts.map +1 -0
- package/dist/{aggregates-Dh6HPdvC.mjs → aggregates-Dw-lAutX.mjs} +105 -40
- package/dist/aggregates-Dw-lAutX.mjs.map +1 -0
- package/dist/authoring-DWd5pnnV-BBX7P1wT.d.mts +52 -0
- package/dist/authoring-DWd5pnnV-BBX7P1wT.d.mts.map +1 -0
- package/dist/authoring-SbdvmVJh-nQ7YliD_.mjs +1342 -0
- package/dist/authoring-SbdvmVJh-nQ7YliD_.mjs.map +1 -0
- package/dist/autoincrement-widths-DonNJgfS-CCvZ4u1W.mjs +58 -0
- package/dist/autoincrement-widths-DonNJgfS-CCvZ4u1W.mjs.map +1 -0
- package/dist/{canonicalize-CQlxSR4D-MnrT5gtW.d.mts → canonicalize-B-xvDOdd-G3yUeKj4.d.mts} +7 -3
- package/dist/canonicalize-B-xvDOdd-G3yUeKj4.d.mts.map +1 -0
- package/dist/{canonicalize-CrN3u_xM-D4MrOqcB.mjs → canonicalize-RdxoUHao-FTTkizfe.mjs} +15 -3
- package/dist/canonicalize-RdxoUHao-FTTkizfe.mjs.map +1 -0
- package/dist/check-expressions-7uCCP01t-DtX2Vak9.mjs +48 -0
- package/dist/check-expressions-7uCCP01t-DtX2Vak9.mjs.map +1 -0
- package/dist/{check-expressions-DRgG8RN5-DiA-22aC.d.mts → check-expressions-CtTzM58x-LloO-5Vf.d.mts} +14 -13
- package/dist/check-expressions-CtTzM58x-LloO-5Vf.d.mts.map +1 -0
- package/dist/{codec-descriptor-LT7BpQta-BaDM8UQQ.mjs → codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs} +12 -21
- package/dist/codec-descriptor-DoR-cTFZ-BlG5Gj-X.mjs.map +1 -0
- package/dist/codec-descriptor-Fb3UoQGb.d.mts +1 -0
- package/dist/codec-descriptor-d1ByNBEk-DhrtS_5y.d.mts +47 -0
- package/dist/codec-descriptor-d1ByNBEk-DhrtS_5y.d.mts.map +1 -0
- package/dist/codec-ids-BMhEpFwv-B8Zh0s_Q.mjs +41 -0
- package/dist/codec-ids-BMhEpFwv-B8Zh0s_Q.mjs.map +1 -0
- package/dist/codec-ids-C6II64Wy-CPYTqDTT.d.mts +41 -0
- package/dist/codec-ids-C6II64Wy-CPYTqDTT.d.mts.map +1 -0
- package/dist/codec-ids-CcB5uBNf.d.mts +1 -0
- package/dist/codec-registry-D7XslgPe-DTZnVB8W.mjs +61 -0
- package/dist/codec-registry-D7XslgPe-DTZnVB8W.mjs.map +1 -0
- package/dist/codec-type-map-Fj5xCgwT-BeCXgfuR.d.mts +53 -0
- package/dist/codec-type-map-Fj5xCgwT-BeCXgfuR.d.mts.map +1 -0
- package/dist/codec-types-BBACckHa.d.mts +2 -0
- package/dist/codec-types-Ct_4iTVc-3tFJcIBo.d.mts +84 -0
- package/dist/codec-types-Ct_4iTVc-3tFJcIBo.d.mts.map +1 -0
- package/dist/codecs-CADK7dCR-C8WToYQb.d.mts +724 -0
- package/dist/codecs-CADK7dCR-C8WToYQb.d.mts.map +1 -0
- package/dist/codecs-CRl9-i_r-Co-bgYl3.mjs +1743 -0
- package/dist/codecs-CRl9-i_r-Co-bgYl3.mjs.map +1 -0
- package/dist/codecs-CoEpEqjM.d.mts +31 -0
- package/dist/codecs-CoEpEqjM.d.mts.map +1 -0
- package/dist/column-types-B4zsV-u3.mjs +106 -0
- package/dist/column-types-B4zsV-u3.mjs.map +1 -0
- package/dist/column-types-Bs2V0j8T.d.mts +164 -0
- package/dist/column-types-Bs2V0j8T.d.mts.map +1 -0
- package/dist/{control-adapter-DFr4gS-r-DM3KcZdQ.mjs → contract-contributions-Xz2FpyfI-CeQZqHKf.mjs} +489 -292
- package/dist/contract-contributions-Xz2FpyfI-CeQZqHKf.mjs.map +1 -0
- package/dist/{contract-free-DzpGxLfb.d.mts → contract-free-B6-wuc6M.d.mts} +36 -6
- package/dist/contract-free-B6-wuc6M.d.mts.map +1 -0
- package/dist/{contract-free-aQ4nT-_R.mjs → contract-free-o7olebm9.mjs} +13 -9
- package/dist/contract-free-o7olebm9.mjs.map +1 -0
- package/dist/control--HupSPoV.d.mts +847 -0
- package/dist/control--HupSPoV.d.mts.map +1 -0
- package/dist/{control-BaUpALVp.d.mts → control-CQEjh4P7.d.mts} +2 -2
- package/dist/control-CQEjh4P7.d.mts.map +1 -0
- package/dist/{control-DLTOAEHj.d.mts → control-D4cTcpcJ.d.mts} +22 -48
- package/dist/control-D4cTcpcJ.d.mts.map +1 -0
- package/dist/{control-Y6FxMu3o.mjs → control-DZQwENIP.mjs} +21 -9
- package/dist/control-DZQwENIP.mjs.map +1 -0
- package/dist/{control-policy-B53lnBCT-B9K9Cj1x.mjs → control-policy-DtU5u9Dm-44r_OF94.mjs} +444 -218
- package/dist/control-policy-DtU5u9Dm-44r_OF94.mjs.map +1 -0
- package/dist/{data-transform-ChZzy2dP-CxVCat_8.mjs → data-transform-h9agBu_c-RlC5A7aY.mjs} +12 -5
- package/dist/data-transform-h9agBu_c-RlC5A7aY.mjs.map +1 -0
- package/dist/{data-transform-Ck5FbyNO-BNE7QlAo.d.mts → data-transform-nGy9rz87-CE3DGlgn.d.mts} +15 -4
- package/dist/data-transform-nGy9rz87-CE3DGlgn.d.mts.map +1 -0
- package/dist/data-transform-nqkqNIb8.d.mts +1 -0
- package/dist/data-type-entries-gQW3-KSb-BIl8vgus.mjs +128 -0
- package/dist/data-type-entries-gQW3-KSb-BIl8vgus.mjs.map +1 -0
- package/dist/data-types--7V9yY1G.d.mts +99 -0
- package/dist/data-types--7V9yY1G.d.mts.map +1 -0
- package/dist/data-types-Chx0mjTP-DczU4S9b.mjs +950 -0
- package/dist/data-types-Chx0mjTP-DczU4S9b.mjs.map +1 -0
- package/dist/date-time-now-generators-CMkXVbMG-C-GjhReE.d.mts +45 -0
- package/dist/date-time-now-generators-CMkXVbMG-C-GjhReE.d.mts.map +1 -0
- package/dist/ddl-B7Rqlz6D-B7dRDgYb.mjs +647 -0
- package/dist/ddl-B7Rqlz6D-B7dRDgYb.mjs.map +1 -0
- package/dist/ddl-B8nQZTWN.d.mts +1 -0
- package/dist/default-constraint-names-Cz9Yoeim-sUzOGvIm.mjs +18 -0
- package/dist/default-constraint-names-Cz9Yoeim-sUzOGvIm.mjs.map +1 -0
- package/dist/default-normalizer-BqK6XxdC-2OUb2ybG.mjs +311 -0
- package/dist/default-normalizer-BqK6XxdC-2OUb2ybG.mjs.map +1 -0
- package/dist/default-normalizer-DO-cH75Q.d.mts +25 -0
- package/dist/default-normalizer-DO-cH75Q.d.mts.map +1 -0
- package/dist/descriptor-meta-BkD3nXF_-CZaNqC6r.mjs +36 -0
- package/dist/descriptor-meta-BkD3nXF_-CZaNqC6r.mjs.map +1 -0
- package/dist/descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs +64 -0
- package/dist/descriptor-meta-DaFDNnHQ-QjiiAEtC.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-Dft1L7eE-D8vpOz_Z.mjs +15 -0
- package/dist/descriptor-meta-runtime-Dft1L7eE-D8vpOz_Z.mjs.map +1 -0
- package/dist/{diff-database-schema-DsoNznGC.d.mts → diff-database-schema-BxzhZaVN.d.mts} +12 -7
- package/dist/diff-database-schema-BxzhZaVN.d.mts.map +1 -0
- package/dist/{diff-database-schema-DKq76rCk-uehceHYz.mjs → diff-database-schema-DAEzWtzU-DoyVgKqh.mjs} +38 -18
- package/dist/diff-database-schema-DAEzWtzU-DoyVgKqh.mjs.map +1 -0
- package/dist/driver.d.mts +3 -3
- package/dist/driver.mjs +3 -2
- package/dist/driver__control.d.mts +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.d.mts +2 -2
- package/dist/driver__runtime.mjs +2 -639
- package/dist/errors-BrhQYgdL-IvZHPjwL.mjs +103 -0
- package/dist/errors-BrhQYgdL-IvZHPjwL.mjs.map +1 -0
- package/dist/{errors-CU4xIwwk.d.mts → errors-D3Mj-x0o.d.mts} +3 -3
- package/dist/errors-D3Mj-x0o.d.mts.map +1 -0
- package/dist/full-text-BYg7EVX2.mjs +39 -0
- package/dist/full-text-BYg7EVX2.mjs.map +1 -0
- package/dist/full-text-SDbfxrE_.d.mts +26 -0
- package/dist/full-text-SDbfxrE_.d.mts.map +1 -0
- package/dist/full-text-collection-method-BFd2u2cs-Ba3OiWM3.d.mts +27 -0
- package/dist/full-text-collection-method-BFd2u2cs-Ba3OiWM3.d.mts.map +1 -0
- package/dist/full-text-index-authoring-CN1L9C1k.d.mts +7 -0
- package/dist/full-text-index-authoring-CN1L9C1k.d.mts.map +1 -0
- package/dist/full-text-index-definition-BPxQQBuC-VLyQ1kEL.mjs +195 -0
- package/dist/full-text-index-definition-BPxQQBuC-VLyQ1kEL.mjs.map +1 -0
- package/dist/full-text-index-definition-D5iBWLss-BEpqiucV.d.mts +71 -0
- package/dist/full-text-index-definition-D5iBWLss-BEpqiucV.d.mts.map +1 -0
- package/dist/full-text-parsers-CFFxiOrp-CrZ7VI1m.mjs +139 -0
- package/dist/full-text-parsers-CFFxiOrp-CrZ7VI1m.mjs.map +1 -0
- package/dist/full-text-search-document-Doy5TF7c-aMWM_1KB.mjs +54 -0
- package/dist/full-text-search-document-Doy5TF7c-aMWM_1KB.mjs.map +1 -0
- package/dist/index-types-BihjrAAq-C2VnfAyF.mjs +14 -0
- package/dist/index-types-BihjrAAq-C2VnfAyF.mjs.map +1 -0
- package/dist/indexes-BYf6nXVv-BXwLw7fO.d.mts +60 -0
- package/dist/indexes-BYf6nXVv-BXwLw7fO.d.mts.map +1 -0
- package/dist/infer-psl-contract-BSSHcuRi-ChdFSviw.mjs +1143 -0
- package/dist/infer-psl-contract-BSSHcuRi-ChdFSviw.mjs.map +1 -0
- package/dist/{issue-planner-Biq9Ls7e.d.mts → issue-planner-D-On52xP.d.mts} +39 -9
- package/dist/issue-planner-D-On52xP.d.mts.map +1 -0
- package/dist/list-decoder-BcrLExnx-DlCwavhu.d.mts +7 -0
- package/dist/list-decoder-BcrLExnx-DlCwavhu.d.mts.map +1 -0
- package/dist/marker-lock-BviIbusV.d.mts +11 -0
- package/dist/marker-lock-BviIbusV.d.mts.map +1 -0
- package/dist/marker-lock-DFc1Tfv5-BkBKBRE3.mjs +11 -0
- package/dist/marker-lock-DFc1Tfv5-BkBKBRE3.mjs.map +1 -0
- package/dist/{migration-PTHAY9Cv.mjs → migration-Be_iuIpn.mjs} +5 -4
- package/dist/migration-Be_iuIpn.mjs.map +1 -0
- package/dist/migration-D4lMmLVj.d.mts +26 -0
- package/dist/migration-D4lMmLVj.d.mts.map +1 -0
- package/dist/{namespace-ids-xtp_ZY86-Cpp8PTxD.mjs → namespace-ids-xtp_ZY86-Cxc0dBbO.mjs} +2 -2
- package/dist/namespace-ids-xtp_ZY86-Cxc0dBbO.mjs.map +1 -0
- package/dist/native-type-normalizer-BaGa9eeb.d.mts +30 -0
- package/dist/native-type-normalizer-BaGa9eeb.d.mts.map +1 -0
- package/dist/native-type-normalizer-Cn-RGt_E.mjs +24 -0
- package/dist/native-type-normalizer-Cn-RGt_E.mjs.map +1 -0
- package/dist/{nodes-DAvDJLvJ-BBdvFXNa.mjs → nodes-G8VTh4PM-DNvIhHag.mjs} +78 -7
- package/dist/nodes-G8VTh4PM-DNvIhHag.mjs.map +1 -0
- package/dist/{nodes-BU-V-aZA-RqwPH68u.d.mts → nodes-s0Oe37jT-Cw3BU2gL.d.mts} +82 -29
- package/dist/nodes-s0Oe37jT-Cw3BU2gL.d.mts.map +1 -0
- package/dist/op-factory-call-CRaVUOb_.d.mts +1 -0
- package/dist/{op-factory-call-H6zeDGLe-_1pAftJk.mjs → op-factory-call-gGX-mZu--0QUG5xH4.mjs} +1014 -258
- package/dist/op-factory-call-gGX-mZu--0QUG5xH4.mjs.map +1 -0
- package/dist/{op-factory-call-BAeyLFYf-BAgG1h1C.d.mts → op-factory-call-nLHvNx0O-BTBhGbOF.d.mts} +169 -111
- package/dist/op-factory-call-nLHvNx0O-BTBhGbOF.d.mts.map +1 -0
- package/dist/operation-types--Wa_cv45-RoRnL1Dn.d.mts +192 -0
- package/dist/operation-types--Wa_cv45-RoRnL1Dn.d.mts.map +1 -0
- package/dist/operation-types-OXILTAOX.d.mts +1 -0
- package/dist/pack-2CYw2w-b.d.mts +1573 -0
- package/dist/pack-2CYw2w-b.d.mts.map +1 -0
- package/dist/{planner-CT-7zSfk.d.mts → planner-AD3Dt57t.d.mts} +23 -51
- package/dist/planner-AD3Dt57t.d.mts.map +1 -0
- package/dist/planner-VuR6URu3-CCUT2Osx.mjs +954 -0
- package/dist/planner-VuR6URu3-CCUT2Osx.mjs.map +1 -0
- package/dist/planner-ddl-builders-CPM3y7cQ.d.mts +16 -0
- package/dist/planner-ddl-builders-CPM3y7cQ.d.mts.map +1 -0
- package/dist/planner-ddl-builders-cYnH52gC-BWifb_M6.mjs +28 -0
- package/dist/planner-ddl-builders-cYnH52gC-BWifb_M6.mjs.map +1 -0
- package/dist/planner-identity-values-Dsq989Lh.d.mts +26 -0
- package/dist/planner-identity-values-Dsq989Lh.d.mts.map +1 -0
- package/dist/planner-identity-values-QstrMJ2U-CcpaRVPY.mjs +70 -0
- package/dist/planner-identity-values-QstrMJ2U-CcpaRVPY.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration-BBUwtjA_.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs → planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs} +5 -5
- package/dist/planner-produced-postgres-migration-BZclL_xO-uflxtYuP.mjs.map +1 -0
- package/dist/{planner-produced-postgres-migration-BaviT8KK-Yo9kw6rs.d.mts → planner-produced-postgres-migration-DyIXJ3MR-DHO5wn_X.d.mts} +4 -4
- package/dist/planner-produced-postgres-migration-DyIXJ3MR-DHO5wn_X.d.mts.map +1 -0
- package/dist/{planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs → planner-schema-lookup-BbUY9oVy.mjs} +2 -2
- package/dist/planner-schema-lookup-BbUY9oVy.mjs.map +1 -0
- package/dist/{planner-schema-lookup-C4DHAddq.d.mts → planner-schema-lookup-ceCNOGFf.d.mts} +2 -2
- package/dist/planner-schema-lookup-ceCNOGFf.d.mts.map +1 -0
- package/dist/planner-sql-checks-D-K44J19-CzvrqzNB.mjs +151 -0
- package/dist/planner-sql-checks-D-K44J19-CzvrqzNB.mjs.map +1 -0
- package/dist/planner-sql-checks-Ed-WGtge-D9ByMrW4.d.mts +37 -0
- package/dist/planner-sql-checks-Ed-WGtge-D9ByMrW4.d.mts.map +1 -0
- package/dist/planner-sql-checks-rEjFx_Jv.d.mts +1 -0
- package/dist/planner-target-details-CUEF0s90-6g-mOgTI.mjs +14 -0
- package/dist/planner-target-details-CUEF0s90-6g-mOgTI.mjs.map +1 -0
- package/dist/{planner-target-details-HkP4RrRO-_xPQVPF0.d.mts → planner-target-details-HkP4RrRO-D6VtK0jY.d.mts} +2 -2
- package/dist/planner-target-details-HkP4RrRO-D6VtK0jY.d.mts.map +1 -0
- package/dist/postgres-codec-traits-CnP5Bjxp-Dxdgv0TI.mjs +11 -0
- package/dist/postgres-codec-traits-CnP5Bjxp-Dxdgv0TI.mjs.map +1 -0
- package/dist/{postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts → postgres-contract-view-BFzIDwwN-hL3QLe_b.d.mts} +2 -2
- package/dist/postgres-contract-view-BFzIDwwN-hL3QLe_b.d.mts.map +1 -0
- package/dist/{postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs → postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs} +27 -14
- package/dist/postgres-contract-view-BO2elRMz-BqMBzJoJ.mjs.map +1 -0
- package/dist/{postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts → postgres-database-schema-node-Cv8usVNX-BmvGozi4.d.mts} +4 -4
- package/dist/postgres-database-schema-node-Cv8usVNX-BmvGozi4.d.mts.map +1 -0
- package/dist/postgres-migration-BSWmeRLo-CUfVTUf0.mjs +1312 -0
- package/dist/postgres-migration-BSWmeRLo-CUfVTUf0.mjs.map +1 -0
- package/dist/{postgres-migration-BNsrwlxh-CwI5BqAu.d.mts → postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts} +135 -15
- package/dist/postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts.map +1 -0
- package/dist/{postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs → postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs} +2 -2
- package/dist/postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs.map +1 -0
- package/dist/postgres-object-name-FPikIvOw-B8FfJI7z.mjs +23 -0
- package/dist/postgres-object-name-FPikIvOw-B8FfJI7z.mjs.map +1 -0
- package/dist/{postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts → postgres-rls-policy-CnDxf3z9-BjpVyUnK.d.mts} +2 -2
- package/dist/postgres-rls-policy-CnDxf3z9-BjpVyUnK.d.mts.map +1 -0
- package/dist/{postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs → postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs} +3 -3
- package/dist/postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs.map +1 -0
- package/dist/{postgres-schema-CF0yHESb-D7n2X21R.mjs → postgres-schema-C6w1rzOF-D1fdwqRx.mjs} +14 -12
- package/dist/postgres-schema-C6w1rzOF-D1fdwqRx.mjs.map +1 -0
- package/dist/{postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts → postgres-schema-Xsjt3RKO-bis-SVSB.d.mts} +4 -4
- package/dist/postgres-schema-Xsjt3RKO-bis-SVSB.d.mts.map +1 -0
- package/dist/{postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs → postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs} +2 -2
- package/dist/postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs.map +1 -0
- package/dist/prisma7-binding-BjiLA9F7.mjs +307 -0
- package/dist/prisma7-binding-BjiLA9F7.mjs.map +1 -0
- package/dist/prisma7-binding-a56klfkc.d.mts +1651 -0
- package/dist/prisma7-binding-a56klfkc.d.mts.map +1 -0
- package/dist/{render-ops-DOsRP0Po-BKn_c_Ia.mjs → render-ops-BgqtCw9Z-T8BPTX85.mjs} +17 -10
- package/dist/render-ops-BgqtCw9Z-T8BPTX85.mjs.map +1 -0
- package/dist/{render-ops-DPwhZt2W.d.mts → render-ops-Bl84i7ut.d.mts} +3 -3
- package/dist/render-ops-Bl84i7ut.d.mts.map +1 -0
- package/dist/{render-typescript-6sCFvMBh.d.mts → render-typescript-BysdXYpH.d.mts} +2 -2
- package/dist/render-typescript-BysdXYpH.d.mts.map +1 -0
- package/dist/{render-typescript-Dqp1Spgn-B128r1qw.mjs → render-typescript-Dqp1Spgn-B4mJhuVr.mjs} +2 -2
- package/dist/render-typescript-Dqp1Spgn-B4mJhuVr.mjs.map +1 -0
- package/dist/resolve-ddl-schema-D3VNPMSm-BuB6NyOI.mjs +34 -0
- package/dist/resolve-ddl-schema-D3VNPMSm-BuB6NyOI.mjs.map +1 -0
- package/dist/{runtime-lHBKgjB9.d.mts → runtime-C0VXuM0b.d.mts} +4 -3
- package/dist/runtime-C0VXuM0b.d.mts.map +1 -0
- package/dist/runtime-CXfxy5ED.mjs +660 -0
- package/dist/runtime-CXfxy5ED.mjs.map +1 -0
- package/dist/{runtime-_TfO66h5.d.mts → runtime-Ci_toEDZ.d.mts} +12 -4
- package/dist/runtime-Ci_toEDZ.d.mts.map +1 -0
- package/dist/{runtime-DOXznQe0.d.mts → runtime-DtjW0GP_.d.mts} +4 -4
- package/dist/runtime-DtjW0GP_.d.mts.map +1 -0
- package/dist/{schema-ir-annotations-DuuYh0gl.d.mts → schema-ir-annotations-BygaWBiC.d.mts} +2 -2
- package/dist/schema-ir-annotations-BygaWBiC.d.mts.map +1 -0
- package/dist/{schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts → schema-node-kinds-C52Bb1ve-DmxQRPPS.d.mts} +2 -2
- package/dist/schema-node-kinds-C52Bb1ve-DmxQRPPS.d.mts.map +1 -0
- package/dist/{normalize-error-CNjgVO71-CLlZ3CuJ.mjs → server-text-types-DeNPQpv5-DqX0h8WF.mjs} +45 -3
- package/dist/server-text-types-DeNPQpv5-DqX0h8WF.mjs.map +1 -0
- package/dist/{sql-renderer-ComgusFq-BBlqM1fw.mjs → sql-renderer-BdWJPa5F-Ct0CPlXc.mjs} +113 -123
- package/dist/sql-renderer-BdWJPa5F-Ct0CPlXc.mjs.map +1 -0
- package/dist/{sql-renderer-BgC0ZgLS.d.mts → sql-renderer-BiBhge7D.d.mts} +9 -7
- package/dist/sql-renderer-BiBhge7D.d.mts.map +1 -0
- package/dist/{sql-utils-DuzN3JZg-DiXy4Vah.mjs → sql-utils-Bnw3JbWf-BN0gcjZB.mjs} +31 -8
- package/dist/sql-utils-Bnw3JbWf-BN0gcjZB.mjs.map +1 -0
- package/dist/{sql-utils-DW6fkczF.d.mts → sql-utils-CnnGiZBc.d.mts} +12 -4
- package/dist/sql-utils-CnnGiZBc.d.mts.map +1 -0
- package/dist/{table-source-ikHOZmhD-DriY1Lcr.d.mts → table-source-ikHOZmhD-vYcblBYv.d.mts} +2 -2
- package/dist/table-source-ikHOZmhD-vYcblBYv.d.mts.map +1 -0
- package/dist/target.d.mts +61 -49
- package/dist/target.mjs +45 -36
- package/dist/target__aggregates.d.mts +1 -1
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-ids.d.mts +3 -3
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +4 -4
- package/dist/target__codecs.d.mts +4 -3
- package/dist/target__codecs.mjs +3 -3
- package/dist/target__contract-free.d.mts +3 -3
- package/dist/target__contract-free.mjs +4 -4
- package/dist/target__control.d.mts +4 -2
- package/dist/target__control.mjs +2501 -2
- package/dist/target__control.mjs.map +1 -0
- package/dist/target__data-transform.d.mts +2 -2
- package/dist/target__data-transform.mjs +1 -1
- package/dist/target__data-types.d.mts +2 -0
- package/dist/target__data-types.mjs +3 -0
- package/dist/target__ddl.d.mts +4 -4
- package/dist/target__ddl.mjs +2 -2
- package/dist/target__default-normalizer.d.mts +2 -2
- package/dist/target__default-normalizer.mjs +2 -2
- package/dist/target__diff-database-schema.d.mts +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__errors.d.mts +1 -1
- package/dist/target__errors.mjs +1 -1
- package/dist/target__full-text-index-authoring.d.mts +3 -0
- package/dist/target__full-text-index-authoring.mjs +3 -0
- package/dist/target__full-text.d.mts +4 -0
- package/dist/target__full-text.mjs +3 -0
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__marker-lock.d.mts +2 -0
- package/dist/target__marker-lock.mjs +2 -0
- package/dist/target__migration.d.mts +4 -4
- package/dist/target__migration.mjs +5 -5
- package/dist/target__native-type-normalizer.d.mts +2 -2
- package/dist/target__native-type-normalizer.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +3 -3
- package/dist/target__op-factory-call.mjs +2 -2
- package/dist/target__operation-types.d.mts +4 -0
- package/dist/target__pack.d.mts +3 -2
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.d.mts +2 -2
- package/dist/target__planner-ddl-builders.mjs +2 -2
- package/dist/target__planner-identity-values.d.mts +1 -1
- package/dist/target__planner-identity-values.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-schema-lookup.d.mts +1 -1
- package/dist/target__planner-schema-lookup.mjs +1 -1
- package/dist/target__planner-sql-checks.d.mts +3 -2
- package/dist/target__planner-sql-checks.mjs +2 -2
- package/dist/target__planner-target-details.d.mts +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.d.mts +2 -0
- package/dist/target__prisma7-binding.mjs +2 -0
- package/dist/target__render-ops.d.mts +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__render-typescript.d.mts +1 -1
- package/dist/target__render-typescript.mjs +1 -1
- package/dist/target__rls-canonicalize.d.mts +2 -2
- package/dist/target__rls-canonicalize.mjs +2 -2
- package/dist/target__runtime.d.mts +6 -3
- package/dist/target__runtime.mjs +193 -4
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.d.mts +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__sql-utils.d.mts +3 -2
- package/dist/target__sql-utils.mjs +4 -2
- package/dist/target__types.d.mts +7 -7
- package/dist/target__types.mjs +5 -5
- package/dist/types-AvjnIUna.d.mts +2 -0
- package/dist/types-D6lgKhE5-D1J9YJnd.d.mts +28 -0
- package/dist/types-D6lgKhE5-D1J9YJnd.d.mts.map +1 -0
- package/dist/{types-CjGjPLr5.d.mts → types-DOmgp_12.d.mts} +8 -8
- package/dist/types-DOmgp_12.d.mts.map +1 -0
- package/dist/{types-ue6jkJyF-BQJzjx1P.d.mts → types-ue6jkJyF-D79DmBTl.d.mts} +2 -2
- package/dist/types-ue6jkJyF-D79DmBTl.d.mts.map +1 -0
- package/package.json +22 -14
- package/dist/adapter-B0xsc80z-sYcF0RVF.mjs.map +0 -1
- package/dist/adapter-CPesdzv0.d.mts +0 -26
- package/dist/adapter-CPesdzv0.d.mts.map +0 -1
- package/dist/adapter__operation-types.d.mts +0 -2
- package/dist/aggregates-CgqNfj2O.d.mts +0 -10
- package/dist/aggregates-CgqNfj2O.d.mts.map +0 -1
- package/dist/aggregates-Dh6HPdvC.mjs.map +0 -1
- package/dist/authoring-BOpdZa2N-ClrLFiXw.mjs +0 -773
- package/dist/authoring-BOpdZa2N-ClrLFiXw.mjs.map +0 -1
- package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts.map +0 -1
- package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs.map +0 -1
- package/dist/check-expressions-5vhxWaFy-CBcjFeur.mjs +0 -41
- package/dist/check-expressions-5vhxWaFy-CBcjFeur.mjs.map +0 -1
- package/dist/check-expressions-DRgG8RN5-DiA-22aC.d.mts.map +0 -1
- package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts +0 -37
- package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts.map +0 -1
- package/dist/codec-descriptor-Bg-_412t.d.mts +0 -1
- package/dist/codec-descriptor-LT7BpQta-BaDM8UQQ.mjs.map +0 -1
- package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts +0 -35
- package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts.map +0 -1
- package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs +0 -35
- package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs.map +0 -1
- package/dist/codec-ids-DJ6j6pZc.d.mts +0 -1
- package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts +0 -84
- package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts.map +0 -1
- package/dist/codec-types-bX63JRLf.d.mts +0 -2
- package/dist/codecs-B1HgsJZ2.mjs +0 -15
- package/dist/codecs-B1HgsJZ2.mjs.map +0 -1
- package/dist/codecs-BmPCJWqb-DveZGJvm.mjs +0 -1680
- package/dist/codecs-BmPCJWqb-DveZGJvm.mjs.map +0 -1
- package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts +0 -638
- package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts.map +0 -1
- package/dist/codecs-DmCKO7dg.d.mts +0 -15
- package/dist/codecs-DmCKO7dg.d.mts.map +0 -1
- package/dist/column-types-BH-MU6uU.d.mts +0 -108
- package/dist/column-types-BH-MU6uU.d.mts.map +0 -1
- package/dist/column-types-Bh92dNjD.mjs +0 -126
- package/dist/column-types-Bh92dNjD.mjs.map +0 -1
- package/dist/contract-free-DzpGxLfb.d.mts.map +0 -1
- package/dist/contract-free-aQ4nT-_R.mjs.map +0 -1
- package/dist/control-2F195jJk.d.mts +0 -11
- package/dist/control-2F195jJk.d.mts.map +0 -1
- package/dist/control-BaUpALVp.d.mts.map +0 -1
- package/dist/control-DLTOAEHj.d.mts.map +0 -1
- package/dist/control-V7OkAC55.mjs +0 -1459
- package/dist/control-V7OkAC55.mjs.map +0 -1
- package/dist/control-Y6FxMu3o.mjs.map +0 -1
- package/dist/control-adapter-DFr4gS-r-DM3KcZdQ.mjs.map +0 -1
- package/dist/control-policy-B53lnBCT-B9K9Cj1x.mjs.map +0 -1
- package/dist/data-transform-BSM7TQpE.d.mts +0 -1
- package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs.map +0 -1
- package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +0 -1
- package/dist/ddl-B4Rh8ntj.d.mts +0 -1
- package/dist/ddl-CNQJds-C-WfZ3y4y8.mjs +0 -395
- package/dist/ddl-CNQJds-C-WfZ3y4y8.mjs.map +0 -1
- package/dist/default-normalizer-B36TOul4.d.mts +0 -31
- package/dist/default-normalizer-B36TOul4.d.mts.map +0 -1
- package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs +0 -253
- package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs.map +0 -1
- package/dist/descriptor-meta-KVX21fsl-DBDoB4eg.mjs +0 -354
- package/dist/descriptor-meta-KVX21fsl-DBDoB4eg.mjs.map +0 -1
- package/dist/descriptor-meta-rilAH3ep-dAmiVLpe.mjs +0 -30
- package/dist/descriptor-meta-rilAH3ep-dAmiVLpe.mjs.map +0 -1
- package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs +0 -13
- package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +0 -1
- package/dist/diff-database-schema-DKq76rCk-uehceHYz.mjs.map +0 -1
- package/dist/diff-database-schema-DsoNznGC.d.mts.map +0 -1
- package/dist/driver__runtime.mjs.map +0 -1
- package/dist/errors-CU4xIwwk.d.mts.map +0 -1
- package/dist/errors-DKjQzNaN-DFcF1thx.mjs +0 -39
- package/dist/errors-DKjQzNaN-DFcF1thx.mjs.map +0 -1
- package/dist/issue-planner-Biq9Ls7e.d.mts.map +0 -1
- package/dist/migration-PTHAY9Cv.mjs.map +0 -1
- package/dist/migration-aFeTWTOJ.d.mts +0 -25
- package/dist/migration-aFeTWTOJ.d.mts.map +0 -1
- package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs.map +0 -1
- package/dist/native-type-normalizer-DqJlOTeX.d.mts +0 -19
- package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +0 -1
- package/dist/native-type-normalizer-yvd3tqv-.mjs +0 -38
- package/dist/native-type-normalizer-yvd3tqv-.mjs.map +0 -1
- package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts.map +0 -1
- package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs.map +0 -1
- package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs.map +0 -1
- package/dist/op-factory-call-BAeyLFYf-BAgG1h1C.d.mts.map +0 -1
- package/dist/op-factory-call-BTU8I_x0.d.mts +0 -1
- package/dist/op-factory-call-H6zeDGLe-_1pAftJk.mjs.map +0 -1
- package/dist/operation-types-BfRocNI8.d.mts +0 -22
- package/dist/operation-types-BfRocNI8.d.mts.map +0 -1
- package/dist/pack-CySS3DQU.d.mts +0 -626
- package/dist/pack-CySS3DQU.d.mts.map +0 -1
- package/dist/planner-CT-7zSfk.d.mts.map +0 -1
- package/dist/planner-D0uogzvT-1WyGIC5p.mjs +0 -671
- package/dist/planner-D0uogzvT-1WyGIC5p.mjs.map +0 -1
- package/dist/planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs +0 -102
- package/dist/planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map +0 -1
- package/dist/planner-ddl-builders-ijp60-JO.d.mts +0 -19
- package/dist/planner-ddl-builders-ijp60-JO.d.mts.map +0 -1
- package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +0 -90
- package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +0 -1
- package/dist/planner-identity-values-TfEhnoWa.d.mts +0 -25
- package/dist/planner-identity-values-TfEhnoWa.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-BaviT8KK-Yo9kw6rs.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-D6C0T2xV.d.mts +0 -1
- package/dist/planner-schema-lookup-C4DHAddq.d.mts.map +0 -1
- package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +0 -1
- package/dist/planner-sql-checks-CFgbRTJw.d.mts +0 -20
- package/dist/planner-sql-checks-CFgbRTJw.d.mts.map +0 -1
- package/dist/planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs +0 -152
- package/dist/planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map +0 -1
- package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts.map +0 -1
- package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +0 -15
- package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +0 -1
- package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map +0 -1
- package/dist/postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs.map +0 -1
- package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts.map +0 -1
- package/dist/postgres-migration-BNsrwlxh-CwI5BqAu.d.mts.map +0 -1
- package/dist/postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs +0 -205
- package/dist/postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs.map +0 -1
- package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs.map +0 -1
- package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts.map +0 -1
- package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs.map +0 -1
- package/dist/postgres-schema-CF0yHESb-D7n2X21R.mjs.map +0 -1
- package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts.map +0 -1
- package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs.map +0 -1
- package/dist/render-ops-DOsRP0Po-BKn_c_Ia.mjs.map +0 -1
- package/dist/render-ops-DPwhZt2W.d.mts.map +0 -1
- package/dist/render-typescript-6sCFvMBh.d.mts.map +0 -1
- package/dist/render-typescript-Dqp1Spgn-B128r1qw.mjs.map +0 -1
- package/dist/resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs +0 -22
- package/dist/resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs.map +0 -1
- package/dist/runtime-DOXznQe0.d.mts.map +0 -1
- package/dist/runtime-_TfO66h5.d.mts.map +0 -1
- package/dist/runtime-lHBKgjB9.d.mts.map +0 -1
- package/dist/schema-ir-annotations-DuuYh0gl.d.mts.map +0 -1
- package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts.map +0 -1
- package/dist/sql-renderer-BgC0ZgLS.d.mts.map +0 -1
- package/dist/sql-renderer-ComgusFq-BBlqM1fw.mjs.map +0 -1
- package/dist/sql-utils-DW6fkczF.d.mts.map +0 -1
- package/dist/sql-utils-DuzN3JZg-DiXy4Vah.mjs.map +0 -1
- package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts.map +0 -1
- package/dist/types-B-4d5_4a.d.mts +0 -1
- package/dist/types-CjGjPLr5.d.mts.map +0 -1
- package/dist/types-CkryN1AS-BcQRGsDn.d.mts +0 -27
- package/dist/types-CkryN1AS-BcQRGsDn.d.mts.map +0 -1
- package/dist/types-ue6jkJyF-BQJzjx1P.d.mts.map +0 -1
- /package/dist/{adapter__operation-types.mjs → target__operation-types.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-migration-BSWmeRLo-CUfVTUf0.mjs","names":["#current","#endView","#startView","#renames"],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-migration-BSWmeRLo.mjs"],"sourcesContent":["import { c as postgresError, t as errorPostgresMigrationStackMissing } from \"./errors-BrhQYgdL.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-C6w1rzOF.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { r as PostgresSchemaNodeKind, 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 { n as emissionSchemaForNamespace, r as resolveDdlSchemaForNamespaceStorage, t as ddlSchemaOfCallSchema } from \"./resolve-ddl-schema-D3VNPMSm.mjs\";\nimport { r as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from \"./diff-database-schema-DAEzWtzU.mjs\";\nimport { c as issueNode, n as resolveNamespaceIdForDdlSchema } from \"./control-policy-DtU5u9Dm.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-Cz9Yoeim.mjs\";\nimport { i as hasAutoincrementDefault } from \"./autoincrement-widths-DonNJgfS.mjs\";\nimport { A as RenameColumnCall, C as DropNativeEnumTypeCall, D as DropTableCall, E as DropSchemaCall, F as RenameTableCall, I as SetDefaultCall, L as SetNotNullCall, M as RenameIndexCall, N as RenamePostgresRlsPolicyCall, O as EnableRowLevelSecurityCall, P as RenameSchemaCall, R as SetTableSchemaCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, U as renameTableStatement, Y as installExtension, _ as DisableRowLevelSecurityCall, a as AddNativeEnumValueCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddForeignKeyCall, j as RenameConstraintCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddPrimaryKeyCall, p as CreatePostgresRlsPolicyCall, r as AddColumnWithTemporaryDefaultCall, s as AddRequiredColumnToEmptyTableCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall, z as alterColumnTypeCallText } from \"./op-factory-call-gGX-mZu-.mjs\";\nimport { a as stackDataTypes, o as writtenColumnType } from \"./planner-sql-checks-D-K44J19.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-BO2elRMz.mjs\";\nimport { t as dataTransform } from \"./data-transform-h9agBu_c.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { nameOf, namingOf, namingOfLiveName, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { sqlTextOf } from \"@internal/sql-relational-core/contract-free\";\nimport { resolveColumnRenameAgainst, resolveTableRenameAgainst, sqlTypeLookupsOf, unmatchedColumnRename, unmatchedTableRename } from \"@internal/family-sql/control\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR, sqlColumnTypesEqual } from \"@internal/sql-schema-ir/types\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\nimport { errorMigrationOperationOptionRemoved } from \"@internal/errors/migration\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-contract-to-schema.ts\n/**\n* The Postgres schema tree a contract describes, as the planner's \"from\" side:\n* the target descriptor's `migrations.contractToSchema` hook and the trees\n* `renameTable` compares to find its companion renames both go through here,\n* so they are built with the same type lookups and default resolver.\n*/\nfunction postgresContractToSchema(contract, frameworkComponents) {\n\tconst types = sqlTypeLookupsOf(frameworkComponents);\n\treturn contractToPostgresDatabaseSchemaNode(blindCast(contract), {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n}\n//#endregion\n//#region src/core/migrations/index-and-check-renames.ts\n/**\n* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n* deterministic by sorted names — the same structure as the policy pass\n* below (which stays untouched: policies pair by hash only).\n*\n* Hash pairing (prefix-only renames): extras whose live names parse as\n* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n* in sorted-name order consume the sorted-name-first candidate.\n*\n* Content pairing (exact→wire convergence), after hash pairing has\n* consumed its matches: the remaining wire-named-missing nodes\n* (`prefix` defined) against the remaining extras of any name shape,\n* paired iff content-equal (columns ordered-strict both-defined-or-\n* both-undefined, `unique`/`type` strict, `options` loose, bodies\n* byte-equal).\n*\n* Leftovers proceed as create/drop exactly as before; without the\n* widening allowance the pass is skipped and pairing degrades to the\n* additive half, like the policy pass.\n*/\nfunction pairIndexRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst rename = (missingFinding, candidate) => {\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t};\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\tconst sortedExtras = [...extra].sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\tconst candidate = sortedExtras.find((extraFinding) => !consumed.has(extraFinding.issue) && extraFinding.ddlSchema === missingFinding.ddlSchema && extraFinding.tableName === missingFinding.tableName && missingFinding.node.contentEquals(extraFinding.node, {\n\t\t\tcolumnPresence: \"matching\",\n\t\t\tbodies: \"verbatim\"\n\t\t}));\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n/**\n* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n* check on the same table whose wire-name content hashes match but whose\n* prefixes differ is a prefix-only rename, and collapses into one\n* `ALTER TABLE … RENAME CONSTRAINT`.\n*\n* This is the index pass's hash-pairing phase and nothing else. There is\n* deliberately no content-pairing phase: a live check body is whatever\n* Postgres reprinted, so it never byte-matches the authored text, and\n* pairing an exact-named live check by content would bless whatever\n* predicate is actually live. Adoption of an old exact-named check stays\n* drop + add.\n*\n* Runs only when the policy allows `widening` (rename's class). Without it\n* the pass no-ops and the pair degrades to an add and a drop, and the drop,\n* which is `widening` too, is refused as a conflict.\n*/\nfunction pairCheckRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, \"checkConstraint\", candidate.node.name, missingFinding.node.name));\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n//#endregion\n//#region src/core/migrations/schema-tables.ts\n/**\n* The tables of a Postgres schema, addressed by `contract`'s namespace ids, each mapped to its DDL\n* schema.\n*/\nfunction postgresSchemaTables(schema, contract) {\n\tconst tableIn = (namespaceId, table) => schema.namespaces[resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId)]?.tables[table];\n\tconst hasTable = (namespaceId, table) => tableIn(namespaceId, table) !== void 0;\n\treturn {\n\t\thasTable,\n\t\thasColumn: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column),\n\t\ttablesNamed: (namespaceId, table) => hasTable(namespaceId, table) ? [table] : [],\n\t\tcolumnsNamed: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column) ? [column] : [],\n\t\thasNamespace: (namespaceId) => {\n\t\t\tconst schemaName = resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId);\n\t\t\treturn schema.existingSchemas.includes(schemaName);\n\t\t},\n\t\tnamespacesWithTable: (table) => Object.keys(contract.storage.namespaces).filter((namespaceId) => hasTable(namespaceId, table))\n\t};\n}\n//#endregion\n//#region src/core/migrations/table-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a table rename. Each primary key, unique constraint and\n* foreign key of the renamed table is paired with the destination constraint of the same kind on\n* the same columns, and for a foreign key the same referenced columns. Foreign keys pair first\n* with destination keys to the same referenced table, and the rest then pair with keys to another\n* table, because a later rename in the same plan may change that table and a foreign key's derived\n* name never depends on it. A paired constraint is renamed to the destination's explicit name, or else\n* to the name the planner derives from the new table name, when that differs from its name in the\n* database. Each destination constraint pairs with at most one constraint, in order. An unpaired\n* constraint is being dropped or changed and keeps its name. Indexes and checks are not handled\n* here: their wire names pair by content hash in the index and check rename passes.\n*/\nfunction constraintRenamesForTableRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: true,\n\t\tonColumns: () => true\n\t});\n}\n/**\n* The renames of the constraints in `scope` that pair with a destination constraint of the same\n* kind on the same columns, to the destination's explicit name or else the derived one.\n*/\nfunction pairedConstraintRenames(input, scope) {\n\tconst { schemaName, previous, next } = input;\n\tconst table = next.name;\n\tconst rename = (kind, actualName, target) => {\n\t\tassertDefined(actualName, `the table \"${previous.name}\" has a ${kind} that has no name; the working schema names every primary key, unique and foreign key a rename can change`);\n\t\treturn target === void 0 || target === actualName ? [] : [new RenameConstraintCall(schemaName, table, kind, actualName, target)];\n\t};\n\tconst nextPrimaryKey = next.primaryKey;\n\tconst primaryKey = previous.primaryKey === void 0 || !scope.primaryKey ? [] : rename(\"primaryKey\", previous.primaryKey.name, nextPrimaryKey !== void 0 && isArrayEqual(previous.primaryKey.columns, nextPrimaryKey.columns) ? nextPrimaryKey.name ?? defaultPrimaryKeyName(table) : void 0);\n\tconst pairedUniques = /* @__PURE__ */ new Set();\n\tconst uniques = previous.uniques.filter((unique) => scope.onColumns(unique.columns)).flatMap((unique) => {\n\t\tconst paired = next.uniques.find((candidate) => !pairedUniques.has(candidate) && isArrayEqual(candidate.columns, unique.columns));\n\t\tif (paired !== void 0) pairedUniques.add(paired);\n\t\treturn rename(\"unique\", unique.name, paired === void 0 ? void 0 : paired.name ?? defaultUniqueName(table, paired.columns));\n\t});\n\tconst previousForeignKeys = previous.foreignKeys.filter((fk) => scope.onColumns(fk.columns));\n\tconst pairing = pairForeignKeys(previousForeignKeys, next.foreignKeys);\n\tconst foreignKeys = previousForeignKeys.flatMap((fk) => {\n\t\tconst paired = pairing.get(fk);\n\t\treturn rename(\"foreignKey\", fk.name, paired === void 0 ? void 0 : paired.name ?? defaultForeignKeyName(table, fk.columns));\n\t});\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* Pairs old foreign keys with destination keys on the same columns and referenced columns. Every\n* key to the same referenced table pairs first, so an old key with no such match cannot take the\n* destination key another old key keeps; the remaining keys then pair in order.\n*/\nfunction pairForeignKeys(previous, next) {\n\tconst pairs = /* @__PURE__ */ new Map();\n\tconst taken = /* @__PURE__ */ new Set();\n\tconst pass = (accepts) => {\n\t\tfor (const fk of previous) {\n\t\t\tif (pairs.has(fk)) continue;\n\t\t\tconst paired = next.find((candidate) => !taken.has(candidate) && isArrayEqual(candidate.columns, fk.columns) && isArrayEqual(candidate.referencedColumns, fk.referencedColumns) && accepts(fk, candidate));\n\t\t\tif (paired === void 0) continue;\n\t\t\tpairs.set(fk, paired);\n\t\t\ttaken.add(paired);\n\t\t}\n\t};\n\tpass((fk, candidate) => candidate.referencedTable === fk.referencedTable && candidate.resolvedReferencedNamespace === fk.resolvedReferencedNamespace);\n\tpass(() => true);\n\treturn pairs;\n}\n//#endregion\n//#region src/core/migrations/column-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a column rename. Each unique constraint and foreign key on\n* the renamed column is paired with the destination constraint of the same kind on the same\n* columns, and renamed to the destination's explicit name, or else to the name the planner derives\n* from the table and the new column names, when that differs from its name in the database. The\n* primary key's derived name does not depend on its columns, so it is left alone. `previous` is\n* the table after the column rename, its constraint names as they are in the database.\n*/\nfunction constraintRenamesForColumnRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: false,\n\t\tonColumns: (columns) => columns.includes(input.column)\n\t});\n}\n//#endregion\n//#region src/core/migrations/working-schema.ts\nfunction rewriteRefs(refs, rewrite) {\n\treturn refs?.map(rewrite);\n}\n/**\n* Rewrites the step of `kind` and `id` in a ref that runs through the given table, and the table\n* step itself when `kind` is the table kind.\n*/\nfunction stepRewrite(schemaName, tableName, kind, fromId, toId) {\n\treturn (ref) => {\n\t\tconst namespaceStep = ref[1];\n\t\tconst tableStep = ref[2];\n\t\tif (namespaceStep?.nodeKind !== PostgresSchemaNodeKind.namespace || namespaceStep.id !== schemaName || tableStep?.nodeKind !== PostgresSchemaNodeKind.table || tableStep.id !== tableName) return ref;\n\t\treturn ref.map((step, index) => index >= 2 && step.nodeKind === kind && step.id === fromId ? {\n\t\t\tnodeKind: kind,\n\t\t\tid: toId\n\t\t} : step);\n\t};\n}\nfunction withPrimaryKey(primaryKey, name, rewrite, columnName) {\n\treturn new PrimaryKey({\n\t\tcolumns: primaryKey.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(primaryKey.dependsOn, rewrite))\n\t});\n}\nfunction withUnique(unique, name, rewrite, columnName) {\n\treturn new SqlUniqueIR({\n\t\tcolumns: unique.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"annotations\", unique.annotations),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(unique.dependsOn, rewrite))\n\t});\n}\nfunction withForeignKey(fk, overrides, rewrite, columnName) {\n\treturn new SqlForeignKeyIR({\n\t\tcolumns: fk.columns.map(columnName),\n\t\treferencedTable: overrides.referencedTable,\n\t\treferencedColumns: overrides.referencedColumns ?? fk.referencedColumns,\n\t\t...ifDefined(\"referencedSchema\", overrides.referencedSchema ?? fk.referencedSchema),\n\t\t...ifDefined(\"name\", overrides.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t...ifDefined(\"resolvedReferencedNamespace\", overrides.referencedSchema ?? fk.resolvedReferencedNamespace),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(fk.dependsOn, rewrite))\n\t});\n}\n/**\n* An index whose definition carries SQL text, an expression or a predicate, keeps its columns as\n* they are: a column named inside the text cannot be renamed here, so the diff plans the index.\n*/\nfunction withIndex(index, naming, rewrite, columnName) {\n\tconst columnsFollow = index.expression === void 0 && index.where === void 0;\n\tconst base = {\n\t\tnaming,\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.partial,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: index.annotations,\n\t\tdependsOn: rewriteRefs(index.dependsOn, rewrite)\n\t};\n\treturn new SqlIndexIR(index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: (index.columns ?? []).map(columnsFollow ? columnName : (c) => c)\n\t});\n}\nfunction withCheck(check, naming, rewrite) {\n\treturn new SqlCheckConstraintIR({\n\t\tnaming,\n\t\texpression: check.expression,\n\t\tdependsOn: rewriteRefs(check.dependsOn, rewrite)\n\t});\n}\nfunction withPolicy(policy, overrides, rewrite) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: overrides.naming,\n\t\ttableName: overrides.tableName,\n\t\tnamespaceId: overrides.namespaceId ?? policy.namespaceId,\n\t\toperation: policy.operation,\n\t\troles: policy.roles,\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: rewriteRefs(policy.dependsOn, rewrite)\n\t});\n}\nfunction unchangedEdit(table) {\n\treturn {\n\t\tname: table.name,\n\t\tprimaryKeyName: (primaryKey) => primaryKey.name,\n\t\tuniqueName: (unique) => unique.name,\n\t\tforeignKey: (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable\n\t\t}),\n\t\tcolumnName: (column) => column,\n\t\tindexNaming: (index) => namingOf(index.name, index.prefix),\n\t\tcheckNaming: (check) => namingOf(check.name, check.prefix),\n\t\tpolicy: (policy) => ({\n\t\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\t\ttableName: policy.tableName\n\t\t})\n\t};\n}\nfunction rebuildTable(table, edit, rewrite) {\n\tconst { columnName } = edit;\n\treturn new PostgresTableSchemaNode({\n\t\tname: edit.name,\n\t\tcolumns: Object.fromEntries(Object.values(table.columns).map((column) => {\n\t\t\tconst name = columnName(column.name);\n\t\t\treturn [name, name === column.name ? column : column.withName(name)];\n\t\t})),\n\t\t...ifDefined(\"primaryKey\", table.primaryKey === void 0 ? void 0 : withPrimaryKey(table.primaryKey, edit.primaryKeyName(table.primaryKey), rewrite, columnName)),\n\t\tuniques: table.uniques.map((unique) => withUnique(unique, edit.uniqueName(unique), rewrite, columnName)),\n\t\tforeignKeys: table.foreignKeys.map((fk) => withForeignKey(fk, edit.foreignKey(fk), rewrite, columnName)),\n\t\tindexes: table.indexes.map((index) => withIndex(index, edit.indexNaming(index), rewrite, columnName)),\n\t\t...ifDefined(\"checks\", table.checks?.map((check) => withCheck(check, edit.checkNaming(check), rewrite))),\n\t\t...ifDefined(\"annotations\", table.annotations),\n\t\tpolicies: table.policies.map((policy) => withPolicy(policy, edit.policy(policy), rewrite)),\n\t\trlsEnabled: table.rlsEnabled\n\t});\n}\n/**\n* Rebuilds every table of the schema: `editFor` returns the edit for a table, or `undefined` to\n* only rewrite its dependencies.\n*/\nfunction mapTables(schema, rewrite, editFor) {\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: Object.fromEntries(Object.entries(schema.namespaces).map(([key, namespace]) => [key, new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: namespace.schemaName,\n\t\t\tnativeEnums: namespace.nativeEnums,\n\t\t\ttables: Object.fromEntries(Object.values(namespace.tables).map((table) => {\n\t\t\t\tconst rebuilt = rebuildTable(table, editFor(namespace.schemaName, table) ?? unchangedEdit(table), rewrite);\n\t\t\t\treturn [rebuilt.name, rebuilt];\n\t\t\t}))\n\t\t})])),\n\t\troles: schema.roles,\n\t\texistingSchemas: schema.existingSchemas,\n\t\tpgVersion: schema.pgVersion\n\t});\n}\n/**\n* The schema with one table under its new name. Foreign keys anywhere that reference the table\n* follow it, its policies and every dependency that names it move with it, and row-level security\n* is carried. Constraint, index, check and policy names do not change: a primary key, unique\n* constraint or foreign key whose name was derived from the old table name gets that name spelled\n* out, since it no longer derives from the table it is on.\n*/\nfunction renameTableInPostgresSchema(schema, rename) {\n\tconst { schemaName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, from, PostgresSchemaNodeKind.table, from, to);\n\tconst referencesRenamed = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === from;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: referencesRenamed(tableSchema, fk) ? to : fk.referencedTable\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== from) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tname: to,\n\t\t\tprimaryKeyName: (primaryKey) => primaryKey.name ?? defaultPrimaryKeyName(from),\n\t\t\tuniqueName: (unique) => unique.name ?? defaultUniqueName(from, unique.columns),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? defaultForeignKeyName(from, fk.columns)\n\t\t\t}),\n\t\t\tpolicy: (policy) => ({\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\ttableName: to\n\t\t\t})\n\t\t};\n\t});\n}\n/**\n* The schema with one table moved to another schema, as `ALTER TABLE … SET SCHEMA` moves it: its\n* constraints, indexes and policies move with it, foreign keys anywhere that reference it follow\n* it, and every dependency that names it moves with it. The destination schema is added when the\n* schema has no node for it.\n*/\nfunction moveTableInPostgresSchema(schema, move) {\n\tconst { table: tableName, from, to } = move;\n\tconst rewrite = (ref) => {\n\t\tconst namespaceStep = ref[1];\n\t\tconst tableStep = ref[2];\n\t\tif (namespaceStep?.nodeKind !== PostgresSchemaNodeKind.namespace || namespaceStep.id !== from || tableStep?.nodeKind !== PostgresSchemaNodeKind.table || tableStep.id !== tableName) return ref;\n\t\treturn ref.map((step, index) => index === 1 ? {\n\t\t\tnodeKind: step.nodeKind,\n\t\t\tid: to\n\t\t} : step);\n\t};\n\tconst rewritten = mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst isMoved = tableSchema === from && table.name === tableName;\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => isMoved ? {\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\tnamespaceId: to\n\t\t\t} : unchanged.policy(policy),\n\t\t\tforeignKey: (fk) => {\n\t\t\t\tconst referencedSchema = fk.resolvedReferencedNamespace ?? tableSchema;\n\t\t\t\tif (referencedSchema === from && fk.referencedTable === tableName) return {\n\t\t\t\t\t...unchanged.foreignKey(fk),\n\t\t\t\t\treferencedSchema: to\n\t\t\t\t};\n\t\t\t\treturn isMoved && fk.resolvedReferencedNamespace === void 0 ? {\n\t\t\t\t\t...unchanged.foreignKey(fk),\n\t\t\t\t\treferencedSchema\n\t\t\t\t} : unchanged.foreignKey(fk);\n\t\t\t}\n\t\t};\n\t});\n\tconst source = rewritten.namespaces[from];\n\tconst moved = source?.tables[tableName];\n\tif (source === void 0 || moved === void 0) return rewritten;\n\tconst destination = rewritten.namespaces[to];\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {\n\t\t\t...rewritten.namespaces,\n\t\t\t[from]: new PostgresNamespaceSchemaNode({\n\t\t\t\tschemaName: source.schemaName,\n\t\t\t\tnativeEnums: source.nativeEnums,\n\t\t\t\ttables: Object.fromEntries(Object.entries(source.tables).filter(([name]) => name !== tableName))\n\t\t\t}),\n\t\t\t[to]: new PostgresNamespaceSchemaNode({\n\t\t\t\tschemaName: to,\n\t\t\t\tnativeEnums: destination?.nativeEnums ?? [],\n\t\t\t\ttables: {\n\t\t\t\t\t...destination?.tables,\n\t\t\t\t\t[tableName]: moved\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\troles: rewritten.roles,\n\t\texistingSchemas: rewritten.existingSchemas,\n\t\tpgVersion: rewritten.pgVersion\n\t});\n}\n/**\n* The schema with one schema renamed, as `ALTER SCHEMA … RENAME TO` renames it: its tables and\n* their policies keep their place in it, and foreign keys and dependencies that name it follow.\n*/\nfunction renameSchemaInPostgresSchema(schema, rename) {\n\tconst { from, to } = rename;\n\tconst rewrite = (ref) => ref[1]?.nodeKind === PostgresSchemaNodeKind.namespace && ref[1].id === from ? ref.map((step, index) => index === 1 ? {\n\t\tnodeKind: step.nodeKind,\n\t\tid: to\n\t} : step) : ref;\n\tconst rewritten = mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => tableSchema === from ? {\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\tnamespaceId: to\n\t\t\t} : unchanged.policy(policy),\n\t\t\tforeignKey: (fk) => (fk.resolvedReferencedNamespace ?? tableSchema) === from ? {\n\t\t\t\t...unchanged.foreignKey(fk),\n\t\t\t\treferencedSchema: to\n\t\t\t} : unchanged.foreignKey(fk)\n\t\t};\n\t});\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: Object.fromEntries(Object.entries(rewritten.namespaces).filter(([key]) => key !== to).map(([key, namespace]) => key === from ? [to, new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: to,\n\t\t\tnativeEnums: namespace.nativeEnums,\n\t\t\ttables: namespace.tables\n\t\t})] : [key, namespace])),\n\t\troles: rewritten.roles,\n\t\texistingSchemas: rewritten.existingSchemas.map((name) => name === from ? to : name),\n\t\tpgVersion: rewritten.pgVersion\n\t});\n}\nfunction withSchema(schema, schemaName) {\n\tif (schema.existingSchemas.includes(schemaName)) return schema;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: schema.namespaces,\n\t\troles: schema.roles,\n\t\texistingSchemas: [...schema.existingSchemas, schemaName],\n\t\tpgVersion: schema.pgVersion\n\t});\n}\n/**\n* The schema with one column under its new name. The table's primary key, unique constraints,\n* foreign keys and plain column indexes name it under the new name, foreign keys anywhere that\n* reference it follow it, and every dependency that names it moves with it. An index with an\n* expression or a predicate, and a check, keep their SQL text. Constraint and index names do not\n* change: a unique constraint or foreign key on the column whose name was derived from the old\n* column name gets that name spelled out.\n*/\nfunction renameColumnInPostgresSchema(schema, rename) {\n\tconst { schemaName, table: tableName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.column, `column:${from}`, `column:${to}`);\n\tconst renamed = (column) => column === from ? to : column;\n\tconst referencesTable = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === tableName;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable,\n\t\t\treferencedColumns: referencesTable(tableSchema, fk) ? fk.referencedColumns.map(renamed) : fk.referencedColumns\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tcolumnName: renamed,\n\t\t\tuniqueName: (unique) => unique.name ?? (unique.columns.includes(from) ? defaultUniqueName(tableName, unique.columns) : void 0),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? (fk.columns.includes(from) ? defaultForeignKeyName(tableName, fk.columns) : void 0)\n\t\t\t})\n\t\t};\n\t});\n}\nfunction renamedNaming(previous, name) {\n\treturn previous.prefix === void 0 ? namingOf(name, void 0) : namingOfLiveName(name);\n}\nfunction renameConstraint(schema, call) {\n\tconst schemaName = ddlSchemaOfCallSchema(call.schemaName);\n\tconst { tableName, oldConstraintName, newConstraintName } = call;\n\tconst renamed = (name, derived) => (name ?? derived) === oldConstraintName ? newConstraintName : name;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.check, `check:${oldConstraintName}`, `check:${newConstraintName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\tswitch (call.kind) {\n\t\t\tcase \"primaryKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tprimaryKeyName: (primaryKey) => renamed(primaryKey.name, defaultPrimaryKeyName(tableName))\n\t\t\t};\n\t\t\tcase \"unique\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tuniqueName: (unique) => renamed(unique.name, defaultUniqueName(tableName, unique.columns))\n\t\t\t};\n\t\t\tcase \"foreignKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tforeignKey: (fk) => ({\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\tname: renamed(fk.name, defaultForeignKeyName(tableName, fk.columns))\n\t\t\t\t})\n\t\t\t};\n\t\t\tcase \"checkConstraint\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tcheckNaming: (check) => check.name === oldConstraintName ? renamedNaming(check, newConstraintName) : unchanged.checkNaming(check)\n\t\t\t};\n\t\t}\n\t});\n}\nfunction renameIndex(schema, call) {\n\tconst schemaName = ddlSchemaOfCallSchema(call.schemaName);\n\tconst { tableName, oldIndexName, newIndexName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.index, `index:${oldIndexName}`, `index:${newIndexName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tindexNaming: (index) => index.name === oldIndexName ? renamedNaming(index, newIndexName) : unchanged.indexNaming(index)\n\t\t};\n\t});\n}\nfunction renamePolicy(schema, call) {\n\tconst schemaName = ddlSchemaOfCallSchema(call.schemaName);\n\tconst { tableName, oldPolicyName, newPolicyName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, PostgresSchemaNodeKind.policy, oldPolicyName, newPolicyName), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => policy.name === oldPolicyName ? {\n\t\t\t\tnaming: renamedNaming(policy, newPolicyName),\n\t\t\t\ttableName: policy.tableName\n\t\t\t} : unchanged.policy(policy)\n\t\t};\n\t});\n}\nfunction applied(schema, call) {\n\tif (call instanceof CreateSchemaCall) return withSchema(schema, call.schemaName);\n\tif (call instanceof RenameSchemaCall) return renameSchemaInPostgresSchema(schema, {\n\t\tfrom: call.schemaName,\n\t\tto: call.toSchemaName\n\t});\n\tif (call instanceof SetTableSchemaCall) return moveTableInPostgresSchema(schema, {\n\t\ttable: call.tableName,\n\t\tfrom: ddlSchemaOfCallSchema(call.schemaName),\n\t\tto: call.toSchemaName\n\t});\n\tif (call instanceof RenameTableCall) {\n\t\tconst renamed = renameTableInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOfCallSchema(call.schemaName),\n\t\t\tfrom: call.oldTableName,\n\t\t\tto: call.tableName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameColumnCall) {\n\t\tconst renamed = renameColumnInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOfCallSchema(call.schemaName),\n\t\t\ttable: call.tableName,\n\t\t\tfrom: call.oldColumnName,\n\t\t\tto: call.columnName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameConstraintCall) return renameConstraint(schema, call);\n\tif (call instanceof RenameIndexCall) return renameIndex(schema, call);\n\treturn renamePolicy(schema, call);\n}\n/** The working schema of a plan or a migration, starting from `initial`. */\nfunction createWorkingSchema(initial) {\n\treturn new WorkingSchemaImpl(initial);\n}\nvar WorkingSchemaImpl = class {\n\t#current;\n\tconstructor(initial) {\n\t\tthis.#current = initial;\n\t}\n\tget current() {\n\t\treturn this.#current;\n\t}\n\tapply(call) {\n\t\tthis.#current = applied(this.#current, call);\n\t}\n};\n//#endregion\n//#region src/core/migrations/table-rename-calls.ts\nconst RENAME_POLICY = { allowedOperationClasses: [\"widening\"] };\n/**\n* The `renameTable` call a user writes in `migration.ts` for `rename`. `schema` names the namespace\n* the facade resolves the table in, and is left out for the unbound namespace or when not given.\n*/\nfunction renderRenameTableCall(rename) {\n\treturn new RenameTableCall(rename.namespaceId ?? UNBOUND_NAMESPACE_ID, rename.from, rename.to, []).renderTypeScript();\n}\n/** The SQL a user runs against the database to rename the table by hand. */\nfunction renameTableByHandStatements(contract, rename) {\n\treturn [renameTableStatement(emissionSchemaForNamespace(contract, rename.namespaceId), rename.from, rename.to)];\n}\n/** How a user renames a table of `contract` by hand on Postgres. */\nfunction postgresTableRenameByHand(contract) {\n\treturn {\n\t\trenderTableRename: renderRenameTableCall,\n\t\ttableRenameByHand: (rename) => renameTableByHandStatements(contract, rename)\n\t};\n}\nfunction tableNode(schema, ddlSchema, tableName) {\n\tconst table = schema.namespaces[ddlSchema]?.tables[tableName];\n\tassertDefined(table, `a resolved rename names table \"${tableName}\" in schema \"${ddlSchema}\"`);\n\treturn table;\n}\n/**\n* The call that renames a table, carrying as companions the renames of the objects on the table\n* whose names derive from the table name: each primary key, unique constraint and foreign key the\n* destination keeps, named as the destination names it, and each wire-named index and check whose\n* prefix changes. `previous` is the schema before the rename; the renamed copy is diffed against\n* the destination built from `contract`.\n*/\nfunction postgresTableRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameTableInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst onRenamedTable = (call) => call.schemaName === schemaName && call.tableName === rename.to;\n\tconst pairing = {\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t};\n\treturn new RenameTableCall(schemaName, rename.from, rename.to, [\n\t\t...constraintRenamesForTableRename({\n\t\t\tschemaName,\n\t\t\tprevious: tableNode(renamed, ddlSchema, rename.to),\n\t\t\tnext: tableNode(expected, ddlSchema, rename.to)\n\t\t}),\n\t\t...pairIndexRenames(pairing, issues).calls.filter(onRenamedTable),\n\t\t...pairCheckRenames(pairing, issues).calls.filter(onRenamedTable)\n\t]);\n}\n/**\n* The call that renames a column, carrying as companions the renames of the objects on its table\n* whose names derive from the column name: each unique constraint and foreign key on the column\n* the destination keeps, named as the destination names it, and each index on the column renamed\n* to the destination's wire name. `previous` is the schema before the rename; the renamed copy is\n* diffed against the destination built from `contract`. A check on the column keeps its name: its\n* expression names the column, so the diff replaces it.\n*/\nfunction postgresColumnRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameColumnInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\ttable: rename.table,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst table = tableNode(renamed, ddlSchema, rename.table);\n\tconst destination = expected.namespaces[ddlSchema]?.tables[rename.table];\n\tconst indexesOnColumn = new Set(table.indexes.filter((index) => index.columns?.includes(rename.to)).map((index) => index.name));\n\tconst indexRenames = pairIndexRenames({\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t}, issues).calls.filter((call) => call.schemaName === schemaName && call.tableName === rename.table && indexesOnColumn.has(call.oldIndexName));\n\treturn new RenameColumnCall(schemaName, rename.table, rename.from, rename.to, [...destination === void 0 ? [] : constraintRenamesForColumnRename({\n\t\tschemaName,\n\t\tcolumn: rename.to,\n\t\tprevious: table,\n\t\tnext: destination\n\t}), ...indexRenames]);\n}\n//#endregion\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t/** The rename calls this read of `operations` has made so far, in order. */\n\t#renames = [];\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? blindCast(stack.adapter.create(stack)) : void 0;\n\t}\n\tframeworkComponents() {\n\t\tconst stack = this.stack;\n\t\tif (stack === void 0) return [];\n\t\treturn [\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t];\n\t}\n\tdataTypes() {\n\t\treturn stackDataTypes(this.frameworkComponents());\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit an `ALTER TABLE … SET SCHEMA` operation that moves `table` from `schema` to the schema\n\t* `to`. Leave out `schema` for a table of the unbound namespace. Indexes, constraints and owned\n\t* sequences move with the table, and foreign keys from other tables keep pointing at it. Later\n\t* rename calls find the table in its new schema.\n\t*/\n\tsetTableSchema(options) {\n\t\tconst call = new SetTableSchemaCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.to);\n\t\tconst op = call.toOp(this.controlAdapterFor(\"setTableSchema\"));\n\t\tthis.#renames.push(call);\n\t\treturn op;\n\t}\n\t/**\n\t* Emit an `ALTER SCHEMA … RENAME TO` operation. Everything in the schema keeps its place in it,\n\t* and later rename calls find its tables under the new name.\n\t*/\n\trenameSchema(options) {\n\t\tconst call = new RenameSchemaCall(options.schema, options.to);\n\t\tconst op = call.toOp(this.controlAdapterFor(\"renameSchema\"));\n\t\tthis.#renames.push(call);\n\t\treturn op;\n\t}\n\t/**\n\t* Emit a `DROP SCHEMA` operation, without `CASCADE`. Drop or move the schema's tables first: the\n\t* operation fails its precheck while the schema still holds anything.\n\t*/\n\tdropSchema(options) {\n\t\treturn new DropSchemaCall(options.schema).toOp(this.controlAdapterFor(\"dropSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\tconst adapter = this.controlAdapterFor(\"addColumn\");\n\t\treturn new AddColumnCall(options.schema, options.table, options.column, this.dataTypes()).toOp(adapter);\n\t}\n\t/**\n\t* Adds a required column of `type` to a table that may have rows. Every existing row takes\n\t* `temporaryDefault`, SQL such as `''` or `0`, and the default is dropped once the column is added.\n\t*/\n\taddColumnWithTemporaryDefault(options) {\n\t\tconst adapter = this.controlAdapterFor(\"addColumnWithTemporaryDefault\");\n\t\treturn new AddColumnWithTemporaryDefaultCall(options.schema, options.table, options.column, options.type, sqlTextOf(options.temporaryDefault, `addColumnWithTemporaryDefault ${JSON.stringify(options.table)}.${JSON.stringify(options.column)} temporaryDefault`), this.dataTypes()).toOp(adapter);\n\t}\n\t/** Adds a required column of `type` with no default, checking first that the table is empty. */\n\taddRequiredColumnToEmptyTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"addRequiredColumnToEmptyTable\");\n\t\treturn new AddRequiredColumnToEmptyTableCall(options.schema, options.table, options.column, options.type, this.dataTypes()).toOp(adapter);\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, sqlTextOf(options.expression, `addCheckConstraint ${JSON.stringify(options.constraint)} expression`)).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\trenameCheckConstraint(options) {\n\t\treturn this.renameConstraint({\n\t\t\t...options,\n\t\t\tkind: \"checkConstraint\"\n\t\t});\n\t}\n\trenameConstraint(options) {\n\t\tconst call = new RenameConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.kind, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameConstraint\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\t/**\n\t* Emit the operations that rename a table: the table rename, then a rename of each primary key,\n\t* unique constraint, foreign key, index and check whose name was derived from the old table name.\n\t* The old name is resolved against the schema as this migration's earlier rename calls\n\t* (`renameTable`, `renameIndex`, `renameConstraint`, `renameRlsPolicy`) leave it, and the new\n\t* name against the end contract, so the companions start from names an earlier rename gave.\n\t* Spread the result into `operations`:\n\t* `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`. `schema` names the table's\n\t* namespace when more than one declares the table. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when\n\t* the table does not exist at that point of the migration or the end contract lacks the new name.\n\t*/\n\trenameTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameTable\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\tfrom: options.table,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedTableRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveTableRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresTableRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* Emit the operations that rename a column: the column rename, then a rename of each unique\n\t* constraint, foreign key and index on the column whose name was derived from the old column\n\t* name, to the name the end contract gives it. The column is resolved against the schema as this\n\t* migration's earlier rename calls leave it, so a column of a table an earlier `renameTable`\n\t* renamed is named on the table's new name. Spread the result into `operations`:\n\t* `...this.renameColumn({ table: 'User', column: 'name', to: 'fullName' })`. `schema` names the\n\t* table's namespace when more than one declares the table. Throws\n\t* `MIGRATION.COLUMN_RENAME_UNMATCHED` when the table or column does not exist at that point of\n\t* the migration, the table already has the new column, or the end contract lacks it.\n\t*/\n\trenameColumn(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameColumn\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\ttable: options.table,\n\t\t\tfrom: options.column,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedColumnRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveColumnRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresColumnRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* The start contract's schema with this read's rename calls applied in order. It is built only\n\t* when a rename or a `setDefault` needs it, so a migration that calls neither never reads its\n\t* start contract.\n\t*/\n\tschemaAfterRenames(startContract) {\n\t\tconst working = createWorkingSchema(postgresContractToSchema(startContract, this.frameworkComponents()));\n\t\tfor (const call of this.#renames) working.apply(call);\n\t\treturn working.current;\n\t}\n\tbeginOperationsRead() {\n\t\tthis.#renames = [];\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\trefuseInvalidAlterColumnTypeOptions(options);\n\t\tconst adapter = this.controlAdapterFor(\"alterColumnType\");\n\t\tconst using = optionalSqlTextOf(options.using, `alterColumnType ${JSON.stringify(options.table)}.${JSON.stringify(options.column)} using`);\n\t\tconst call = new AlterColumnTypeCall({\n\t\t\tschemaName: options.schema,\n\t\t\ttableName: options.table,\n\t\t\tcolumnName: options.column,\n\t\t\ttype: options.type,\n\t\t\t...ifDefined(\"raw\", options.raw),\n\t\t\t...ifDefined(\"using\", using === void 0 ? void 0 : {\n\t\t\t\tkind: \"sql\",\n\t\t\t\tsql: using\n\t\t\t}),\n\t\t\tdataTypes: this.dataTypes(),\n\t\t\t...ifDefined(\"operationClass\", options.operationClass),\n\t\t\townsAutoincrementSequence: this.startColumnHasAutoincrementDefault(options.schema, options.table, options.column)\n\t\t});\n\t\tif (using !== void 0) this.refuseUnchangedTypeConversion(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tstartColumnHasAutoincrementDefault(schema, table, column) {\n\t\tconst startColumn = this.startColumnAfterRenames(schema, table, column);\n\t\treturn startColumn !== void 0 && hasAutoincrementDefault(startColumn);\n\t}\n\t/** The column in the start contract's schema after this migration's earlier renames. */\n\tstartColumnAfterRenames(schema, table, column) {\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) return void 0;\n\t\treturn this.schemaAfterRenames(startContract).namespaces[ddlSchemaOfCallSchema(schema)]?.tables[table]?.columns[column];\n\t}\n\t/**\n\t* Refuses an `alterColumnType` with `using` to the type the start contract, after this migration's earlier renames, already gives the column. Its postcheck compares only the type, which already holds, so the runner would skip the conversion. Other earlier operations of the migration, such as an earlier `alterColumnType`, are not applied to the start contract.\n\t*/\n\trefuseUnchangedTypeConversion(call) {\n\t\tconst column = this.startColumnAfterRenames(call.schemaName, call.tableName, call.columnName);\n\t\tif (column === void 0) return;\n\t\tconst written = writtenColumnType(call.type, this.dataTypes());\n\t\tif (written === void 0 || !sqlColumnTypesEqual(column, written)) return;\n\t\tconst where = alterColumnTypeCallText(call.schemaName, call.tableName, call.columnName);\n\t\tthrow postgresError(\"MIGRATION.ALTER_COLUMN_TYPE_USING_WITHOUT_TYPE_CHANGE\", `${where}: the start contract, after the earlier renames in this migration, already gives the column the type ${JSON.stringify(call.type)}, so the conversion in using would never run`, {\n\t\t\twhy: \"The runner skips an operation whose postchecks already hold. alterColumnType checks only that the column has the new type, which holds before it runs, so the values would never be converted.\",\n\t\t\tfix: \"Write the conversion as a dataTransform, which checks the rows themselves, or change the column to another type.\",\n\t\t\tmeta: {\n\t\t\t\twhere,\n\t\t\t\ttype: call.type\n\t\t\t}\n\t\t});\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\t/**\n\t* Emit an `ALTER COLUMN … SET DEFAULT` operation. It is widening when this migration's start contract, after the renames made earlier in the migration, gives the column a default, and additive otherwise.\n\t*/\n\tsetDefault(options) {\n\t\trefuseEarlierSetDefaultOptions(options);\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, this.columnHasDefaultAfterRenames(options.schema, options.table, options.column.name) ? \"widening\" : \"additive\").toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\t/**\n\t* Whether the column, found by schema, table and column name in the start contract after this migration's earlier renames, has a default.\n\t*/\n\tcolumnHasDefaultAfterRenames(schema, table, column) {\n\t\treturn this.startColumnAfterRenames(schema, table, column)?.resolvedDefault !== void 0;\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: sqlTextOf(options.expression, `createIndex ${JSON.stringify(options.index)} expression`) }, options.extras === void 0 ? void 0 : createIndexExtrasOf(options.extras, options.index)).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\tconst call = new RenameIndexCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameIndex\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\tconst policyName = JSON.stringify(nameOf(options.policy.naming));\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: optionalSqlTextOf(options.policy.using, `createRlsPolicy ${policyName} using`),\n\t\t\twithCheck: optionalSqlTextOf(options.policy.withCheck, `createRlsPolicy ${policyName} withCheck`)\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\tconst call = new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameRlsPolicy\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n};\n/**\n* `setDefault` options an earlier version wrote carry the column's name in `column` and its default as SQL text in `defaultSql`.\n*/\nfunction refuseEarlierSetDefaultOptions(options) {\n\tconst column = options.column;\n\tconst columnIsName = typeof column === \"string\";\n\tif (!columnIsName && !Object.hasOwn(options, \"defaultSql\")) return;\n\tthrow errorMigrationOperationOptionRemoved({\n\t\toperation: \"setDefault\",\n\t\toption: \"defaultSql\",\n\t\tsubject: `column ${JSON.stringify(columnIsName ? column : options.column.name)} of table ${JSON.stringify(options.table)}`,\n\t\trewrite: \"Pass the column as `col(name, type, { default, codecRef })`, with its default written as `lit(value)` or `fn(expression)`, in place of its name and `defaultSql`.\",\n\t\tupgradeEntry: \"migration-ts-column-defaults\"\n\t});\n}\n/**\n* `alterColumnType` options as a hand-written `migration.ts` may pass them, which `node migration.ts` does not type-check: the\n* `options` object an earlier version wrote, or no `type`.\n*/\nfunction refuseInvalidAlterColumnTypeOptions(options) {\n\tif (Object.hasOwn(options, \"options\")) throw errorMigrationOperationOptionRemoved({\n\t\toperation: \"alterColumnType\",\n\t\toption: \"options\",\n\t\tsubject: `column ${JSON.stringify(options.column)} of table ${JSON.stringify(options.table)}`,\n\t\trewrite: \"Pass `{ schema, table, column, type, using? }`: move `options.qualifiedTargetType` to `type` and `options.using` to `using`, and drop the other options.\",\n\t\tupgradeEntry: \"postgres-alter-column-type-plain-options\"\n\t});\n\tconst type = options.type;\n\tif (typeof type === \"string\") return;\n\tconst where = alterColumnTypeCallText(options.schema, options.table, options.column);\n\tthrow postgresError(\"MIGRATION.COLUMN_TYPE_UNREADABLE\", `${where}: it has no \\`type\\``, {\n\t\twhy: \"A column type change needs the new type, and node migration.ts does not check the types of the options it is given.\",\n\t\tfix: \"Pass `{ schema, table, column, type, using? }`, with `type` written as a migration writes it, such as int4 or varchar(20).\",\n\t\tmeta: {\n\t\t\ttype: String(type),\n\t\t\twhere\n\t\t}\n\t});\n}\nfunction optionalSqlTextOf(value, what) {\n\treturn value === void 0 ? void 0 : sqlTextOf(value, what);\n}\nfunction createIndexExtrasOf(extras, index) {\n\tconst { where, ...rest } = extras;\n\tconst what = `createIndex ${JSON.stringify(index)} where`;\n\treturn {\n\t\t...rest,\n\t\t...ifDefined(\"where\", optionalSqlTextOf(where, what))\n\t};\n}\n//#endregion\nexport { renameTableByHandStatements as a, postgresSchemaTables as c, postgresContractToSchema as d, postgresTableRenameCall as i, pairCheckRenames as l, postgresColumnRenameCall as n, renderRenameTableCall as o, postgresTableRenameByHand as r, createWorkingSchema as s, PostgresMigration as t, pairIndexRenames as u };\n\n//# sourceMappingURL=postgres-migration-BSWmeRLo.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,yBAAyB,UAAU,qBAAqB;CAChE,MAAM,QAAQ,iBAAiB,mBAAmB;CAClD,OAAO,qCAAqC,UAAU,QAAQ,GAAG;EAChE,qBAAqB;EACrB,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,gBAAgB;CACjB,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,iBAAiB,SAAS,QAAQ;CAC1C,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,Q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AAI,CAAC,gBAAgB,CAAC,OAAO,OAAO,SAAS,YAAY,GAAG;CAC5D,MAAM,qCAAqC;EAC1C,WAAW;EACX,QAAQ;EACR,SAAS,UAAU,KAAK,UAAU,eAAe,SAAS,QAAQ,OAAO,IAAI,EAAE,YAAY,KAAK,UAAU,QAAQ,KAAK;EACvH,SAAS;EACT,cAAc;CACf,CAAC;AACF;;;;;AAKA,SAAS,oCAAoC,SAAS;CACrD,IAAI,OAAO,OAAO,SAAS,SAAS,GAAG,MAAM,qCAAqC;EACjF,WAAW;EACX,QAAQ;EACR,SAAS,UAAU,KAAK,UAAU,QAAQ,MAAM,EAAE,YAAY,KAAK,UAAU,QAAQ,KAAK;EAC1F,SAAS;EACT,cAAc;CACf,CAAC;CACD,MAAM,OAAO,QAAQ;CACrB,IAAI,OAAO,SAAS,UAAU;CAC9B,MAAM,QAAQ,wBAAwB,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM;CACnF,MAAM,cAAc,oCAAoC,GAAG,MAAM,uBAAuB;EACvF,KAAK;EACL,KAAK;EACL,MAAM;GACL,MAAM,OAAO,IAAI;GACjB;EACD;CACD,CAAC;AACF;AACA,SAAS,kBAAkB,OAAO,MAAM;CACvC,OAAO,UAAU,KAAK,IAAI,KAAK,IAAI,UAAU,OAAO,IAAI;AACzD;AACA,SAAS,oBAAoB,QAAQ,OAAO;CAC3C,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,MAAM,OAAO,eAAe,KAAK,UAAU,KAAK,EAAE;CAClD,OAAO;EACN,GAAG;EACH,GAAG,UAAU,SAAS,kBAAkB,OAAO,IAAI,CAAC;CACrD;AACD"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { r as RenderedRlsPolicyLiteral } from "./postgres-rls-policy-CnDxf3z9-
|
|
2
|
-
import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as PostgresContractView } from "./postgres-contract-view-
|
|
1
|
+
import { r as RenderedRlsPolicyLiteral } from "./postgres-rls-policy-CnDxf3z9-BjpVyUnK.mjs";
|
|
2
|
+
import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-D6VtK0jY.mjs";
|
|
3
|
+
import { r as DataTransformOptions } from "./data-transform-nGy9rz87-CE3DGlgn.mjs";
|
|
4
|
+
import { i as ForeignKeySpec, o as RenamableConstraintKind, r as CreateIndexExtras, t as AlterColumnTypeClass } from "./indexes-BYf6nXVv-BXwLw7fO.mjs";
|
|
5
|
+
import { t as PostgresContractView } from "./postgres-contract-view-BFzIDwwN-hL3QLe_b.mjs";
|
|
6
6
|
import { DdlColumn, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
|
|
7
7
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
8
8
|
import { ControlStack } from "@prisma/orm-framework/components/control";
|
|
9
|
+
import { SqlTextInput } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
9
10
|
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
10
11
|
import { Migration } from "@prisma/orm-family-sql/family/migration";
|
|
11
12
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
12
13
|
import { SqlControlAdapter } from "@prisma/orm-family-sql/family/control-adapter";
|
|
13
|
-
//#region ../../../3-targets/
|
|
14
|
+
//#region ../../../3-targets/postgres/1-target/dist/postgres-migration-C5deJ3Ne.d.mts
|
|
14
15
|
//#region src/core/migrations/postgres-migration.d.ts
|
|
15
16
|
/**
|
|
16
17
|
* Target-owned base class for Postgres migrations.
|
|
@@ -50,6 +51,8 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
50
51
|
*/
|
|
51
52
|
protected readonly controlAdapter: SqlControlAdapter<'postgres'> | undefined;
|
|
52
53
|
constructor(stack?: ControlStack<'sql', 'postgres'>);
|
|
54
|
+
private frameworkComponents;
|
|
55
|
+
private dataTypes;
|
|
53
56
|
/**
|
|
54
57
|
* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming
|
|
55
58
|
* `operation` when the migration was constructed without a `ControlStack`.
|
|
@@ -94,6 +97,32 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
94
97
|
readonly schema: string;
|
|
95
98
|
readonly ifNotExists?: boolean;
|
|
96
99
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
100
|
+
/**
|
|
101
|
+
* Emit an `ALTER TABLE … SET SCHEMA` operation that moves `table` from `schema` to the schema
|
|
102
|
+
* `to`. Leave out `schema` for a table of the unbound namespace. Indexes, constraints and owned
|
|
103
|
+
* sequences move with the table, and foreign keys from other tables keep pointing at it. Later
|
|
104
|
+
* rename calls find the table in its new schema.
|
|
105
|
+
*/
|
|
106
|
+
protected setTableSchema(options: {
|
|
107
|
+
readonly schema?: string;
|
|
108
|
+
readonly table: string;
|
|
109
|
+
readonly to: string;
|
|
110
|
+
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
111
|
+
/**
|
|
112
|
+
* Emit an `ALTER SCHEMA … RENAME TO` operation. Everything in the schema keeps its place in it,
|
|
113
|
+
* and later rename calls find its tables under the new name.
|
|
114
|
+
*/
|
|
115
|
+
protected renameSchema(options: {
|
|
116
|
+
readonly schema: string;
|
|
117
|
+
readonly to: string;
|
|
118
|
+
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
119
|
+
/**
|
|
120
|
+
* Emit a `DROP SCHEMA` operation, without `CASCADE`. Drop or move the schema's tables first: the
|
|
121
|
+
* operation fails its precheck while the schema still holds anything.
|
|
122
|
+
*/
|
|
123
|
+
protected dropSchema(options: {
|
|
124
|
+
readonly schema: string;
|
|
125
|
+
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
97
126
|
/**
|
|
98
127
|
* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed
|
|
99
128
|
* native enum. Builds a typed DDL node and lowers it through the stored
|
|
@@ -129,6 +158,24 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
129
158
|
readonly table: string;
|
|
130
159
|
readonly column: DdlColumn;
|
|
131
160
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
161
|
+
/**
|
|
162
|
+
* Adds a required column of `type` to a table that may have rows. Every existing row takes
|
|
163
|
+
* `temporaryDefault`, SQL such as `''` or `0`, and the default is dropped once the column is added.
|
|
164
|
+
*/
|
|
165
|
+
protected addColumnWithTemporaryDefault(options: {
|
|
166
|
+
readonly schema: string;
|
|
167
|
+
readonly table: string;
|
|
168
|
+
readonly column: string;
|
|
169
|
+
readonly type: string;
|
|
170
|
+
readonly temporaryDefault: SqlTextInput;
|
|
171
|
+
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
172
|
+
/** Adds a required column of `type` with no default, checking first that the table is empty. */
|
|
173
|
+
protected addRequiredColumnToEmptyTable(options: {
|
|
174
|
+
readonly schema: string;
|
|
175
|
+
readonly table: string;
|
|
176
|
+
readonly column: string;
|
|
177
|
+
readonly type: string;
|
|
178
|
+
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
132
179
|
protected addPrimaryKey(options: {
|
|
133
180
|
readonly schema: string;
|
|
134
181
|
readonly table: string;
|
|
@@ -150,7 +197,7 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
150
197
|
readonly schema: string;
|
|
151
198
|
readonly table: string;
|
|
152
199
|
readonly constraint: string;
|
|
153
|
-
readonly expression:
|
|
200
|
+
readonly expression: SqlTextInput;
|
|
154
201
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
155
202
|
protected renameCheckConstraint(options: {
|
|
156
203
|
readonly schema?: string;
|
|
@@ -158,6 +205,13 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
158
205
|
readonly from: string;
|
|
159
206
|
readonly to: string;
|
|
160
207
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
208
|
+
protected renameConstraint(options: {
|
|
209
|
+
readonly schema?: string;
|
|
210
|
+
readonly table: string;
|
|
211
|
+
readonly kind: RenamableConstraintKind;
|
|
212
|
+
readonly from: string;
|
|
213
|
+
readonly to: string;
|
|
214
|
+
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
161
215
|
protected dropCheckConstraint(options: {
|
|
162
216
|
readonly schema: string;
|
|
163
217
|
readonly table: string;
|
|
@@ -169,6 +223,46 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
169
223
|
readonly constraint: string;
|
|
170
224
|
readonly kind?: 'foreignKey' | 'unique' | 'primaryKey';
|
|
171
225
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
226
|
+
/**
|
|
227
|
+
* Emit the operations that rename a table: the table rename, then a rename of each primary key,
|
|
228
|
+
* unique constraint, foreign key, index and check whose name was derived from the old table name.
|
|
229
|
+
* The old name is resolved against the schema as this migration's earlier rename calls
|
|
230
|
+
* (`renameTable`, `renameIndex`, `renameConstraint`, `renameRlsPolicy`) leave it, and the new
|
|
231
|
+
* name against the end contract, so the companions start from names an earlier rename gave.
|
|
232
|
+
* Spread the result into `operations`:
|
|
233
|
+
* `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`. `schema` names the table's
|
|
234
|
+
* namespace when more than one declares the table. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when
|
|
235
|
+
* the table does not exist at that point of the migration or the end contract lacks the new name.
|
|
236
|
+
*/
|
|
237
|
+
protected renameTable(options: {
|
|
238
|
+
readonly schema?: string;
|
|
239
|
+
readonly table: string;
|
|
240
|
+
readonly to: string;
|
|
241
|
+
}): readonly Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>[];
|
|
242
|
+
/**
|
|
243
|
+
* Emit the operations that rename a column: the column rename, then a rename of each unique
|
|
244
|
+
* constraint, foreign key and index on the column whose name was derived from the old column
|
|
245
|
+
* name, to the name the end contract gives it. The column is resolved against the schema as this
|
|
246
|
+
* migration's earlier rename calls leave it, so a column of a table an earlier `renameTable`
|
|
247
|
+
* renamed is named on the table's new name. Spread the result into `operations`:
|
|
248
|
+
* `...this.renameColumn({ table: 'User', column: 'name', to: 'fullName' })`. `schema` names the
|
|
249
|
+
* table's namespace when more than one declares the table. Throws
|
|
250
|
+
* `MIGRATION.COLUMN_RENAME_UNMATCHED` when the table or column does not exist at that point of
|
|
251
|
+
* the migration, the table already has the new column, or the end contract lacks it.
|
|
252
|
+
*/
|
|
253
|
+
protected renameColumn(options: {
|
|
254
|
+
readonly schema?: string;
|
|
255
|
+
readonly table: string;
|
|
256
|
+
readonly column: string;
|
|
257
|
+
readonly to: string;
|
|
258
|
+
}): readonly Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>[];
|
|
259
|
+
/**
|
|
260
|
+
* The start contract's schema with this read's rename calls applied in order. It is built only
|
|
261
|
+
* when a rename or a `setDefault` needs it, so a migration that calls neither never reads its
|
|
262
|
+
* start contract.
|
|
263
|
+
*/
|
|
264
|
+
private schemaAfterRenames;
|
|
265
|
+
protected beginOperationsRead(): void;
|
|
172
266
|
protected dropTable(options: {
|
|
173
267
|
readonly schema: string;
|
|
174
268
|
readonly table: string;
|
|
@@ -182,8 +276,22 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
182
276
|
readonly schema: string;
|
|
183
277
|
readonly table: string;
|
|
184
278
|
readonly column: string;
|
|
185
|
-
|
|
279
|
+
/** The new type as a migration writes it, such as `int4` or `varchar(20)`. */
|
|
280
|
+
readonly type: string;
|
|
281
|
+
/** The type is a raw type, named by its catalog text, such as `circle` (ADR 273): it is checked as written. */
|
|
282
|
+
readonly raw?: true;
|
|
283
|
+
/** The SQL that converts each value to the new type; by default a cast of the column. */
|
|
284
|
+
readonly using?: SqlTextInput;
|
|
285
|
+
/** By default `data` when `using` is given, and `destructive` otherwise. */
|
|
286
|
+
readonly operationClass?: AlterColumnTypeClass;
|
|
186
287
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
288
|
+
private startColumnHasAutoincrementDefault;
|
|
289
|
+
/** The column in the start contract's schema after this migration's earlier renames. */
|
|
290
|
+
private startColumnAfterRenames;
|
|
291
|
+
/**
|
|
292
|
+
* Refuses an `alterColumnType` with `using` to the type the start contract, after this migration's earlier renames, already gives the column. Its postcheck compares only the type, which already holds, so the runner would skip the conversion. Other earlier operations of the migration, such as an earlier `alterColumnType`, are not applied to the start contract.
|
|
293
|
+
*/
|
|
294
|
+
private refuseUnchangedTypeConversion;
|
|
187
295
|
protected setNotNull(options: {
|
|
188
296
|
readonly schema: string;
|
|
189
297
|
readonly table: string;
|
|
@@ -194,13 +302,18 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
194
302
|
readonly table: string;
|
|
195
303
|
readonly column: string;
|
|
196
304
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
305
|
+
/**
|
|
306
|
+
* Emit an `ALTER COLUMN … SET DEFAULT` operation. It is widening when this migration's start contract, after the renames made earlier in the migration, gives the column a default, and additive otherwise.
|
|
307
|
+
*/
|
|
197
308
|
protected setDefault(options: {
|
|
198
309
|
readonly schema: string;
|
|
199
310
|
readonly table: string;
|
|
200
|
-
readonly column:
|
|
201
|
-
readonly defaultSql: string;
|
|
202
|
-
readonly operationClass?: 'additive' | 'widening';
|
|
311
|
+
readonly column: DdlColumn;
|
|
203
312
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
313
|
+
/**
|
|
314
|
+
* Whether the column, found by schema, table and column name in the start contract after this migration's earlier renames, has a default.
|
|
315
|
+
*/
|
|
316
|
+
private columnHasDefaultAfterRenames;
|
|
204
317
|
protected dropDefault(options: {
|
|
205
318
|
readonly schema: string;
|
|
206
319
|
readonly table: string;
|
|
@@ -210,12 +323,12 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
210
323
|
readonly schema: string;
|
|
211
324
|
readonly table: string;
|
|
212
325
|
readonly index: string;
|
|
213
|
-
readonly extras?:
|
|
326
|
+
readonly extras?: CreateIndexExtrasInput;
|
|
214
327
|
} & ({
|
|
215
328
|
readonly columns: readonly string[];
|
|
216
329
|
readonly expression?: never;
|
|
217
330
|
} | {
|
|
218
|
-
readonly expression:
|
|
331
|
+
readonly expression: SqlTextInput;
|
|
219
332
|
readonly columns?: never;
|
|
220
333
|
})): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
221
334
|
protected renameIndex(options: {
|
|
@@ -246,7 +359,7 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
246
359
|
protected createRlsPolicy(options: {
|
|
247
360
|
readonly schema: string;
|
|
248
361
|
readonly table: string;
|
|
249
|
-
readonly policy:
|
|
362
|
+
readonly policy: RlsPolicyInput;
|
|
250
363
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
251
364
|
protected dropRlsPolicy(options: {
|
|
252
365
|
readonly schema: string;
|
|
@@ -260,6 +373,13 @@ declare abstract class PostgresMigration<Start extends Contract<SqlStorage> = Co
|
|
|
260
373
|
readonly to: string;
|
|
261
374
|
}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
|
|
262
375
|
}
|
|
376
|
+
type CreateIndexExtrasInput = Omit<CreateIndexExtras, 'where'> & {
|
|
377
|
+
readonly where?: SqlTextInput;
|
|
378
|
+
};
|
|
379
|
+
type RlsPolicyInput = Omit<RenderedRlsPolicyLiteral, 'using' | 'withCheck'> & {
|
|
380
|
+
readonly using?: SqlTextInput;
|
|
381
|
+
readonly withCheck?: SqlTextInput;
|
|
382
|
+
};
|
|
263
383
|
//#endregion
|
|
264
384
|
export { PostgresMigration as t };
|
|
265
|
-
//# sourceMappingURL=postgres-migration-
|
|
385
|
+
//# sourceMappingURL=postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-migration-C5deJ3Ne.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAyCuB,kBAAkB,cAAc,SAAS,cAAc,SAAS,aAAa,YAAY,SAAS,cAAc,SAAS,qBAAqB,UAAU,uCAAuC,OAAO;;WAElN;;;;;;;qBAOU,gBAAgB;EACnC,YAAY,QAAQ;UACZ;UACA;;;;;;UAMA;;;;;;MAMJ,eAAe,qBAAqB;;;;;MAKpC,iBAAiB,qBAAqB;;;;;;YAMhC,cAAc,kBAAkB,SAAS,aAAa,UAAU,WAAW,cAAc,SAAS,uBAAuB,QAAQ,0BAA0B;;;;;;YAM3J,YAAY;aACX;aACA;aACA;aACA,kBAAkB;aAClB,uBAAuB;MAC9B,QAAQ,0BAA0B;;;;;;YAM5B,aAAa;aACZ;aACA;MACP,QAAQ,0BAA0B;;;;;;;YAO5B,eAAe;aACd;aACA;aACA;MACP,QAAQ,0BAA0B;;;;;YAK5B,aAAa;aACZ;aACA;MACP,QAAQ,0BAA0B;;;;;YAK5B,WAAW;aACV;MACP,QAAQ,0BAA0B;;;;;;;YAO5B,qBAAqB;aACpB;aACA;aACA;MACP,QAAQ,0BAA0B;;;;;YAK5B,mBAAmB;aAClB;aACA;MACP,QAAQ,0BAA0B;;;;;;;YAO5B,mBAAmB;aAClB;aACA;aACA;MACP,QAAQ,0BAA0B;YAC5B,UAAU;aACT;aACA;aACA,QAAQ;MACf,QAAQ,0BAA0B;;;;;YAK5B,8BAA8B;aAC7B;aACA;aACA;aACA;aACA,kBAAkB;MACzB,QAAQ,0BAA0B;;YAE5B,8BAA8B;aAC7B;a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,0BAA0B;YAC5B,iBAAiB;aAChB;aACA;aACA;aACA;MACP,QAAQ,0BAA0B;YAC5B,uBAAuB;aACtB;aACA;MACP,QAAQ,0BAA0B;YAC5B,wBAAwB;aACvB;aACA;MACP,QAAQ,0BAA0B;YAC5B,gBAAgB;aACf;aACA;aACA,QAAQ;MACf,QAAQ,0BAA0B;YAC5B,cAAc;aACb;aACA;aACA;MACP,QAAQ,0BAA0B;YAC5B,gBAAgB;aACf;aACA;aACA;aACA;MACP,QAAQ,0BAA0B;;KAEnC,yBAAyB,KAAK;WACxB,QAAQ;;KAEd,iBAAiB,KAAK;WAChB,QAAQ;WACR,YAAY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
2
2
|
import { freezeNode } from "@prisma/orm-framework/components/ir";
|
|
3
3
|
import { SqlNode } from "@prisma/orm-family-sql/contract/types";
|
|
4
|
-
//#region ../../../3-targets/
|
|
4
|
+
//#region ../../../3-targets/postgres/1-target/dist/postgres-native-enum-CdP3b_-R.mjs
|
|
5
5
|
function freezeMembers(members) {
|
|
6
6
|
return blindCast(Object.freeze([...members]));
|
|
7
7
|
}
|
|
@@ -42,4 +42,4 @@ var PostgresNativeEnum = class extends SqlNode {
|
|
|
42
42
|
//#endregion
|
|
43
43
|
export { PostgresNativeEnum as t };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=postgres-native-enum-CdP3b_-R-
|
|
45
|
+
//# sourceMappingURL=postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-native-enum-CdP3b_-R.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { freezeNode } from \"@internal/framework-components/ir\";\nimport { SqlNode } from \"@internal/sql-contract/types\";\n//#region src/core/postgres-native-enum.ts\nfunction freezeMembers(members) {\n\treturn blindCast(Object.freeze([...members]));\n}\n/**\n* Postgres contract-IR class for a native enum type (`CREATE TYPE … AS ENUM (…)`).\n*\n* This is an authored, serialized Contract-IR entity — it is registered as an entity\n* kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n* the schema-diff tree will use `PostgresNativeEnumSchemaNode` when the managed phase\n* builds it.\n*\n* A member is a value, not a name→value pair — matching `CREATE TYPE … AS ENUM\n* ('a', 'b')`, which has no separate member name.\n*\n* Target-only concept — no SQL-family abstract. Extends `SqlNode` directly,\n* frozen at construction via `freezeNode(this)`. The `kind: 'postgres-enum'`\n* discriminant is enumerable so it survives JSON. Lives at\n* `storage.namespaces[ns].entries.native_enum[HandleName]`; the entries key\n* (`native_enum`) is the entity-kind descriptor's `kind`, decoupled from this\n* node's own `kind` literal — the same shape as `table`/`StorageTable` and\n* `valueSet`/`StorageValueSet`.\n*/\nvar PostgresNativeEnum = class extends SqlNode {\n\tstatic is(node) {\n\t\treturn typeof node === \"object\" && node !== null && \"kind\" in node && node.kind === \"postgres-enum\";\n\t}\n\tkind = \"postgres-enum\";\n\ttypeName;\n\tmembers;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.typeName = input.typeName;\n\t\tthis.members = freezeMembers(input.members);\n\t\tif (input.control !== void 0) this.control = input.control;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\nexport { PostgresNativeEnum as t };\n\n//# sourceMappingURL=postgres-native-enum-CdP3b_-R.mjs.map"],"mappings":";;;;AAIA,SAAS,cAAc,SAAS;CAC/B,OAAO,UAAU,OAAO,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAC7C;;;;;;;;;;;;;;;;;;;;AAoBA,IAAI,qBAAqB,cAAc,QAAQ;CAC9C,OAAO,GAAG,MAAM;EACf,OAAO,OAAO,SAAS,YAAY,SAAS,QAAQ,UAAU,QAAQ,KAAK,SAAS;CACrF;CACA,OAAO;CACP;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,WAAW,MAAM;EACtB,KAAK,UAAU,cAAc,MAAM,OAAO;EAC1C,IAAI,MAAM,YAAY,KAAK,GAAG,KAAK,UAAU,MAAM;EACnD,WAAW,IAAI;CAChB;AACD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { clipToUtf8Bytes, utf8ByteLength } from "@prisma/orm-framework/utils/text";
|
|
2
|
+
//#region ../../../3-targets/postgres/1-target/dist/postgres-object-name-FPikIvOw.mjs
|
|
3
|
+
/** The name Postgres stores for an identifier it is given: the first 63 bytes, cut on a character boundary. */
|
|
4
|
+
function storedIdentifier(name) {
|
|
5
|
+
return clipToUtf8Bytes(name, 63);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The name Postgres gives an object it names itself, as its `makeObjectName` does: `{first}_{second}_{label}`, or `{first}_{label}` without a second name, with the longer of the two names trimmed by bytes, cut on a character boundary, until the name fits 63 bytes. A SERIAL column's sequence is `(table, column, 'seq')`; an unnamed primary key is `(table, undefined, 'pkey')`.
|
|
9
|
+
*/
|
|
10
|
+
function postgresObjectName(first, second, label) {
|
|
11
|
+
const separators = second === void 0 ? 1 : 2;
|
|
12
|
+
const available = 63 - utf8ByteLength(label) - separators;
|
|
13
|
+
let firstBytes = utf8ByteLength(first);
|
|
14
|
+
let secondBytes = second === void 0 ? 0 : utf8ByteLength(second);
|
|
15
|
+
while (firstBytes + secondBytes > available) if (firstBytes > secondBytes) firstBytes--;
|
|
16
|
+
else secondBytes--;
|
|
17
|
+
const head = clipToUtf8Bytes(first, firstBytes);
|
|
18
|
+
return second === void 0 ? `${head}_${label}` : `${head}_${clipToUtf8Bytes(second, secondBytes)}_${label}`;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { storedIdentifier as n, postgresObjectName as t };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=postgres-object-name-FPikIvOw-B8FfJI7z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-object-name-FPikIvOw-B8FfJI7z.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-object-name-FPikIvOw.mjs"],"sourcesContent":["import { clipToUtf8Bytes, utf8ByteLength } from \"@internal/utils/text\";\n/** The name Postgres stores for an identifier it is given: the first 63 bytes, cut on a character boundary. */\nfunction storedIdentifier(name) {\n\treturn clipToUtf8Bytes(name, 63);\n}\n/**\n* The name Postgres gives an object it names itself, as its `makeObjectName` does: `{first}_{second}_{label}`, or `{first}_{label}` without a second name, with the longer of the two names trimmed by bytes, cut on a character boundary, until the name fits 63 bytes. A SERIAL column's sequence is `(table, column, 'seq')`; an unnamed primary key is `(table, undefined, 'pkey')`.\n*/\nfunction postgresObjectName(first, second, label) {\n\tconst separators = second === void 0 ? 1 : 2;\n\tconst available = 63 - utf8ByteLength(label) - separators;\n\tlet firstBytes = utf8ByteLength(first);\n\tlet secondBytes = second === void 0 ? 0 : utf8ByteLength(second);\n\twhile (firstBytes + secondBytes > available) if (firstBytes > secondBytes) firstBytes--;\n\telse secondBytes--;\n\tconst head = clipToUtf8Bytes(first, firstBytes);\n\treturn second === void 0 ? `${head}_${label}` : `${head}_${clipToUtf8Bytes(second, secondBytes)}_${label}`;\n}\n//#endregion\nexport { storedIdentifier as n, postgresObjectName as t };\n\n//# sourceMappingURL=postgres-object-name-FPikIvOw.mjs.map"],"mappings":";;;AAEA,SAAS,iBAAiB,MAAM;CAC/B,OAAO,gBAAgB,MAAM,EAAE;AAChC;;;;AAIA,SAAS,mBAAmB,OAAO,QAAQ,OAAO;CACjD,MAAM,aAAa,WAAW,KAAK,IAAI,IAAI;CAC3C,MAAM,YAAY,KAAK,eAAe,KAAK,IAAI;CAC/C,IAAI,aAAa,eAAe,KAAK;CACrC,IAAI,cAAc,WAAW,KAAK,IAAI,IAAI,eAAe,MAAM;CAC/D,OAAO,aAAa,cAAc,WAAW,IAAI,aAAa,aAAa;MACtE;CACL,MAAM,OAAO,gBAAgB,OAAO,UAAU;CAC9C,OAAO,WAAW,KAAK,IAAI,GAAG,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,gBAAgB,QAAQ,WAAW,EAAE,GAAG;AACpG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SqlNode } from "@prisma/orm-family-sql/contract/types";
|
|
2
2
|
import { SqlObjectNaming } from "@prisma/orm-family-sql/schema-ir/naming";
|
|
3
|
-
//#region ../../../3-targets/
|
|
3
|
+
//#region ../../../3-targets/postgres/1-target/dist/postgres-rls-policy-CnDxf3z9.d.mts
|
|
4
4
|
//#region src/core/postgres-rls-policy.d.ts
|
|
5
5
|
type RlsPolicyOperation = 'select' | 'insert' | 'update' | 'delete' | 'all';
|
|
6
6
|
interface PostgresRlsPolicyInput {
|
|
@@ -58,4 +58,4 @@ declare class PostgresRlsPolicy extends SqlNode {
|
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
60
|
export { RlsPolicyOperation as i, PostgresRlsPolicyInput as n, RenderedRlsPolicyLiteral as r, PostgresRlsPolicy as t };
|
|
61
|
-
//# sourceMappingURL=postgres-rls-policy-CnDxf3z9-
|
|
61
|
+
//# sourceMappingURL=postgres-rls-policy-CnDxf3z9-BjpVyUnK.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-rls-policy-CnDxf3z9-BjpVyUnK.d.mts","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-rls-policy-CnDxf3z9.d.mts"],"mappings":";;;;KAGK;UACK;;WAEC,QAAQ;;WAER;;WAEA;WACA,WAAW;;WAEX;;WAEA;;WAEA;;WAEA;;;KAGN,oBAAoB,QAAQ,WAAW,uBAAuB,EAAE,aAAa,IAAI,EAAE,WAAW,WAAW,uBAAuB,EAAE,KAAK,aAAa,EAAE;;;;;;;;KAQtJ,2BAA2B,oBAAoB;;;;;;;;;;;;;;cActC,0BAA0B;WAC7B;WACA;WACA;WACA;WACA;WACA,WAAW;WACX;WACA;WACA;WACA;EACT,YAAY,OAAO"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as PostgresSchemaNodeKind } from "./postgres-table-schema-node-BBkitBQh-
|
|
1
|
+
import { n as PostgresSchemaNodeKind } from "./postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs";
|
|
2
2
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
3
|
import { freezeNode } from "@prisma/orm-framework/components/ir";
|
|
4
4
|
import { nameOf } from "@prisma/orm-family-sql/schema-ir/naming";
|
|
5
5
|
import { SqlSchemaIRNode, assertNode, defineNonEnumerable } from "@prisma/orm-family-sql/schema-ir/types";
|
|
6
6
|
import { isArrayEqual } from "@prisma/orm-framework/utils/array-equal";
|
|
7
|
-
//#region ../../../3-targets/
|
|
7
|
+
//#region ../../../3-targets/postgres/1-target/dist/postgres-role-schema-node-B8Z5i5D-.mjs
|
|
8
8
|
/**
|
|
9
9
|
* The root of the Postgres schema-diff tree: one node per database.
|
|
10
10
|
*
|
|
@@ -201,4 +201,4 @@ var PostgresRoleSchemaNode = class PostgresRoleSchemaNode extends SqlSchemaIRNod
|
|
|
201
201
|
//#endregion
|
|
202
202
|
export { PostgresRoleSchemaNode as i, PostgresNamespaceSchemaNode as n, PostgresPolicySchemaNode as r, PostgresDatabaseSchemaNode as t };
|
|
203
203
|
|
|
204
|
-
//# sourceMappingURL=postgres-role-schema-node-B8Z5i5D--
|
|
204
|
+
//# sourceMappingURL=postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/postgres-role-schema-node-B8Z5i5D-.mjs"],"sourcesContent":["import { r as PostgresSchemaNodeKind } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { freezeNode } from \"@internal/framework-components/ir\";\nimport { nameOf } from \"@internal/sql-schema-ir/naming\";\nimport { SqlSchemaIRNode, assertNode, defineNonEnumerable } from \"@internal/sql-schema-ir/types\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\n//#region src/core/schema-ir/postgres-database-schema-node.ts\n/**\n* The root of the Postgres schema-diff tree: one node per database.\n*\n* `id` is the fixed sentinel `'database'` — the root has no siblings and\n* the value is never emitted into migration paths. `isEqualTo` is identity\n* (roots always share the `'database'` id). `children()` yields the namespace\n* nodes followed by the role nodes — both are root-level diff subjects. The\n* differ pairs siblings by `(nodeKind, id)`, so a role and a namespace may\n* share a name without colliding.\n*/\nvar PostgresDatabaseSchemaNode = class PostgresDatabaseSchemaNode extends SqlSchemaIRNode {\n\tnodeKind = PostgresSchemaNodeKind.database;\n\tnamespaces;\n\troles;\n\texistingSchemas;\n\tpgVersion;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.namespaces = Object.freeze({ ...input.namespaces });\n\t\tthis.roles = Object.freeze([...input.roles]);\n\t\tthis.existingSchemas = Object.freeze([...input.existingSchemas]);\n\t\tthis.pgVersion = input.pgVersion;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn \"database\";\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [...Object.values(this.namespaces), ...this.roles];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === PostgresSchemaNodeKind.database;\n\t}\n\tstatic assert(node) {\n\t\tassertNode(node, \"PostgresDatabaseSchemaNode\", PostgresDatabaseSchemaNode.is);\n\t}\n};\n//#endregion\n//#region src/core/schema-ir/postgres-namespace-schema-node.ts\n/**\n* One-per-Postgres-schema diff-tree node. Groups the tables belonging to a\n* single namespace. Per-schema consumers (the relational planner,\n* toSchemaView) read this node's `tables` field structurally via\n* `blindCast`/`SqlSchemaIRNode` — not through a static `SqlSchemaIR`\n* assignment — because `nodeKind` carries this node's own literal\n* (`postgres-namespace`), distinct from `SqlSchemaIR`'s own (`sql-schema`).\n*\n* `id` is the schema name; `isEqualTo` is identity on it; `children()` returns\n* the table nodes plus `nativeEnums`.\n*\n* `nativeEnums` is the diff-tree representation of native enum types the\n* differ pairs — the sole enum carrier, built directly by both sides: the\n* expected (contract-projected) side and introspection alike hand in\n* `PostgresNativeEnumSchemaNode`s.\n*/\nvar PostgresNamespaceSchemaNode = class PostgresNamespaceSchemaNode extends SqlSchemaIRNode {\n\tnodeKind = PostgresSchemaNodeKind.namespace;\n\tschemaName;\n\ttables;\n\tnativeEnums;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.schemaName = input.schemaName;\n\t\tthis.tables = Object.freeze({ ...input.tables });\n\t\tthis.nativeEnums = Object.freeze([...input.nativeEnums ?? []]);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.schemaName;\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [...Object.values(this.tables), ...this.nativeEnums];\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === PostgresSchemaNodeKind.namespace;\n\t}\n\tstatic assert(node) {\n\t\tassertNode(node, \"PostgresNamespaceSchemaNode\", PostgresNamespaceSchemaNode.is);\n\t}\n};\n//#endregion\n//#region src/core/schema-ir/postgres-policy-schema-node.ts\n/**\n* Schema-diff leaf node for a Postgres row-level security policy.\n*\n* This is a derived, transient node walked by the differ — it is NEVER serialized.\n* Built by project-from-contract and project-from-database from their respective\n* `PostgresRlsPolicy` contract entities / introspected rows.\n*\n* `id` is the full physical name. `isEqualTo` is mode-selected by the\n* receiver's `prefix`: a wire-named receiver (`prefix` present) compares ids\n* only — the wire name encodes a body hash, so name-equality is\n* body-equality and predicate bodies are never byte-compared (Postgres\n* reprints them). An exact receiver (`prefix` absent) compares content:\n* `operation`/`permissive` strict, `roles` sorted, and `using ?? ''` /\n* `withCheck ?? ''` verbatim byte-for-byte — reliable precisely when the\n* body text was captured from a Postgres reprint (contract infer).\n*/\nvar PostgresPolicySchemaNode = class PostgresPolicySchemaNode extends SqlSchemaIRNode {\n\tnodeKind = PostgresSchemaNodeKind.policy;\n\tname;\n\ttableName;\n\tnamespaceId;\n\toperation;\n\troles;\n\tpermissive;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = nameOf(input.naming);\n\t\tif (input.naming.kind === \"wire\") this.prefix = input.naming.prefix;\n\t\tthis.tableName = input.tableName;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tthis.operation = input.operation;\n\t\tthis.roles = Object.freeze([...input.roles]);\n\t\tif (input.using !== void 0) this.using = input.using;\n\t\tif (input.withCheck !== void 0) this.withCheck = input.withCheck;\n\t\tthis.permissive = input.permissive;\n\t\tdefineNonEnumerable(this, \"dependsOn\", input.dependsOn);\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tPostgresPolicySchemaNode.assert(node);\n\t\tif (this.prefix !== void 0) return this.id === node.id;\n\t\treturn this.contentEquals(node);\n\t}\n\t/**\n\t* The single policy content-equality relation — the exact-mode\n\t* {@link isEqualTo} and the planner's rename content-pairing both call\n\t* this rather than growing a parallel relation: `operation` and\n\t* `permissive` strict, `roles` compared deduplicated-and-sorted (the same\n\t* set semantics as the wire-hash tuple, so the two never disagree),\n\t* `using`/`withCheck` VERBATIM byte-for-byte with absent ≡ empty —\n\t* deliberately NOT the normalized wire-hash bodies.\n\t*/\n\tcontentEquals(other) {\n\t\treturn this.operation === other.operation && this.permissive === other.permissive && isArrayEqual([...new Set(this.roles)].sort(), [...new Set(other.roles)].sort()) && (this.using ?? \"\") === (other.using ?? \"\") && (this.withCheck ?? \"\") === (other.withCheck ?? \"\");\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === PostgresSchemaNodeKind.policy;\n\t}\n\tstatic assert(node) {\n\t\tassertNode(node, \"PostgresPolicySchemaNode\", PostgresPolicySchemaNode.is);\n\t}\n};\n//#endregion\n//#region src/core/schema-ir/postgres-role-schema-node.ts\n/**\n* Schema-diff leaf node for a Postgres database role.\n*\n* This is a derived, transient node walked by the differ — it is NEVER serialized.\n* Built by project-from-contract and project-from-database from their respective\n* `PostgresRole` contract entities / introspected rows.\n*\n* Roles are cluster-scoped, so `id` is the bare role name. The differ pairs\n* siblings by `(nodeKind, id)`, so a role and a namespace may share a name\n* (role `public`, schema `public`) without colliding. `isEqualTo` compares\n* ids — name-equality is role-equality for cluster-scoped objects.\n*/\nvar PostgresRoleSchemaNode = class PostgresRoleSchemaNode extends SqlSchemaIRNode {\n\tnodeKind = PostgresSchemaNodeKind.role;\n\tname;\n\tnamespaceId;\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.name = input.name;\n\t\tthis.namespaceId = input.namespaceId;\n\t\tfreezeNode(this);\n\t}\n\tget id() {\n\t\treturn this.name;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n\tisEqualTo(other) {\n\t\tconst node = blindCast(other);\n\t\tPostgresRoleSchemaNode.assert(node);\n\t\treturn this.id === node.id;\n\t}\n\tstatic is(node) {\n\t\treturn node.nodeKind === PostgresSchemaNodeKind.role;\n\t}\n\tstatic assert(node) {\n\t\tassertNode(node, \"PostgresRoleSchemaNode\", PostgresRoleSchemaNode.is);\n\t}\n};\n//#endregion\nexport { PostgresDatabaseSchemaNode as i, PostgresPolicySchemaNode as n, PostgresNamespaceSchemaNode as r, PostgresRoleSchemaNode as t };\n\n//# sourceMappingURL=postgres-role-schema-node-B8Z5i5D-.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAI,6BAA6B,MAAM,mCAAmC,gBAAgB;CACzF,WAAW,uBAAuB;CAClC;CACA;CACA;CACA;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,aAAa,OAAO,OAAO,EAAE,GAAG,MAAM,WAAW,CAAC;EACvD,KAAK,QAAQ,OAAO,OAAO,CAAC,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