@prisma/orm-target-postgres 8.0.0-rc.17-dev.37 → 8.0.0-rc.17-dev.38
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-C0SKPLzt-D3_mXLaM.mjs → adapter-C0SKPLzt-flxKm2YQ.mjs} +5 -5
- package/dist/{adapter-C0SKPLzt-D3_mXLaM.mjs.map → adapter-C0SKPLzt-flxKm2YQ.mjs.map} +1 -1
- package/dist/adapter.mjs +5 -5
- package/dist/adapter__adapter.mjs +2 -2
- package/dist/adapter__control.mjs +6 -6
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{authoring-kZOSollq-DP0v31A_.mjs → authoring-CTn87jlt-VHX7hiNU.mjs} +5 -5
- package/dist/{authoring-kZOSollq-DP0v31A_.mjs.map → authoring-CTn87jlt-VHX7hiNU.mjs.map} +1 -1
- package/dist/autoincrement-widths-DbyXRo5B-BUVCYb_V.mjs +39 -0
- package/dist/autoincrement-widths-DbyXRo5B-BUVCYb_V.mjs.map +1 -0
- package/dist/{check-expressions-BaFrBceq-ChgvazEN.mjs → check-expressions-CVLs1Cgf-DaMRk-Q4.mjs} +3 -3
- package/dist/{check-expressions-BaFrBceq-ChgvazEN.mjs.map → check-expressions-CVLs1Cgf-DaMRk-Q4.mjs.map} +1 -1
- package/dist/{codec-registry-CKBDkxX7-Kw84Or3s.mjs → codec-registry-BWUY_QLt-CzrMkP9N.mjs} +4 -4
- package/dist/{codec-registry-CKBDkxX7-Kw84Or3s.mjs.map → codec-registry-BWUY_QLt-CzrMkP9N.mjs.map} +1 -1
- package/dist/{codecs-BK3J4C0n-B8EnUXZf.mjs → codecs-Cb5S70Lx-WRSQkpza.mjs} +3 -3
- package/dist/{codecs-BK3J4C0n-B8EnUXZf.mjs.map → codecs-Cb5S70Lx-WRSQkpza.mjs.map} +1 -1
- package/dist/{contract-free-DjI-gclO.mjs → contract-free-spGyVyoh.mjs} +3 -3
- package/dist/{contract-free-DjI-gclO.mjs.map → contract-free-spGyVyoh.mjs.map} +1 -1
- package/dist/{control-DJo3P3yL.mjs → control-C4-UbYOH.mjs} +6 -3
- package/dist/control-C4-UbYOH.mjs.map +1 -0
- package/dist/{control-C5pTVhtN.mjs → control-DnqvbRrL.mjs} +105 -23
- package/dist/control-DnqvbRrL.mjs.map +1 -0
- package/dist/{control-adapter-CEeF_Na4-CMRZNp7S.mjs → control-adapter-CEeF_Na4-Cp6Si4hD.mjs} +6 -6
- package/dist/{control-adapter-CEeF_Na4-CMRZNp7S.mjs.map → control-adapter-CEeF_Na4-Cp6Si4hD.mjs.map} +1 -1
- package/dist/{control-policy-C5VoaD11-lzAw5cjN.mjs → control-policy-DXaIsgUW-Btyo9Vs8.mjs} +172 -130
- package/dist/control-policy-DXaIsgUW-Btyo9Vs8.mjs.map +1 -0
- package/dist/data-transform-C-3UJ3hC.d.mts +1 -0
- package/dist/{data-transform-Bo32KRbq-BLn1_UG-.mjs → data-transform-CtHnNYhF-r19375h3.mjs} +11 -4
- package/dist/data-transform-CtHnNYhF-r19375h3.mjs.map +1 -0
- package/dist/{data-transform-Ck5FbyNO-BNE7QlAo.d.mts → data-transform-nGy9rz87-CEOXAj91.d.mts} +14 -3
- package/dist/data-transform-nGy9rz87-CEOXAj91.d.mts.map +1 -0
- package/dist/{data-type-entries-DoR61yeO-BB2cY7rI.mjs → data-type-entries-15a-vBdm-vIj5l1u5.mjs} +3 -3
- package/dist/{data-type-entries-DoR61yeO-BB2cY7rI.mjs.map → data-type-entries-15a-vBdm-vIj5l1u5.mjs.map} +1 -1
- package/dist/{data-types-DRkmmE9S-C5Q9oH4Q.mjs → data-types-K6tDhu1D-BN--9o1o.mjs} +3 -3
- package/dist/{data-types-DRkmmE9S-C5Q9oH4Q.mjs.map → data-types-K6tDhu1D-BN--9o1o.mjs.map} +1 -1
- package/dist/{ddl-CFWv3VOT-Ad-I5p22.mjs → ddl-BKqbtVN3-CPHiYaCY.mjs} +3 -3
- package/dist/{ddl-CFWv3VOT-Ad-I5p22.mjs.map → ddl-BKqbtVN3-CPHiYaCY.mjs.map} +1 -1
- package/dist/{descriptor-meta-Dekti3e8-DLSepvAq.mjs → descriptor-meta-D5OipARb-6znWwvjE.mjs} +8 -8
- package/dist/{descriptor-meta-Dekti3e8-DLSepvAq.mjs.map → descriptor-meta-D5OipARb-6znWwvjE.mjs.map} +1 -1
- package/dist/{descriptor-meta-DyjDJfnQ-5lgalclQ.mjs → descriptor-meta-DyjDJfnQ-CoD4Kmpz.mjs} +3 -3
- package/dist/{descriptor-meta-DyjDJfnQ-5lgalclQ.mjs.map → descriptor-meta-DyjDJfnQ-CoD4Kmpz.mjs.map} +1 -1
- package/dist/{descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs → descriptor-meta-runtime-D4a-hsd_-B_YkwgHQ.mjs} +3 -3
- package/dist/{descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs.map → descriptor-meta-runtime-D4a-hsd_-B_YkwgHQ.mjs.map} +1 -1
- package/dist/{diff-database-schema-CUSXh2y2-CWRGCPL7.mjs → diff-database-schema-BV6Px0Gg-DAC6TL3P.mjs} +6 -6
- package/dist/{diff-database-schema-CUSXh2y2-CWRGCPL7.mjs.map → diff-database-schema-BV6Px0Gg-DAC6TL3P.mjs.map} +1 -1
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/{errors-DZ3zQdpT.d.mts → errors-D5sJ0fgp.d.mts} +2 -2
- package/dist/{errors-DZ3zQdpT.d.mts.map → errors-D5sJ0fgp.d.mts.map} +1 -1
- package/dist/{full-text-search-document-DJd-9K-K-CuV_QLH3.mjs → full-text-search-document-DYNz29YC-CfVTPwIL.mjs} +3 -3
- package/dist/{full-text-search-document-DJd-9K-K-CuV_QLH3.mjs.map → full-text-search-document-DYNz29YC-CfVTPwIL.mjs.map} +1 -1
- package/dist/indexes-BWHRVhke-vqXUnRfT.d.mts +49 -0
- package/dist/indexes-BWHRVhke-vqXUnRfT.d.mts.map +1 -0
- package/dist/{infer-psl-contract-BCPaLzjl-ByBJpE6R.mjs → infer-psl-contract-B_Bl_RJC-BfJbvDUs.mjs} +6 -6
- package/dist/{infer-psl-contract-BCPaLzjl-ByBJpE6R.mjs.map → infer-psl-contract-B_Bl_RJC-BfJbvDUs.mjs.map} +1 -1
- package/dist/{issue-planner-BLOtwO3z.d.mts → issue-planner-BiJDKtW5.d.mts} +10 -3
- package/dist/issue-planner-BiJDKtW5.d.mts.map +1 -0
- package/dist/migration-C9ZH26Nj.mjs.map +1 -1
- package/dist/{migration-CQeS0oqg.d.mts → migration-NJo7cPpB.d.mts} +6 -6
- package/dist/{migration-CQeS0oqg.d.mts.map → migration-NJo7cPpB.d.mts.map} +1 -1
- package/dist/{op-factory-call-DF9ijUbg-CSF8ZhJM.d.mts → op-factory-call-DkaMatJ4-D_7fWo-v.d.mts} +46 -87
- package/dist/op-factory-call-DkaMatJ4-D_7fWo-v.d.mts.map +1 -0
- package/dist/op-factory-call-LGCmMtZM.d.mts +1 -0
- package/dist/{op-factory-call-DiwaNQVO-NSekrcmI.mjs → op-factory-call-ltgiEZ8g-CX6WX57X.mjs} +163 -99
- package/dist/op-factory-call-ltgiEZ8g-CX6WX57X.mjs.map +1 -0
- package/dist/{planner-DCYVwcYk-vGUsjG3x.mjs → planner-Ccn9yxL7-B6Pgoz6c.mjs} +95 -18
- package/dist/planner-Ccn9yxL7-B6Pgoz6c.mjs.map +1 -0
- package/dist/{planner-C6vpC6nq.d.mts → planner-Xei8enE-.d.mts} +5 -4
- package/dist/planner-Xei8enE-.d.mts.map +1 -0
- package/dist/{planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs → planner-ddl-builders-BcJ353Wj-Dfaixf4X.mjs} +6 -38
- package/dist/planner-ddl-builders-BcJ353Wj-Dfaixf4X.mjs.map +1 -0
- package/dist/{planner-identity-values-CRS2cQ6v-DakZeIQj.mjs → planner-identity-values-BZdomjRU-G521DabU.mjs} +3 -3
- package/dist/{planner-identity-values-CRS2cQ6v-DakZeIQj.mjs.map → planner-identity-values-BZdomjRU-G521DabU.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-BPk0jQUi-BFV5JJn1.mjs → planner-produced-postgres-migration-Brgj59VY-DOOLRWyy.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-BPk0jQUi-BFV5JJn1.mjs.map → planner-produced-postgres-migration-Brgj59VY-DOOLRWyy.mjs.map} +1 -1
- package/dist/planner-produced-postgres-migration-DgyIhdpw.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-CoLy4THO-CkCRWsv_.d.mts → planner-produced-postgres-migration-MoopN05f-CfmsQNwj.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-MoopN05f-CfmsQNwj.d.mts.map +1 -0
- package/dist/{planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs → planner-schema-lookup-CdgWer9s.mjs} +2 -2
- package/dist/planner-schema-lookup-CdgWer9s.mjs.map +1 -0
- package/dist/{planner-sql-checks-CXDdt_9m.d.mts → planner-sql-checks-C54jJ5qt.d.mts} +16 -2
- package/dist/planner-sql-checks-C54jJ5qt.d.mts.map +1 -0
- package/dist/planner-sql-checks-CX37qDix-Gkq38UQQ.mjs +108 -0
- package/dist/planner-sql-checks-CX37qDix-Gkq38UQQ.mjs.map +1 -0
- package/dist/planner-target-details-CUEF0s90-COTks5yz.mjs +14 -0
- package/dist/planner-target-details-CUEF0s90-COTks5yz.mjs.map +1 -0
- package/dist/{postgres-codec-traits-BUygtI9N-CB-uwvY1.mjs → postgres-codec-traits-BV62PF0L-NuMNArAx.mjs} +3 -3
- package/dist/{postgres-codec-traits-BUygtI9N-CB-uwvY1.mjs.map → postgres-codec-traits-BV62PF0L-NuMNArAx.mjs.map} +1 -1
- package/dist/{postgres-contract-view-6xGfZyGS-C58Bint3.mjs → postgres-contract-view-3yxlqPfK-CRFLsRHu.mjs} +7 -7
- package/dist/{postgres-contract-view-6xGfZyGS-C58Bint3.mjs.map → postgres-contract-view-3yxlqPfK-CRFLsRHu.mjs.map} +1 -1
- package/dist/{postgres-migration-BSvGOQze-WEc_3gN0.mjs → postgres-migration-CLIfS2iQ-BgnVMLRT.mjs} +63 -20
- package/dist/postgres-migration-CLIfS2iQ-BgnVMLRT.mjs.map +1 -0
- package/dist/{postgres-migration-Dajq9YrO-_sZwyRnK.d.mts → postgres-migration-D5OiThXV-CihIARAE.d.mts} +27 -8
- package/dist/{postgres-migration-Dajq9YrO-_sZwyRnK.d.mts.map → postgres-migration-D5OiThXV-CihIARAE.d.mts.map} +1 -1
- package/dist/{postgres-schema-DIaAgaL6-Dmqzjbu5.mjs → postgres-schema-Ysxbqkzr-hFRwS-zT.mjs} +3 -3
- package/dist/{postgres-schema-DIaAgaL6-Dmqzjbu5.mjs.map → postgres-schema-Ysxbqkzr-hFRwS-zT.mjs.map} +1 -1
- package/dist/{prisma7-binding-DQlvZyAM.mjs → prisma7-binding-nxvUgQTH.mjs} +6 -6
- package/dist/{prisma7-binding-DQlvZyAM.mjs.map → prisma7-binding-nxvUgQTH.mjs.map} +1 -1
- package/dist/{render-ops-D1lOuFbE-d95NrYqF.mjs → render-ops-Cw9B6aq6-CMzRGNUZ.mjs} +3 -3
- package/dist/{render-ops-D1lOuFbE-d95NrYqF.mjs.map → render-ops-Cw9B6aq6-CMzRGNUZ.mjs.map} +1 -1
- package/dist/{resolve-ddl-schema-b746rtzf-Dydnc_gK.mjs → resolve-ddl-schema-BvsUhPsJ-CY5uEwIr.mjs} +3 -3
- package/dist/{resolve-ddl-schema-b746rtzf-Dydnc_gK.mjs.map → resolve-ddl-schema-BvsUhPsJ-CY5uEwIr.mjs.map} +1 -1
- package/dist/{sql-renderer-DT4IEOVi-CBE8uTub.mjs → sql-renderer-DT4IEOVi-CGCgCiTV.mjs} +3 -3
- package/dist/{sql-renderer-DT4IEOVi-CBE8uTub.mjs.map → sql-renderer-DT4IEOVi-CGCgCiTV.mjs.map} +1 -1
- package/dist/{sql-utils-CVsvXiX4-C7xD0Bgv.mjs → sql-utils-Df-nf6eM-Ov1KgjWm.mjs} +24 -3
- package/dist/{sql-utils-CVsvXiX4-C7xD0Bgv.mjs.map → sql-utils-Df-nf6eM-Ov1KgjWm.mjs.map} +1 -1
- package/dist/target.d.mts +13 -13
- 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 +3 -3
- package/dist/target__data-transform.d.mts +2 -2
- package/dist/target__data-transform.mjs +1 -1
- package/dist/target__data-types.mjs +2 -2
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__errors.d.mts +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 +3 -3
- package/dist/target__migration.mjs +3 -3
- package/dist/target__op-factory-call.d.mts +3 -3
- package/dist/target__op-factory-call.mjs +2 -2
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-identity-values.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-schema-lookup.mjs +1 -1
- package/dist/target__planner-sql-checks.d.mts +2 -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.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.mjs +4 -4
- 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/package.json +9 -9
- package/dist/control-C5pTVhtN.mjs.map +0 -1
- package/dist/control-DJo3P3yL.mjs.map +0 -1
- package/dist/control-policy-C5VoaD11-lzAw5cjN.mjs.map +0 -1
- package/dist/data-transform-BSM7TQpE.d.mts +0 -1
- package/dist/data-transform-Bo32KRbq-BLn1_UG-.mjs.map +0 -1
- package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +0 -1
- package/dist/issue-planner-BLOtwO3z.d.mts.map +0 -1
- package/dist/op-factory-call-CBqqbXBb.d.mts +0 -1
- package/dist/op-factory-call-DF9ijUbg-CSF8ZhJM.d.mts.map +0 -1
- package/dist/op-factory-call-DiwaNQVO-NSekrcmI.mjs.map +0 -1
- package/dist/planner-C6vpC6nq.d.mts.map +0 -1
- package/dist/planner-DCYVwcYk-vGUsjG3x.mjs.map +0 -1
- package/dist/planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-CoLy4THO-CkCRWsv_.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-D7zijd5s.d.mts +0 -1
- package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +0 -1
- package/dist/planner-sql-checks-Bt_KuSiH-CdGZDp7M.mjs +0 -46
- package/dist/planner-sql-checks-Bt_KuSiH-CdGZDp7M.mjs.map +0 -1
- package/dist/planner-sql-checks-CXDdt_9m.d.mts.map +0 -1
- package/dist/postgres-migration-BSvGOQze-WEc_3gN0.mjs.map +0 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { C as PG_TIMESTAMPTZ_DATE_CODEC_ID, D as PG_TIMESTAMP_TEMPORAL_CODEC_ID, E as PG_TIMESTAMP_STRING_CODEC_ID, S as PG_TEXT_CODEC_ID, T as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, s as PG_ENUM_CODEC_ID, w as PG_TIMESTAMPTZ_STRING_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
|
|
2
2
|
import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
3
|
+
import { i as quoteIdentifier } from "./sql-utils-Df-nf6eM-Ov1KgjWm.mjs";
|
|
3
4
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
|
|
4
5
|
import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-Cgz9KEKx.mjs";
|
|
5
|
-
import { M as setFallbackTemporal } from "./codecs-
|
|
6
|
+
import { M as setFallbackTemporal } from "./codecs-Cb5S70Lx-WRSQkpza.mjs";
|
|
6
7
|
import { s as fullTextIndexDefinitionOf } from "./full-text-index-definition-D-QC3DO2-DXbQitDn.mjs";
|
|
7
|
-
import { i as PostgresRlsPolicy, n as PostgresRlsEnablement, o as PostgresRole } from "./postgres-schema-
|
|
8
|
+
import { i as PostgresRlsPolicy, n as PostgresRlsEnablement, o as PostgresRole } from "./postgres-schema-Ysxbqkzr-hFRwS-zT.mjs";
|
|
8
9
|
import { n as computeContentHash } from "./canonicalize-CrN3u_xM-D4MrOqcB.mjs";
|
|
9
|
-
import { m as postgresNowGeneratorIdFor, r as POLICY_BLOCK_KEYWORDS } from "./authoring-
|
|
10
|
-
import { t as postgresRenderCheckExpressions } from "./check-expressions-
|
|
11
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
10
|
+
import { m as postgresNowGeneratorIdFor, r as POLICY_BLOCK_KEYWORDS } from "./authoring-CTn87jlt-VHX7hiNU.mjs";
|
|
11
|
+
import { t as postgresRenderCheckExpressions } from "./check-expressions-CVLs1Cgf-DaMRk-Q4.mjs";
|
|
12
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-D5OipARb-6znWwvjE.mjs";
|
|
12
13
|
import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
|
|
13
14
|
import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
|
|
14
|
-
import { r as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { r as qualifyTableName } from "./planner-sql-checks-CX37qDix-Gkq38UQQ.mjs";
|
|
16
|
+
import { r as diffPostgresSchema } from "./diff-database-schema-BV6Px0Gg-DAC6TL3P.mjs";
|
|
17
|
+
import { t as PostgresContractSerializer } from "./postgres-contract-view-3yxlqPfK-CRFLsRHu.mjs";
|
|
18
|
+
import { o as postgresContractToSchema } from "./postgres-migration-CLIfS2iQ-BgnVMLRT.mjs";
|
|
19
|
+
import { t as createPostgresMigrationPlanner } from "./planner-Ccn9yxL7-B6Pgoz6c.mjs";
|
|
18
20
|
import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-QMJSzMIa.mjs";
|
|
19
|
-
import { _ as positionalArg, a as buildFullTextIndexAttribute, c as buildModelConstraintAttribute, f as createPostgresTypeMap, g as parseDefaultAttributeString, i as buildCheckAttribute, l as buildNativeEnumBlock, m as namedArg, n as SYNTHETIC_SPAN, o as buildIndexAttribute, p as inferPostgresPslContract, r as buildAttribute, s as buildMapAttribute } from "./infer-psl-contract-
|
|
21
|
+
import { _ as positionalArg, a as buildFullTextIndexAttribute, c as buildModelConstraintAttribute, f as createPostgresTypeMap, g as parseDefaultAttributeString, i as buildCheckAttribute, l as buildNativeEnumBlock, m as namedArg, n as SYNTHETIC_SPAN, o as buildIndexAttribute, p as inferPostgresPslContract, r as buildAttribute, s as buildMapAttribute } from "./infer-psl-contract-B_Bl_RJC-BfJbvDUs.mjs";
|
|
20
22
|
import { requiredParamKeys, validateCodecTypeParams } from "@prisma/orm-framework/components/codec";
|
|
21
23
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
22
24
|
import { dataTypeParams, isSqlDataType, unquotedSqlBaseName } from "@prisma/orm-family-sql/contract/data-type";
|
|
@@ -27,7 +29,7 @@ import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
|
27
29
|
import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions";
|
|
28
30
|
import { composeCheckWirePrefix, computeCheckContentHash, computeIndexContentHash, formatWireName, parseNaming } from "@prisma/orm-family-sql/schema-ir/naming";
|
|
29
31
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
30
|
-
import { runnerFailure, runnerSuccess } from "@prisma/orm-family-sql/family/control";
|
|
32
|
+
import { convertedColumnOf, requiredColumnOf, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
|
|
31
33
|
import { findAuthoringTypeConstructorCall } from "@prisma/orm-framework/components/authoring";
|
|
32
34
|
import { NAME_THE_PSL_SOURCE_LOSES, isPslIdentifier } from "@prisma/orm-framework/psl-parser";
|
|
33
35
|
import { printSqlExpressionLiteral, sqlTextsReadBack } from "@prisma/orm-family-sql/contract/sql-expression";
|
|
@@ -55,6 +57,48 @@ function cloneAndFreezeRecord(value) {
|
|
|
55
57
|
else cloned[key] = val;
|
|
56
58
|
return blindCast(Object.freeze(cloned));
|
|
57
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* SQLSTATE classes of failures that come from the connection or the server, not from the SQL a step
|
|
62
|
+
* runs: connection exceptions, transaction rollbacks, resources, operator intervention, system and
|
|
63
|
+
* internal errors.
|
|
64
|
+
*/
|
|
65
|
+
const NOT_THE_STEPS_SQL = [
|
|
66
|
+
"08",
|
|
67
|
+
"40",
|
|
68
|
+
"53",
|
|
69
|
+
"57",
|
|
70
|
+
"58",
|
|
71
|
+
"XX"
|
|
72
|
+
];
|
|
73
|
+
/**
|
|
74
|
+
* The type change a failed step carries out. For the database's cast, a data exception (class 22)
|
|
75
|
+
* is a value it could not convert, and 42846 (`cannot_coerce`) a pair of types with no cast. For
|
|
76
|
+
* the migration's own conversion, every error of the step's SQL is the conversion's: a data
|
|
77
|
+
* exception is a value, an integrity violation (class 23) a value the new type cannot hold, and
|
|
78
|
+
* anything else an error in its expression.
|
|
79
|
+
*/
|
|
80
|
+
function failedTypeChangeOf(step, sqlState, plan) {
|
|
81
|
+
const converted = convertedColumnOf(step);
|
|
82
|
+
const field = unconvertedFieldOf(step, plan.contract);
|
|
83
|
+
if (converted === void 0 || field === void 0 || sqlState === void 0) return void 0;
|
|
84
|
+
const { operationIndex } = plan;
|
|
85
|
+
if (converted.by === "conversion") {
|
|
86
|
+
if (NOT_THE_STEPS_SQL.some((sqlClass) => sqlState.startsWith(sqlClass))) return void 0;
|
|
87
|
+
return {
|
|
88
|
+
field,
|
|
89
|
+
by: "conversion",
|
|
90
|
+
reason: sqlState.startsWith("22") ? "value" : sqlState.startsWith("23") ? "invalidResult" : "expressionError",
|
|
91
|
+
operationIndex
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const reason = sqlState === "42846" ? "noCast" : sqlState.startsWith("22") ? "value" : void 0;
|
|
95
|
+
return reason === void 0 ? void 0 : {
|
|
96
|
+
field,
|
|
97
|
+
by: "cast",
|
|
98
|
+
reason,
|
|
99
|
+
operationIndex
|
|
100
|
+
};
|
|
101
|
+
}
|
|
58
102
|
function createPostgresMigrationRunner(family) {
|
|
59
103
|
return new PostgresMigrationRunner(family);
|
|
60
104
|
}
|
|
@@ -178,14 +222,20 @@ var PostgresMigrationRunner = class {
|
|
|
178
222
|
continue;
|
|
179
223
|
}
|
|
180
224
|
}
|
|
225
|
+
const position = {
|
|
226
|
+
contract: options.destinationContract,
|
|
227
|
+
operationIndex: ops.indexOf(operation),
|
|
228
|
+
operations: ops,
|
|
229
|
+
edges: options.migrationEdges
|
|
230
|
+
};
|
|
181
231
|
if (runPrechecks) {
|
|
182
|
-
const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck");
|
|
232
|
+
const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck", position);
|
|
183
233
|
if (!precheckResult.ok) return precheckResult;
|
|
184
234
|
}
|
|
185
|
-
const executeResult = await this.runExecuteSteps(driver, operation
|
|
235
|
+
const executeResult = await this.runExecuteSteps(driver, operation, position);
|
|
186
236
|
if (!executeResult.ok) return executeResult;
|
|
187
237
|
if (runPostchecks) {
|
|
188
|
-
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck");
|
|
238
|
+
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck", position);
|
|
189
239
|
if (!postcheckResult.ok) return postcheckResult;
|
|
190
240
|
}
|
|
191
241
|
executedOperations.push(operation);
|
|
@@ -222,23 +272,55 @@ var PostgresMigrationRunner = class {
|
|
|
222
272
|
columns: [...columns].sort()
|
|
223
273
|
} });
|
|
224
274
|
}
|
|
225
|
-
async runExpectationSteps(driver, steps, operation, phase) {
|
|
275
|
+
async runExpectationSteps(driver, steps, operation, phase, plan) {
|
|
226
276
|
for (const step of steps) {
|
|
227
277
|
const result = await driver.query(step.sql, step.params ?? []);
|
|
228
|
-
if (!this.stepResultIsTrue(result.rows))
|
|
229
|
-
|
|
230
|
-
phase
|
|
231
|
-
|
|
232
|
-
|
|
278
|
+
if (!this.stepResultIsTrue(result.rows)) {
|
|
279
|
+
const code = phase === "precheck" ? "MIGRATION.PRECHECK_FAILED" : "MIGRATION.POSTCHECK_FAILED";
|
|
280
|
+
const failed = `Operation ${operation.id} failed during ${phase}: ${step.description}`;
|
|
281
|
+
const required = requiredColumnOf(step);
|
|
282
|
+
const rowsWithoutValue = required === void 0 ? void 0 : await this.rowsWithoutValue(driver, operation, required, plan);
|
|
283
|
+
return runnerFailure(code, rowsWithoutValue?.summary ?? failed, {
|
|
284
|
+
...ifDefined("why", rowsWithoutValue === void 0 ? void 0 : failed),
|
|
285
|
+
meta: {
|
|
286
|
+
operationId: operation.id,
|
|
287
|
+
phase,
|
|
288
|
+
stepDescription: step.description
|
|
289
|
+
},
|
|
290
|
+
rowsWithoutValue: rowsWithoutValue?.reports
|
|
291
|
+
});
|
|
292
|
+
}
|
|
233
293
|
}
|
|
234
294
|
return okVoid();
|
|
235
295
|
}
|
|
236
|
-
|
|
237
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Counts the rows the failed step's column has no value in, then those of every other column the
|
|
298
|
+
* failed operation's migration makes required.
|
|
299
|
+
*/
|
|
300
|
+
rowsWithoutValue(driver, operation, required, plan) {
|
|
301
|
+
return rowsWithoutValueFailure({
|
|
302
|
+
failed: [{
|
|
303
|
+
operation,
|
|
304
|
+
operationIndex: plan.operationIndex,
|
|
305
|
+
required
|
|
306
|
+
}],
|
|
307
|
+
others: requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex),
|
|
308
|
+
count: async ({ operation: marked, required: column }) => {
|
|
309
|
+
const schema = marked.target.details?.schema;
|
|
310
|
+
if (schema === void 0) return 0;
|
|
311
|
+
const where = column.reason !== "newField" ? ` WHERE ${quoteIdentifier(column.column)} IS NULL` : "";
|
|
312
|
+
return (await driver.query(`SELECT COUNT(*)::int AS rows FROM ${qualifyTableName(schema, column.table)}${where}`)).rows[0]?.rows ?? 0;
|
|
313
|
+
},
|
|
314
|
+
contract: plan.contract
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
async runExecuteSteps(driver, operation, plan) {
|
|
318
|
+
for (const step of operation.execute) try {
|
|
238
319
|
await driver.query(step.sql, step.params ?? []);
|
|
239
320
|
} catch (error) {
|
|
240
321
|
if (SqlQueryError.is(error)) return runnerFailure("MIGRATION.EXECUTION_FAILED", `Operation ${operation.id} failed during execution: ${step.description}`, {
|
|
241
322
|
why: error.message,
|
|
323
|
+
failedTypeChange: failedTypeChangeOf(step, error.sqlState, plan),
|
|
242
324
|
meta: {
|
|
243
325
|
operationId: operation.id,
|
|
244
326
|
stepDescription: step.description,
|
|
@@ -2758,4 +2840,4 @@ const postgresTargetDescriptor = createPostgresTargetDescriptor();
|
|
|
2758
2840
|
//#endregion
|
|
2759
2841
|
export { postgresTargetDescriptor as i, postgresPslTypeConstructors as n, postgresScalarAuthoringTypes as r, postgresNativeAuthoringTypes as t };
|
|
2760
2842
|
|
|
2761
|
-
//# sourceMappingURL=control-
|
|
2843
|
+
//# sourceMappingURL=control-DnqvbRrL.mjs.map
|