@prisma/orm-target-postgres 8.0.0-rc.2-dev.2 → 8.0.0-rc.20
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,647 @@
|
|
|
1
|
+
import { S as PG_TEXT_CODEC_ID, n as PG_BOOL_CODEC_ID } from "./codec-ids-BMhEpFwv-B8Zh0s_Q.mjs";
|
|
2
|
+
import { h as postgresCreateNamespace, l as PostgresTableSource } from "./postgres-schema-C6w1rzOF-D1fdwqRx.mjs";
|
|
3
|
+
import { _ as PostgresDropIndex, a as PostgresAlterIndexRename, b as PostgresDropType, c as PostgresAlterTable, d as PostgresCreatePolicy, f as PostgresCreateSchema, g as PostgresDisableRowLevelSecurity, i as DropDefaultAction, l as PostgresAlterTableSetSchema, m as PostgresCreateType, n as AddConstraintAction, o as PostgresAlterPolicyRename, p as PostgresCreateTable, r as AlterColumnTypeAction, s as PostgresAlterSchemaRename, t as AddColumnAction, u as PostgresCreateIndex, v as PostgresDropPolicy, y as PostgresDropSchema } from "./nodes-G8VTh4PM-DNvIhHag.mjs";
|
|
4
|
+
import { opaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
6
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
|
+
import { cfExpr, cfTable, exprSelect } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
8
|
+
//#region ../../../3-targets/postgres/1-target/dist/ddl-B7Rqlz6D.mjs
|
|
9
|
+
/**
|
|
10
|
+
* `to_regclass($1)` with the qualified table name bound as a text parameter.
|
|
11
|
+
* Thin vocabulary wrapper over the core `cfExpr.fn` helper — the target
|
|
12
|
+
* supplies only the template and the codec'd operand.
|
|
13
|
+
*/
|
|
14
|
+
function toRegclass(qualifiedName) {
|
|
15
|
+
return cfExpr.fn({
|
|
16
|
+
method: "to_regclass",
|
|
17
|
+
template: "to_regclass({{self}})",
|
|
18
|
+
self: cfExpr.param(qualifiedName, PG_TEXT_CODEC_ID),
|
|
19
|
+
returns: {
|
|
20
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
21
|
+
nullable: true
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Typed builder for the migration planner's table-existence checks. Produces
|
|
27
|
+
* FROM-less `SELECT to_regclass($1) IS [NOT] NULL AS "result"` ASTs with the
|
|
28
|
+
* qualified table name bound as a text parameter — never inlined into the SQL.
|
|
29
|
+
*
|
|
30
|
+
* `schema` is a namespace coordinate: the framework `__unbound__` sentinel
|
|
31
|
+
* elides the qualifier (search_path decides at runtime); any other id
|
|
32
|
+
* qualifies as `"schema"."table"`.
|
|
33
|
+
*/
|
|
34
|
+
function tableExistsAst(schema, table) {
|
|
35
|
+
const regclass = toRegclass(postgresCreateNamespace({
|
|
36
|
+
id: schema,
|
|
37
|
+
entries: { table: {} }
|
|
38
|
+
}).qualifyTable(table));
|
|
39
|
+
return {
|
|
40
|
+
tableAbsent: () => exprSelect().project("result", regclass.isNull()).build(),
|
|
41
|
+
tablePresent: () => exprSelect().project("result", regclass.isNotNull()).build()
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Typed builder for the migration planner's constraint-existence checks.
|
|
46
|
+
* Produces `SELECT [NOT ]EXISTS (SELECT 1 FROM pg_constraint c JOIN
|
|
47
|
+
* pg_namespace n ON n.oid = c.connamespace WHERE c.conname = $1 AND
|
|
48
|
+
* n.nspname = $2 [AND c.conrelid = to_regclass($3)]) AS "result"` with the
|
|
49
|
+
* constraint name, schema name, and qualified table name bound as text
|
|
50
|
+
* parameters.
|
|
51
|
+
*
|
|
52
|
+
* When `table` is omitted the check matches by name + schema across all
|
|
53
|
+
* tables. Pass `table` to scope the check to a single table (prevents false
|
|
54
|
+
* matches on identically-named constraints in different tables). `schema`
|
|
55
|
+
* is a namespace coordinate: the `__unbound__` sentinel compares `nspname`
|
|
56
|
+
* against `current_schema()` instead of a bound parameter.
|
|
57
|
+
*/
|
|
58
|
+
function constraintExistsAst(options) {
|
|
59
|
+
const namespace = postgresCreateNamespace({
|
|
60
|
+
id: options.schema,
|
|
61
|
+
entries: { table: {} }
|
|
62
|
+
});
|
|
63
|
+
const conditions = [cfExpr.columnRef("c", "conname").eqParam(options.constraintName, PG_TEXT_CODEC_ID), cfExpr.columnRef("n", "nspname").eqExpr(namespace.schemaFilterExpression())];
|
|
64
|
+
if (options.table !== void 0) conditions.push(cfExpr.columnRef("c", "conrelid").eqExpr(toRegclass(namespace.qualifyTable(options.table))));
|
|
65
|
+
const inner = () => exprSelect().from(cfTable("pg_constraint", "c")).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("c", "connamespace"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf(conditions));
|
|
66
|
+
return {
|
|
67
|
+
constraintPresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
68
|
+
constraintAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function checkNamespace(schema) {
|
|
72
|
+
return postgresCreateNamespace({
|
|
73
|
+
id: schema,
|
|
74
|
+
entries: { table: {} }
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function informationSchemaColumns() {
|
|
78
|
+
return new PostgresTableSource({
|
|
79
|
+
schema: "information_schema",
|
|
80
|
+
name: "columns"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function infoSchemaColumnConditions(options) {
|
|
84
|
+
return [
|
|
85
|
+
cfExpr.identifierRef("table_schema").eqExpr(checkNamespace(options.schema).schemaFilterExpression()),
|
|
86
|
+
cfExpr.identifierRef("table_name").eqParam(options.table, PG_TEXT_CODEC_ID),
|
|
87
|
+
cfExpr.identifierRef("column_name").eqParam(options.column, PG_TEXT_CODEC_ID)
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
function infoSchemaColumnQuery(conditions) {
|
|
91
|
+
return exprSelect().from(informationSchemaColumns()).project("one", cfExpr.lit(1)).where(cfExpr.allOf(conditions));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Typed builder for column-existence checks over
|
|
95
|
+
* `information_schema.columns`, with schema, table, and column names bound
|
|
96
|
+
* as text parameters.
|
|
97
|
+
*/
|
|
98
|
+
function columnExistsAst(options) {
|
|
99
|
+
const inner = () => infoSchemaColumnQuery(infoSchemaColumnConditions(options));
|
|
100
|
+
return {
|
|
101
|
+
columnPresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
102
|
+
columnAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Typed nullability check: EXISTS over `information_schema.columns` with
|
|
107
|
+
* `is_nullable` compared against the bound `'YES'` / `'NO'` marker.
|
|
108
|
+
*/
|
|
109
|
+
function columnNullabilityAst(options) {
|
|
110
|
+
const conditions = [...infoSchemaColumnConditions(options), cfExpr.identifierRef("is_nullable").eqParam(options.nullable ? "YES" : "NO", PG_TEXT_CODEC_ID)];
|
|
111
|
+
return exprSelect().project("result", cfExpr.exists(infoSchemaColumnQuery(conditions))).build();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Typed default-presence checks over `information_schema.columns`.
|
|
115
|
+
* `defaultPresent` / `defaultAbsent` assert the column row exists with a
|
|
116
|
+
* non-null / null `column_default`; `noDefault` is the NOT EXISTS variant
|
|
117
|
+
* (also true when the column row is missing entirely).
|
|
118
|
+
*/
|
|
119
|
+
function columnDefaultAst(options) {
|
|
120
|
+
const withDefault = () => infoSchemaColumnQuery([...infoSchemaColumnConditions(options), cfExpr.identifierRef("column_default").isNotNull()]);
|
|
121
|
+
const withoutDefault = () => infoSchemaColumnQuery([...infoSchemaColumnConditions(options), cfExpr.identifierRef("column_default").isNull()]);
|
|
122
|
+
return {
|
|
123
|
+
defaultPresent: () => exprSelect().project("result", cfExpr.exists(withDefault())).build(),
|
|
124
|
+
defaultAbsent: () => exprSelect().project("result", cfExpr.exists(withoutDefault())).build(),
|
|
125
|
+
noDefault: () => exprSelect().project("result", cfExpr.notExists(withDefault())).build()
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Typed check that a column takes its default from the sequence it owns: the column's default (`pg_attrdef`) depends on the sequence `pg_get_serial_sequence` finds for it. A `nextval(...)` default records that dependency on the sequence it reads, so a default that reads another sequence, an earlier default, or no default does not pass. It compares catalog identities, never the default's text.
|
|
130
|
+
*/
|
|
131
|
+
function columnDefaultSequenceAst(options) {
|
|
132
|
+
const regclassOf = (catalog) => cfExpr.raw(`'${catalog}'::regclass`, {
|
|
133
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
134
|
+
nullable: false
|
|
135
|
+
});
|
|
136
|
+
const defaultOnOwnedSequence = exprSelect().from(cfTable("pg_attrdef", "d")).join(cfTable("pg_attribute", "a"), cfExpr.columnRef("a", "attrelid").eqExpr(cfExpr.columnRef("d", "adrelid")).and(cfExpr.columnRef("a", "attnum").eqExpr(cfExpr.columnRef("d", "adnum")))).join(cfTable("pg_depend", "dep"), cfExpr.columnRef("dep", "objid").eqExpr(cfExpr.columnRef("d", "oid"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
137
|
+
cfExpr.columnRef("d", "adrelid").eqExpr(toRegclass(checkNamespace(options.schema).qualifyTable(options.table))),
|
|
138
|
+
cfExpr.columnRef("a", "attname").eqParam(options.column, PG_TEXT_CODEC_ID),
|
|
139
|
+
cfExpr.columnRef("dep", "classid").eqExpr(regclassOf("pg_attrdef")),
|
|
140
|
+
cfExpr.columnRef("dep", "refclassid").eqExpr(regclassOf("pg_class")),
|
|
141
|
+
cfExpr.columnRef("dep", "refobjid").eqExpr(ownedSequenceOf(options))
|
|
142
|
+
]));
|
|
143
|
+
return exprSelect().project("result", cfExpr.exists(defaultOnOwnedSequence)).build();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The sequence the column owns, as a `regclass`, found in the catalog with `pg_get_serial_sequence`; `NULL` when it owns none. A SERIAL column and an identity column both own one, and it keeps its name when the table or column is renamed.
|
|
147
|
+
*/
|
|
148
|
+
function ownedSequenceOf(location) {
|
|
149
|
+
return cfExpr.fn({
|
|
150
|
+
method: "pg_get_serial_sequence",
|
|
151
|
+
template: "pg_get_serial_sequence({{self}}, {{arg0}})::regclass",
|
|
152
|
+
self: cfExpr.param(checkNamespace(location.schema).qualifyTable(location.table), PG_TEXT_CODEC_ID),
|
|
153
|
+
args: [cfExpr.param(location.column, PG_TEXT_CODEC_ID)],
|
|
154
|
+
returns: {
|
|
155
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
156
|
+
nullable: true
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Typed check that a column's autoincrement default has a sequence to use: the column already owns one, whatever its name, or no relation has the name `sequence`, which the operation creates.
|
|
162
|
+
*/
|
|
163
|
+
function sequenceNameAvailableAst(options) {
|
|
164
|
+
const qualifiedSequence = checkNamespace(options.schema).qualifyTable(options.sequence);
|
|
165
|
+
return exprSelect().project("result", ownedSequenceOf(options).isNotNull().or(toRegclass(qualifiedSequence).isNull())).build();
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Typed column-type check: EXISTS over `pg_attribute` joined to `pg_class`
|
|
169
|
+
* and `pg_namespace`, comparing `format_type(a.atttypid, a.atttypmod)`
|
|
170
|
+
* against the bound expected display type and excluding dropped columns.
|
|
171
|
+
*/
|
|
172
|
+
function columnTypeAst(options) {
|
|
173
|
+
const formatType = cfExpr.fn({
|
|
174
|
+
method: "format_type",
|
|
175
|
+
template: "format_type({{self}}, {{arg0}})",
|
|
176
|
+
self: cfExpr.columnRef("a", "atttypid"),
|
|
177
|
+
args: [cfExpr.columnRef("a", "atttypmod")],
|
|
178
|
+
returns: {
|
|
179
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
180
|
+
nullable: false
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
const inner = exprSelect().from(cfTable("pg_attribute", "a")).join(cfTable("pg_class", "c"), cfExpr.columnRef("c", "oid").eqExpr(cfExpr.columnRef("a", "attrelid"))).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("c", "relnamespace"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
184
|
+
cfExpr.columnRef("n", "nspname").eqExpr(checkNamespace(options.schema).schemaFilterExpression()),
|
|
185
|
+
cfExpr.columnRef("c", "relname").eqParam(options.table, PG_TEXT_CODEC_ID),
|
|
186
|
+
cfExpr.columnRef("a", "attname").eqParam(options.column, PG_TEXT_CODEC_ID),
|
|
187
|
+
formatType.eqParam(options.expectedType, PG_TEXT_CODEC_ID),
|
|
188
|
+
cfExpr.columnRef("a", "attisdropped").not()
|
|
189
|
+
]));
|
|
190
|
+
return exprSelect().project("result", cfExpr.exists(inner)).build();
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Typed primary-key existence check over `pg_index` joined to `pg_class`
|
|
194
|
+
* and `pg_namespace`, with a LEFT JOIN on the index relation so an
|
|
195
|
+
* optional `constraintName` can scope the match to a named constraint.
|
|
196
|
+
*/
|
|
197
|
+
function tablePrimaryKeyAst(options) {
|
|
198
|
+
const conditions = [
|
|
199
|
+
cfExpr.columnRef("n", "nspname").eqExpr(checkNamespace(options.schema).schemaFilterExpression()),
|
|
200
|
+
cfExpr.columnRef("c", "relname").eqParam(options.table, PG_TEXT_CODEC_ID),
|
|
201
|
+
cfExpr.columnRef("i", "indisprimary")
|
|
202
|
+
];
|
|
203
|
+
if (options.constraintName !== void 0) conditions.push(cfExpr.columnRef("c2", "relname").eqParam(options.constraintName, PG_TEXT_CODEC_ID));
|
|
204
|
+
const inner = () => exprSelect().from(cfTable("pg_index", "i")).join(cfTable("pg_class", "c"), cfExpr.columnRef("c", "oid").eqExpr(cfExpr.columnRef("i", "indrelid"))).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("c", "relnamespace"))).leftJoin(cfTable("pg_class", "c2"), cfExpr.columnRef("c2", "oid").eqExpr(cfExpr.columnRef("i", "indexrelid"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf(conditions));
|
|
205
|
+
return {
|
|
206
|
+
pkPresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
207
|
+
pkAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Typed emptiness check: NOT EXISTS over the user table itself with
|
|
212
|
+
* `LIMIT 1`. The table is addressed through the namespace's polymorphic
|
|
213
|
+
* `tableSource` (qualified for named schemas, bare for the unbound slot).
|
|
214
|
+
*/
|
|
215
|
+
function tableIsEmptyAst(schema, table) {
|
|
216
|
+
const inner = exprSelect().from(checkNamespace(schema).tableSource(table)).project("one", cfExpr.lit(1)).limit(1);
|
|
217
|
+
return exprSelect().project("result", cfExpr.notExists(inner)).build();
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Typed no-NULL-values data check used by `SET NOT NULL` prechecks:
|
|
221
|
+
* NOT EXISTS over the user table where the column IS NULL.
|
|
222
|
+
*/
|
|
223
|
+
function noNullValuesAst(options) {
|
|
224
|
+
const inner = exprSelect().from(checkNamespace(options.schema).tableSource(options.table)).project("one", cfExpr.lit(1)).where(cfExpr.identifierRef(options.column).isNull());
|
|
225
|
+
return exprSelect().project("result", cfExpr.notExists(inner)).build();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Typed extension existence check over `pg_extension`, with the extension
|
|
229
|
+
* name bound as a text parameter.
|
|
230
|
+
*/
|
|
231
|
+
function extensionExistsAst(extensionName) {
|
|
232
|
+
const inner = () => exprSelect().from(cfTable("pg_extension")).project("one", cfExpr.lit(1)).where(cfExpr.identifierRef("extname").eqParam(extensionName, PG_TEXT_CODEC_ID));
|
|
233
|
+
return {
|
|
234
|
+
extensionPresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
235
|
+
extensionAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Typed RLS-policy existence check over `pg_policies`, with schema, table,
|
|
240
|
+
* and policy names bound as text parameters (never inlined). The `schema`
|
|
241
|
+
* coordinate is the resolved live-database schema name (e.g. `'public'`),
|
|
242
|
+
* compared against `pg_policies.schemaname` as a bound parameter.
|
|
243
|
+
*/
|
|
244
|
+
function rlsPolicyExistsAst(options) {
|
|
245
|
+
const inner = () => exprSelect().from(cfTable("pg_policies")).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
246
|
+
cfExpr.identifierRef("schemaname").eqParam(options.schema, PG_TEXT_CODEC_ID),
|
|
247
|
+
cfExpr.identifierRef("tablename").eqParam(options.table, PG_TEXT_CODEC_ID),
|
|
248
|
+
cfExpr.identifierRef("policyname").eqParam(options.policyName, PG_TEXT_CODEC_ID)
|
|
249
|
+
]));
|
|
250
|
+
return {
|
|
251
|
+
policyPresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
252
|
+
policyAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Typed row-level-security enabled check over `pg_class` joined to
|
|
257
|
+
* `pg_namespace`, comparing `pg_class.relrowsecurity` against the expected
|
|
258
|
+
* boolean. Schema and table names are bound as text parameters.
|
|
259
|
+
*/
|
|
260
|
+
function rlsEnabledAst(schema, table) {
|
|
261
|
+
const inner = (enabled) => exprSelect().from(cfTable("pg_class", "c")).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("c", "relnamespace"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
262
|
+
cfExpr.columnRef("n", "nspname").eqParam(schema, PG_TEXT_CODEC_ID),
|
|
263
|
+
cfExpr.columnRef("c", "relname").eqParam(table, PG_TEXT_CODEC_ID),
|
|
264
|
+
enabled ? cfExpr.columnRef("c", "relrowsecurity") : cfExpr.columnRef("c", "relrowsecurity").not()
|
|
265
|
+
]));
|
|
266
|
+
return {
|
|
267
|
+
rlsEnabled: () => exprSelect().project("result", cfExpr.exists(inner(true))).build(),
|
|
268
|
+
rlsDisabled: () => exprSelect().project("result", cfExpr.exists(inner(false))).build()
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Typed index existence check riding the same `to_regclass` vocabulary as
|
|
273
|
+
* `tableExistsAst`, with the qualified index name bound as a text parameter.
|
|
274
|
+
*/
|
|
275
|
+
function indexExistsAst(schema, indexName) {
|
|
276
|
+
const regclass = toRegclass(checkNamespace(schema).qualifyTable(indexName));
|
|
277
|
+
return {
|
|
278
|
+
indexPresent: () => exprSelect().project("result", regclass.isNotNull()).build(),
|
|
279
|
+
indexAbsent: () => exprSelect().project("result", regclass.isNull()).build()
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Typed native-enum type existence check over `pg_type` joined to
|
|
284
|
+
* `pg_namespace`, restricted to enum types (`typtype = 'e'`). Schema and
|
|
285
|
+
* type name are bound as text parameters; `schema` is a namespace
|
|
286
|
+
* coordinate (the `__unbound__` sentinel compares against
|
|
287
|
+
* `current_schema()`), matching {@link tableExistsAst} et al.
|
|
288
|
+
*/
|
|
289
|
+
function nativeEnumTypeExistsAst(schema, typeName) {
|
|
290
|
+
const inner = () => exprSelect().from(cfTable("pg_type", "t")).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("t", "typnamespace"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
291
|
+
cfExpr.columnRef("n", "nspname").eqExpr(checkNamespace(schema).schemaFilterExpression()),
|
|
292
|
+
cfExpr.columnRef("t", "typname").eqParam(typeName, PG_TEXT_CODEC_ID),
|
|
293
|
+
cfExpr.columnRef("t", "typtype").eqParam("e", PG_TEXT_CODEC_ID)
|
|
294
|
+
]));
|
|
295
|
+
return {
|
|
296
|
+
typePresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
297
|
+
typeAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Typed native-enum member-value existence check over `pg_enum` joined to
|
|
302
|
+
* `pg_type` and `pg_namespace`. Schema, type name, and the candidate member
|
|
303
|
+
* value are bound as text parameters — used by `addNativeEnumValue`'s
|
|
304
|
+
* precheck (value absent) and postcheck (value present).
|
|
305
|
+
*/
|
|
306
|
+
function nativeEnumValueExistsAst(options) {
|
|
307
|
+
const inner = () => exprSelect().from(cfTable("pg_enum", "e")).join(cfTable("pg_type", "t"), cfExpr.columnRef("t", "oid").eqExpr(cfExpr.columnRef("e", "enumtypid"))).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("t", "typnamespace"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
308
|
+
cfExpr.columnRef("n", "nspname").eqExpr(checkNamespace(options.schema).schemaFilterExpression()),
|
|
309
|
+
cfExpr.columnRef("t", "typname").eqParam(options.typeName, PG_TEXT_CODEC_ID),
|
|
310
|
+
cfExpr.columnRef("e", "enumlabel").eqParam(options.value, PG_TEXT_CODEC_ID)
|
|
311
|
+
]));
|
|
312
|
+
return {
|
|
313
|
+
valuePresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
314
|
+
valueAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Whether the attribute numbers in `keys` (an `int2[]` or `int2vector` such as `pg_constraint.conkey` or `pg_index.indkey`) name, in order, exactly the columns `names` of the relation `relation`. Key `0`, an expression slot of an index, names no column.
|
|
319
|
+
*/
|
|
320
|
+
function keyColumnsAre(keys, relation, names) {
|
|
321
|
+
return cfExpr.fn({
|
|
322
|
+
method: "key_columns_are",
|
|
323
|
+
template: "(SELECT coalesce(jsonb_agg(key_attribute.attname ORDER BY key_column.position), '[]'::jsonb) FROM unnest({{self}}::int2[]) WITH ORDINALITY AS key_column(attnum, position) JOIN pg_attribute key_attribute ON key_attribute.attrelid = {{arg0}} AND key_attribute.attnum = key_column.attnum) = ({{arg1}})::jsonb",
|
|
324
|
+
self: keys,
|
|
325
|
+
args: [relation, cfExpr.param(JSON.stringify(names), PG_TEXT_CODEC_ID)],
|
|
326
|
+
returns: {
|
|
327
|
+
codecId: PG_BOOL_CODEC_ID,
|
|
328
|
+
nullable: false
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Typed check that the relation `name` exists and its `pg_class.relkind` is one of `kinds`, so a view, sequence or index of the same name does not pass as a table.
|
|
334
|
+
*/
|
|
335
|
+
function relationKindAst(options) {
|
|
336
|
+
const relation = toRegclass(checkNamespace(options.schema).qualifyTable(options.name));
|
|
337
|
+
const inner = exprSelect().from(cfTable("pg_class", "c")).project("one", cfExpr.lit(1)).where(cfExpr.allOf([cfExpr.columnRef("c", "oid").eqExpr(relation), options.kinds.map((kind) => cfExpr.columnRef("c", "relkind").eqParam(kind, PG_TEXT_CODEC_ID)).reduce((either, kind) => either.or(kind))]));
|
|
338
|
+
return exprSelect().project("result", cfExpr.exists(inner)).build();
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Typed check that the constraint `constraintName` on `table` is of kind `contype` (`p`, `u`, `f` or `c`), on the columns `columns` in order when given, and for a foreign key, references `foreignKey`'s table and columns in order with its delete and update actions. It reads only catalog values, never the text Postgres prints for a constraint.
|
|
342
|
+
*/
|
|
343
|
+
function constraintDefinitionAst(options) {
|
|
344
|
+
const namespace = checkNamespace(options.schema);
|
|
345
|
+
const conditions = [
|
|
346
|
+
cfExpr.columnRef("c", "conname").eqParam(options.constraintName, PG_TEXT_CODEC_ID),
|
|
347
|
+
cfExpr.columnRef("n", "nspname").eqExpr(namespace.schemaFilterExpression()),
|
|
348
|
+
cfExpr.columnRef("c", "conrelid").eqExpr(toRegclass(namespace.qualifyTable(options.table))),
|
|
349
|
+
cfExpr.columnRef("c", "contype").eqParam(options.contype, PG_TEXT_CODEC_ID)
|
|
350
|
+
];
|
|
351
|
+
if (options.columns !== void 0) conditions.push(keyColumnsAre(cfExpr.columnRef("c", "conkey"), cfExpr.columnRef("c", "conrelid"), options.columns));
|
|
352
|
+
const foreignKey = options.foreignKey;
|
|
353
|
+
if (foreignKey !== void 0) conditions.push(cfExpr.columnRef("c", "confrelid").eqExpr(toRegclass(checkNamespace(foreignKey.referencedSchema).qualifyTable(foreignKey.referencedTable))), keyColumnsAre(cfExpr.columnRef("c", "confkey"), cfExpr.columnRef("c", "confrelid"), foreignKey.referencedColumns), cfExpr.columnRef("c", "confdeltype").eqParam(foreignKey.onDelete, PG_TEXT_CODEC_ID), cfExpr.columnRef("c", "confupdtype").eqParam(foreignKey.onUpdate, PG_TEXT_CODEC_ID));
|
|
354
|
+
const inner = exprSelect().from(cfTable("pg_constraint", "c")).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("c", "connamespace"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf(conditions));
|
|
355
|
+
return exprSelect().project("result", cfExpr.exists(inner)).build();
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Typed check that `index` is an index on `table` with the given uniqueness and access method, on the columns `columns` in order, and with or without a predicate. For an index written as an element list (`expression`) it checks no elements: the list can be a real expression, which Postgres stores in `indexprs`, or plain columns with a sort order, operator class or collation, which it stores as columns, and comparing its text would need the form Postgres prints.
|
|
359
|
+
*/
|
|
360
|
+
function indexDefinitionAst(options) {
|
|
361
|
+
const namespace = checkNamespace(options.schema);
|
|
362
|
+
const indexColumn = (name) => cfExpr.columnRef("i", name);
|
|
363
|
+
const inner = exprSelect().from(cfTable("pg_class", "c")).join(cfTable("pg_index", "i"), cfExpr.columnRef("i", "indexrelid").eqExpr(cfExpr.columnRef("c", "oid"))).join(cfTable("pg_am", "m"), cfExpr.columnRef("m", "oid").eqExpr(cfExpr.columnRef("c", "relam"))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
364
|
+
cfExpr.columnRef("c", "oid").eqExpr(toRegclass(namespace.qualifyTable(options.index))),
|
|
365
|
+
cfExpr.columnRef("c", "relkind").eqParam("i", PG_TEXT_CODEC_ID).or(cfExpr.columnRef("c", "relkind").eqParam("I", PG_TEXT_CODEC_ID)),
|
|
366
|
+
indexColumn("indrelid").eqExpr(toRegclass(namespace.qualifyTable(options.table))),
|
|
367
|
+
options.unique ? indexColumn("indisunique") : indexColumn("indisunique").not(),
|
|
368
|
+
cfExpr.columnRef("m", "amname").eqParam(options.method, PG_TEXT_CODEC_ID),
|
|
369
|
+
..."columns" in options.elements ? [indexColumn("indexprs").isNull().and(keyColumnsAre(indexColumn("indkey"), indexColumn("indrelid"), options.elements.columns))] : [],
|
|
370
|
+
options.hasPredicate ? indexColumn("indpred").isNotNull() : indexColumn("indpred").isNull()
|
|
371
|
+
]));
|
|
372
|
+
return exprSelect().project("result", cfExpr.exists(inner)).build();
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Typed check that the RLS policy `policyName` on `table` exists with the command `command` (as `pg_policies.cmd` prints it, such as `ALL` or `SELECT`), the permissive flag, and exactly the roles `roles`, in any order. A role written as `current_user`, `current_role` or `session_user` stands for the role it names in the session that runs the check, as `CREATE POLICY` resolves it. It never compares the policy's expressions.
|
|
376
|
+
*/
|
|
377
|
+
function rlsPolicyDefinitionAst(options) {
|
|
378
|
+
const rolesAre = cfExpr.fn({
|
|
379
|
+
method: "roles_are",
|
|
380
|
+
template: `(SELECT coalesce(jsonb_agg(role_name ORDER BY role_name), '[]'::jsonb) FROM (SELECT DISTINCT policy_role::text COLLATE "C" AS role_name FROM unnest({{self}}) AS policy_role) AS actual_roles) = (SELECT coalesce(jsonb_agg(role_name ORDER BY role_name), '[]'::jsonb) FROM (SELECT DISTINCT (CASE expected_role WHEN 'current_user' THEN current_user::text WHEN 'current_role' THEN current_role::text WHEN 'session_user' THEN session_user::text ELSE expected_role END) COLLATE "C" AS role_name FROM jsonb_array_elements_text(({{arg0}})::jsonb) AS expected_role) AS expected_roles)`,
|
|
381
|
+
self: cfExpr.identifierRef("roles"),
|
|
382
|
+
args: [cfExpr.param(JSON.stringify(options.roles), PG_TEXT_CODEC_ID)],
|
|
383
|
+
returns: {
|
|
384
|
+
codecId: PG_BOOL_CODEC_ID,
|
|
385
|
+
nullable: false
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
const inner = exprSelect().from(cfTable("pg_policies")).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
389
|
+
cfExpr.identifierRef("schemaname").eqParam(options.schema, PG_TEXT_CODEC_ID),
|
|
390
|
+
cfExpr.identifierRef("tablename").eqParam(options.table, PG_TEXT_CODEC_ID),
|
|
391
|
+
cfExpr.identifierRef("policyname").eqParam(options.policyName, PG_TEXT_CODEC_ID),
|
|
392
|
+
cfExpr.identifierRef("cmd").eqParam(options.command, PG_TEXT_CODEC_ID),
|
|
393
|
+
cfExpr.identifierRef("permissive").eqParam(options.permissive ? "PERMISSIVE" : "RESTRICTIVE", PG_TEXT_CODEC_ID),
|
|
394
|
+
rolesAre
|
|
395
|
+
]));
|
|
396
|
+
return exprSelect().project("result", cfExpr.exists(inner)).build();
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Typed check that the column owns a sequence, whatever its name, of the type `sequenceType` (`smallint`, `integer` or `bigint`). With `orNone`, a column that owns no sequence passes too.
|
|
400
|
+
*/
|
|
401
|
+
function columnOwnsSequenceAst(options) {
|
|
402
|
+
const ownedSequence = ownedSequenceOf(options);
|
|
403
|
+
const sequenceType = cfExpr.fn({
|
|
404
|
+
method: "to_regtype",
|
|
405
|
+
template: "to_regtype({{self}})",
|
|
406
|
+
self: cfExpr.param(options.sequenceType, PG_TEXT_CODEC_ID),
|
|
407
|
+
returns: {
|
|
408
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
409
|
+
nullable: true
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
const sequenceOfType = exprSelect().from(cfTable("pg_sequence", "s")).project("one", cfExpr.lit(1)).where(cfExpr.allOf([cfExpr.columnRef("s", "seqrelid").eqExpr(ownedSequence), cfExpr.columnRef("s", "seqtypid").eqExpr(sequenceType)]));
|
|
413
|
+
return exprSelect().project("result", options.orNone ? ownedSequence.isNull().or(cfExpr.exists(sequenceOfType)) : ownedSequence.isNotNull().and(cfExpr.exists(sequenceOfType))).build();
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Typed column-type check by the type's identity: compares the column's `pg_attribute.atttypid` with `to_regtype(type)`, or with that type's array type for a list. It checks a type that claims a kind, such as an enum, whatever schema it is in, and a type the stack's data types do not read. `to_regtype` drops a type modifier, so `varchar(20)` matches any `varchar`.
|
|
417
|
+
*/
|
|
418
|
+
function columnTypeOidAst(options) {
|
|
419
|
+
const namespace = checkNamespace(options.schema);
|
|
420
|
+
const expectedType = cfExpr.fn({
|
|
421
|
+
method: "to_regtype",
|
|
422
|
+
template: options.many ? "(SELECT \"t\".\"typarray\" FROM \"pg_catalog\".\"pg_type\" AS \"t\" WHERE \"t\".\"oid\" = to_regtype({{self}}))" : "to_regtype({{self}})",
|
|
423
|
+
self: cfExpr.param(options.type, PG_TEXT_CODEC_ID),
|
|
424
|
+
returns: {
|
|
425
|
+
codecId: PG_TEXT_CODEC_ID,
|
|
426
|
+
nullable: true
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
const inner = exprSelect().from(cfTable("pg_attribute", "a")).project("one", cfExpr.lit(1)).where(cfExpr.allOf([
|
|
430
|
+
cfExpr.columnRef("a", "attrelid").eqExpr(toRegclass(namespace.qualifyTable(options.table))),
|
|
431
|
+
cfExpr.columnRef("a", "attname").eqParam(options.column, PG_TEXT_CODEC_ID),
|
|
432
|
+
cfExpr.columnRef("a", "atttypid").eqExpr(expectedType),
|
|
433
|
+
cfExpr.columnRef("a", "attisdropped").not()
|
|
434
|
+
]));
|
|
435
|
+
return exprSelect().project("result", cfExpr.exists(inner)).build();
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Typed check that the sequence the column owns has handed out no value above `maxValue`, so narrowing it to a smaller integer type keeps every value it already gave. The sequence's position is read only when its current maximum is above `maxValue`, that is when the change narrows it, so widening needs no rights on the sequence. A sequence that has never been read, and a column that owns none, pass.
|
|
439
|
+
*/
|
|
440
|
+
function sequenceValuesFitAst(options) {
|
|
441
|
+
const pastMax = cfExpr.fn({
|
|
442
|
+
method: "sequence_past_max",
|
|
443
|
+
template: "CASE WHEN {{self}} <= ({{arg0}})::bigint THEN false ELSE coalesce(pg_sequence_last_value(\"s\".\"seqrelid\"), 0) > ({{arg0}})::bigint END",
|
|
444
|
+
self: cfExpr.columnRef("s", "seqmax"),
|
|
445
|
+
args: [cfExpr.param(options.maxValue, PG_TEXT_CODEC_ID)],
|
|
446
|
+
returns: {
|
|
447
|
+
codecId: PG_BOOL_CODEC_ID,
|
|
448
|
+
nullable: false
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
const narrowedPastMax = exprSelect().from(cfTable("pg_sequence", "s")).project("one", cfExpr.lit(1)).where(cfExpr.columnRef("s", "seqrelid").eqExpr(ownedSequenceOf(options)).and(pastMax));
|
|
452
|
+
return exprSelect().project("result", cfExpr.notExists(narrowedPastMax)).build();
|
|
453
|
+
}
|
|
454
|
+
/** Typed schema existence check over `pg_namespace`, with the schema name bound as a text parameter. */
|
|
455
|
+
function schemaExistsAst(schema) {
|
|
456
|
+
const inner = () => exprSelect().from(cfTable("pg_namespace")).project("one", cfExpr.lit(1)).where(cfExpr.identifierRef("nspname").eqParam(schema, PG_TEXT_CODEC_ID));
|
|
457
|
+
return {
|
|
458
|
+
schemaPresent: () => exprSelect().project("result", cfExpr.exists(inner())).build(),
|
|
459
|
+
schemaAbsent: () => exprSelect().project("result", cfExpr.notExists(inner())).build()
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
function objectsInSchema(catalog, namespaceColumn, schema, only = []) {
|
|
463
|
+
return exprSelect().from(cfTable(catalog, "o")).join(cfTable("pg_namespace", "n"), cfExpr.columnRef("n", "oid").eqExpr(cfExpr.columnRef("o", namespaceColumn))).project("one", cfExpr.lit(1)).where(cfExpr.allOf([cfExpr.columnRef("n", "nspname").eqParam(schema, PG_TEXT_CODEC_ID), ...only]));
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Whether a schema holds no relations (tables, views, sequences, indexes), no types of its own and
|
|
467
|
+
* no functions, so `DROP SCHEMA` without `CASCADE` succeeds. A table's row type and an array type
|
|
468
|
+
* belong to another object and are not counted.
|
|
469
|
+
*/
|
|
470
|
+
function schemaHoldsNoObjectsAst(schema) {
|
|
471
|
+
return exprSelect().project("result", cfExpr.allOf([
|
|
472
|
+
cfExpr.notExists(objectsInSchema("pg_class", "relnamespace", schema)),
|
|
473
|
+
cfExpr.notExists(objectsInSchema("pg_type", "typnamespace", schema, [cfExpr.columnRef("o", "typrelid").eqLit(0), cfExpr.columnRef("o", "typelem").eqLit(0)])),
|
|
474
|
+
cfExpr.notExists(objectsInSchema("pg_proc", "pronamespace", schema))
|
|
475
|
+
])).build();
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* After a table of the unbound namespace moves to `toSchema`: the search path finds no table of that
|
|
479
|
+
* name, or finds only the moved one, which it does when `toSchema` is on the search path.
|
|
480
|
+
*/
|
|
481
|
+
function unboundTableMovedAst(table, toSchema) {
|
|
482
|
+
const found = toRegclass(checkNamespace(UNBOUND_NAMESPACE_ID).qualifyTable(table));
|
|
483
|
+
const moved = toRegclass(checkNamespace(toSchema).qualifyTable(table));
|
|
484
|
+
return exprSelect().project("result", found.isNull().or(found.eqExpr(moved))).build();
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Build a Postgres `CREATE TABLE` query node.
|
|
488
|
+
*
|
|
489
|
+
* Pass `constraints` for table-level composite primary keys, foreign keys, and
|
|
490
|
+
* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},
|
|
491
|
+
* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.
|
|
492
|
+
*
|
|
493
|
+
* Precondition: identifiers (`table`, `schema`, column names/types) are
|
|
494
|
+
* emitted to SQL verbatim — they are not quoted or escaped, so callers must
|
|
495
|
+
* pass pre-trusted values (e.g. fixed control-plane identifiers). String-literal
|
|
496
|
+
* default values, by contrast, are single-quote-escaped (embedded `'` doubled)
|
|
497
|
+
* by the renderer. Identifier quoting for untrusted identifiers is added when
|
|
498
|
+
* the migration planner adopts this lowering path.
|
|
499
|
+
*/
|
|
500
|
+
function createTable(options) {
|
|
501
|
+
return new PostgresCreateTable(options);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Build a Postgres `CREATE SCHEMA` query node. See {@link createTable} for the
|
|
505
|
+
* pre-trusted-identifier precondition.
|
|
506
|
+
*/
|
|
507
|
+
function createSchema(options) {
|
|
508
|
+
return new PostgresCreateSchema(options);
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Build a Postgres `CREATE TYPE … AS ENUM (…)` DDL node. The type name (and
|
|
512
|
+
* optional schema) are quoted by the renderer; the enum member `values` are
|
|
513
|
+
* emitted as single-quote-escaped string literals. An absent `schema` renders
|
|
514
|
+
* the type name unqualified so the connection's `search_path` resolves it.
|
|
515
|
+
*/
|
|
516
|
+
function createType(options) {
|
|
517
|
+
return new PostgresCreateType(options);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Build a Postgres `DROP TYPE` DDL node. See {@link createType} for the
|
|
521
|
+
* identifier-quoting and unqualified-when-schemaless behaviour.
|
|
522
|
+
*/
|
|
523
|
+
function dropType(options) {
|
|
524
|
+
return new PostgresDropType(options);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Build an `ADD COLUMN` action for use inside {@link alterTable}.
|
|
528
|
+
* The column is a structured `DdlColumn` so codec-encoded defaults flow
|
|
529
|
+
* through the adapter's `pgRenderDdlColumn` → `pgRenderDdlColumnDefault` path.
|
|
530
|
+
*/
|
|
531
|
+
function addColumnAction(column) {
|
|
532
|
+
return new AddColumnAction(column);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Build a `DROP DEFAULT` action (`ALTER COLUMN "<name>" DROP DEFAULT`) for
|
|
536
|
+
* use inside {@link alterTable}. The renderer quotes the column name.
|
|
537
|
+
*/
|
|
538
|
+
function dropDefaultAction(columnName) {
|
|
539
|
+
return new DropDefaultAction(columnName);
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Build an `ADD CONSTRAINT` action for use inside {@link alterTable}. The renderer writes the constraint as `CREATE TABLE` writes it.
|
|
543
|
+
*/
|
|
544
|
+
function addConstraintAction(constraint) {
|
|
545
|
+
return new AddConstraintAction(constraint);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Build an `ALTER COLUMN "<columnName>" TYPE <type> USING …` action for use inside {@link alterTable}. `type` is written verbatim; `using` is opaque SQL, and when it is absent or empty the conversion is `"<columnName>"::<type>`.
|
|
549
|
+
*/
|
|
550
|
+
function alterColumnTypeAction(options) {
|
|
551
|
+
return new AlterColumnTypeAction({
|
|
552
|
+
columnName: options.columnName,
|
|
553
|
+
type: options.type,
|
|
554
|
+
using: options.using ? opaqueSql(options.using) : void 0
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Build a Postgres `ALTER TABLE` query node carrying one or more actions.
|
|
559
|
+
* See {@link addColumnAction}, {@link dropDefaultAction}, {@link addConstraintAction} and {@link alterColumnTypeAction} for building actions.
|
|
560
|
+
*/
|
|
561
|
+
function alterTable(options) {
|
|
562
|
+
return new PostgresAlterTable(options);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Build a Postgres `CREATE POLICY` DDL node.
|
|
566
|
+
*
|
|
567
|
+
* Identifiers (`schema`, `table`, `name`) are quoted by the renderer.
|
|
568
|
+
* `using` and `withCheck` are emitted verbatim as predicate SQL — callers
|
|
569
|
+
* must supply safe, pre-validated SQL expressions.
|
|
570
|
+
*/
|
|
571
|
+
function createPolicy(options) {
|
|
572
|
+
const { using, withCheck, ...rest } = options;
|
|
573
|
+
return new PostgresCreatePolicy({
|
|
574
|
+
...rest,
|
|
575
|
+
...ifDefined("using", using === void 0 ? void 0 : opaqueSql(using)),
|
|
576
|
+
...ifDefined("withCheck", withCheck === void 0 ? void 0 : opaqueSql(withCheck))
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Build a Postgres `DROP POLICY` DDL node.
|
|
581
|
+
* Identifiers (`schema`, `table`, `name`) are quoted by the renderer.
|
|
582
|
+
*/
|
|
583
|
+
function dropPolicy(options) {
|
|
584
|
+
return new PostgresDropPolicy(options);
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Build a Postgres `ALTER POLICY … RENAME TO` DDL node.
|
|
588
|
+
* Identifiers (`schema`, `table`, `name`, `newName`) are quoted by the renderer.
|
|
589
|
+
*/
|
|
590
|
+
function alterPolicyRename(options) {
|
|
591
|
+
return new PostgresAlterPolicyRename(options);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Build a Postgres `CREATE [UNIQUE] INDEX` DDL node. Identifiers (`schema`,
|
|
595
|
+
* `table`, `name`, column elements, `type`, option keys) are quoted by the
|
|
596
|
+
* renderer; the `expression` element list and the `where` predicate are
|
|
597
|
+
* inserted verbatim (opaque SQL). An absent `schema` renders the object
|
|
598
|
+
* names unqualified (the unbound namespace).
|
|
599
|
+
*/
|
|
600
|
+
function createIndex(options) {
|
|
601
|
+
const { elements, where, ...rest } = options;
|
|
602
|
+
return new PostgresCreateIndex({
|
|
603
|
+
...rest,
|
|
604
|
+
elements: "columns" in elements ? { columns: elements.columns } : { expression: opaqueSql(elements.expression) },
|
|
605
|
+
where: where === void 0 ? void 0 : opaqueSql(where)
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Build a Postgres `DROP INDEX` DDL node. The index name (and optional
|
|
610
|
+
* schema) are quoted by the renderer.
|
|
611
|
+
*/
|
|
612
|
+
function dropIndex(options) {
|
|
613
|
+
return new PostgresDropIndex(options);
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Build a Postgres `ALTER INDEX … RENAME TO` DDL node. Identifiers are
|
|
617
|
+
* quoted by the renderer.
|
|
618
|
+
*/
|
|
619
|
+
function alterIndexRename(options) {
|
|
620
|
+
return new PostgresAlterIndexRename(options);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Build a Postgres `ALTER TABLE … DISABLE ROW LEVEL SECURITY` DDL node.
|
|
624
|
+
* Identifiers (`schema`, `table`) are quoted by the renderer.
|
|
625
|
+
*/
|
|
626
|
+
function disableRowLevelSecurity(options) {
|
|
627
|
+
return new PostgresDisableRowLevelSecurity(options);
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Build a Postgres `ALTER TABLE … SET SCHEMA` DDL node. Identifiers are quoted by the renderer; an
|
|
631
|
+
* absent `schema` leaves the table unqualified (the unbound namespace).
|
|
632
|
+
*/
|
|
633
|
+
function alterTableSetSchema(options) {
|
|
634
|
+
return new PostgresAlterTableSetSchema(options);
|
|
635
|
+
}
|
|
636
|
+
/** Build a Postgres `ALTER SCHEMA … RENAME TO` DDL node. Identifiers are quoted by the renderer. */
|
|
637
|
+
function alterSchemaRename(options) {
|
|
638
|
+
return new PostgresAlterSchemaRename(options);
|
|
639
|
+
}
|
|
640
|
+
/** Build a Postgres `DROP SCHEMA` DDL node, without `CASCADE`. The name is quoted by the renderer. */
|
|
641
|
+
function dropSchema(options) {
|
|
642
|
+
return new PostgresDropSchema(options);
|
|
643
|
+
}
|
|
644
|
+
//#endregion
|
|
645
|
+
export { indexDefinitionAst as A, schemaHoldsNoObjectsAst as B, disableRowLevelSecurity as C, dropSchema as D, dropPolicy as E, relationKindAst as F, tablePrimaryKeyAst as G, sequenceValuesFitAst as H, rlsEnabledAst as I, toRegclass as K, rlsPolicyDefinitionAst as L, nativeEnumTypeExistsAst as M, nativeEnumValueExistsAst as N, dropType as O, noNullValuesAst as P, rlsPolicyExistsAst as R, createType as S, dropIndex as T, tableExistsAst as U, sequenceNameAvailableAst as V, tableIsEmptyAst as W, constraintExistsAst as _, alterPolicyRename as a, createSchema as b, alterTableSetSchema as c, columnExistsAst as d, columnNullabilityAst as f, constraintDefinitionAst as g, columnTypeOidAst as h, alterIndexRename as i, indexExistsAst as j, extensionExistsAst as k, columnDefaultAst as l, columnTypeAst as m, addConstraintAction as n, alterSchemaRename as o, columnOwnsSequenceAst as p, unboundTableMovedAst as q, alterColumnTypeAction as r, alterTable as s, addColumnAction as t, columnDefaultSequenceAst as u, createIndex as v, dropDefaultAction as w, createTable as x, createPolicy as y, schemaExistsAst as z };
|
|
646
|
+
|
|
647
|
+
//# sourceMappingURL=ddl-B7Rqlz6D-B7dRDgYb.mjs.map
|