@prisma-next/target-postgres 0.16.0-dev.2 → 0.16.0
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-CZKdMztu.mjs → control-policy-42vVVpTL.mjs} +2 -2
- package/dist/{control-policy-CZKdMztu.mjs.map → control-policy-42vVVpTL.mjs.map} +1 -1
- package/dist/control.mjs +13 -13
- package/dist/control.mjs.map +1 -1
- package/dist/data-transform-BOWpliq8.mjs.map +1 -1
- package/dist/{diff-database-schema-C-hnJ5mr.mjs → diff-database-schema-CrYO0j4_.mjs} +2 -2
- package/dist/{diff-database-schema-C-hnJ5mr.mjs.map → diff-database-schema-CrYO0j4_.mjs.map} +1 -1
- package/dist/diff-database-schema.mjs +1 -1
- package/dist/{errors-ByDS0xJL.mjs → errors-DO-w0EUS.mjs} +6 -6
- package/dist/errors-DO-w0EUS.mjs.map +1 -0
- package/dist/errors.d.mts +3 -4
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/issue-planner.d.mts +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +2 -2
- package/dist/migration.mjs +2 -2
- package/dist/{op-factory-call-DT7kdjVP.d.mts → op-factory-call-MOWnyFor.d.mts} +2 -2
- package/dist/{op-factory-call-DT7kdjVP.d.mts.map → op-factory-call-MOWnyFor.d.mts.map} +1 -1
- package/dist/{op-factory-call-DuRj7WXX.mjs → op-factory-call-rCP7TXTh.mjs} +3 -3
- package/dist/op-factory-call-rCP7TXTh.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +1 -1
- package/dist/op-factory-call.mjs +1 -1
- package/dist/{planner-DPGxFcXo.mjs → planner-Bj7MTEeR.mjs} +5 -5
- package/dist/{planner-DPGxFcXo.mjs.map → planner-Bj7MTEeR.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-C-dwGdb2.d.mts → planner-produced-postgres-migration-DnMRtO7t.d.mts} +2 -2
- package/dist/planner-produced-postgres-migration-DnMRtO7t.d.mts.map +1 -0
- package/dist/{planner-produced-postgres-migration-CFDpqWWE.mjs → planner-produced-postgres-migration-iHdZVN5i.mjs} +2 -2
- package/dist/planner-produced-postgres-migration-iHdZVN5i.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/planner.d.mts +1 -1
- package/dist/planner.mjs +2 -2
- package/dist/{postgres-migration-DLIvzHjX.d.mts → postgres-migration-CjnEdWxh.d.mts} +4 -4
- package/dist/{postgres-migration-DLIvzHjX.d.mts.map → postgres-migration-CjnEdWxh.d.mts.map} +1 -1
- package/dist/{postgres-migration-C_OPFhIF.mjs → postgres-migration-fxgsblW1.mjs} +5 -5
- package/dist/postgres-migration-fxgsblW1.mjs.map +1 -0
- package/package.json +20 -20
- package/src/core/errors.ts +5 -5
- package/src/core/migrations/op-factory-call.ts +2 -2
- package/src/core/migrations/operations/data-transform.ts +1 -1
- package/src/core/migrations/planner-produced-postgres-migration.ts +1 -1
- package/src/core/migrations/postgres-migration.ts +2 -2
- package/src/core/migrations/runner.ts +11 -12
- package/dist/errors-ByDS0xJL.mjs.map +0 -1
- package/dist/op-factory-call-DuRj7WXX.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-C-dwGdb2.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-CFDpqWWE.mjs.map +0 -1
- package/dist/postgres-migration-C_OPFhIF.mjs.map +0 -1
package/dist/control.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import { n as postgresResolveDefault } from "./default-normalizer-B9ZUiyUE.mjs";
|
|
|
2
2
|
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-qubYaxQA.mjs";
|
|
3
3
|
import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-D6LvInCe.mjs";
|
|
4
4
|
import { i as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-bg32e7I-.mjs";
|
|
5
|
-
import { n as diffPostgresSchema, r as contractToPostgresDatabaseSchemaNode } from "./diff-database-schema-
|
|
5
|
+
import { n as diffPostgresSchema, r as contractToPostgresDatabaseSchemaNode } from "./diff-database-schema-CrYO0j4_.mjs";
|
|
6
6
|
import { r as renderDefaultLiteral } from "./planner-ddl-builders-BKlmGDJl.mjs";
|
|
7
7
|
import { n as PostgresContractSerializer } from "./postgres-contract-view-DebHMqGR.mjs";
|
|
8
|
-
import { t as createPostgresMigrationPlanner } from "./planner-
|
|
8
|
+
import { t as createPostgresMigrationPlanner } from "./planner-Bj7MTEeR.mjs";
|
|
9
9
|
import { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates } from "@prisma-next/framework-components/ir";
|
|
10
10
|
import { blindCast } from "@prisma-next/utils/casts";
|
|
11
11
|
import { buildNativeTypeExpander, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
|
|
@@ -88,7 +88,7 @@ var PostgresMigrationRunner = class {
|
|
|
88
88
|
strict: options.strictVerification ?? true,
|
|
89
89
|
frameworkComponents: options.frameworkComponents
|
|
90
90
|
});
|
|
91
|
-
if (!schemaVerifyResult.ok) return runnerFailure("
|
|
91
|
+
if (!schemaVerifyResult.ok) return runnerFailure("SCHEMA_VERIFY_FAILED", schemaVerifyResult.summary, {
|
|
92
92
|
why: "The resulting database schema does not satisfy the destination contract.",
|
|
93
93
|
meta: { issues: schemaVerifyResult.schema.issues }
|
|
94
94
|
});
|
|
@@ -192,7 +192,7 @@ var PostgresMigrationRunner = class {
|
|
|
192
192
|
if (result.rows.length === 0) return okVoid();
|
|
193
193
|
const columns = new Set(result.rows.map((row) => row.column_name));
|
|
194
194
|
if (columns.has("space")) return okVoid();
|
|
195
|
-
return runnerFailure("
|
|
195
|
+
return runnerFailure("LEGACY_MARKER_SHAPE", "Legacy marker-table shape detected on prisma_contract.marker (no `space` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.", { meta: {
|
|
196
196
|
table: "prisma_contract.marker",
|
|
197
197
|
columns: [...columns].sort()
|
|
198
198
|
} });
|
|
@@ -200,7 +200,7 @@ var PostgresMigrationRunner = class {
|
|
|
200
200
|
async runExpectationSteps(driver, steps, operation, phase) {
|
|
201
201
|
for (const step of steps) {
|
|
202
202
|
const result = await driver.query(step.sql, step.params ?? []);
|
|
203
|
-
if (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === "precheck" ? "
|
|
203
|
+
if (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === "precheck" ? "PRECHECK_FAILED" : "POSTCHECK_FAILED", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {
|
|
204
204
|
operationId: operation.id,
|
|
205
205
|
phase,
|
|
206
206
|
stepDescription: step.description
|
|
@@ -212,7 +212,7 @@ var PostgresMigrationRunner = class {
|
|
|
212
212
|
for (const step of steps) try {
|
|
213
213
|
await driver.query(step.sql, step.params ?? []);
|
|
214
214
|
} catch (error) {
|
|
215
|
-
if (SqlQueryError.is(error)) return runnerFailure("
|
|
215
|
+
if (SqlQueryError.is(error)) return runnerFailure("EXECUTION_FAILED", `Operation ${operation.id} failed during execution: ${step.description}`, {
|
|
216
216
|
why: error.message,
|
|
217
217
|
meta: {
|
|
218
218
|
operationId: operation.id,
|
|
@@ -282,7 +282,7 @@ var PostgresMigrationRunner = class {
|
|
|
282
282
|
}
|
|
283
283
|
enforcePolicyCompatibility(policy, operations) {
|
|
284
284
|
const allowedClasses = new Set(policy.allowedOperationClasses);
|
|
285
|
-
for (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure("
|
|
285
|
+
for (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure("POLICY_VIOLATION", `Operation ${operation.id} has class "${operation.operationClass}" which is not allowed by policy.`, {
|
|
286
286
|
why: `Policy only allows: ${policy.allowedOperationClasses.join(", ")}.`,
|
|
287
287
|
meta: {
|
|
288
288
|
operationId: operation.id,
|
|
@@ -295,23 +295,23 @@ var PostgresMigrationRunner = class {
|
|
|
295
295
|
ensureMarkerCompatibility(marker, plan) {
|
|
296
296
|
const origin = plan.origin ?? null;
|
|
297
297
|
if (!origin) return okVoid();
|
|
298
|
-
if (!marker) return runnerFailure("
|
|
299
|
-
if (marker.storageHash !== origin.storageHash) return runnerFailure("
|
|
298
|
+
if (!marker) return runnerFailure("MARKER_ORIGIN_MISMATCH", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });
|
|
299
|
+
if (marker.storageHash !== origin.storageHash) return runnerFailure("MARKER_ORIGIN_MISMATCH", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {
|
|
300
300
|
markerStorageHash: marker.storageHash,
|
|
301
301
|
expectedOriginStorageHash: origin.storageHash
|
|
302
302
|
} });
|
|
303
|
-
if (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure("
|
|
303
|
+
if (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure("MARKER_ORIGIN_MISMATCH", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {
|
|
304
304
|
markerProfileHash: marker.profileHash,
|
|
305
305
|
expectedOriginProfileHash: origin.profileHash
|
|
306
306
|
} });
|
|
307
307
|
return okVoid();
|
|
308
308
|
}
|
|
309
309
|
ensurePlanMatchesDestinationContract(destination, contract) {
|
|
310
|
-
if (destination.storageHash !== contract.storage.storageHash) return runnerFailure("
|
|
310
|
+
if (destination.storageHash !== contract.storage.storageHash) return runnerFailure("DESTINATION_CONTRACT_MISMATCH", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {
|
|
311
311
|
planStorageHash: destination.storageHash,
|
|
312
312
|
contractStorageHash: contract.storage.storageHash
|
|
313
313
|
} });
|
|
314
|
-
if (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure("
|
|
314
|
+
if (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure("DESTINATION_CONTRACT_MISMATCH", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {
|
|
315
315
|
planProfileHash: destination.profileHash,
|
|
316
316
|
contractProfileHash: contract.profileHash
|
|
317
317
|
} });
|
|
@@ -336,7 +336,7 @@ var PostgresMigrationRunner = class {
|
|
|
336
336
|
space,
|
|
337
337
|
expectedFrom: existingMarker.storageHash,
|
|
338
338
|
destination
|
|
339
|
-
})) return runnerFailure("
|
|
339
|
+
})) return runnerFailure("MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
|
|
340
340
|
space,
|
|
341
341
|
expectedStorageHash: existingMarker.storageHash,
|
|
342
342
|
destinationStorageHash: options.plan.destination.storageHash
|