@prisma/orm-target-postgres 0.16.0-dev.36
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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/adapter-CWvVo0PV.d.mts +22 -0
- package/dist/adapter-CWvVo0PV.d.mts.map +1 -0
- package/dist/adapter-DhqcO3YO-jzwDVcCv.mjs +70 -0
- package/dist/adapter-DhqcO3YO-jzwDVcCv.mjs.map +1 -0
- package/dist/adapter.d.mts +12 -0
- package/dist/adapter.mjs +7 -0
- package/dist/adapter__adapter.d.mts +2 -0
- package/dist/adapter__adapter.mjs +2 -0
- package/dist/adapter__column-types.d.mts +2 -0
- package/dist/adapter__column-types.mjs +2 -0
- package/dist/adapter__control.d.mts +5 -0
- package/dist/adapter__control.mjs +441 -0
- package/dist/adapter__control.mjs.map +1 -0
- package/dist/adapter__operation-types.d.mts +2 -0
- package/dist/adapter__operation-types.mjs +1 -0
- package/dist/adapter__runtime.d.mts +2 -0
- package/dist/adapter__runtime.mjs +38 -0
- package/dist/adapter__runtime.mjs.map +1 -0
- package/dist/adapter__types.d.mts +4 -0
- package/dist/adapter__types.mjs +1 -0
- package/dist/authoring-03FwIL2k-kPjZAp3s.mjs +757 -0
- package/dist/authoring-03FwIL2k-kPjZAp3s.mjs.map +1 -0
- package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts +34 -0
- package/dist/canonicalize-CQlxSR4D-MnrT5gtW.d.mts.map +1 -0
- package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs +59 -0
- package/dist/canonicalize-CrN3u_xM-D4MrOqcB.mjs.map +1 -0
- package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts +37 -0
- package/dist/codec-descriptor-Bec_zukr-BfvtUqhm.d.mts.map +1 -0
- package/dist/codec-descriptor-Bg-_412t.d.mts +1 -0
- package/dist/codec-descriptor-CB6x0xEu-C-Zn2IEz.mjs +135 -0
- package/dist/codec-descriptor-CB6x0xEu-C-Zn2IEz.mjs.map +1 -0
- package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts +33 -0
- package/dist/codec-ids-CsOU3xDv-mPI0INiF.d.mts.map +1 -0
- package/dist/codec-ids-fgafMLR7.d.mts +1 -0
- package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs +33 -0
- package/dist/codec-ids-tX7Svtz--BuOfRaVU.mjs.map +1 -0
- package/dist/codec-types-BHwY9Ff-.d.mts +2 -0
- package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts +82 -0
- package/dist/codec-types-mWhnDEAf-CAQzGFnF.d.mts.map +1 -0
- package/dist/codecs-CBl0nD44-CaWPc1bd.mjs +1486 -0
- package/dist/codecs-CBl0nD44-CaWPc1bd.mjs.map +1 -0
- package/dist/codecs-CHIVTNZs.mjs +15 -0
- package/dist/codecs-CHIVTNZs.mjs.map +1 -0
- package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts +589 -0
- package/dist/codecs-Cvqvb9pV-Cdc51FKY.d.mts.map +1 -0
- package/dist/codecs-DBn-uIv-.d.mts +15 -0
- package/dist/codecs-DBn-uIv-.d.mts.map +1 -0
- package/dist/column-types-BH-MU6uU.d.mts +108 -0
- package/dist/column-types-BH-MU6uU.d.mts.map +1 -0
- package/dist/column-types-CwAyCgp2.mjs +126 -0
- package/dist/column-types-CwAyCgp2.mjs.map +1 -0
- package/dist/contract-free-BZUS18FU.mjs +118 -0
- package/dist/contract-free-BZUS18FU.mjs.map +1 -0
- package/dist/contract-free-DzpGxLfb.d.mts +258 -0
- package/dist/contract-free-DzpGxLfb.d.mts.map +1 -0
- package/dist/control-2F195jJk.d.mts +11 -0
- package/dist/control-2F195jJk.d.mts.map +1 -0
- package/dist/control-6WFTtLAM.mjs +60 -0
- package/dist/control-6WFTtLAM.mjs.map +1 -0
- package/dist/control-B-FTbEnE.d.mts +22 -0
- package/dist/control-B-FTbEnE.d.mts.map +1 -0
- package/dist/control-D85zv_aY.d.mts +199 -0
- package/dist/control-D85zv_aY.d.mts.map +1 -0
- package/dist/control-DRMWptiJ.mjs +1355 -0
- package/dist/control-DRMWptiJ.mjs.map +1 -0
- package/dist/control-adapter-B9t0g7Pf-HrCxlM65.mjs +1901 -0
- package/dist/control-adapter-B9t0g7Pf-HrCxlM65.mjs.map +1 -0
- package/dist/control-policy-Cl3RRSPg-CT3QGpR3.mjs +1257 -0
- package/dist/control-policy-Cl3RRSPg-CT3QGpR3.mjs.map +1 -0
- package/dist/data-transform-BSM7TQpE.d.mts +1 -0
- package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs +53 -0
- package/dist/data-transform-ChZzy2dP-CxVCat_8.mjs.map +1 -0
- package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts +38 -0
- package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +1 -0
- package/dist/ddl-B4Rh8ntj.d.mts +1 -0
- package/dist/ddl-BdP4q3KY-Duef4uHw.mjs +395 -0
- package/dist/ddl-BdP4q3KY-Duef4uHw.mjs.map +1 -0
- package/dist/default-normalizer-B36TOul4.d.mts +31 -0
- package/dist/default-normalizer-B36TOul4.d.mts.map +1 -0
- package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs +253 -0
- package/dist/default-normalizer-Ba5ZebHM-isV86rjy.mjs.map +1 -0
- package/dist/descriptor-meta-2IlVC6_d-DnV00Qd_.mjs +351 -0
- package/dist/descriptor-meta-2IlVC6_d-DnV00Qd_.mjs.map +1 -0
- package/dist/descriptor-meta-DnHabAS3-C53XXPQw.mjs +28 -0
- package/dist/descriptor-meta-DnHabAS3-C53XXPQw.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs +13 -0
- package/dist/descriptor-meta-runtime-UwYdV8fD-B_m_Ha8r.mjs.map +1 -0
- package/dist/diff-database-schema-BfRs2vrG-D2o4KII0.mjs +390 -0
- package/dist/diff-database-schema-BfRs2vrG-D2o4KII0.mjs.map +1 -0
- package/dist/diff-database-schema-DsoNznGC.d.mts +38 -0
- package/dist/diff-database-schema-DsoNznGC.d.mts.map +1 -0
- package/dist/driver.d.mts +3 -0
- package/dist/driver.mjs +2 -0
- package/dist/driver__control.d.mts +2 -0
- package/dist/driver__control.mjs +2 -0
- package/dist/driver__runtime.d.mts +2 -0
- package/dist/driver__runtime.mjs +597 -0
- package/dist/driver__runtime.mjs.map +1 -0
- package/dist/errors-DCcVX4j1.d.mts +32 -0
- package/dist/errors-DCcVX4j1.d.mts.map +1 -0
- package/dist/errors-kYxOQjdD-D4T3rbVp.mjs +39 -0
- package/dist/errors-kYxOQjdD-D4T3rbVp.mjs.map +1 -0
- package/dist/issue-planner-jkY6p-Ca.d.mts +105 -0
- package/dist/issue-planner-jkY6p-Ca.d.mts.map +1 -0
- package/dist/migration-CBSAPE8S.d.mts +25 -0
- package/dist/migration-CBSAPE8S.d.mts.map +1 -0
- package/dist/migration-PTHAY9Cv.mjs +21 -0
- package/dist/migration-PTHAY9Cv.mjs.map +1 -0
- package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs +7 -0
- package/dist/namespace-ids-xtp_ZY86-Cpp8PTxD.mjs.map +1 -0
- package/dist/native-type-normalizer-DqJlOTeX.d.mts +19 -0
- package/dist/native-type-normalizer-DqJlOTeX.d.mts.map +1 -0
- package/dist/native-type-normalizer-yvd3tqv-.mjs +38 -0
- package/dist/native-type-normalizer-yvd3tqv-.mjs.map +1 -0
- package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts +235 -0
- package/dist/nodes-BU-V-aZA-RqwPH68u.d.mts.map +1 -0
- package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs +255 -0
- package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs.map +1 -0
- package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs +121 -0
- package/dist/normalize-error-CNjgVO71-CLlZ3CuJ.mjs.map +1 -0
- package/dist/op-factory-call-DifL68KT-Bo6pxs-R.mjs +2009 -0
- package/dist/op-factory-call-DifL68KT-Bo6pxs-R.mjs.map +1 -0
- package/dist/op-factory-call-FEA5mnWH.d.mts +1 -0
- package/dist/op-factory-call-jd4cgfjA-CyNT4YVn.d.mts +521 -0
- package/dist/op-factory-call-jd4cgfjA-CyNT4YVn.d.mts.map +1 -0
- package/dist/operation-types-BfRocNI8.d.mts +22 -0
- package/dist/operation-types-BfRocNI8.d.mts.map +1 -0
- package/dist/pack-DFM4tmob.d.mts +610 -0
- package/dist/pack-DFM4tmob.d.mts.map +1 -0
- package/dist/planner-Bmje9ii8-B99fEsNM.mjs +588 -0
- package/dist/planner-Bmje9ii8-B99fEsNM.mjs.map +1 -0
- package/dist/planner-DL4Bh5Nk.d.mts +163 -0
- package/dist/planner-DL4Bh5Nk.d.mts.map +1 -0
- package/dist/planner-ddl-builders-CbfICQfm-CxYiLrhX.mjs +102 -0
- package/dist/planner-ddl-builders-CbfICQfm-CxYiLrhX.mjs.map +1 -0
- package/dist/planner-ddl-builders-ijp60-JO.d.mts +19 -0
- package/dist/planner-ddl-builders-ijp60-JO.d.mts.map +1 -0
- package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs +90 -0
- package/dist/planner-identity-values-BmHn5C6U-BYBbUAyR.mjs.map +1 -0
- package/dist/planner-identity-values-TfEhnoWa.d.mts +25 -0
- package/dist/planner-identity-values-TfEhnoWa.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts +25 -0
- package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-C3GPZWeC.d.mts +1 -0
- package/dist/planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs +47 -0
- package/dist/planner-produced-postgres-migration-Cicg2sXg-Ck9iDxGI.mjs.map +1 -0
- package/dist/planner-schema-lookup-C4DHAddq.d.mts +21 -0
- package/dist/planner-schema-lookup-C4DHAddq.d.mts.map +1 -0
- package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs +57 -0
- package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +1 -0
- package/dist/planner-sql-checks-CFgbRTJw.d.mts +20 -0
- package/dist/planner-sql-checks-CFgbRTJw.d.mts.map +1 -0
- package/dist/planner-sql-checks-DRc_78n8-C9nHOrvU.mjs +152 -0
- package/dist/planner-sql-checks-DRc_78n8-C9nHOrvU.mjs.map +1 -0
- package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts +12 -0
- package/dist/planner-target-details-HkP4RrRO-_xPQVPF0.d.mts.map +1 -0
- package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs +15 -0
- package/dist/planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs.map +1 -0
- package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts +36 -0
- package/dist/postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map +1 -0
- package/dist/postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs +144 -0
- package/dist/postgres-contract-view-FdLX7dV9-Cat1VKV9.mjs.map +1 -0
- package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts +285 -0
- package/dist/postgres-database-schema-node-CyfpHXDr-BqyozkQE.d.mts.map +1 -0
- package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts +260 -0
- package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts.map +1 -0
- package/dist/postgres-migration-CJshdIZn-DYYjgdD0.mjs +201 -0
- package/dist/postgres-migration-CJshdIZn-DYYjgdD0.mjs.map +1 -0
- package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs +45 -0
- package/dist/postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs.map +1 -0
- package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts +61 -0
- package/dist/postgres-rls-policy-CnDxf3z9-C3LIHAIG.d.mts.map +1 -0
- package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs +204 -0
- package/dist/postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs.map +1 -0
- package/dist/postgres-schema-KSzLDONj-CsXGoY8b.mjs +421 -0
- package/dist/postgres-schema-KSzLDONj-CsXGoY8b.mjs.map +1 -0
- package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts +269 -0
- package/dist/postgres-schema-Xsjt3RKO-Buv2X8ai.d.mts.map +1 -0
- package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs +212 -0
- package/dist/postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs.map +1 -0
- package/dist/render-ops-DPwhZt2W.d.mts +11 -0
- package/dist/render-ops-DPwhZt2W.d.mts.map +1 -0
- package/dist/render-ops-DxzTxSsv-Bz85uUHk.mjs +34 -0
- package/dist/render-ops-DxzTxSsv-Bz85uUHk.mjs.map +1 -0
- package/dist/render-typescript-6sCFvMBh.d.mts +21 -0
- package/dist/render-typescript-6sCFvMBh.d.mts.map +1 -0
- package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs +117 -0
- package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs.map +1 -0
- package/dist/resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs +22 -0
- package/dist/resolve-ddl-schema-CxqlLW47-0GiHRziS.mjs.map +1 -0
- package/dist/runtime-BbSRVwdd.d.mts +12 -0
- package/dist/runtime-BbSRVwdd.d.mts.map +1 -0
- package/dist/runtime-CDewySU9.d.mts +55 -0
- package/dist/runtime-CDewySU9.d.mts.map +1 -0
- package/dist/runtime-_TfO66h5.d.mts +32 -0
- package/dist/runtime-_TfO66h5.d.mts.map +1 -0
- package/dist/schema-ir-annotations-DuuYh0gl.d.mts +15 -0
- package/dist/schema-ir-annotations-DuuYh0gl.d.mts.map +1 -0
- package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts +30 -0
- package/dist/schema-node-kinds-qlnURWJy-Bo30pwTM.d.mts.map +1 -0
- package/dist/sql-utils-BnBlQxyh-DaX9Nb7Z.mjs +90 -0
- package/dist/sql-utils-BnBlQxyh-DaX9Nb7Z.mjs.map +1 -0
- package/dist/sql-utils-DW6fkczF.d.mts +62 -0
- package/dist/sql-utils-DW6fkczF.d.mts.map +1 -0
- package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts +15 -0
- package/dist/table-source-ikHOZmhD-DriY1Lcr.d.mts.map +1 -0
- package/dist/target.d.mts +47 -0
- package/dist/target.mjs +34 -0
- package/dist/target__codec-descriptor.d.mts +3 -0
- package/dist/target__codec-descriptor.mjs +2 -0
- package/dist/target__codec-ids.d.mts +3 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +4 -0
- package/dist/target__codec-types.mjs +1 -0
- package/dist/target__codecs.d.mts +3 -0
- package/dist/target__codecs.mjs +3 -0
- package/dist/target__contract-free.d.mts +3 -0
- package/dist/target__contract-free.mjs +4 -0
- package/dist/target__control.d.mts +2 -0
- package/dist/target__control.mjs +2 -0
- package/dist/target__data-transform.d.mts +3 -0
- package/dist/target__data-transform.mjs +2 -0
- package/dist/target__ddl.d.mts +4 -0
- package/dist/target__ddl.mjs +2 -0
- package/dist/target__default-normalizer.d.mts +2 -0
- package/dist/target__default-normalizer.mjs +2 -0
- package/dist/target__diff-database-schema.d.mts +2 -0
- package/dist/target__diff-database-schema.mjs +2 -0
- package/dist/target__errors.d.mts +2 -0
- package/dist/target__errors.mjs +2 -0
- package/dist/target__issue-planner.d.mts +2 -0
- package/dist/target__issue-planner.mjs +2 -0
- package/dist/target__migration.d.mts +4 -0
- package/dist/target__migration.mjs +5 -0
- package/dist/target__native-type-normalizer.d.mts +2 -0
- package/dist/target__native-type-normalizer.mjs +2 -0
- package/dist/target__op-factory-call.d.mts +3 -0
- package/dist/target__op-factory-call.mjs +2 -0
- package/dist/target__pack.d.mts +2 -0
- package/dist/target__pack.mjs +2 -0
- package/dist/target__planner-ddl-builders.d.mts +2 -0
- package/dist/target__planner-ddl-builders.mjs +2 -0
- package/dist/target__planner-identity-values.d.mts +2 -0
- package/dist/target__planner-identity-values.mjs +2 -0
- package/dist/target__planner-produced-postgres-migration.d.mts +3 -0
- package/dist/target__planner-produced-postgres-migration.mjs +2 -0
- package/dist/target__planner-schema-lookup.d.mts +2 -0
- package/dist/target__planner-schema-lookup.mjs +2 -0
- package/dist/target__planner-sql-checks.d.mts +2 -0
- package/dist/target__planner-sql-checks.mjs +2 -0
- package/dist/target__planner-target-details.d.mts +2 -0
- package/dist/target__planner-target-details.mjs +1 -0
- package/dist/target__planner.d.mts +2 -0
- package/dist/target__planner.mjs +3 -0
- package/dist/target__render-ops.d.mts +2 -0
- package/dist/target__render-ops.mjs +2 -0
- package/dist/target__render-typescript.d.mts +2 -0
- package/dist/target__render-typescript.mjs +2 -0
- package/dist/target__rls-canonicalize.d.mts +2 -0
- package/dist/target__rls-canonicalize.mjs +2 -0
- package/dist/target__runtime.d.mts +3 -0
- package/dist/target__runtime.mjs +23 -0
- package/dist/target__runtime.mjs.map +1 -0
- package/dist/target__schema-ir-annotations.d.mts +2 -0
- package/dist/target__schema-ir-annotations.mjs +2 -0
- package/dist/target__sql-utils.d.mts +2 -0
- package/dist/target__sql-utils.mjs +2 -0
- package/dist/target__types.d.mts +7 -0
- package/dist/target__types.mjs +5 -0
- package/dist/types-CkryN1AS-6MNZLjLY.d.mts +27 -0
- package/dist/types-CkryN1AS-6MNZLjLY.d.mts.map +1 -0
- package/dist/types-Cp_Jf2tk.d.mts +1 -0
- package/dist/types-ue6jkJyF-BQJzjx1P.d.mts +10 -0
- package/dist/types-ue6jkJyF-BQJzjx1P.d.mts.map +1 -0
- package/dist/types-xa86TkcV.d.mts +32 -0
- package/dist/types-xa86TkcV.d.mts.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
+
import { CliStructuredError } from "@prisma/orm-framework/errors/control";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/errors-kYxOQjdD.mjs
|
|
4
|
+
function postgresError(code, message, options) {
|
|
5
|
+
return structuredError(code, message, options);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A `PostgresMigration` operation that needs the materialized control adapter
|
|
9
|
+
* — named by `operation` (e.g. `createTable`, `dropColumn`, `dataTransform`) —
|
|
10
|
+
* was invoked, but the migration was constructed without a `ControlStack`.
|
|
11
|
+
* Concrete authoring usage always goes through the migration CLI entrypoint,
|
|
12
|
+
* which assembles a stack from the loaded `prisma-next.config.ts`; reaching this
|
|
13
|
+
* error means a test fixture or ad-hoc consumer instantiated `PostgresMigration`
|
|
14
|
+
* with the no-arg form (legal for `operations` / `describe` introspection only).
|
|
15
|
+
*
|
|
16
|
+
* The `operation` argument is required so every throw site names the operation
|
|
17
|
+
* that actually failed; a new operation cannot inherit a misattributed message.
|
|
18
|
+
*
|
|
19
|
+
* Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)
|
|
20
|
+
* and `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH` (data-transform query
|
|
21
|
+
* plan against wrong contract) because the missing input is the stack
|
|
22
|
+
* itself, not the per-operation contract.
|
|
23
|
+
*
|
|
24
|
+
* Lives in `@internal/target-postgres/errors` rather than the shared
|
|
25
|
+
* framework migration errors module because the failure is target-specific:
|
|
26
|
+
* the contract it talks about (`PostgresMigration`, the Postgres control
|
|
27
|
+
* adapter, the Postgres-target stack) only exists in this package.
|
|
28
|
+
*/
|
|
29
|
+
function errorPostgresMigrationStackMissing(operation) {
|
|
30
|
+
return new CliStructuredError("MIGRATION.POSTGRES_CONTROL_STACK_MISSING", `PostgresMigration.${operation} requires a control adapter`, {
|
|
31
|
+
why: `PostgresMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its plan.`,
|
|
32
|
+
fix: "Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a Postgres adapter to the migration constructor in test fixtures.",
|
|
33
|
+
meta: { operation }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { postgresError as n, errorPostgresMigrationStackMissing as t };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=errors-kYxOQjdD-D4T3rbVp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-kYxOQjdD-D4T3rbVp.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/errors-kYxOQjdD.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { CliStructuredError } from \"@internal/errors/control\";\n//#region src/core/errors.ts\nfunction postgresError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n/**\n* A `PostgresMigration` operation that needs the materialized control adapter\n* — named by `operation` (e.g. `createTable`, `dropColumn`, `dataTransform`) —\n* was invoked, but the migration was constructed without a `ControlStack`.\n* Concrete authoring usage always goes through the migration CLI entrypoint,\n* which assembles a stack from the loaded `prisma-next.config.ts`; reaching this\n* error means a test fixture or ad-hoc consumer instantiated `PostgresMigration`\n* with the no-arg form (legal for `operations` / `describe` introspection only).\n*\n* The `operation` argument is required so every throw site names the operation\n* that actually failed; a new operation cannot inherit a misattributed message.\n*\n* Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)\n* and `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH` (data-transform query\n* plan against wrong contract) because the missing input is the stack\n* itself, not the per-operation contract.\n*\n* Lives in `@internal/target-postgres/errors` rather than the shared\n* framework migration errors module because the failure is target-specific:\n* the contract it talks about (`PostgresMigration`, the Postgres control\n* adapter, the Postgres-target stack) only exists in this package.\n*/\nfunction errorPostgresMigrationStackMissing(operation) {\n\treturn new CliStructuredError(\"MIGRATION.POSTGRES_CONTROL_STACK_MISSING\", `PostgresMigration.${operation} requires a control adapter`, {\n\t\twhy: `PostgresMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its plan.`,\n\t\tfix: \"Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a Postgres adapter to the migration constructor in test fixtures.\",\n\t\tmeta: { operation }\n\t});\n}\n//#endregion\nexport { postgresError as n, errorPostgresMigrationStackMissing as t };\n\n//# sourceMappingURL=errors-kYxOQjdD.mjs.map"],"mappings":";;;AAGA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,mCAAmC,WAAW;CACtD,OAAO,IAAI,mBAAmB,4CAA4C,qBAAqB,UAAU,8BAA8B;EACtI,KAAK,qBAAqB,UAAU;EACpC,KAAK;EACL,MAAM,EAAE,UAAU;CACnB,CAAC;AACF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { j as PostgresOpFactoryCall } from "./op-factory-call-jd4cgfjA-CyNT4YVn.mjs";
|
|
2
|
+
import { SqlStorage, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
|
|
3
|
+
import { DiffableNode, SchemaDiffIssue } from "@prisma/orm-framework/components/control";
|
|
4
|
+
import { CodecControlHooks, MigrationOperationPolicy, SqlPlannerConflict } from "@prisma/orm-family-sql/family/control";
|
|
5
|
+
import { SqlSchemaIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
6
|
+
import { Result } from "@prisma/orm-framework/utils/result";
|
|
7
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
8
|
+
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
9
|
+
//#region ../../../3-targets/3-targets/postgres/dist/issue-planner.d.mts
|
|
10
|
+
//#region src/core/migrations/planner-strategies.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* Context passed to each migration strategy.
|
|
13
|
+
*
|
|
14
|
+
* Strategies read the source (`fromContract`), target (`toContract`), current
|
|
15
|
+
* database state (`schema`), operation policy (`policy`), and component list
|
|
16
|
+
* (`frameworkComponents`) to make planning decisions. `fromContract` is null
|
|
17
|
+
* when no prior contract is available (e.g. `db update`, where the current
|
|
18
|
+
* DB state is approximated via `schema`).
|
|
19
|
+
*/
|
|
20
|
+
interface StrategyContext {
|
|
21
|
+
readonly toContract: Contract<SqlStorage>;
|
|
22
|
+
readonly fromContract: Contract<SqlStorage> | null;
|
|
23
|
+
readonly schemaName: string;
|
|
24
|
+
readonly codecHooks: ReadonlyMap<string, CodecControlHooks>;
|
|
25
|
+
readonly storageTypes: Readonly<Record<string, StorageTypeInstance>>;
|
|
26
|
+
readonly schema: SqlSchemaIR;
|
|
27
|
+
readonly policy: MigrationOperationPolicy;
|
|
28
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Consumes node-typed diff issues (`SchemaDiffIssue`, from the one differ —
|
|
32
|
+
* `buildPostgresPlanDiff`), reading the issue's node pair for structural
|
|
33
|
+
* decisions and resolving column DDL from the node's `codecRef`. The
|
|
34
|
+
* retained subsystems (codec type-operations, the NOT-NULL temp-default
|
|
35
|
+
* backfill) keep reading the contract via `StrategyContext`.
|
|
36
|
+
*/
|
|
37
|
+
type CallMigrationStrategy = (issues: readonly SchemaDiffIssue[], context: StrategyContext) => {
|
|
38
|
+
kind: 'match';
|
|
39
|
+
issues: readonly SchemaDiffIssue[];
|
|
40
|
+
calls: readonly PostgresOpFactoryCall[];
|
|
41
|
+
/**
|
|
42
|
+
* `true` for strategies that emit cohesive sequential recipes whose
|
|
43
|
+
* calls must stay contiguous and in the returned order — e.g.
|
|
44
|
+
* `notNullBackfillCallStrategy` (addColumn → dataTransform → setNotNull).
|
|
45
|
+
* Defaults to `false`, which lets `planIssues` hoist individual calls
|
|
46
|
+
* into their DDL sequencing bucket.
|
|
47
|
+
*/
|
|
48
|
+
recipe?: boolean;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'no_match';
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/core/migrations/issue-planner.d.ts
|
|
54
|
+
interface IssuePlannerValue {
|
|
55
|
+
readonly calls: readonly PostgresOpFactoryCall[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The generic differ is total: a missing/extra table (or column) emits an
|
|
59
|
+
* issue for itself AND for every node in its subtree. `CreateTable`/`DropTable`
|
|
60
|
+
* and `AddColumn`/`DropColumn` already account for the whole subtree, so the
|
|
61
|
+
* nested issues are redundant — coalescing drops any issue whose path is a
|
|
62
|
+
* strict descendant of a `not-found`/`not-expected` issue's path. Run over the
|
|
63
|
+
* relational subset ONLY (policy issues and synthesized namespace issues are
|
|
64
|
+
* handled on their own paths, never coalesced against tables).
|
|
65
|
+
*/
|
|
66
|
+
declare function coalesceSubtreeIssues<TNode extends DiffableNode = DiffableNode>(issues: readonly SchemaDiffIssue<TNode>[]): readonly SchemaDiffIssue<TNode>[];
|
|
67
|
+
interface IssuePlannerOptions {
|
|
68
|
+
readonly issues: readonly SchemaDiffIssue[];
|
|
69
|
+
readonly toContract: Contract<SqlStorage>;
|
|
70
|
+
readonly fromContract: Contract<SqlStorage> | null;
|
|
71
|
+
readonly schemaName: string;
|
|
72
|
+
readonly codecHooks: ReadonlyMap<string, CodecControlHooks>;
|
|
73
|
+
readonly storageTypes: Readonly<Record<string, StorageTypeInstance>>;
|
|
74
|
+
/**
|
|
75
|
+
* Current database schema IR. Strategies read this to detect whether a
|
|
76
|
+
* structure already exists (e.g. `buildSchemaLookupMap` for shared-temp-
|
|
77
|
+
* default safety, extension dependency checks). Defaults to an empty schema
|
|
78
|
+
* when omitted so the planner can still run over "fresh DB" contract
|
|
79
|
+
* snapshots.
|
|
80
|
+
*/
|
|
81
|
+
readonly schema?: SqlSchemaIR;
|
|
82
|
+
/**
|
|
83
|
+
* Operation-class policy. `planIssues` filters calls whose `operationClass`
|
|
84
|
+
* is not in `policy.allowedOperationClasses` and surfaces them as conflicts
|
|
85
|
+
* instead of emitting disallowed DDL. Defaults to additive-only.
|
|
86
|
+
*/
|
|
87
|
+
readonly policy?: MigrationOperationPolicy;
|
|
88
|
+
/**
|
|
89
|
+
* Framework components participating in this composition. Available to
|
|
90
|
+
* future strategies that may consult component metadata at plan time.
|
|
91
|
+
*/
|
|
92
|
+
readonly frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
|
|
93
|
+
readonly strategies?: readonly CallMigrationStrategy[];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Runs the ordered strategy list over the node-typed diff issues, maps
|
|
97
|
+
* leftover issues via {@link mapNodeIssueToCall}, applies operation-class
|
|
98
|
+
* policy gating, and buckets calls into the fixed DDL emission order (dep →
|
|
99
|
+
* drop → table → column → recipe → alter → primaryKey → unique → index →
|
|
100
|
+
* foreignKey).
|
|
101
|
+
*/
|
|
102
|
+
declare function planIssues(options: IssuePlannerOptions): Result<IssuePlannerValue, readonly SqlPlannerConflict[]>;
|
|
103
|
+
//#endregion
|
|
104
|
+
export { planIssues as n, coalesceSubtreeIssues as t };
|
|
105
|
+
//# sourceMappingURL=issue-planner-jkY6p-Ca.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-planner-jkY6p-Ca.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/issue-planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;UAkBU;WACC,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;WACtC,QAAQ;WACR,QAAQ;WACR,qBAAqB,cAAc;;;;;;;;;KASzC,yBAAyB,iBAAiB,mBAAmB,SAAS;EACzE;EACA,iBAAiB;EACjB,gBAAgB;;;;;;;;EAQhB;;EAEA;;;;UAIQ;WACC,gBAAgB;;;;;;;;;;;iBAWV,sBAAsB,cAAc,eAAe,cAAc,iBAAiB,gBAAgB,oBAAoB,gBAAgB;UAC7I;WACC,iBAAiB;WACjB,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;;;;;;;;WAQtC,SAAS;;;;;;WAMT,SAAS;;;;;WAKT,sBAAsB,cAAc;WACpC,sBAAsB;;;;;;;;;iBAShB,WAAW,SAAS,sBAAsB,OAAO,4BAA4B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "./data-transform-Ck5FbyNO-BNE7QlAo.mjs";
|
|
2
|
+
import { A as Op$1 } from "./op-factory-call-jd4cgfjA-CyNT4YVn.mjs";
|
|
3
|
+
import "./postgres-migration-CDJj7CvD-Bsqs_fVo.mjs";
|
|
4
|
+
import { checkExpression, col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
5
|
+
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
6
|
+
import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
|
|
7
|
+
//#region ../../../3-targets/3-targets/postgres/dist/migration.d.mts
|
|
8
|
+
//#region src/core/migrations/operations/dependencies.d.ts
|
|
9
|
+
declare function createExtension(extensionName: string): Op$1;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/core/migrations/operations/raw.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* Identity factory for an already-materialized `SqlMigrationPlanOperation`.
|
|
14
|
+
*
|
|
15
|
+
* The planner uses this via `liftOpToCall` to carry ops produced by SQL
|
|
16
|
+
* family methods, codec control hooks, and component database dependencies
|
|
17
|
+
* alongside migration IR without reverse-engineering them. Users writing
|
|
18
|
+
* raw migrations can pass a full op shape directly — typically built by
|
|
19
|
+
* composing SQL family helpers — to author a migration that bypasses the
|
|
20
|
+
* structured call classes.
|
|
21
|
+
*/
|
|
22
|
+
declare function rawSql(op: Op$1): Op$1;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { fn$1 as a, placeholder as c, unique as d, createExtension as i, primaryKey as l, checkExpression as n, foreignKey as o, col$1 as r, lit$1 as s, MigrationCLI as t, rawSql as u };
|
|
25
|
+
//# sourceMappingURL=migration-CBSAPE8S.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-CBSAPE8S.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.d.mts"],"mappings":";;;;;;;;iBAQiB,gBAAgB,wBAAwB;;;;;;;;;;;;;iBAaxC,OAAO,IAAI,OAAK"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { checkExpression, col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
2
|
+
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
3
|
+
import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
|
|
4
|
+
//#region ../../../3-targets/3-targets/postgres/dist/migration.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Identity factory for an already-materialized `SqlMigrationPlanOperation`.
|
|
7
|
+
*
|
|
8
|
+
* The planner uses this via `liftOpToCall` to carry ops produced by SQL
|
|
9
|
+
* family methods, codec control hooks, and component database dependencies
|
|
10
|
+
* alongside migration IR without reverse-engineering them. Users writing
|
|
11
|
+
* raw migrations can pass a full op shape directly — typically built by
|
|
12
|
+
* composing SQL family helpers — to author a migration that bypasses the
|
|
13
|
+
* structured call classes.
|
|
14
|
+
*/
|
|
15
|
+
function rawSql(op) {
|
|
16
|
+
return op;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { foreignKey as a, primaryKey as c, fn$1 as i, rawSql as l, checkExpression as n, lit$1 as o, col$1 as r, placeholder as s, MigrationCLI as t, unique as u };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=migration-PTHAY9Cv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-PTHAY9Cv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { F as createExtension } from \"./op-factory-call-DifL68KT.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { t as PostgresMigration } from \"./postgres-migration-CJshdIZn.mjs\";\nimport { checkExpression, col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized `SqlMigrationPlanOperation`.\n*\n* The planner uses this via `liftOpToCall` to carry ops produced by SQL\n* family methods, codec control hooks, and component database dependencies\n* alongside migration IR without reverse-engineering them. Users writing\n* raw migrations can pass a full op shape directly — typically built by\n* composing SQL family helpers — to author a migration that bypasses the\n* structured call classes.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { PostgresMigration as Migration, MigrationCLI, checkExpression, col, createExtension, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/namespace-ids-xtp_ZY86.mjs
|
|
2
|
+
/** Postgres's default schema; `postgresTargetDescriptorMeta.defaultNamespaceId` is this value. */
|
|
3
|
+
const DEFAULT_NAMESPACE_ID = "public";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { DEFAULT_NAMESPACE_ID as t };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=namespace-ids-xtp_ZY86-Cpp8PTxD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-ids-xtp_ZY86-Cpp8PTxD.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/namespace-ids-xtp_ZY86.mjs"],"sourcesContent":["//#region src/core/namespace-ids.ts\n/** Postgres's default schema; `postgresTargetDescriptorMeta.defaultNamespaceId` is this value. */\nconst DEFAULT_NAMESPACE_ID = \"public\";\n//#endregion\nexport { DEFAULT_NAMESPACE_ID as t };\n\n//# sourceMappingURL=namespace-ids-xtp_ZY86.mjs.map"],"mappings":";;AAEA,MAAM,uBAAuB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/native-type-normalizer.d.mts
|
|
2
|
+
//#region src/core/native-type-normalizer.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Postgres native-type normalization.
|
|
5
|
+
*
|
|
6
|
+
* Lives in `target-postgres` because both the migration planner/runner (control
|
|
7
|
+
* plane) and the introspection adapter (control plane) need to normalize raw
|
|
8
|
+
* native-type strings to the same canonical form for comparison.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Normalizes a Postgres schema native type to its canonical form for comparison.
|
|
12
|
+
*
|
|
13
|
+
* Uses a pre-computed lookup map for simple prefix replacements (O(1))
|
|
14
|
+
* and handles complex temporal type normalization separately.
|
|
15
|
+
*/
|
|
16
|
+
declare function normalizeSchemaNativeType(nativeType: string): string;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { normalizeSchemaNativeType as t };
|
|
19
|
+
//# sourceMappingURL=native-type-normalizer-DqJlOTeX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-type-normalizer-DqJlOTeX.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/native-type-normalizer.d.mts"],"mappings":";;;;;;;;;;;;;;;iBAciB,0BAA0B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/native-type-normalizer.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Postgres native-type normalization.
|
|
4
|
+
*
|
|
5
|
+
* Lives in `target-postgres` because both the migration planner/runner (control
|
|
6
|
+
* plane) and the introspection adapter (control plane) need to normalize raw
|
|
7
|
+
* native-type strings to the same canonical form for comparison.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Lookup map for simple prefix-based type normalization.
|
|
11
|
+
*
|
|
12
|
+
* Using a Map for O(1) lookup instead of multiple startsWith checks.
|
|
13
|
+
*/
|
|
14
|
+
const TYPE_PREFIX_MAP = /* @__PURE__ */ new Map([
|
|
15
|
+
["varchar", "character varying"],
|
|
16
|
+
["bpchar", "character"],
|
|
17
|
+
["varbit", "bit varying"]
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* Normalizes a Postgres schema native type to its canonical form for comparison.
|
|
21
|
+
*
|
|
22
|
+
* Uses a pre-computed lookup map for simple prefix replacements (O(1))
|
|
23
|
+
* and handles complex temporal type normalization separately.
|
|
24
|
+
*/
|
|
25
|
+
function normalizeSchemaNativeType(nativeType) {
|
|
26
|
+
const trimmed = nativeType.trim();
|
|
27
|
+
for (const [prefix, replacement] of TYPE_PREFIX_MAP) if (trimmed.startsWith(prefix)) return replacement + trimmed.slice(prefix.length);
|
|
28
|
+
if (trimmed.includes(" with time zone")) {
|
|
29
|
+
if (trimmed.startsWith("timestamp")) return `timestamptz${trimmed.slice(9).replace(" with time zone", "")}`;
|
|
30
|
+
if (trimmed.startsWith("time")) return `timetz${trimmed.slice(4).replace(" with time zone", "")}`;
|
|
31
|
+
}
|
|
32
|
+
if (trimmed.includes(" without time zone")) return trimmed.replace(" without time zone", "");
|
|
33
|
+
return trimmed;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { normalizeSchemaNativeType as t };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=native-type-normalizer-yvd3tqv-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-type-normalizer-yvd3tqv-.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/native-type-normalizer.mjs"],"sourcesContent":["//#region src/core/native-type-normalizer.ts\n/**\n* Postgres native-type normalization.\n*\n* Lives in `target-postgres` because both the migration planner/runner (control\n* plane) and the introspection adapter (control plane) need to normalize raw\n* native-type strings to the same canonical form for comparison.\n*/\n/**\n* Lookup map for simple prefix-based type normalization.\n*\n* Using a Map for O(1) lookup instead of multiple startsWith checks.\n*/\nconst TYPE_PREFIX_MAP = /* @__PURE__ */ new Map([\n\t[\"varchar\", \"character varying\"],\n\t[\"bpchar\", \"character\"],\n\t[\"varbit\", \"bit varying\"]\n]);\n/**\n* Normalizes a Postgres schema native type to its canonical form for comparison.\n*\n* Uses a pre-computed lookup map for simple prefix replacements (O(1))\n* and handles complex temporal type normalization separately.\n*/\nfunction normalizeSchemaNativeType(nativeType) {\n\tconst trimmed = nativeType.trim();\n\tfor (const [prefix, replacement] of TYPE_PREFIX_MAP) if (trimmed.startsWith(prefix)) return replacement + trimmed.slice(prefix.length);\n\tif (trimmed.includes(\" with time zone\")) {\n\t\tif (trimmed.startsWith(\"timestamp\")) return `timestamptz${trimmed.slice(9).replace(\" with time zone\", \"\")}`;\n\t\tif (trimmed.startsWith(\"time\")) return `timetz${trimmed.slice(4).replace(\" with time zone\", \"\")}`;\n\t}\n\tif (trimmed.includes(\" without time zone\")) return trimmed.replace(\" without time zone\", \"\");\n\treturn trimmed;\n}\n//#endregion\nexport { normalizeSchemaNativeType };\n\n//# sourceMappingURL=native-type-normalizer.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,kCAAkC,IAAI,IAAI;CAC/C,CAAC,WAAW,mBAAmB;CAC/B,CAAC,UAAU,WAAW;CACtB,CAAC,UAAU,aAAa;AACzB,CAAC;;;;;;;AAOD,SAAS,0BAA0B,YAAY;CAC9C,MAAM,UAAU,WAAW,KAAK;CAChC,KAAK,MAAM,CAAC,QAAQ,gBAAgB,iBAAiB,IAAI,QAAQ,WAAW,MAAM,GAAG,OAAO,cAAc,QAAQ,MAAM,OAAO,MAAM;CACrI,IAAI,QAAQ,SAAS,iBAAiB,GAAG;EACxC,IAAI,QAAQ,WAAW,WAAW,GAAG,OAAO,cAAc,QAAQ,MAAM,CAAC,CAAC,CAAC,QAAQ,mBAAmB,EAAE;EACxG,IAAI,QAAQ,WAAW,MAAM,GAAG,OAAO,SAAS,QAAQ,MAAM,CAAC,CAAC,CAAC,QAAQ,mBAAmB,EAAE;CAC/F;CACA,IAAI,QAAQ,SAAS,oBAAoB,GAAG,OAAO,QAAQ,QAAQ,sBAAsB,EAAE;CAC3F,OAAO;AACR"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { r as RlsPolicyOperation } from "./canonicalize-CQlxSR4D-MnrT5gtW.mjs";
|
|
2
|
+
import { DdlColumn, DdlNode, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/nodes-BU-V-aZA.d.mts
|
|
4
|
+
//#region src/core/ddl/nodes.d.ts
|
|
5
|
+
interface AlterTableActionVisitor<R> {
|
|
6
|
+
addColumn(action: AddColumnAction): R;
|
|
7
|
+
dropDefault(action: DropDefaultAction): R;
|
|
8
|
+
}
|
|
9
|
+
declare abstract class AlterTableAction {
|
|
10
|
+
abstract readonly kind: string;
|
|
11
|
+
abstract accept<R>(visitor: AlterTableActionVisitor<R>): R;
|
|
12
|
+
}
|
|
13
|
+
declare class AddColumnAction extends AlterTableAction {
|
|
14
|
+
readonly kind: "add-column";
|
|
15
|
+
readonly column: DdlColumn;
|
|
16
|
+
constructor(column: DdlColumn);
|
|
17
|
+
accept<R>(visitor: AlterTableActionVisitor<R>): R;
|
|
18
|
+
}
|
|
19
|
+
declare class DropDefaultAction extends AlterTableAction {
|
|
20
|
+
readonly kind: "drop-default";
|
|
21
|
+
readonly columnName: string;
|
|
22
|
+
constructor(columnName: string);
|
|
23
|
+
accept<R>(visitor: AlterTableActionVisitor<R>): R;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The set of ALTER TABLE subactions currently expressible as typed DDL.
|
|
27
|
+
*
|
|
28
|
+
* The remaining actions — SetDefault, SetNotNull, DropNotNull,
|
|
29
|
+
* AlterColumnType — are still emitted as raw SQL by `operations/columns.ts`
|
|
30
|
+
* and join this union as they are converted to typed DDL. Until then it is
|
|
31
|
+
* intentionally partial: only the ALTER subactions used by the
|
|
32
|
+
* already-converted ops (AddColumn, DropDefault) appear here.
|
|
33
|
+
*/
|
|
34
|
+
type AnyAlterTableAction = AddColumnAction | DropDefaultAction;
|
|
35
|
+
interface PostgresDdlVisitor<R> {
|
|
36
|
+
createTable(node: PostgresCreateTable): R;
|
|
37
|
+
createSchema(node: PostgresCreateSchema): R;
|
|
38
|
+
createType(node: PostgresCreateType): R;
|
|
39
|
+
dropType(node: PostgresDropType): R;
|
|
40
|
+
alterTable(node: PostgresAlterTable): R;
|
|
41
|
+
createPolicy(node: PostgresCreatePolicy): R;
|
|
42
|
+
dropPolicy(node: PostgresDropPolicy): R;
|
|
43
|
+
alterPolicyRename(node: PostgresAlterPolicyRename): R;
|
|
44
|
+
createIndex(node: PostgresCreateIndex): R;
|
|
45
|
+
dropIndex(node: PostgresDropIndex): R;
|
|
46
|
+
alterIndexRename(node: PostgresAlterIndexRename): R;
|
|
47
|
+
disableRowLevelSecurity(node: PostgresDisableRowLevelSecurity): R;
|
|
48
|
+
}
|
|
49
|
+
declare abstract class PostgresDdlNode extends DdlNode {
|
|
50
|
+
abstract accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
51
|
+
}
|
|
52
|
+
declare class PostgresCreateTable extends PostgresDdlNode {
|
|
53
|
+
readonly kind: "create-table";
|
|
54
|
+
readonly table: string;
|
|
55
|
+
readonly schema: string | undefined;
|
|
56
|
+
readonly ifNotExists: boolean | undefined;
|
|
57
|
+
readonly columns: ReadonlyArray<DdlColumn>;
|
|
58
|
+
readonly constraints: ReadonlyArray<DdlTableConstraint> | undefined;
|
|
59
|
+
constructor(options: {
|
|
60
|
+
readonly table: string;
|
|
61
|
+
readonly schema?: string;
|
|
62
|
+
readonly ifNotExists?: boolean;
|
|
63
|
+
readonly columns: readonly DdlColumn[];
|
|
64
|
+
readonly constraints?: readonly DdlTableConstraint[];
|
|
65
|
+
});
|
|
66
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
67
|
+
}
|
|
68
|
+
declare class PostgresCreateSchema extends PostgresDdlNode {
|
|
69
|
+
readonly kind: "create-schema";
|
|
70
|
+
readonly schema: string;
|
|
71
|
+
readonly ifNotExists: boolean | undefined;
|
|
72
|
+
constructor(options: {
|
|
73
|
+
readonly schema: string;
|
|
74
|
+
readonly ifNotExists?: boolean;
|
|
75
|
+
});
|
|
76
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
77
|
+
}
|
|
78
|
+
declare class PostgresCreateType extends PostgresDdlNode {
|
|
79
|
+
readonly kind: "create-type";
|
|
80
|
+
readonly schema: string | undefined;
|
|
81
|
+
readonly name: string;
|
|
82
|
+
readonly values: ReadonlyArray<string>;
|
|
83
|
+
constructor(options: {
|
|
84
|
+
readonly schema?: string;
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly values: readonly string[];
|
|
87
|
+
});
|
|
88
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
89
|
+
}
|
|
90
|
+
declare class PostgresDropType extends PostgresDdlNode {
|
|
91
|
+
readonly kind: "drop-type";
|
|
92
|
+
readonly schema: string | undefined;
|
|
93
|
+
readonly name: string;
|
|
94
|
+
constructor(options: {
|
|
95
|
+
readonly schema?: string;
|
|
96
|
+
readonly name: string;
|
|
97
|
+
});
|
|
98
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
99
|
+
}
|
|
100
|
+
declare class PostgresAlterTable extends PostgresDdlNode {
|
|
101
|
+
readonly kind: "alter-table";
|
|
102
|
+
readonly table: string;
|
|
103
|
+
readonly schema: string | undefined;
|
|
104
|
+
readonly actions: ReadonlyArray<AnyAlterTableAction>;
|
|
105
|
+
constructor(options: {
|
|
106
|
+
readonly table: string;
|
|
107
|
+
readonly schema?: string;
|
|
108
|
+
readonly actions: readonly AnyAlterTableAction[];
|
|
109
|
+
});
|
|
110
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
111
|
+
}
|
|
112
|
+
declare class PostgresCreatePolicy extends PostgresDdlNode {
|
|
113
|
+
readonly kind: "create-policy";
|
|
114
|
+
readonly schema: string;
|
|
115
|
+
readonly table: string;
|
|
116
|
+
readonly name: string;
|
|
117
|
+
readonly permissive: boolean;
|
|
118
|
+
readonly operation: RlsPolicyOperation;
|
|
119
|
+
readonly roles: ReadonlyArray<string>;
|
|
120
|
+
readonly using: string | undefined;
|
|
121
|
+
readonly withCheck: string | undefined;
|
|
122
|
+
constructor(options: {
|
|
123
|
+
readonly schema: string;
|
|
124
|
+
readonly table: string;
|
|
125
|
+
readonly name: string;
|
|
126
|
+
readonly permissive: boolean;
|
|
127
|
+
readonly operation: RlsPolicyOperation;
|
|
128
|
+
readonly roles: readonly string[];
|
|
129
|
+
readonly using?: string;
|
|
130
|
+
readonly withCheck?: string;
|
|
131
|
+
});
|
|
132
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
133
|
+
}
|
|
134
|
+
declare class PostgresDropPolicy extends PostgresDdlNode {
|
|
135
|
+
readonly kind: "drop-policy";
|
|
136
|
+
readonly schema: string;
|
|
137
|
+
readonly table: string;
|
|
138
|
+
readonly name: string;
|
|
139
|
+
constructor(options: {
|
|
140
|
+
readonly schema: string;
|
|
141
|
+
readonly table: string;
|
|
142
|
+
readonly name: string;
|
|
143
|
+
});
|
|
144
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
145
|
+
}
|
|
146
|
+
declare class PostgresAlterPolicyRename extends PostgresDdlNode {
|
|
147
|
+
readonly kind: "alter-policy-rename";
|
|
148
|
+
readonly schema: string;
|
|
149
|
+
readonly table: string;
|
|
150
|
+
readonly name: string;
|
|
151
|
+
readonly newName: string;
|
|
152
|
+
constructor(options: {
|
|
153
|
+
readonly schema: string;
|
|
154
|
+
readonly table: string;
|
|
155
|
+
readonly name: string;
|
|
156
|
+
readonly newName: string;
|
|
157
|
+
});
|
|
158
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The element list between the parens of CREATE INDEX: either a column
|
|
162
|
+
* tuple (each identifier quoted by the renderer) or one opaque expression
|
|
163
|
+
* string covering the entire list, inserted verbatim — the same opaque-SQL
|
|
164
|
+
* stance as RLS policy predicates (ADR 234).
|
|
165
|
+
*/
|
|
166
|
+
type DdlIndexElements = {
|
|
167
|
+
readonly columns: readonly string[];
|
|
168
|
+
} | {
|
|
169
|
+
readonly expression: string;
|
|
170
|
+
};
|
|
171
|
+
declare class PostgresCreateIndex extends PostgresDdlNode {
|
|
172
|
+
readonly kind: "create-index";
|
|
173
|
+
/** Absent ⇔ unqualified (the unbound namespace — `search_path` decides). */
|
|
174
|
+
readonly schema: string | undefined;
|
|
175
|
+
readonly table: string;
|
|
176
|
+
readonly name: string;
|
|
177
|
+
readonly unique: boolean;
|
|
178
|
+
readonly elements: DdlIndexElements;
|
|
179
|
+
readonly type: string | undefined;
|
|
180
|
+
readonly options: Record<string, unknown> | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Partial-index predicate (WHERE body, without the keyword). Inserted
|
|
183
|
+
* verbatim, never quoted or escaped.
|
|
184
|
+
*/
|
|
185
|
+
readonly where: string | undefined;
|
|
186
|
+
constructor(options: {
|
|
187
|
+
readonly schema: string | undefined;
|
|
188
|
+
readonly table: string;
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly unique: boolean;
|
|
191
|
+
readonly elements: DdlIndexElements;
|
|
192
|
+
readonly type: string | undefined;
|
|
193
|
+
readonly options: Record<string, unknown> | undefined;
|
|
194
|
+
readonly where: string | undefined;
|
|
195
|
+
});
|
|
196
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
197
|
+
}
|
|
198
|
+
declare class PostgresDropIndex extends PostgresDdlNode {
|
|
199
|
+
readonly kind: "drop-index";
|
|
200
|
+
/** Absent ⇔ unqualified (the unbound namespace). */
|
|
201
|
+
readonly schema: string | undefined;
|
|
202
|
+
readonly name: string;
|
|
203
|
+
constructor(options: {
|
|
204
|
+
readonly schema: string | undefined;
|
|
205
|
+
readonly name: string;
|
|
206
|
+
});
|
|
207
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
208
|
+
}
|
|
209
|
+
declare class PostgresAlterIndexRename extends PostgresDdlNode {
|
|
210
|
+
readonly kind: "alter-index-rename";
|
|
211
|
+
/** Absent ⇔ unqualified (the unbound namespace). */
|
|
212
|
+
readonly schema: string | undefined;
|
|
213
|
+
readonly from: string;
|
|
214
|
+
readonly to: string;
|
|
215
|
+
constructor(options: {
|
|
216
|
+
readonly schema: string | undefined;
|
|
217
|
+
readonly from: string;
|
|
218
|
+
readonly to: string;
|
|
219
|
+
});
|
|
220
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
221
|
+
}
|
|
222
|
+
declare class PostgresDisableRowLevelSecurity extends PostgresDdlNode {
|
|
223
|
+
readonly kind: "disable-row-level-security";
|
|
224
|
+
readonly schema: string;
|
|
225
|
+
readonly table: string;
|
|
226
|
+
constructor(options: {
|
|
227
|
+
readonly schema: string;
|
|
228
|
+
readonly table: string;
|
|
229
|
+
});
|
|
230
|
+
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
231
|
+
}
|
|
232
|
+
type AnyPostgresDdlNode = PostgresCreateTable | PostgresCreateSchema | PostgresCreateType | PostgresDropType | PostgresAlterTable | PostgresCreatePolicy | PostgresDropPolicy | PostgresAlterPolicyRename | PostgresCreateIndex | PostgresDropIndex | PostgresAlterIndexRename | PostgresDisableRowLevelSecurity;
|
|
233
|
+
//#endregion
|
|
234
|
+
export { PostgresDisableRowLevelSecurity as _, DdlIndexElements as a, PostgresDropType as b, PostgresAlterPolicyRename as c, PostgresCreatePolicy as d, PostgresCreateSchema as f, PostgresDdlVisitor as g, PostgresDdlNode as h, AnyPostgresDdlNode as i, PostgresAlterTable as l, PostgresCreateType as m, AlterTableActionVisitor as n, DropDefaultAction as o, PostgresCreateTable as p, AnyAlterTableAction as r, PostgresAlterIndexRename as s, AddColumnAction as t, PostgresCreateIndex as u, PostgresDropIndex as v, PostgresDropPolicy as y };
|
|
235
|
+
//# sourceMappingURL=nodes-BU-V-aZA-RqwPH68u.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes-BU-V-aZA-RqwPH68u.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/nodes-BU-V-aZA.d.mts"],"mappings":";;;;UAGU,wBAAwB;EAChC,UAAU,QAAQ,kBAAkB;EACpC,YAAY,QAAQ,oBAAoB;;uBAEnB;oBACH;WACT,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAE7C,wBAAwB;WAC3B;WACA,QAAQ;EACjB,YAAY,QAAQ;EACpB,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAEpC,0BAA0B;WAC7B;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,wBAAwB,KAAK;;;;;;;;;;;KAW7C,sBAAsB,kBAAkB;UACnC,mBAAmB;EAC3B,YAAY,MAAM,sBAAsB;EACxC,aAAa,MAAM,uBAAuB;EAC1C,WAAW,MAAM,qBAAqB;EACtC,SAAS,MAAM,mBAAmB;EAClC,WAAW,MAAM,qBAAqB;EACtC,aAAa,MAAM,uBAAuB;EAC1C,WAAW,MAAM,qBAAqB;EACtC,kBAAkB,MAAM,4BAA4B;EACpD,YAAY,MAAM,sBAAsB;EACxC,UAAU,MAAM,oBAAoB;EACpC,iBAAiB,MAAM,2BAA2B;EAClD,wBAAwB,MAAM,kCAAkC;;uBAE3C,wBAAwB;WACpC,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAExC,4BAA4B;WAC/B;WACA;WACA;WACA;WACA,SAAS,cAAc;WACvB,aAAa,cAAc;EACpC,YAAY;aACD;aACA;aACA;aACA,kBAAkB;aAClB,uBAAuB;;EAElC,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,6BAA6B;WAChC;WACA;WACA;EACT,YAAY;aACD;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,2BAA2B;WAC9B;WACA;WACA;WACA,QAAQ;EACjB,YAAY;aACD;aACA;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,yBAAyB;WAC5B;WACA;WACA;EACT,YAAY;aACD;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,2BAA2B;WAC9B;WACA;WACA;WACA,SAAS,cAAc;EAChC,YAAY;aACD;aACA;aACA,kBAAkB;;EAE7B,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,6BAA6B;WAChC;WACA;WACA;WACA;WACA;WACA,WAAW;WACX,OAAO;WACP;WACA;EACT,YAAY;aACD;aACA;aACA;aACA;aACA,WAAW;aACX;aACA;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,2BAA2B;WAC9B;WACA;WACA;WACA;EACT,YAAY;aACD;aACA;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,kCAAkC;WACrC;WACA;WACA;WACA;WACA;EACT,YAAY;aACD;aACA;aACA;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;;;;;;;KAQxC;WACM;;WAEA;;cAEG,4BAA4B;WAC/B;;WAEA;WACA;WACA;WACA;WACA,UAAU;WACV;WACA,SAAS;;;;;WAKT;EACT,YAAY;aACD;aACA;aACA;aACA;aACA,UAAU;aACV;aACA,SAAS;aACT;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,0BAA0B;WAC7B;;WAEA;WACA;EACT,YAAY;aACD;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,iCAAiC;WACpC;;WAEA;WACA;WACA;EACT,YAAY;aACD;aACA;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,wCAAwC;WAC3C;WACA;WACA;EACT,YAAY;aACD;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;KAExC,qBAAqB,sBAAsB,uBAAuB,qBAAqB,mBAAmB,qBAAqB,uBAAuB,qBAAqB,4BAA4B,sBAAsB,oBAAoB,2BAA2B"}
|