@prisma-next/target-postgres 0.14.0-dev.57 → 0.14.0-dev.59
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-BtOZBVxL.mjs → control-policy-Co_13Hxa.mjs} +10 -10
- package/dist/{control-policy-BtOZBVxL.mjs.map → control-policy-Co_13Hxa.mjs.map} +1 -1
- package/dist/control.mjs +2 -2
- package/dist/{diff-database-schema-CWb-jeLy.mjs → diff-database-schema-BOsDnH64.mjs} +12 -68
- package/dist/diff-database-schema-BOsDnH64.mjs.map +1 -0
- package/dist/diff-database-schema.d.mts +3 -3
- package/dist/diff-database-schema.d.mts.map +1 -1
- package/dist/diff-database-schema.mjs +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/{planner-BryLk0Ie.mjs → planner-Bd-5WLzr.mjs} +3 -4
- package/dist/planner-Bd-5WLzr.mjs.map +1 -0
- package/dist/planner.mjs +2 -2
- package/package.json +20 -20
- package/src/core/migrations/contract-to-postgres-database-schema-node.ts +8 -6
- package/src/core/migrations/diff-database-schema.ts +9 -74
- package/src/core/migrations/issue-planner.ts +9 -9
- package/src/core/migrations/verify-postgres-namespaces.ts +0 -1
- package/dist/diff-database-schema-CWb-jeLy.mjs.map +0 -1
- package/dist/planner-BryLk0Ie.mjs.map +0 -1
|
@@ -801,7 +801,7 @@ function mapPrimaryKeyNodeIssue(issue, schemaName, tableName) {
|
|
|
801
801
|
return ok([new AddPrimaryKeyCall(schemaName, tableName, pk.name ?? `${tableName}_pkey`, [...pk.columns])]);
|
|
802
802
|
}
|
|
803
803
|
if (issue.reason === "not-expected") return ok([new DropConstraintCall(schemaName, tableName, blindCast(issue.actual).name ?? `${tableName}_pkey`, "primaryKey")]);
|
|
804
|
-
return notOk(nodeConflict("indexIncompatible", issue.
|
|
804
|
+
return notOk(nodeConflict("indexIncompatible", issue.path.join("/")));
|
|
805
805
|
}
|
|
806
806
|
function mapForeignKeyNodeIssue(issue, schemaName, tableName) {
|
|
807
807
|
if (issue.reason === "not-found") return ok([new AddForeignKeyCall(schemaName, tableName, fkSpecFromNode(blindCast(issue.expected), tableName))]);
|
|
@@ -809,7 +809,7 @@ function mapForeignKeyNodeIssue(issue, schemaName, tableName) {
|
|
|
809
809
|
const fk = blindCast(issue.actual);
|
|
810
810
|
return ok([new DropConstraintCall(schemaName, tableName, fk.name ?? `${tableName}_${fk.columns.join("_")}_fkey`, "foreignKey")]);
|
|
811
811
|
}
|
|
812
|
-
return notOk(nodeConflict("foreignKeyConflict", issue.
|
|
812
|
+
return notOk(nodeConflict("foreignKeyConflict", issue.path.join("/")));
|
|
813
813
|
}
|
|
814
814
|
function mapUniqueNodeIssue(issue, schemaName, tableName) {
|
|
815
815
|
if (issue.reason === "not-found") {
|
|
@@ -820,7 +820,7 @@ function mapUniqueNodeIssue(issue, schemaName, tableName) {
|
|
|
820
820
|
const unique = blindCast(issue.actual);
|
|
821
821
|
return ok([new DropConstraintCall(schemaName, tableName, unique.name ?? `${tableName}_${unique.columns.join("_")}_key`, "unique")]);
|
|
822
822
|
}
|
|
823
|
-
return notOk(nodeConflict("indexIncompatible", issue.
|
|
823
|
+
return notOk(nodeConflict("indexIncompatible", issue.path.join("/")));
|
|
824
824
|
}
|
|
825
825
|
function mapIndexNodeIssue(issue, schemaName, tableName) {
|
|
826
826
|
if (issue.reason === "not-found") {
|
|
@@ -835,11 +835,11 @@ function mapIndexNodeIssue(issue, schemaName, tableName) {
|
|
|
835
835
|
const index = blindCast(issue.actual);
|
|
836
836
|
return ok([new DropIndexCall(schemaName, tableName, index.name ?? defaultIndexName(tableName, index.columns))]);
|
|
837
837
|
}
|
|
838
|
-
return notOk(nodeConflict("indexIncompatible", issue.
|
|
838
|
+
return notOk(nodeConflict("indexIncompatible", issue.path.join("/")));
|
|
839
839
|
}
|
|
840
840
|
function mapCheckNodeIssue(issue, schemaName, tableName) {
|
|
841
841
|
if (issue.reason === "not-expected") return ok([new DropCheckConstraintCall(schemaName, tableName, blindCast(issue.actual).name)]);
|
|
842
|
-
return notOk(nodeConflict("unsupportedOperation", `Check constraint drift on "${tableName}" — handled by checkConstraintPlanCallStrategy: ${issue.
|
|
842
|
+
return notOk(nodeConflict("unsupportedOperation", `Check constraint drift on "${tableName}" — handled by checkConstraintPlanCallStrategy: ${issue.path.join("/")}`));
|
|
843
843
|
}
|
|
844
844
|
/**
|
|
845
845
|
* Maps one node-typed diff issue to its migration call(s), dispatching on the
|
|
@@ -848,21 +848,21 @@ function mapCheckNodeIssue(issue, schemaName, tableName) {
|
|
|
848
848
|
*/
|
|
849
849
|
function mapNodeIssueToCall(issue, ctx) {
|
|
850
850
|
const node = issueNode(issue);
|
|
851
|
-
if (node === void 0) return notOk(nodeConflict("unsupportedOperation", `Issue carries neither an expected nor an actual node: ${issue.
|
|
851
|
+
if (node === void 0) return notOk(nodeConflict("unsupportedOperation", `Issue carries neither an expected nor an actual node: ${issue.path.join("/")}`));
|
|
852
852
|
if (node.nodeKind === PostgresSchemaNodeKind.namespace) {
|
|
853
|
-
if (issue.reason !== "not-found") return notOk(nodeConflict("unsupportedOperation", `Unexpected namespace drift: ${issue.
|
|
853
|
+
if (issue.reason !== "not-found") return notOk(nodeConflict("unsupportedOperation", `Unexpected namespace drift: ${issue.path.join("/")}`));
|
|
854
854
|
return ok([new CreateSchemaCall(blindCast(issue.expected).schemaName)]);
|
|
855
855
|
}
|
|
856
856
|
const ddlSchemaName = issueSchemaName(issue);
|
|
857
857
|
const tableName = issueTableName(issue);
|
|
858
|
-
if (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict("unsupportedOperation", `Issue has no schema/table in its path: ${issue.
|
|
858
|
+
if (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict("unsupportedOperation", `Issue has no schema/table in its path: ${issue.path.join("/")}`));
|
|
859
859
|
const schemaName = emissionSchemaName(ctx, ddlSchemaName);
|
|
860
860
|
switch (node.nodeKind) {
|
|
861
861
|
case PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.codecHooks);
|
|
862
862
|
case RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.codecHooks);
|
|
863
863
|
case RelationalSchemaNodeKind.columnDefault: {
|
|
864
864
|
const columnName = issueColumnName(issue);
|
|
865
|
-
if (columnName === void 0) return notOk(nodeConflict("unsupportedOperation", `Default issue has no column in its path: ${issue.
|
|
865
|
+
if (columnName === void 0) return notOk(nodeConflict("unsupportedOperation", `Default issue has no column in its path: ${issue.path.join("/")}`));
|
|
866
866
|
return mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName);
|
|
867
867
|
}
|
|
868
868
|
case RelationalSchemaNodeKind.primaryKey: return mapPrimaryKeyNodeIssue(issue, schemaName, tableName);
|
|
@@ -1125,4 +1125,4 @@ function resolvePostgresNodeIssueControlPolicySubject(issue, contract) {
|
|
|
1125
1125
|
//#endregion
|
|
1126
1126
|
export { resolvePostgresNodeIssueCreationFactoryName as a, issueSchemaName as c, postgresPlannerStrategies as d, resolvePostgresNodeIssueControlPolicySubject as i, issueTableName as l, resolveNamespaceIdForDdlSchema as n, coalesceSubtreeIssues as o, resolvePostgresCallControlPolicySubject as r, issueNode as s, formatPostgresControlPolicySubjectLabel as t, planIssues as u };
|
|
1127
1127
|
|
|
1128
|
-
//# sourceMappingURL=control-policy-
|
|
1128
|
+
//# sourceMappingURL=control-policy-Co_13Hxa.mjs.map
|