@prisma/orm-target-postgres 8.0.0-rc.20-dev.8 → 8.0.0-rc.20-dev.10
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/{control-policy-DtU5u9Dm-44r_OF94.mjs → control-policy-BcplTDhK-DMJjsg6l.mjs} +5 -3
- package/dist/control-policy-BcplTDhK-DMJjsg6l.mjs.map +1 -0
- package/dist/{diff-database-schema-DAEzWtzU-DoyVgKqh.mjs → diff-database-schema-zWe9Lrh7-CD7T95HL.mjs} +3 -3
- package/dist/{diff-database-schema-DAEzWtzU-DoyVgKqh.mjs.map → diff-database-schema-zWe9Lrh7-CD7T95HL.mjs.map} +1 -1
- package/dist/{errors-D3Mj-x0o.d.mts → errors-LdIppowi.d.mts} +2 -2
- package/dist/{errors-D3Mj-x0o.d.mts.map → errors-LdIppowi.d.mts.map} +1 -1
- package/dist/{issue-planner-D-On52xP.d.mts → issue-planner-BLiMn8iP.d.mts} +2 -2
- package/dist/{issue-planner-D-On52xP.d.mts.map → issue-planner-BLiMn8iP.d.mts.map} +1 -1
- package/dist/migration-Be_iuIpn.mjs.map +1 -1
- package/dist/{migration-D4lMmLVj.d.mts → migration-cnT6b-9x.d.mts} +2 -2
- package/dist/{migration-D4lMmLVj.d.mts.map → migration-cnT6b-9x.d.mts.map} +1 -1
- package/dist/{op-factory-call-gGX-mZu--0QUG5xH4.mjs → op-factory-call-CNXvLsqS-BT9PCNDI.mjs} +159 -4
- package/dist/op-factory-call-CNXvLsqS-BT9PCNDI.mjs.map +1 -0
- package/dist/op-factory-call-D9O6cXRE.d.mts +1 -0
- package/dist/{op-factory-call-nLHvNx0O-BTBhGbOF.d.mts → op-factory-call-DeaoFqMW-XAP00c7U.d.mts} +43 -6
- package/dist/{op-factory-call-nLHvNx0O-BTBhGbOF.d.mts.map → op-factory-call-DeaoFqMW-XAP00c7U.d.mts.map} +1 -1
- package/dist/{planner-BYD9uL95-BYETKJX3.mjs → planner-B_mJlpS3-Cp4ZLLMC.mjs} +106 -14
- package/dist/planner-B_mJlpS3-Cp4ZLLMC.mjs.map +1 -0
- package/dist/{planner-AD3Dt57t.d.mts → planner-RW8za3Vm.d.mts} +2 -2
- package/dist/{planner-AD3Dt57t.d.mts.map → planner-RW8za3Vm.d.mts.map} +1 -1
- package/dist/{planner-produced-postgres-migration-DyIXJ3MR-DHO5wn_X.d.mts → planner-produced-postgres-migration-DtjZyo7p-CQxcHWwC.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-DtjZyo7p-CQxcHWwC.d.mts.map +1 -0
- package/dist/planner-produced-postgres-migration-JI4uclWQ.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-BFJVBalB-DoWrL1oX.mjs → planner-produced-postgres-migration-W1MyA8gh-CsJ2mBwk.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-BFJVBalB-DoWrL1oX.mjs.map → planner-produced-postgres-migration-W1MyA8gh-CsJ2mBwk.mjs.map} +1 -1
- package/dist/{postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts → postgres-migration-CDPlleMc-B4JQjDcN.d.mts} +33 -3
- package/dist/postgres-migration-CDPlleMc-B4JQjDcN.d.mts.map +1 -0
- package/dist/{postgres-migration-DG6SF-aU-DjRMnDmA.mjs → postgres-migration-iX1KfbM2-CF0mqcmz.mjs} +26 -5
- package/dist/postgres-migration-iX1KfbM2-CF0mqcmz.mjs.map +1 -0
- package/dist/{render-ops-BgqtCw9Z-T8BPTX85.mjs → render-ops-DszuGMgp--NFBbNry.mjs} +3 -3
- package/dist/{render-ops-BgqtCw9Z-T8BPTX85.mjs.map → render-ops-DszuGMgp--NFBbNry.mjs.map} +1 -1
- package/dist/target.d.mts +10 -10
- package/dist/target.mjs +8 -8
- package/dist/target__control.mjs +44 -5
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__errors.d.mts +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__op-factory-call.d.mts +3 -3
- package/dist/target__op-factory-call.mjs +2 -2
- 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.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__render-ops.mjs +1 -1
- package/package.json +9 -9
- package/dist/control-policy-DtU5u9Dm-44r_OF94.mjs.map +0 -1
- package/dist/op-factory-call-CRaVUOb_.d.mts +0 -1
- package/dist/op-factory-call-gGX-mZu--0QUG5xH4.mjs.map +0 -1
- package/dist/planner-BYD9uL95-BYETKJX3.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-BBUwtjA_.d.mts +0 -1
- package/dist/planner-produced-postgres-migration-DyIXJ3MR-DHO5wn_X.d.mts.map +0 -1
- package/dist/postgres-migration-C5deJ3Ne-C4Jxu-e6.d.mts.map +0 -1
- package/dist/postgres-migration-DG6SF-aU-DjRMnDmA.mjs.map +0 -1
package/dist/target__control.mjs
CHANGED
|
@@ -13,11 +13,11 @@ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-15Dhylpt-Bl
|
|
|
13
13
|
import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-BBkitBQh-Dll8iaZT.mjs";
|
|
14
14
|
import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--BzOKm4N1.mjs";
|
|
15
15
|
import { i as qualifyTableName } from "./planner-sql-checks-D-K44J19-CzvrqzNB.mjs";
|
|
16
|
-
import {
|
|
17
|
-
import { r as diffPostgresSchema } from "./diff-database-schema-
|
|
16
|
+
import { R as SCHEMA_OBJECTS_SQL, X as schemaContentsOf, Y as schemaBlockingObjects, Z as schemaObjectsSummary } from "./op-factory-call-CNXvLsqS-BT9PCNDI.mjs";
|
|
17
|
+
import { r as diffPostgresSchema } from "./diff-database-schema-zWe9Lrh7-CD7T95HL.mjs";
|
|
18
18
|
import { t as PostgresContractSerializer } from "./postgres-contract-view-DgBsbRyj-CWrgmyHg.mjs";
|
|
19
|
-
import { o as postgresContractToSchema } from "./postgres-migration-
|
|
20
|
-
import { t as createPostgresMigrationPlanner } from "./planner-
|
|
19
|
+
import { o as postgresContractToSchema } from "./postgres-migration-iX1KfbM2-CF0mqcmz.mjs";
|
|
20
|
+
import { n as keepRowsEdit, t as createPostgresMigrationPlanner } from "./planner-B_mJlpS3-Cp4ZLLMC.mjs";
|
|
21
21
|
import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-BkBKBRE3.mjs";
|
|
22
22
|
import { a as buildIndexAttribute, c as buildNativeEnumBlock, d as inferPostgresPslContract, f as namedArg, g as positionalArg, h as parseDefaultAttributeString, i as buildFullTextIndexAttribute, n as buildAttribute, o as buildMapAttribute, r as buildCheckAttribute, s as buildModelConstraintAttribute, t as SYNTHETIC_SPAN } from "./infer-psl-contract-CdGGwxP3-JfIJ81cu.mjs";
|
|
23
23
|
import { dataTypeParams, requiredParamKeys, validateCodecTypeParams } from "@prisma/orm-framework/components/codec";
|
|
@@ -33,7 +33,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
|
33
33
|
import { authoringTypeConstructorArguments, findAuthoringTypeConstructorCall, getAuthoringTypeConstructor } from "@prisma/orm-framework/components/authoring";
|
|
34
34
|
import { NAME_THE_PSL_SOURCE_LOSES, isPslIdentifier } from "@prisma/orm-framework/psl-parser";
|
|
35
35
|
import { printSqlExpressionLiteral, sqlTextsReadBack } from "@prisma/orm-family-sql/contract/sql-expression";
|
|
36
|
-
import { convertedColumnOf, requiredColumnOf, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
|
|
36
|
+
import { convertedColumnOf, requiredColumnOf, requiredColumnsOfMigration, rowsHoldingValueOf, rowsHoldingValueSummary, rowsWithoutValueFailure, runnerFailure, runnerSuccess, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
|
|
37
37
|
import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
|
|
38
38
|
import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
|
|
39
39
|
import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
@@ -345,6 +345,14 @@ var PostgresMigrationRunner = class {
|
|
|
345
345
|
description: step.description,
|
|
346
346
|
...ifDefined("expectation", step.expectation)
|
|
347
347
|
};
|
|
348
|
+
const holding = phase === "precheck" ? await this.rowsHoldingValue(driver, step, operation, plan.operationIndex) : void 0;
|
|
349
|
+
if (holding !== void 0) return runnerFailure(code, holding.summary, {
|
|
350
|
+
why: failed,
|
|
351
|
+
meta: {
|
|
352
|
+
failedCheck,
|
|
353
|
+
rowsHoldingValue: holding.report
|
|
354
|
+
}
|
|
355
|
+
});
|
|
348
356
|
return runnerFailure(code, rowsWithoutValue?.summary ?? failed, {
|
|
349
357
|
...ifDefined("why", rowsWithoutValue !== void 0 ? failed : phase === "precheck" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck)),
|
|
350
358
|
meta: {
|
|
@@ -357,6 +365,37 @@ var PostgresMigrationRunner = class {
|
|
|
357
365
|
return okVoid();
|
|
358
366
|
}
|
|
359
367
|
/**
|
|
368
|
+
* Counts the rows that hold the stored value a removal check guards, as `rowsHoldingValueMeta`
|
|
369
|
+
* marks the check. A count that fails leaves the failure without it.
|
|
370
|
+
*/
|
|
371
|
+
async rowsHoldingValue(driver, step, operation, operationIndex) {
|
|
372
|
+
const mark = rowsHoldingValueOf(step);
|
|
373
|
+
const details = operation.target.details;
|
|
374
|
+
const stored = step.params?.[0];
|
|
375
|
+
if (mark === void 0 || details?.table === void 0) return void 0;
|
|
376
|
+
if (typeof stored !== "string" && typeof stored !== "number") return void 0;
|
|
377
|
+
const { table } = details;
|
|
378
|
+
let rows;
|
|
379
|
+
try {
|
|
380
|
+
rows = (await driver.query(`SELECT COUNT(*)::int AS rows FROM ${qualifyTableName(details.schema, table)} WHERE ${quoteIdentifier(details.name)} = $1`, [stored])).rows[0]?.rows ?? 0;
|
|
381
|
+
} catch {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
summary: rowsHoldingValueSummary(table, details.name, stored, rows),
|
|
386
|
+
report: {
|
|
387
|
+
enumValue: mark.enumValue,
|
|
388
|
+
value: stored,
|
|
389
|
+
rows,
|
|
390
|
+
operationIndex,
|
|
391
|
+
keepDataEdit: keepRowsEdit({
|
|
392
|
+
...details,
|
|
393
|
+
table
|
|
394
|
+
}, mark)
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
360
399
|
* Counts the rows the failed step's column has no value in, then those of every other column the
|
|
361
400
|
* failed operation's migration makes required.
|
|
362
401
|
*/
|