@prisma/orm-target-postgres 8.0.0-rc.18-dev.25 → 8.0.0-rc.18-dev.26
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/dist/{adapter-UEtFYllx-DXa1Ekth.mjs → adapter-BkfuSVLm-DmjWB5c9.mjs} +14 -14
- package/dist/adapter-BkfuSVLm-DmjWB5c9.mjs.map +1 -0
- package/dist/{adapter-CA0jY1EK.d.mts → adapter-vfsQ80l6.d.mts} +3 -3
- package/dist/adapter-vfsQ80l6.d.mts.map +1 -0
- package/dist/adapter.d.mts +3 -4
- package/dist/adapter.mjs +6 -7
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.d.mts +2 -3
- package/dist/adapter__control.mjs +8 -9
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +6 -6
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{authoring-mmK5aduF-BltVG_HJ.mjs → authoring-DhyLHFHA-pB4NuFxh.mjs} +5 -5
- package/dist/{authoring-mmK5aduF-BltVG_HJ.mjs.map → authoring-DhyLHFHA-pB4NuFxh.mjs.map} +1 -1
- package/dist/{autoincrement-widths-djl9Gw7k-C4Vk6s7I.mjs → autoincrement-widths-1v9UfTSw-NFaqRGCV.mjs} +3 -3
- package/dist/{autoincrement-widths-djl9Gw7k-C4Vk6s7I.mjs.map → autoincrement-widths-1v9UfTSw-NFaqRGCV.mjs.map} +1 -1
- package/dist/{check-expressions-DoxKokL1-RVvYRdA6.mjs → check-expressions-7uCCP01t-WtUqfqkP.mjs} +3 -3
- package/dist/{check-expressions-DoxKokL1-RVvYRdA6.mjs.map → check-expressions-7uCCP01t-WtUqfqkP.mjs.map} +1 -1
- package/dist/{codec-registry-CvKdYTYj-4xXqgKKs.mjs → codec-registry-T79ktJL4-B9_zlIhI.mjs} +4 -4
- package/dist/{codec-registry-CvKdYTYj-4xXqgKKs.mjs.map → codec-registry-T79ktJL4-B9_zlIhI.mjs.map} +1 -1
- package/dist/{codecs-D183NDmb-DKryvPH2.mjs → codecs-UZ1NEbvk-CMnI6Ti0.mjs} +3 -3
- package/dist/{codecs-D183NDmb-DKryvPH2.mjs.map → codecs-UZ1NEbvk-CMnI6Ti0.mjs.map} +1 -1
- package/dist/{contract-contributions-DrHk5h_E-BbmViVsC.mjs → contract-contributions-CQqafzSC-DrMFSSO4.mjs} +49 -40
- package/dist/contract-contributions-CQqafzSC-DrMFSSO4.mjs.map +1 -0
- package/dist/{contract-free-CiUW36L2.mjs → contract-free-Kwm74Hg9.mjs} +3 -3
- package/dist/{contract-free-CiUW36L2.mjs.map → contract-free-Kwm74Hg9.mjs.map} +1 -1
- package/dist/{control-policy-BdfDPcjX-BueP9PBT.mjs → control-policy-BHjZnca1-DUWuKmdJ.mjs} +65 -89
- package/dist/control-policy-BHjZnca1-DUWuKmdJ.mjs.map +1 -0
- package/dist/{control-l0spLFiu.d.mts → control-vBNwKZ7Q.d.mts} +6 -4
- package/dist/control-vBNwKZ7Q.d.mts.map +1 -0
- package/dist/{data-type-entries-KJ4Mn8C5-DY3rLz33.mjs → data-type-entries-CqnLlCkK-uN0WjREd.mjs} +3 -3
- package/dist/{data-type-entries-KJ4Mn8C5-DY3rLz33.mjs.map → data-type-entries-CqnLlCkK-uN0WjREd.mjs.map} +1 -1
- package/dist/{data-types-BkFfMhgz.d.mts → data-types-BTUMiCZS.d.mts} +5 -2
- package/dist/data-types-BTUMiCZS.d.mts.map +1 -0
- package/dist/{data-types-CQs1yW4F-CSexn8mK.mjs → data-types-Cs-LkJBw-CJN57Y5M.mjs} +4 -4
- package/dist/{data-types-CQs1yW4F-CSexn8mK.mjs.map → data-types-Cs-LkJBw-CJN57Y5M.mjs.map} +1 -1
- package/dist/{ddl-V9Yxnoa6-BcStSw33.mjs → ddl-2L13tYjC-enYPQJnG.mjs} +5 -5
- package/dist/{ddl-V9Yxnoa6-BcStSw33.mjs.map → ddl-2L13tYjC-enYPQJnG.mjs.map} +1 -1
- package/dist/{default-normalizer-BqFHmlox-CP8ywN-r.mjs → default-normalizer-BqK6XxdC-BAgxt9FF.mjs} +10 -12
- package/dist/default-normalizer-BqK6XxdC-BAgxt9FF.mjs.map +1 -0
- package/dist/{default-normalizer-CTAiFe9Y.d.mts → default-normalizer-P-u2VRBf.d.mts} +5 -5
- package/dist/default-normalizer-P-u2VRBf.d.mts.map +1 -0
- package/dist/{descriptor-meta-axWY-kHl-Bt2_NjH4.mjs → descriptor-meta-Bzs7kSyA-BjbnpZLW.mjs} +8 -8
- package/dist/{descriptor-meta-axWY-kHl-Bt2_NjH4.mjs.map → descriptor-meta-Bzs7kSyA-BjbnpZLW.mjs.map} +1 -1
- package/dist/{descriptor-meta-CvJvXGfx-CGIgsveo.mjs → descriptor-meta-DDh7-s6c-D6qC3SDx.mjs} +4 -4
- package/dist/{descriptor-meta-CvJvXGfx-CGIgsveo.mjs.map → descriptor-meta-DDh7-s6c-D6qC3SDx.mjs.map} +1 -1
- package/dist/{descriptor-meta-runtime-CMaPJG46-CPYTMJ7t.mjs → descriptor-meta-runtime-C1AjrKaP-CYer0qt7.mjs} +3 -3
- package/dist/{descriptor-meta-runtime-CMaPJG46-CPYTMJ7t.mjs.map → descriptor-meta-runtime-C1AjrKaP-CYer0qt7.mjs.map} +1 -1
- package/dist/{diff-database-schema-DLIpM5BX-DlEJquxk.mjs → diff-database-schema-DyCIRT80-C1zMCmRx.mjs} +7 -7
- package/dist/{diff-database-schema-DLIpM5BX-DlEJquxk.mjs.map → diff-database-schema-DyCIRT80-C1zMCmRx.mjs.map} +1 -1
- package/dist/{full-text-search-document-DbegbX0J-jrbc8kfp.mjs → full-text-search-document-Doy5TF7c-DezgYsP-.mjs} +3 -3
- package/dist/{full-text-search-document-DbegbX0J-jrbc8kfp.mjs.map → full-text-search-document-Doy5TF7c-DezgYsP-.mjs.map} +1 -1
- package/dist/{indexes-ca4Dxsym-By_PZuYD.d.mts → indexes-DtIXFHAb-DBubdl32.d.mts} +3 -2
- package/dist/indexes-DtIXFHAb-DBubdl32.d.mts.map +1 -0
- package/dist/{issue-planner-B3E9yChD.d.mts → issue-planner-DrWlNiAf.d.mts} +5 -6
- package/dist/issue-planner-DrWlNiAf.d.mts.map +1 -0
- package/dist/migration-CbOh59ZJ.mjs.map +1 -1
- package/dist/{migration-cGzKlTv0.d.mts → migration-DO23kNde.d.mts} +3 -3
- package/dist/{migration-cGzKlTv0.d.mts.map → migration-DO23kNde.d.mts.map} +1 -1
- package/dist/native-type-normalizer-DFE5L3YY.d.mts +30 -0
- package/dist/native-type-normalizer-DFE5L3YY.d.mts.map +1 -0
- package/dist/native-type-normalizer-a1XJSlk6.mjs +24 -0
- package/dist/native-type-normalizer-a1XJSlk6.mjs.map +1 -0
- package/dist/op-factory-call-CijzNDaJ.d.mts +1 -0
- package/dist/{op-factory-call-B-EoYQIO-BIfzqVX6.mjs → op-factory-call-No9Z2tdw-Lap8xvVy.mjs} +35 -27
- package/dist/op-factory-call-No9Z2tdw-Lap8xvVy.mjs.map +1 -0
- package/dist/{op-factory-call-z5TKsamx-DDfPa57U.d.mts → op-factory-call-kdPO0kgG-DV8hS6qA.d.mts} +10 -9
- package/dist/op-factory-call-kdPO0kgG-DV8hS6qA.d.mts.map +1 -0
- package/dist/{planner-BBGH1cAB.d.mts → planner-B_MRApHM.d.mts} +3 -3
- package/dist/{planner-BBGH1cAB.d.mts.map → planner-B_MRApHM.d.mts.map} +1 -1
- package/dist/{planner-BNoWx3rb-rkajA65G.mjs → planner-C1czBCmI-C-x1Ip-_.mjs} +10 -10
- package/dist/{planner-BNoWx3rb-rkajA65G.mjs.map → planner-C1czBCmI-C-x1Ip-_.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-Bo_8ozOV-AMIs8Og7.mjs → planner-ddl-builders-B8PhQZ2T-D1KBJxcS.mjs} +3 -3
- package/dist/{planner-ddl-builders-Bo_8ozOV-AMIs8Og7.mjs.map → planner-ddl-builders-B8PhQZ2T-D1KBJxcS.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-Byw5BICu.d.mts → planner-ddl-builders-DbG9_uAk.d.mts} +3 -3
- package/dist/{planner-ddl-builders-Byw5BICu.d.mts.map → planner-ddl-builders-DbG9_uAk.d.mts.map} +1 -1
- package/dist/{planner-identity-values-Dr5FgyF1.d.mts → planner-identity-values-B-NAiN7I.d.mts} +3 -3
- package/dist/planner-identity-values-B-NAiN7I.d.mts.map +1 -0
- package/dist/{planner-identity-values--pbIuAZR-lgKcM-Zu.mjs → planner-identity-values-BnxSwhlS-CzyBeK0a.mjs} +3 -3
- package/dist/{planner-identity-values--pbIuAZR-lgKcM-Zu.mjs.map → planner-identity-values-BnxSwhlS-CzyBeK0a.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-sxhIP3Te-Cn3sD9zE.d.mts → planner-produced-postgres-migration-B6NsNaam-BmvloI2L.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-B6NsNaam-BmvloI2L.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-BW8GJFjS.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-BIKLMKpf-B5h4hpvf.mjs → planner-produced-postgres-migration-F9joIngl-C04yYu-i.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-BIKLMKpf-B5h4hpvf.mjs.map → planner-produced-postgres-migration-F9joIngl-C04yYu-i.mjs.map} +1 -1
- package/dist/planner-sql-checks-CB4oLSuZ.d.mts +1 -0
- package/dist/planner-sql-checks-CxlrM4J2-VqQpmMwn.d.mts +37 -0
- package/dist/planner-sql-checks-CxlrM4J2-VqQpmMwn.d.mts.map +1 -0
- package/dist/planner-sql-checks-pkURMYMz-2QAIKyW-.mjs +139 -0
- package/dist/planner-sql-checks-pkURMYMz-2QAIKyW-.mjs.map +1 -0
- package/dist/{postgres-codec-traits-Da2UyO_9-BsGjYJHf.mjs → postgres-codec-traits-D3muwxMS-OwnBG0Mz.mjs} +3 -3
- package/dist/{postgres-codec-traits-Da2UyO_9-BsGjYJHf.mjs.map → postgres-codec-traits-D3muwxMS-OwnBG0Mz.mjs.map} +1 -1
- package/dist/{postgres-contract-view-csjnSNLt-M2QaYBn0.mjs → postgres-contract-view-B-bLZB7o-zpuamDXT.mjs} +7 -7
- package/dist/{postgres-contract-view-csjnSNLt-M2QaYBn0.mjs.map → postgres-contract-view-B-bLZB7o-zpuamDXT.mjs.map} +1 -1
- package/dist/{postgres-migration-BGkcs09r-BmUXCs80.mjs → postgres-migration-BbXm1l5I-DDy8IgYB.mjs} +15 -32
- package/dist/postgres-migration-BbXm1l5I-DDy8IgYB.mjs.map +1 -0
- package/dist/{postgres-migration-D6_R3__I-rFg_i2gz.d.mts → postgres-migration-CRLV93uK-ThJW3tFf.d.mts} +3 -3
- package/dist/{postgres-migration-D6_R3__I-rFg_i2gz.d.mts.map → postgres-migration-CRLV93uK-ThJW3tFf.d.mts.map} +1 -1
- package/dist/{postgres-schema-BtW3Sw0F-CH3NqoOo.mjs → postgres-schema-DyUXtYIT-vb-RxpRN.mjs} +3 -3
- package/dist/{postgres-schema-BtW3Sw0F-CH3NqoOo.mjs.map → postgres-schema-DyUXtYIT-vb-RxpRN.mjs.map} +1 -1
- package/dist/{prisma7-binding-XSuxkjqy.d.mts → prisma7-binding-C5RLV6kJ.d.mts} +12 -121
- package/dist/prisma7-binding-C5RLV6kJ.d.mts.map +1 -0
- package/dist/{prisma7-binding-ZUOUC530.mjs → prisma7-binding-CzO7rkpS.mjs} +80 -141
- package/dist/prisma7-binding-CzO7rkpS.mjs.map +1 -0
- package/dist/{render-ops-WhXRiDGu-LZMJf0aV.mjs → render-ops-MeXLgeOa-nL4PdJzz.mjs} +3 -3
- package/dist/{render-ops-WhXRiDGu-LZMJf0aV.mjs.map → render-ops-MeXLgeOa-nL4PdJzz.mjs.map} +1 -1
- package/dist/{resolve-ddl-schema-B8cX92k0-DzN6Alxy.mjs → resolve-ddl-schema-IdPEiyLX-BZGpy8Wz.mjs} +3 -3
- package/dist/{resolve-ddl-schema-B8cX92k0-DzN6Alxy.mjs.map → resolve-ddl-schema-IdPEiyLX-BZGpy8Wz.mjs.map} +1 -1
- package/dist/{sql-renderer-CD5aYQos-DZotmt9U.mjs → sql-renderer-CD5aYQos-1hGCWT0S.mjs} +3 -3
- package/dist/{sql-renderer-CD5aYQos-DZotmt9U.mjs.map → sql-renderer-CD5aYQos-1hGCWT0S.mjs.map} +1 -1
- package/dist/{sql-utils-DxE_vJt4-Dkjw9U45.mjs → sql-utils-Bnw3JbWf-zvWDkyrr.mjs} +3 -178
- package/dist/sql-utils-Bnw3JbWf-zvWDkyrr.mjs.map +1 -0
- package/dist/target.d.mts +17 -16
- package/dist/target.mjs +29 -29
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__contract-free.mjs +3 -3
- package/dist/target__control.mjs +2558 -3
- package/dist/target__control.mjs.map +1 -0
- package/dist/target__data-types.d.mts +2 -2
- package/dist/target__data-types.mjs +3 -3
- package/dist/target__default-normalizer.d.mts +1 -1
- package/dist/target__default-normalizer.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__full-text-index-authoring.mjs +1 -1
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- 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 +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.d.mts +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- 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-sql-checks.d.mts +3 -2
- package/dist/target__planner-sql-checks.mjs +2 -2
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.mjs +5 -5
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__sql-utils.mjs +2 -2
- package/dist/target__types.mjs +2 -2
- package/dist/{infer-psl-contract-CKP3nwjB-x1_ji7Z9.mjs → type-constructors-CrNUrtwZ-dmWF-mtV.mjs} +385 -15
- package/dist/type-constructors-CrNUrtwZ-dmWF-mtV.mjs.map +1 -0
- package/package.json +9 -9
- package/dist/adapter-CA0jY1EK.d.mts.map +0 -1
- package/dist/adapter-UEtFYllx-DXa1Ekth.mjs.map +0 -1
- package/dist/contract-contributions-DrHk5h_E-BbmViVsC.mjs.map +0 -1
- package/dist/control-CwTFk4YS.mjs +0 -2929
- package/dist/control-CwTFk4YS.mjs.map +0 -1
- package/dist/control-l0spLFiu.d.mts.map +0 -1
- package/dist/control-policy-BdfDPcjX-BueP9PBT.mjs.map +0 -1
- package/dist/data-types-BkFfMhgz.d.mts.map +0 -1
- package/dist/default-normalizer-BqFHmlox-CP8ywN-r.mjs.map +0 -1
- package/dist/default-normalizer-CTAiFe9Y.d.mts.map +0 -1
- package/dist/indexes-ca4Dxsym-By_PZuYD.d.mts.map +0 -1
- package/dist/infer-psl-contract-CKP3nwjB-x1_ji7Z9.mjs.map +0 -1
- package/dist/issue-planner-B3E9yChD.d.mts.map +0 -1
- package/dist/native-type-normalizer-BFo5tSyh.d.mts +0 -37
- package/dist/native-type-normalizer-BFo5tSyh.d.mts.map +0 -1
- package/dist/native-type-normalizer-CwyVR7xB.mjs +0 -96
- package/dist/native-type-normalizer-CwyVR7xB.mjs.map +0 -1
- package/dist/op-factory-call-B-EoYQIO-BIfzqVX6.mjs.map +0 -1
- package/dist/op-factory-call-uVDKZqw1.d.mts +0 -1
- package/dist/op-factory-call-z5TKsamx-DDfPa57U.d.mts.map +0 -1
- package/dist/planner-identity-values-Dr5FgyF1.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-D-ZcNy7h.d.mts +0 -1
- package/dist/planner-produced-postgres-migration-sxhIP3Te-Cn3sD9zE.d.mts.map +0 -1
- package/dist/planner-sql-checks-C54jJ5qt.d.mts +0 -39
- package/dist/planner-sql-checks-C54jJ5qt.d.mts.map +0 -1
- package/dist/planner-sql-checks-pAQfWJz_-CosbjrRp.mjs +0 -132
- package/dist/planner-sql-checks-pAQfWJz_-CosbjrRp.mjs.map +0 -1
- package/dist/postgres-migration-BGkcs09r-BmUXCs80.mjs.map +0 -1
- package/dist/prisma7-binding-XSuxkjqy.d.mts.map +0 -1
- package/dist/prisma7-binding-ZUOUC530.mjs.map +0 -1
- package/dist/sql-utils-DxE_vJt4-Dkjw9U45.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-database-schema-DLIpM5BX-DlEJquxk.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/diff-database-schema-DLIpM5BX.mjs"],"sourcesContent":["import { c as postgresError } from \"./errors-BrhQYgdL.mjs\";\nimport { i as fullTextIndexDefinitionOf, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-BPxQQBuC.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-BtW3Sw0F.mjs\";\nimport { t as postgresAccessMethodOf } from \"./index-types-BihjrAAq.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqFHmlox.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { n as renderFullTextIndexDocument } from \"./full-text-search-document-DbegbX0J.mjs\";\nimport { r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-B8cX92k0.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-BdfDPcjX.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst fullText = fullTextIndexDefinitionOf(i);\n\t\t\t\tif (fullText !== void 0) return new SqlIndexIR({\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: postgresAccessMethodOf(FULL_TEXT_INDEX_TYPE),\n\t\t\t\t\toptions: void 0,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\texpression: renderFullTextIndexDocument(fullText),\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, fullText.weightGroups.flat())\n\t\t\t\t});\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-DLIpM5BX.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;AACA,SAAS,aAAa,QAAQ,aAAa;CAC1C,OAAO,IAAI,yBAAyB;EACnC,QAAQ,SAAS,OAAO,MAAM,OAAO,MAAM;EAC3C,WAAW,OAAO;EAClB;EACA,WAAW,OAAO;EAClB,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,YAAY,OAAO;EACnB,WAAW,CAAC,eAAe,aAAa,OAAO,SAAS,GAAG,GAAG,OAAO,MAAM,IAAI,aAAa,CAAC;CAC9F,CAAC;AACF;;;;;;;;;;;;;;;;;;;;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,QAAQ,CAAC;EACV,CAAC;EACD,SAAS;CACV;CACA,IAAI,CAAC,QAAQ,OAAO;CACpB,OAAO,IAAI,2BAA2B;EACrC;EACA,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,iBAAiB,CAAC,GAAG,OAAO,eAAe;EAC3C,WAAW,OAAO;CACnB,CAAC;AACF;;;;;;;;;;;;;AAaA,SAAS,sBAAsB,OAAO;CACrC,MAAM,mBAAmB,UAAU,MAAM,QAAQ;CACjD,2BAA2B,OAAO,MAAM,YAAY;CACpD,MAAM,SAAS,MAAM;CACrB,MAAM,QAAQ,iBAAiB,MAAM,mBAAmB;CACxD,MAAM,eAAe,qCAAqC,kBAAkB;EAC3E,qBAAqB;EACrB,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,gBAAgB;CACjB,CAAC;CACD,MAAM,WAAW,yBAAyB,YAAY;CACtD,MAAM,eAAe,oBAAoB,UAAU,MAAM;CACzD,MAAM,kBAAkB,iBAAiB,QAAQ;CACjD,MAAM,kBAAkB,iBAAiB,YAAY;CACrD,OAAO;EACN;EACA,QAAQ;EACR,QAAQ,UAAU,YAAY,UAAU,YAAY,CAAC,CAAC,CAAC,QAAQ,UAAU;GACxE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"diff-database-schema-DyCIRT80-C1zMCmRx.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/diff-database-schema-DyCIRT80.mjs"],"sourcesContent":["import { c as postgresError } from \"./errors-BrhQYgdL.mjs\";\nimport { i as fullTextIndexDefinitionOf, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-BPxQQBuC.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-DyUXtYIT.mjs\";\nimport { t as postgresAccessMethodOf } from \"./index-types-BihjrAAq.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { n as renderFullTextIndexDocument } from \"./full-text-search-document-Doy5TF7c.mjs\";\nimport { r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-IdPEiyLX.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-BHjZnca1.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst fullText = fullTextIndexDefinitionOf(i);\n\t\t\t\tif (fullText !== void 0) return new SqlIndexIR({\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: postgresAccessMethodOf(FULL_TEXT_INDEX_TYPE),\n\t\t\t\t\toptions: void 0,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\texpression: renderFullTextIndexDocument(fullText),\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, fullText.weightGroups.flat())\n\t\t\t\t});\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-DyCIRT80.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,y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GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c as postgresError } from "./errors-BrhQYgdL-D_lIrddD.mjs";
|
|
2
|
-
import { i as quoteIdentifier } from "./sql-utils-
|
|
2
|
+
import { i as quoteIdentifier } from "./sql-utils-Bnw3JbWf-zvWDkyrr.mjs";
|
|
3
3
|
import { l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-BPxQQBuC-BrpDsuJu.mjs";
|
|
4
4
|
import { assertDefined } from "@prisma/orm-framework/utils/assertions";
|
|
5
|
-
//#region ../../../3-targets/3-targets/postgres/dist/full-text-search-document-
|
|
5
|
+
//#region ../../../3-targets/3-targets/postgres/dist/full-text-search-document-Doy5TF7c.mjs
|
|
6
6
|
/**
|
|
7
7
|
* The search document of a full-text index: the expression the index is built over and the one
|
|
8
8
|
* `fullTextMatches` and `fullTextRank` search. Postgres uses an expression index only when the
|
|
@@ -51,4 +51,4 @@ function renderFullTextIndexDocument(definition) {
|
|
|
51
51
|
//#endregion
|
|
52
52
|
export { renderFullTextIndexDocument as n, renderFullTextDocument as t };
|
|
53
53
|
|
|
54
|
-
//# sourceMappingURL=full-text-search-document-
|
|
54
|
+
//# sourceMappingURL=full-text-search-document-Doy5TF7c-DezgYsP-.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"full-text-search-document-
|
|
1
|
+
{"version":3,"file":"full-text-search-document-Doy5TF7c-DezgYsP-.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text-search-document-Doy5TF7c.mjs"],"sourcesContent":["import { c as postgresError } from \"./errors-BrhQYgdL.mjs\";\nimport { i as quoteIdentifier } from \"./sql-utils-Bnw3JbWf.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, o as fullTextIndexProblems, r as describeFullTextIndexProblem } from \"./full-text-index-definition-BPxQQBuC.mjs\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region src/core/full-text-search-document.ts\n/**\n* The search document of a full-text index: the expression the index is built over and the one\n* `fullTextMatches` and `fullTextRank` search. Postgres uses an expression index only when the\n* query carries the same expression, so the index DDL, the schema node and the query operations\n* all render it here, from weight groups their callers have already checked.\n*\n* One field alone is `to_tsvector(language, field)`. With more fields, each gets its own\n* `to_tsvector`, wrapped in `coalesce(field, '')` since one null would make the whole document\n* null, and they are joined with `||`. With more than one group, each field is weighted with its\n* group's weight, `A` for the first. The document depends on the groups and the language only, so\n* a column's nullability never changes it.\n*/\nfunction renderFullTextDocument(groups, writer) {\n\tconst fieldCount = groups.reduce((count, group) => count + group.length, 0);\n\tconst weighted = groups.length > 1;\n\tconst vectors = groups.flatMap((group, position) => group.map((field) => {\n\t\tconst column = writer.column(field);\n\t\tconst text = fieldCount > 1 ? `coalesce(${column}, '')` : column;\n\t\tconst vector = `to_tsvector(${writer.language}, ${text})`;\n\t\tif (!weighted) return vector;\n\t\tconst weight = FULL_TEXT_WEIGHTS[position];\n\t\tassertDefined(weight, `a full-text document has no weight for group ${position + 1}`);\n\t\treturn `setweight(${vector}, '${weight}')`;\n\t}));\n\tconst [only] = vectors;\n\tassertDefined(only, \"a full-text document has at least one field\");\n\treturn vectors.length === 1 ? only : `(${vectors.join(\" || \")})`;\n}\n/**\n* The search document over storage columns, as the index DDL and the schema node carry it. A\n* definition that breaks a rule of a full-text index is refused.\n*/\nfunction renderFullTextIndexDocument(definition) {\n\tconst { weightGroups } = definition;\n\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\tif (problem !== void 0) throw postgresError(\"CONTRACT.INDEX_INVALID\", describeFullTextIndexProblem(\"The full-text index definition\", problem), {\n\t\twhy: \"Each field of a search document is weighted by the position of its group, so the document is rendered only from weight groups that follow the rules of a full-text index.\",\n\t\tfix: \"Pass one to four non-empty weight groups that name each column once.\",\n\t\tmeta: { weightGroups }\n\t});\n\treturn renderFullTextDocument(weightGroups, {\n\t\tcolumn: quoteIdentifier,\n\t\tlanguage: `'${definition.language}'`\n\t});\n}\n//#endregion\nexport { renderFullTextIndexDocument as n, renderFullTextDocument as t };\n\n//# sourceMappingURL=full-text-search-document-Doy5TF7c.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,uBAAuB,QAAQ,QAAQ;CAC/C,MAAM,aAAa,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,QAAQ,CAAC;CAC1E,MAAM,WAAW,OAAO,SAAS;CACjC,MAAM,UAAU,OAAO,SAAS,OAAO,aAAa,MAAM,KAAK,UAAU;EACxE,MAAM,SAAS,OAAO,OAAO,KAAK;EAClC,MAAM,OAAO,aAAa,IAAI,YAAY,OAAO,SAAS;EAC1D,MAAM,SAAS,eAAe,OAAO,SAAS,IAAI,KAAK;EACvD,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,SAAS,kBAAkB;EACjC,cAAc,QAAQ,gDAAgD,WAAW,GAAG;EACpF,OAAO,aAAa,OAAO,KAAK,OAAO;CACxC,CAAC,CAAC;CACF,MAAM,CAAC,QAAQ;CACf,cAAc,MAAM,6CAA6C;CACjE,OAAO,QAAQ,WAAW,IAAI,OAAO,IAAI,QAAQ,KAAK,MAAM,EAAE;AAC/D;;;;;AAKA,SAAS,4BAA4B,YAAY;CAChD,MAAM,EAAE,iBAAiB;CACzB,MAAM,CAAC,WAAW,sBAAsB,EAAE,aAAa,CAAC;CACxD,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,0BAA0B,6BAA6B,kCAAkC,OAAO,GAAG;EAC9I,KAAK;EACL,KAAK;EACL,MAAM,EAAE,aAAa;CACtB,CAAC;CACD,OAAO,uBAAuB,cAAc;EAC3C,QAAQ;EACR,UAAU,IAAI,WAAW,SAAS;CACnC,CAAC;AACF"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "./nodes-DOXes-fG-BifJqoRd.mjs";
|
|
2
2
|
import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-_xPQVPF0.mjs";
|
|
3
|
+
import "./planner-sql-checks-CxlrM4J2-VqQpmMwn.mjs";
|
|
3
4
|
import { ReferentialAction } from "@prisma/orm-family-sql/contract/types";
|
|
4
5
|
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
5
|
-
//#region ../../../3-targets/3-targets/postgres/dist/indexes-
|
|
6
|
+
//#region ../../../3-targets/3-targets/postgres/dist/indexes-DtIXFHAb.d.mts
|
|
6
7
|
//#region src/core/migrations/autoincrement-widths.d.ts
|
|
7
8
|
/** How an `autoincrement()` column of one integer width is written: its SERIAL pseudo-type when the column is created, and the `AS` type of the sequence `setDefault` attaches to an existing column. */
|
|
8
9
|
interface AutoincrementWidth {
|
|
@@ -55,4 +56,4 @@ interface CreateIndexExtras {
|
|
|
55
56
|
}
|
|
56
57
|
//#endregion
|
|
57
58
|
export { Op as a, ForeignKeySpec as i, AutoincrementWidth as n, RenamableConstraintKind as o, CreateIndexExtras as r, AlterColumnTypeClass as t };
|
|
58
|
-
//# sourceMappingURL=indexes-
|
|
59
|
+
//# sourceMappingURL=indexes-DtIXFHAb-DBubdl32.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexes-DtIXFHAb-DBubdl32.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/indexes-DtIXFHAb.d.mts"],"mappings":";;;;;;;;UAUU;WACC;WACA;;WAEA;;;;KAIN,KAAK,0BAA0B;;;;;;UAM1B;WACC;WACA;WACA;aACE;aACA;aACA;;WAEF,WAAW;WACX,WAAW;;;;;;;;KAQjB;;;KAGA;;;UAGK;WACC;WACA,UAAU;;;;;;WAMV;WACA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { O as PostgresOpFactoryCall } from "./op-factory-call-
|
|
2
|
-
import { DataType } from "@prisma/orm-framework/components/codec";
|
|
3
|
-
import { SqlTypeLookups } from "@prisma/orm-family-sql/contract/data-type";
|
|
1
|
+
import { O as PostgresOpFactoryCall } from "./op-factory-call-kdPO0kgG-DV8hS6qA.mjs";
|
|
2
|
+
import { DataType, TypeLookups } from "@prisma/orm-framework/components/codec";
|
|
4
3
|
import { SqlStorage, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
|
|
5
4
|
import { DiffableNode, SchemaDiffIssue } from "@prisma/orm-framework/components/control";
|
|
6
5
|
import { CodecControlHooks, FieldStatementColumns, MigrationOperationPolicy, SqlPlannerConflict } from "@prisma/orm-family-sql/family/control";
|
|
@@ -25,7 +24,7 @@ interface StrategyContext {
|
|
|
25
24
|
readonly schemaName: string;
|
|
26
25
|
readonly codecHooks: ReadonlyMap<string, CodecControlHooks>;
|
|
27
26
|
/** The composed stack's codecs and data types, which write each column's type. */
|
|
28
|
-
readonly types:
|
|
27
|
+
readonly types: TypeLookups;
|
|
29
28
|
readonly storageTypes: Readonly<Record<string, StorageTypeInstance>>;
|
|
30
29
|
readonly schema: SqlSchemaIR;
|
|
31
30
|
readonly policy: MigrationOperationPolicy;
|
|
@@ -79,7 +78,7 @@ interface IssuePlannerOptions {
|
|
|
79
78
|
readonly schemaName: string;
|
|
80
79
|
readonly codecHooks: ReadonlyMap<string, CodecControlHooks>;
|
|
81
80
|
/** The composed stack's codecs and data types, which write each column's type. */
|
|
82
|
-
readonly types:
|
|
81
|
+
readonly types: TypeLookups;
|
|
83
82
|
readonly storageTypes: Readonly<Record<string, StorageTypeInstance>>;
|
|
84
83
|
/**
|
|
85
84
|
* Current database schema IR. Strategies read this to detect whether a
|
|
@@ -114,4 +113,4 @@ interface IssuePlannerOptions {
|
|
|
114
113
|
declare function planIssues(options: IssuePlannerOptions): Result<IssuePlannerValue, readonly SqlPlannerConflict[]>;
|
|
115
114
|
//#endregion
|
|
116
115
|
export { planIssues as n, coalesceSubtreeIssues as t };
|
|
117
|
-
//# sourceMappingURL=issue-planner-
|
|
116
|
+
//# sourceMappingURL=issue-planner-DrWlNiAf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-planner-DrWlNiAf.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/issue-planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAmBU;WACC,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;;WAEhC,OAAO;WACP,cAAc,SAAS,eAAe;WACtC,QAAQ;WACR,QAAQ;WACR,qBAAqB,cAAc;;WAEnC,kBAAkB;;WAElB,oBAAoB;;;;;;;;;KAS1B,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;;WAEhC,OAAO;WACP,cAAc,SAAS,eAAe;;;;;;;;WAQtC,SAAS;;;;;;WAMT,SAAS;;;;;WAKT,sBAAsB,cAAc;;WAEpC,mBAAmB;WACnB,sBAAsB;;;;;;;;;iBAShB,WAAW,SAAS,sBAAsB,OAAO,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-CbOh59ZJ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { V as createExtension } from \"./op-factory-call-
|
|
1
|
+
{"version":3,"file":"migration-CbOh59ZJ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { V as createExtension } from \"./op-factory-call-No9Z2tdw.mjs\";\nimport { t as PostgresMigration } from \"./postgres-migration-BbXm1l5I.mjs\";\nimport { t as dataTransform } from \"./data-transform-CtHnNYhF.mjs\";\nimport { sql } from \"@internal/sql-contract/sql-expression\";\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, sql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAkBA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./data-transform-nGy9rz87-CEOXAj91.mjs";
|
|
2
|
-
import { a as Op } from "./indexes-
|
|
3
|
-
import "./postgres-migration-
|
|
2
|
+
import { a as Op } from "./indexes-DtIXFHAb-DBubdl32.mjs";
|
|
3
|
+
import "./postgres-migration-CRLV93uK-ThJW3tFf.mjs";
|
|
4
4
|
import { checkExpression as checkExpression$1, 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
5
|
import { sql } from "@prisma/orm-family-sql/contract/sql-expression";
|
|
6
6
|
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
@@ -23,4 +23,4 @@ declare function createExtension(extensionName: string): Op;
|
|
|
23
23
|
declare function rawSql(op: Op): Op;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { fn$1 as a, placeholder as c, sql as d, unique as f, createExtension as i, primaryKey as l, checkExpression$1 as n, foreignKey as o, col$1 as r, lit$1 as s, MigrationCLI as t, rawSql as u };
|
|
26
|
-
//# sourceMappingURL=migration-
|
|
26
|
+
//# sourceMappingURL=migration-DO23kNde.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-DO23kNde.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.d.mts"],"mappings":";;;;;;;;;iBASiB,gBAAgB,wBAAwB;;;;;;;;;;;;;iBAaxC,OAAO,IAAI,KAAK"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/postgres/dist/native-type-normalizer.d.mts
|
|
2
|
+
//#region src/core/native-type-normalizer.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The type columns introspection reads for one column: `format_type(atttypid, atttypmod)` and the
|
|
5
|
+
* `information_schema.columns` type fields.
|
|
6
|
+
*/
|
|
7
|
+
interface CatalogColumnType {
|
|
8
|
+
readonly formattedType: string | null;
|
|
9
|
+
/** `information_schema.columns.data_type`. */
|
|
10
|
+
readonly informationSchemaType: string;
|
|
11
|
+
readonly udtName: string;
|
|
12
|
+
readonly characterMaximumLength: number | null;
|
|
13
|
+
readonly numericPrecision: number | null;
|
|
14
|
+
readonly numericScale: number | null;
|
|
15
|
+
/** The enum the column, or each of its elements, is typed by. */
|
|
16
|
+
readonly enumType?: {
|
|
17
|
+
readonly schema: string;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface IntrospectedTypeText {
|
|
22
|
+
/** The column's type as the database reports it, or an enum's name as a contract writes it; for an array column, its element type. */
|
|
23
|
+
readonly typeText: string;
|
|
24
|
+
readonly many: true | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** The type introspection reports for a column, from its catalog type columns. */
|
|
27
|
+
declare function introspectedTypeText(column: CatalogColumnType): IntrospectedTypeText;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { IntrospectedTypeText as n, introspectedTypeText as r, CatalogColumnType as t };
|
|
30
|
+
//# sourceMappingURL=native-type-normalizer-DFE5L3YY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-type-normalizer-DFE5L3YY.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/native-type-normalizer.d.mts"],"mappings":";;;;;;UAKU;WACC;;WAEA;WACA;WACA;WACA;WACA;;WAEA;aACE;aACA;;;UAGH;;WAEC;WACA;;;iBAGM,qBAAqB,QAAQ,oBAAoB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Z as qualifiedEnumName } from "./data-types-Cs-LkJBw-CJN57Y5M.mjs";
|
|
2
|
+
//#region ../../../3-targets/3-targets/postgres/dist/native-type-normalizer.mjs
|
|
3
|
+
/** The type introspection reports for a column, from its catalog type columns. */
|
|
4
|
+
function introspectedTypeText(column) {
|
|
5
|
+
const reported = reportedTypeText(column);
|
|
6
|
+
const many = reported.endsWith("[]") ? true : void 0;
|
|
7
|
+
return {
|
|
8
|
+
typeText: column.enumType !== void 0 ? qualifiedEnumName(column.enumType) : many ? reported.slice(0, -2) : reported,
|
|
9
|
+
many
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function reportedTypeText(column) {
|
|
13
|
+
if (column.formattedType) return column.formattedType;
|
|
14
|
+
if (column.informationSchemaType === "character varying" || column.informationSchemaType === "character") return column.characterMaximumLength ? `${column.informationSchemaType}(${column.characterMaximumLength})` : column.informationSchemaType;
|
|
15
|
+
if (column.informationSchemaType === "numeric" || column.informationSchemaType === "decimal") {
|
|
16
|
+
if (column.numericPrecision && column.numericScale !== null) return `${column.informationSchemaType}(${column.numericPrecision},${column.numericScale})`;
|
|
17
|
+
return column.numericPrecision ? `${column.informationSchemaType}(${column.numericPrecision})` : column.informationSchemaType;
|
|
18
|
+
}
|
|
19
|
+
return column.udtName || column.informationSchemaType;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { introspectedTypeText as t };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=native-type-normalizer-a1XJSlk6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-type-normalizer-a1XJSlk6.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/native-type-normalizer.mjs"],"sourcesContent":["import { z as qualifiedEnumName } from \"./data-types-Cs-LkJBw.mjs\";\n//#region src/core/native-type-normalizer.ts\n/** The type introspection reports for a column, from its catalog type columns. */\nfunction introspectedTypeText(column) {\n\tconst reported = reportedTypeText(column);\n\tconst many = reported.endsWith(\"[]\") ? true : void 0;\n\treturn {\n\t\ttypeText: column.enumType !== void 0 ? qualifiedEnumName(column.enumType) : many ? reported.slice(0, -2) : reported,\n\t\tmany\n\t};\n}\nfunction reportedTypeText(column) {\n\tif (column.formattedType) return column.formattedType;\n\tif (column.informationSchemaType === \"character varying\" || column.informationSchemaType === \"character\") return column.characterMaximumLength ? `${column.informationSchemaType}(${column.characterMaximumLength})` : column.informationSchemaType;\n\tif (column.informationSchemaType === \"numeric\" || column.informationSchemaType === \"decimal\") {\n\t\tif (column.numericPrecision && column.numericScale !== null) return `${column.informationSchemaType}(${column.numericPrecision},${column.numericScale})`;\n\t\treturn column.numericPrecision ? `${column.informationSchemaType}(${column.numericPrecision})` : column.informationSchemaType;\n\t}\n\treturn column.udtName || column.informationSchemaType;\n}\n//#endregion\nexport { introspectedTypeText };\n\n//# sourceMappingURL=native-type-normalizer.mjs.map"],"mappings":";;;AAGA,SAAS,qBAAqB,QAAQ;CACrC,MAAM,WAAW,iBAAiB,MAAM;CACxC,MAAM,OAAO,SAAS,SAAS,IAAI,IAAI,OAAO,KAAK;CACnD,OAAO;EACN,UAAU,OAAO,aAAa,KAAK,IAAI,kBAAkB,OAAO,QAAQ,IAAI,OAAO,SAAS,MAAM,GAAG,EAAE,IAAI;EAC3G;CACD;AACD;AACA,SAAS,iBAAiB,QAAQ;CACjC,IAAI,OAAO,eAAe,OAAO,OAAO;CACxC,IAAI,OAAO,0BAA0B,uBAAuB,OAAO,0BAA0B,aAAa,OAAO,OAAO,yBAAyB,GAAG,OAAO,sBAAsB,GAAG,OAAO,uBAAuB,KAAK,OAAO;CAC9N,IAAI,OAAO,0BAA0B,aAAa,OAAO,0BAA0B,WAAW;EAC7F,IAAI,OAAO,oBAAoB,OAAO,iBAAiB,MAAM,OAAO,GAAG,OAAO,sBAAsB,GAAG,OAAO,iBAAiB,GAAG,OAAO,aAAa;EACtJ,OAAO,OAAO,mBAAmB,GAAG,OAAO,sBAAsB,GAAG,OAAO,iBAAiB,KAAK,OAAO;CACzG;CACA,OAAO,OAAO,WAAW,OAAO;AACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./op-factory-call-kdPO0kgG-DV8hS6qA.mjs";
|
package/dist/{op-factory-call-B-EoYQIO-BIfzqVX6.mjs → op-factory-call-No9Z2tdw-Lap8xvVy.mjs}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { c as postgresError } from "./errors-BrhQYgdL-D_lIrddD.mjs";
|
|
2
|
-
import { i as quoteIdentifier, n as escapeLiteral, o as
|
|
2
|
+
import { a as quoteQualifiedName, i as quoteIdentifier, n as escapeLiteral, o as validateEnumValueLength, t as POSTGRES_QUOTING } from "./sql-utils-Bnw3JbWf-zvWDkyrr.mjs";
|
|
3
3
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
|
|
4
|
-
import { A as nativeEnumValueExistsAst, C as dropIndex$1, D as indexDefinitionAst, E as extensionExistsAst, F as rlsPolicyExistsAst, I as sequenceNameAvailableAst, L as sequenceValuesFitAst, M as relationKindAst, N as rlsEnabledAst, O as indexExistsAst, P as rlsPolicyDefinitionAst, R as tableExistsAst, S as dropDefaultAction, T as dropType, _ as createPolicy, a as alterPolicyRename, b as createType, c as columnDefaultSequenceAst, d as columnOwnsSequenceAst, f as columnTypeAst, g as createIndex$1, h as constraintExistsAst, i as alterIndexRename, j as noNullValuesAst, k as nativeEnumTypeExistsAst, l as columnExistsAst, m as constraintDefinitionAst, n as addConstraintAction, o as alterTable, p as columnTypeOidAst, r as alterColumnTypeAction, s as columnDefaultAst, t as addColumnAction, u as columnNullabilityAst, v as createSchema, w as dropPolicy, x as disableRowLevelSecurity$1, y as createTable, z as tableIsEmptyAst } from "./ddl-
|
|
4
|
+
import { A as nativeEnumValueExistsAst, C as dropIndex$1, D as indexDefinitionAst, E as extensionExistsAst, F as rlsPolicyExistsAst, I as sequenceNameAvailableAst, L as sequenceValuesFitAst, M as relationKindAst, N as rlsEnabledAst, O as indexExistsAst, P as rlsPolicyDefinitionAst, R as tableExistsAst, S as dropDefaultAction, T as dropType, _ as createPolicy, a as alterPolicyRename, b as createType, c as columnDefaultSequenceAst, d as columnOwnsSequenceAst, f as columnTypeAst, g as createIndex$1, h as constraintExistsAst, i as alterIndexRename, j as noNullValuesAst, k as nativeEnumTypeExistsAst, l as columnExistsAst, m as constraintDefinitionAst, n as addConstraintAction, o as alterTable, p as columnTypeOidAst, r as alterColumnTypeAction, s as columnDefaultAst, t as addColumnAction, u as columnNullabilityAst, v as createSchema, w as dropPolicy, x as disableRowLevelSecurity$1, y as createTable, z as tableIsEmptyAst } from "./ddl-2L13tYjC-enYPQJnG.mjs";
|
|
5
5
|
import { i as policyRoleList, t as POLICY_COMMAND_SQL } from "./canonicalize-RdxoUHao-DK_M6HU-.mjs";
|
|
6
|
-
import { r as autoincrementWidthOfPseudoType, t as autoincrementWidth } from "./autoincrement-widths-
|
|
6
|
+
import { r as autoincrementWidthOfPseudoType, t as autoincrementWidth } from "./autoincrement-widths-1v9UfTSw-NFaqRGCV.mjs";
|
|
7
7
|
import { t as postgresObjectName } from "./postgres-object-name-FPikIvOw-BNs44hTu.mjs";
|
|
8
|
-
import { i as qualifyTableName, r as
|
|
8
|
+
import { i as qualifyTableName, n as columnTypeCheckIfReadable, r as columnTypeCheckText, t as alterTypeCheck } from "./planner-sql-checks-pkURMYMz-2QAIKyW-.mjs";
|
|
9
9
|
import { t as buildTargetDetails } from "./planner-target-details-CUEF0s90-COTks5yz.mjs";
|
|
10
10
|
import { DdlColumn, FunctionColumnDefault, LiteralColumnDefault, opaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
|
|
11
11
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
@@ -18,7 +18,7 @@ import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal
|
|
|
18
18
|
import { unfilledPlaceholderOperation } from "@prisma/orm-framework/errors/migration";
|
|
19
19
|
import { TsExpression, jsonToTsSource, tsObjectSource } from "@prisma/orm-framework/ts-render";
|
|
20
20
|
import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
|
|
21
|
-
//#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-
|
|
21
|
+
//#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-No9Z2tdw.mjs
|
|
22
22
|
/**
|
|
23
23
|
* Maps a planner schema name to the contract-free DDL builder's optional
|
|
24
24
|
* `schema` field: the unbound sentinel becomes `undefined` (the builder omits
|
|
@@ -58,18 +58,27 @@ async function columnExistsSteps(lowerer, options) {
|
|
|
58
58
|
absent: await lowerer.lowerToExecuteRequest(checks.columnAbsent())
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/** The check that the column has the type `check` recognises: by the text `format_type` prints, or by the type's identity. */
|
|
62
|
+
function columnTypeCheckAst(location, check) {
|
|
63
|
+
return check.kind === "catalog-text" ? columnTypeAst({
|
|
64
|
+
...location,
|
|
65
|
+
expectedType: check.text
|
|
66
|
+
}) : columnTypeOidAst({
|
|
67
|
+
...location,
|
|
68
|
+
type: check.typeName,
|
|
69
|
+
many: check.many
|
|
70
|
+
});
|
|
71
|
+
}
|
|
61
72
|
/**
|
|
62
|
-
* The postcheck step that the column has the type `type`:
|
|
73
|
+
* The postcheck step that the column has the type `type`: as `check` recognises it when the stack's data types read the type, and otherwise by the type's oid, which ignores a type modifier.
|
|
63
74
|
*/
|
|
64
|
-
async function columnTypeStep(lowerer, location, type,
|
|
65
|
-
const
|
|
66
|
-
...location,
|
|
67
|
-
type
|
|
68
|
-
}) : columnTypeAst({
|
|
75
|
+
async function columnTypeStep(lowerer, location, type, check) {
|
|
76
|
+
const lowered = await lowerer.lowerToExecuteRequest(check === void 0 ? columnTypeOidAst({
|
|
69
77
|
...location,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
type,
|
|
79
|
+
many: false
|
|
80
|
+
}) : columnTypeCheckAst(location, check));
|
|
81
|
+
return step(`verify column "${location.column}" has type ${check === void 0 ? `"${type}"` : columnTypeCheckText(check)}`, lowered.sql, lowered.params);
|
|
73
82
|
}
|
|
74
83
|
async function dropColumn(schemaName, tableName, columnName, lowerer) {
|
|
75
84
|
const qualified = qualifyTableName(schemaName, tableName);
|
|
@@ -117,7 +126,7 @@ async function renameColumn(schemaName, tableName, fromName, toName, lowerer) {
|
|
|
117
126
|
}
|
|
118
127
|
/**
|
|
119
128
|
* `type` is the new column type as a migration writes it, into the `ALTER COLUMN TYPE` clause.
|
|
120
|
-
* `checkType` is the
|
|
129
|
+
* `checkType` is how the postcheck recognises the new type. `sequence` is
|
|
121
130
|
* the width of the sequence the column owns when it has an `autoincrement()` default: the operation
|
|
122
131
|
* finds that sequence in the catalog and changes it to the new width, refusing first when the
|
|
123
132
|
* sequence has handed out a value past that width. A column whose default reads a sequence it does
|
|
@@ -130,12 +139,11 @@ async function alterColumnType(schemaName, tableName, columnName, options, lower
|
|
|
130
139
|
table: tableName,
|
|
131
140
|
column: columnName
|
|
132
141
|
});
|
|
133
|
-
const typeCheck = await lowerer.lowerToExecuteRequest(
|
|
142
|
+
const typeCheck = await lowerer.lowerToExecuteRequest(columnTypeCheckAst({
|
|
134
143
|
schema: schemaName,
|
|
135
144
|
table: tableName,
|
|
136
|
-
column: columnName
|
|
137
|
-
|
|
138
|
-
}));
|
|
145
|
+
column: columnName
|
|
146
|
+
}, options.checkType));
|
|
139
147
|
const alterType = await lowerer.lowerToExecuteRequest(alterTable({
|
|
140
148
|
...ifDefined("schema", boundSchema(schemaName)),
|
|
141
149
|
table: tableName,
|
|
@@ -160,7 +168,7 @@ async function alterColumnType(schemaName, tableName, columnName, options, lower
|
|
|
160
168
|
...step(`alter type of "${columnName}" to ${options.type}`, alterType.sql),
|
|
161
169
|
...options.using !== void 0 ? { meta: convertedColumnMeta(tableName, columnName, "conversion") } : operationClass === "destructive" ? { meta: convertedColumnMeta(tableName, columnName, "cast") } : {}
|
|
162
170
|
}, ...sequenceSteps.execute],
|
|
163
|
-
postcheck: [step(`verify column "${columnName}" has type
|
|
171
|
+
postcheck: [step(`verify column "${columnName}" has type ${columnTypeCheckText(options.checkType)}`, typeCheck.sql, typeCheck.params), ...sequenceSteps.postcheck],
|
|
164
172
|
meta: { warning: "TABLE_REWRITE" }
|
|
165
173
|
};
|
|
166
174
|
}
|
|
@@ -1339,7 +1347,7 @@ var AddColumnCall = class extends PostgresOpFactoryCallNode {
|
|
|
1339
1347
|
schemaName;
|
|
1340
1348
|
tableName;
|
|
1341
1349
|
column;
|
|
1342
|
-
/**
|
|
1350
|
+
/** How the postcheck recognises the column's type, or `undefined` when the stack's data types do not read it. */
|
|
1343
1351
|
checkType;
|
|
1344
1352
|
label;
|
|
1345
1353
|
constructor(schemaName, tableName, column, dataTypes) {
|
|
@@ -1347,7 +1355,7 @@ var AddColumnCall = class extends PostgresOpFactoryCallNode {
|
|
|
1347
1355
|
this.schemaName = schemaName;
|
|
1348
1356
|
this.tableName = tableName;
|
|
1349
1357
|
this.column = column;
|
|
1350
|
-
this.checkType =
|
|
1358
|
+
this.checkType = columnTypeCheckIfReadable(column.type, dataTypes);
|
|
1351
1359
|
this.label = `Add column "${column.name}" to "${tableName}"`;
|
|
1352
1360
|
this.freeze();
|
|
1353
1361
|
}
|
|
@@ -1504,7 +1512,7 @@ var AlterColumnTypeCall = class extends PostgresOpFactoryCallNode {
|
|
|
1504
1512
|
/** The new type as a migration writes it. */
|
|
1505
1513
|
type;
|
|
1506
1514
|
using;
|
|
1507
|
-
/**
|
|
1515
|
+
/** How the postcheck recognises the column's new type once the alter has run. */
|
|
1508
1516
|
checkType;
|
|
1509
1517
|
/** The width the sequence the column owns takes, when the column has an `autoincrement()` default and an integer type. */
|
|
1510
1518
|
sequenceWidth;
|
|
@@ -1519,7 +1527,7 @@ var AlterColumnTypeCall = class extends PostgresOpFactoryCallNode {
|
|
|
1519
1527
|
this.sequenceWidth = input.ownsAutoincrementSequence ? autoincrementWidth(input.type) : void 0;
|
|
1520
1528
|
this.operationClass = input.operationClass ?? this.#defaultClass();
|
|
1521
1529
|
this.#refuseUnsafeUsing();
|
|
1522
|
-
this.checkType =
|
|
1530
|
+
this.checkType = alterTypeCheck(input.type, input.dataTypes, this.#callText());
|
|
1523
1531
|
this.label = `Alter type of "${input.tableName}"."${input.columnName}" to ${input.type}`;
|
|
1524
1532
|
this.freeze();
|
|
1525
1533
|
}
|
|
@@ -1746,7 +1754,7 @@ var AddRequiredColumnToEmptyTableCall = class extends PostgresOpFactoryCallNode
|
|
|
1746
1754
|
this.tableName = tableName;
|
|
1747
1755
|
this.columnName = columnName;
|
|
1748
1756
|
this.type = type;
|
|
1749
|
-
this.checkType =
|
|
1757
|
+
this.checkType = columnTypeCheckIfReadable(type, dataTypes);
|
|
1750
1758
|
this.label = `Add column ${columnName} to ${tableName}`;
|
|
1751
1759
|
this.freeze();
|
|
1752
1760
|
}
|
|
@@ -1785,7 +1793,7 @@ var AddColumnWithTemporaryDefaultCall = class extends PostgresOpFactoryCallNode
|
|
|
1785
1793
|
this.columnName = columnName;
|
|
1786
1794
|
this.type = type;
|
|
1787
1795
|
this.temporaryDefault = temporaryDefault;
|
|
1788
|
-
this.checkType =
|
|
1796
|
+
this.checkType = columnTypeCheckIfReadable(type, dataTypes);
|
|
1789
1797
|
const refused = checkSqlDefaultText(temporaryDefault);
|
|
1790
1798
|
if (refused !== void 0) {
|
|
1791
1799
|
const call = `addColumnWithTemporaryDefault({ ${columnCallLocation(schemaName, tableName, columnName).join(", ")} })`;
|
|
@@ -2600,4 +2608,4 @@ function columnNameOfCall(call) {
|
|
|
2600
2608
|
//#endregion
|
|
2601
2609
|
export { RenameConstraintCall as A, isPostgresOpFactoryCall as B, DropNativeEnumTypeCall as C, EnableRowLevelSecurityCall as D, DropTableCall as E, SetNotNullCall as F, renameTableStatement as H, alterColumnTypeCallText as I, columnNameOfCall as L, RenamePostgresRlsPolicyCall as M, RenameTableCall as N, RawSqlCall as O, SetDefaultCall as P, createExtension as R, DropIndexCall as S, DropPostgresRlsPolicyCall as T, postgresDefaultToDdlColumnDefault as V, DisableRowLevelSecurityCall as _, AddNativeEnumValueCall as a, DropConstraintCall as b, AddUniqueCall as c, CreateIndexCall as d, CreateNativeEnumTypeCall as f, DataTransformCall as g, CreateTableCall as h, AddForeignKeyCall as i, RenameIndexCall as j, RenameColumnCall as k, AlterColumnTypeCall as l, CreateSchemaCall as m, AddColumnCall as n, AddPrimaryKeyCall as o, CreatePostgresRlsPolicyCall as p, AddColumnWithTemporaryDefaultCall as r, AddRequiredColumnToEmptyTableCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DropCheckConstraintCall as v, DropNotNullCall as w, DropDefaultCall as x, DropColumnCall as y, installExtension as z };
|
|
2602
2610
|
|
|
2603
|
-
//# sourceMappingURL=op-factory-call-
|
|
2611
|
+
//# sourceMappingURL=op-factory-call-No9Z2tdw-Lap8xvVy.mjs.map
|