@prisma-next/family-sql 0.3.0-pr.86.2 → 0.3.0-pr.87.1
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/{chunk-BHEGVBY7.js → chunk-D6DIM7UR.js} +43 -116
- package/dist/chunk-D6DIM7UR.js.map +1 -0
- package/dist/{chunk-SQ2VWYDV.js → chunk-DI4IPJTV.js} +2 -2
- package/dist/core/schema-verify/verify-helpers.d.ts +22 -2
- package/dist/core/schema-verify/verify-helpers.d.ts.map +1 -1
- package/dist/core/schema-verify/verify-sql-schema.d.ts.map +1 -1
- package/dist/exports/control.js +2 -2
- package/dist/exports/schema-verify.js +1 -1
- package/dist/exports/test-utils.js +2 -2
- package/package.json +16 -16
- package/src/core/schema-verify/verify-helpers.ts +81 -122
- package/src/core/schema-verify/verify-sql-schema.ts +4 -0
- package/dist/chunk-BHEGVBY7.js.map +0 -1
- /package/dist/{chunk-SQ2VWYDV.js.map → chunk-DI4IPJTV.js.map} +0 -0
|
@@ -30,17 +30,6 @@ function verifyPrimaryKey(contractPK, schemaPK, tableName, issues) {
|
|
|
30
30
|
});
|
|
31
31
|
return "fail";
|
|
32
32
|
}
|
|
33
|
-
if (contractPK.name && schemaPK.name && contractPK.name !== schemaPK.name) {
|
|
34
|
-
issues.push({
|
|
35
|
-
kind: "primary_key_mismatch",
|
|
36
|
-
table: tableName,
|
|
37
|
-
indexOrConstraint: contractPK.name,
|
|
38
|
-
expected: contractPK.name,
|
|
39
|
-
actual: schemaPK.name,
|
|
40
|
-
message: `Table "${tableName}" has primary key name mismatch: expected "${contractPK.name}", got "${schemaPK.name}"`
|
|
41
|
-
});
|
|
42
|
-
return "fail";
|
|
43
|
-
}
|
|
44
33
|
return "pass";
|
|
45
34
|
}
|
|
46
35
|
function verifyForeignKeys(contractFKs, schemaFKs, tableName, tablePath, issues, strict) {
|
|
@@ -69,39 +58,17 @@ function verifyForeignKeys(contractFKs, schemaFKs, tableName, tablePath, issues,
|
|
|
69
58
|
children: []
|
|
70
59
|
});
|
|
71
60
|
} else {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
kind: "foreignKey",
|
|
84
|
-
name: `foreignKey(${contractFK.columns.join(", ")})`,
|
|
85
|
-
contractPath: fkPath,
|
|
86
|
-
code: "foreign_key_mismatch",
|
|
87
|
-
message: "Foreign key name mismatch",
|
|
88
|
-
expected: contractFK.name,
|
|
89
|
-
actual: matchingFK.name,
|
|
90
|
-
children: []
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
nodes.push({
|
|
94
|
-
status: "pass",
|
|
95
|
-
kind: "foreignKey",
|
|
96
|
-
name: `foreignKey(${contractFK.columns.join(", ")})`,
|
|
97
|
-
contractPath: fkPath,
|
|
98
|
-
code: "",
|
|
99
|
-
message: "",
|
|
100
|
-
expected: void 0,
|
|
101
|
-
actual: void 0,
|
|
102
|
-
children: []
|
|
103
|
-
});
|
|
104
|
-
}
|
|
61
|
+
nodes.push({
|
|
62
|
+
status: "pass",
|
|
63
|
+
kind: "foreignKey",
|
|
64
|
+
name: `foreignKey(${contractFK.columns.join(", ")})`,
|
|
65
|
+
contractPath: fkPath,
|
|
66
|
+
code: "",
|
|
67
|
+
message: "",
|
|
68
|
+
expected: void 0,
|
|
69
|
+
actual: void 0,
|
|
70
|
+
children: []
|
|
71
|
+
});
|
|
105
72
|
}
|
|
106
73
|
}
|
|
107
74
|
if (strict) {
|
|
@@ -131,14 +98,15 @@ function verifyForeignKeys(contractFKs, schemaFKs, tableName, tablePath, issues,
|
|
|
131
98
|
}
|
|
132
99
|
return nodes;
|
|
133
100
|
}
|
|
134
|
-
function verifyUniqueConstraints(contractUniques, schemaUniques, tableName, tablePath, issues, strict) {
|
|
101
|
+
function verifyUniqueConstraints(contractUniques, schemaUniques, schemaIndexes, tableName, tablePath, issues, strict) {
|
|
135
102
|
const nodes = [];
|
|
136
103
|
for (const contractUnique of contractUniques) {
|
|
137
104
|
const uniquePath = `${tablePath}.uniques[${contractUnique.columns.join(",")}]`;
|
|
138
105
|
const matchingUnique = schemaUniques.find(
|
|
139
106
|
(u) => arraysEqual(u.columns, contractUnique.columns)
|
|
140
107
|
);
|
|
141
|
-
|
|
108
|
+
const matchingUniqueIndex = !matchingUnique && schemaIndexes.find((idx) => idx.unique && arraysEqual(idx.columns, contractUnique.columns));
|
|
109
|
+
if (!matchingUnique && !matchingUniqueIndex) {
|
|
142
110
|
issues.push({
|
|
143
111
|
kind: "unique_constraint_mismatch",
|
|
144
112
|
table: tableName,
|
|
@@ -157,39 +125,17 @@ function verifyUniqueConstraints(contractUniques, schemaUniques, tableName, tabl
|
|
|
157
125
|
children: []
|
|
158
126
|
});
|
|
159
127
|
} else {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
kind: "unique",
|
|
172
|
-
name: `unique(${contractUnique.columns.join(", ")})`,
|
|
173
|
-
contractPath: uniquePath,
|
|
174
|
-
code: "unique_constraint_mismatch",
|
|
175
|
-
message: "Unique constraint name mismatch",
|
|
176
|
-
expected: contractUnique.name,
|
|
177
|
-
actual: matchingUnique.name,
|
|
178
|
-
children: []
|
|
179
|
-
});
|
|
180
|
-
} else {
|
|
181
|
-
nodes.push({
|
|
182
|
-
status: "pass",
|
|
183
|
-
kind: "unique",
|
|
184
|
-
name: `unique(${contractUnique.columns.join(", ")})`,
|
|
185
|
-
contractPath: uniquePath,
|
|
186
|
-
code: "",
|
|
187
|
-
message: "",
|
|
188
|
-
expected: void 0,
|
|
189
|
-
actual: void 0,
|
|
190
|
-
children: []
|
|
191
|
-
});
|
|
192
|
-
}
|
|
128
|
+
nodes.push({
|
|
129
|
+
status: "pass",
|
|
130
|
+
kind: "unique",
|
|
131
|
+
name: `unique(${contractUnique.columns.join(", ")})`,
|
|
132
|
+
contractPath: uniquePath,
|
|
133
|
+
code: "",
|
|
134
|
+
message: "",
|
|
135
|
+
expected: void 0,
|
|
136
|
+
actual: void 0,
|
|
137
|
+
children: []
|
|
138
|
+
});
|
|
193
139
|
}
|
|
194
140
|
}
|
|
195
141
|
if (strict) {
|
|
@@ -219,14 +165,15 @@ function verifyUniqueConstraints(contractUniques, schemaUniques, tableName, tabl
|
|
|
219
165
|
}
|
|
220
166
|
return nodes;
|
|
221
167
|
}
|
|
222
|
-
function verifyIndexes(contractIndexes, schemaIndexes, tableName, tablePath, issues, strict) {
|
|
168
|
+
function verifyIndexes(contractIndexes, schemaIndexes, schemaUniques, tableName, tablePath, issues, strict) {
|
|
223
169
|
const nodes = [];
|
|
224
170
|
for (const contractIndex of contractIndexes) {
|
|
225
171
|
const indexPath = `${tablePath}.indexes[${contractIndex.columns.join(",")}]`;
|
|
226
172
|
const matchingIndex = schemaIndexes.find(
|
|
227
|
-
(idx) => arraysEqual(idx.columns, contractIndex.columns)
|
|
173
|
+
(idx) => arraysEqual(idx.columns, contractIndex.columns)
|
|
228
174
|
);
|
|
229
|
-
|
|
175
|
+
const matchingUniqueConstraint = !matchingIndex && schemaUniques.find((u) => arraysEqual(u.columns, contractIndex.columns));
|
|
176
|
+
if (!matchingIndex && !matchingUniqueConstraint) {
|
|
230
177
|
issues.push({
|
|
231
178
|
kind: "index_mismatch",
|
|
232
179
|
table: tableName,
|
|
@@ -245,39 +192,17 @@ function verifyIndexes(contractIndexes, schemaIndexes, tableName, tablePath, iss
|
|
|
245
192
|
children: []
|
|
246
193
|
});
|
|
247
194
|
} else {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
kind: "index",
|
|
260
|
-
name: `index(${contractIndex.columns.join(", ")})`,
|
|
261
|
-
contractPath: indexPath,
|
|
262
|
-
code: "index_mismatch",
|
|
263
|
-
message: "Index name mismatch",
|
|
264
|
-
expected: contractIndex.name,
|
|
265
|
-
actual: matchingIndex.name,
|
|
266
|
-
children: []
|
|
267
|
-
});
|
|
268
|
-
} else {
|
|
269
|
-
nodes.push({
|
|
270
|
-
status: "pass",
|
|
271
|
-
kind: "index",
|
|
272
|
-
name: `index(${contractIndex.columns.join(", ")})`,
|
|
273
|
-
contractPath: indexPath,
|
|
274
|
-
code: "",
|
|
275
|
-
message: "",
|
|
276
|
-
expected: void 0,
|
|
277
|
-
actual: void 0,
|
|
278
|
-
children: []
|
|
279
|
-
});
|
|
280
|
-
}
|
|
195
|
+
nodes.push({
|
|
196
|
+
status: "pass",
|
|
197
|
+
kind: "index",
|
|
198
|
+
name: `index(${contractIndex.columns.join(", ")})`,
|
|
199
|
+
contractPath: indexPath,
|
|
200
|
+
code: "",
|
|
201
|
+
message: "",
|
|
202
|
+
expected: void 0,
|
|
203
|
+
actual: void 0,
|
|
204
|
+
children: []
|
|
205
|
+
});
|
|
281
206
|
}
|
|
282
207
|
}
|
|
283
208
|
if (strict) {
|
|
@@ -626,6 +551,7 @@ function verifySqlSchema(options) {
|
|
|
626
551
|
const uniqueStatuses = verifyUniqueConstraints(
|
|
627
552
|
contractTable.uniques,
|
|
628
553
|
schemaTable.uniques,
|
|
554
|
+
schemaTable.indexes,
|
|
629
555
|
tableName,
|
|
630
556
|
tablePath,
|
|
631
557
|
issues,
|
|
@@ -635,6 +561,7 @@ function verifySqlSchema(options) {
|
|
|
635
561
|
const indexStatuses = verifyIndexes(
|
|
636
562
|
contractTable.indexes,
|
|
637
563
|
schemaTable.indexes,
|
|
564
|
+
schemaTable.uniques,
|
|
638
565
|
tableName,
|
|
639
566
|
tablePath,
|
|
640
567
|
issues,
|
|
@@ -769,4 +696,4 @@ export {
|
|
|
769
696
|
verifyDatabaseDependencies,
|
|
770
697
|
verifySqlSchema
|
|
771
698
|
};
|
|
772
|
-
//# sourceMappingURL=chunk-
|
|
699
|
+
//# sourceMappingURL=chunk-D6DIM7UR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/schema-verify/verify-helpers.ts","../src/core/schema-verify/verify-sql-schema.ts"],"sourcesContent":["/**\n * Pure verification helper functions for SQL schema verification.\n * These functions verify schema IR against contract requirements.\n */\n\nimport type { SchemaIssue, SchemaVerificationNode } from '@prisma-next/core-control-plane/types';\nimport type {\n ForeignKey,\n Index,\n PrimaryKey,\n UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport type {\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport type { ComponentDatabaseDependency } from '../migrations/types';\n\n/**\n * Compares two arrays of strings for equality (order-sensitive).\n */\nexport function arraysEqual(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Verifies primary key matches between contract and schema.\n * Returns 'pass' or 'fail'.\n *\n * Uses semantic satisfaction: identity is based on (table + kind + columns).\n * Name differences are ignored by default (names are for DDL/diagnostics, not identity).\n */\nexport function verifyPrimaryKey(\n contractPK: PrimaryKey,\n schemaPK: PrimaryKey | undefined,\n tableName: string,\n issues: SchemaIssue[],\n): 'pass' | 'fail' {\n if (!schemaPK) {\n issues.push({\n kind: 'primary_key_mismatch',\n table: tableName,\n expected: contractPK.columns.join(', '),\n message: `Table \"${tableName}\" is missing primary key`,\n });\n return 'fail';\n }\n\n if (!arraysEqual(contractPK.columns, schemaPK.columns)) {\n issues.push({\n kind: 'primary_key_mismatch',\n table: tableName,\n expected: contractPK.columns.join(', '),\n actual: schemaPK.columns.join(', '),\n message: `Table \"${tableName}\" has primary key mismatch: expected columns [${contractPK.columns.join(', ')}], got [${schemaPK.columns.join(', ')}]`,\n });\n return 'fail';\n }\n\n // Name differences are ignored for semantic satisfaction.\n // Names are persisted for deterministic DDL and diagnostics but are not identity.\n\n return 'pass';\n}\n\n/**\n * Verifies foreign keys match between contract and schema.\n * Returns verification nodes for the tree.\n *\n * Uses semantic satisfaction: identity is based on (table + columns + referenced table + referenced columns).\n * Name differences are ignored by default (names are for DDL/diagnostics, not identity).\n */\nexport function verifyForeignKeys(\n contractFKs: readonly ForeignKey[],\n schemaFKs: readonly SqlForeignKeyIR[],\n tableName: string,\n tablePath: string,\n issues: SchemaIssue[],\n strict: boolean,\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n // Check each contract FK exists in schema\n for (const contractFK of contractFKs) {\n const fkPath = `${tablePath}.foreignKeys[${contractFK.columns.join(',')}]`;\n const matchingFK = schemaFKs.find((fk) => {\n return (\n arraysEqual(fk.columns, contractFK.columns) &&\n fk.referencedTable === contractFK.references.table &&\n arraysEqual(fk.referencedColumns, contractFK.references.columns)\n );\n });\n\n if (!matchingFK) {\n issues.push({\n kind: 'foreign_key_mismatch',\n table: tableName,\n expected: `${contractFK.columns.join(', ')} -> ${contractFK.references.table}(${contractFK.references.columns.join(', ')})`,\n message: `Table \"${tableName}\" is missing foreign key: ${contractFK.columns.join(', ')} -> ${contractFK.references.table}(${contractFK.references.columns.join(', ')})`,\n });\n nodes.push({\n status: 'fail',\n kind: 'foreignKey',\n name: `foreignKey(${contractFK.columns.join(', ')})`,\n contractPath: fkPath,\n code: 'foreign_key_mismatch',\n message: 'Foreign key missing',\n expected: contractFK,\n actual: undefined,\n children: [],\n });\n } else {\n // Name differences are ignored for semantic satisfaction.\n // Names are persisted for deterministic DDL and diagnostics but are not identity.\n nodes.push({\n status: 'pass',\n kind: 'foreignKey',\n name: `foreignKey(${contractFK.columns.join(', ')})`,\n contractPath: fkPath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n\n // Check for extra FKs in strict mode\n if (strict) {\n for (const schemaFK of schemaFKs) {\n const matchingFK = contractFKs.find((fk) => {\n return (\n arraysEqual(fk.columns, schemaFK.columns) &&\n fk.references.table === schemaFK.referencedTable &&\n arraysEqual(fk.references.columns, schemaFK.referencedColumns)\n );\n });\n\n if (!matchingFK) {\n issues.push({\n kind: 'extra_foreign_key',\n table: tableName,\n message: `Extra foreign key found in database (not in contract): ${schemaFK.columns.join(', ')} -> ${schemaFK.referencedTable}(${schemaFK.referencedColumns.join(', ')})`,\n });\n nodes.push({\n status: 'fail',\n kind: 'foreignKey',\n name: `foreignKey(${schemaFK.columns.join(', ')})`,\n contractPath: `${tablePath}.foreignKeys[${schemaFK.columns.join(',')}]`,\n code: 'extra_foreign_key',\n message: 'Extra foreign key found',\n expected: undefined,\n actual: schemaFK,\n children: [],\n });\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Verifies unique constraints match between contract and schema.\n * Returns verification nodes for the tree.\n *\n * Uses semantic satisfaction: identity is based on (table + kind + columns).\n * A unique constraint requirement can be satisfied by either:\n * - A unique constraint with the same columns, or\n * - A unique index with the same columns\n *\n * Name differences are ignored by default (names are for DDL/diagnostics, not identity).\n */\nexport function verifyUniqueConstraints(\n contractUniques: readonly UniqueConstraint[],\n schemaUniques: readonly SqlUniqueIR[],\n schemaIndexes: readonly SqlIndexIR[],\n tableName: string,\n tablePath: string,\n issues: SchemaIssue[],\n strict: boolean,\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n // Check each contract unique exists in schema\n for (const contractUnique of contractUniques) {\n const uniquePath = `${tablePath}.uniques[${contractUnique.columns.join(',')}]`;\n\n // First check for a matching unique constraint\n const matchingUnique = schemaUniques.find((u) =>\n arraysEqual(u.columns, contractUnique.columns),\n );\n\n // If no matching constraint, check for a unique index with the same columns\n const matchingUniqueIndex =\n !matchingUnique &&\n schemaIndexes.find((idx) => idx.unique && arraysEqual(idx.columns, contractUnique.columns));\n\n if (!matchingUnique && !matchingUniqueIndex) {\n issues.push({\n kind: 'unique_constraint_mismatch',\n table: tableName,\n expected: contractUnique.columns.join(', '),\n message: `Table \"${tableName}\" is missing unique constraint: ${contractUnique.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'unique',\n name: `unique(${contractUnique.columns.join(', ')})`,\n contractPath: uniquePath,\n code: 'unique_constraint_mismatch',\n message: 'Unique constraint missing',\n expected: contractUnique,\n actual: undefined,\n children: [],\n });\n } else {\n // Name differences are ignored for semantic satisfaction.\n // Names are persisted for deterministic DDL and diagnostics but are not identity.\n nodes.push({\n status: 'pass',\n kind: 'unique',\n name: `unique(${contractUnique.columns.join(', ')})`,\n contractPath: uniquePath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n\n // Check for extra uniques in strict mode\n if (strict) {\n for (const schemaUnique of schemaUniques) {\n const matchingUnique = contractUniques.find((u) =>\n arraysEqual(u.columns, schemaUnique.columns),\n );\n\n if (!matchingUnique) {\n issues.push({\n kind: 'extra_unique_constraint',\n table: tableName,\n message: `Extra unique constraint found in database (not in contract): ${schemaUnique.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'unique',\n name: `unique(${schemaUnique.columns.join(', ')})`,\n contractPath: `${tablePath}.uniques[${schemaUnique.columns.join(',')}]`,\n code: 'extra_unique_constraint',\n message: 'Extra unique constraint found',\n expected: undefined,\n actual: schemaUnique,\n children: [],\n });\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Verifies indexes match between contract and schema.\n * Returns verification nodes for the tree.\n *\n * Uses semantic satisfaction: identity is based on (table + kind + columns).\n * A non-unique index requirement can be satisfied by either:\n * - A non-unique index with the same columns, or\n * - A unique index with the same columns (stronger satisfies weaker)\n *\n * Name differences are ignored by default (names are for DDL/diagnostics, not identity).\n */\nexport function verifyIndexes(\n contractIndexes: readonly Index[],\n schemaIndexes: readonly SqlIndexIR[],\n schemaUniques: readonly SqlUniqueIR[],\n tableName: string,\n tablePath: string,\n issues: SchemaIssue[],\n strict: boolean,\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n // Check each contract index exists in schema\n for (const contractIndex of contractIndexes) {\n const indexPath = `${tablePath}.indexes[${contractIndex.columns.join(',')}]`;\n\n // Check for any matching index (unique or non-unique)\n // A unique index can satisfy a non-unique index requirement (stronger satisfies weaker)\n const matchingIndex = schemaIndexes.find((idx) =>\n arraysEqual(idx.columns, contractIndex.columns),\n );\n\n // Also check if a unique constraint satisfies the index requirement\n const matchingUniqueConstraint =\n !matchingIndex && schemaUniques.find((u) => arraysEqual(u.columns, contractIndex.columns));\n\n if (!matchingIndex && !matchingUniqueConstraint) {\n issues.push({\n kind: 'index_mismatch',\n table: tableName,\n expected: contractIndex.columns.join(', '),\n message: `Table \"${tableName}\" is missing index: ${contractIndex.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'index',\n name: `index(${contractIndex.columns.join(', ')})`,\n contractPath: indexPath,\n code: 'index_mismatch',\n message: 'Index missing',\n expected: contractIndex,\n actual: undefined,\n children: [],\n });\n } else {\n // Name differences are ignored for semantic satisfaction.\n // Names are persisted for deterministic DDL and diagnostics but are not identity.\n nodes.push({\n status: 'pass',\n kind: 'index',\n name: `index(${contractIndex.columns.join(', ')})`,\n contractPath: indexPath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n\n // Check for extra indexes in strict mode\n if (strict) {\n for (const schemaIndex of schemaIndexes) {\n // Skip unique indexes (they're handled as unique constraints)\n if (schemaIndex.unique) {\n continue;\n }\n\n const matchingIndex = contractIndexes.find((idx) =>\n arraysEqual(idx.columns, schemaIndex.columns),\n );\n\n if (!matchingIndex) {\n issues.push({\n kind: 'extra_index',\n table: tableName,\n message: `Extra index found in database (not in contract): ${schemaIndex.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'index',\n name: `index(${schemaIndex.columns.join(', ')})`,\n contractPath: `${tablePath}.indexes[${schemaIndex.columns.join(',')}]`,\n code: 'extra_index',\n message: 'Extra index found',\n expected: undefined,\n actual: schemaIndex,\n children: [],\n });\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Verifies database dependencies are installed using component-owned verification hooks.\n * Each dependency provides a pure verifyDatabaseDependencyInstalled function that checks\n * whether the dependency is satisfied based on the in-memory schema IR (no DB I/O).\n *\n * Returns verification nodes for the tree.\n */\nexport function verifyDatabaseDependencies(\n dependencies: ReadonlyArray<ComponentDatabaseDependency<unknown>>,\n schema: SqlSchemaIR,\n issues: SchemaIssue[],\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n for (const dependency of dependencies) {\n const depIssues = dependency.verifyDatabaseDependencyInstalled(schema);\n const depPath = `dependencies.${dependency.id}`;\n\n if (depIssues.length > 0) {\n // Dependency is not satisfied\n issues.push(...depIssues);\n const issuesMessage = depIssues.map((i) => i.message).join('; ');\n const nodeMessage = issuesMessage ? `${dependency.id}: ${issuesMessage}` : dependency.id;\n nodes.push({\n status: 'fail',\n kind: 'databaseDependency',\n name: dependency.label,\n contractPath: depPath,\n code: 'dependency_missing',\n message: nodeMessage,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n } else {\n // Dependency is satisfied\n nodes.push({\n status: 'pass',\n kind: 'databaseDependency',\n name: dependency.label,\n contractPath: depPath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n\n return nodes;\n}\n\n/**\n * Computes counts of pass/warn/fail nodes by traversing the tree.\n */\nexport function computeCounts(node: SchemaVerificationNode): {\n pass: number;\n warn: number;\n fail: number;\n totalNodes: number;\n} {\n let pass = 0;\n let warn = 0;\n let fail = 0;\n\n function traverse(n: SchemaVerificationNode): void {\n if (n.status === 'pass') {\n pass++;\n } else if (n.status === 'warn') {\n warn++;\n } else if (n.status === 'fail') {\n fail++;\n }\n\n if (n.children) {\n for (const child of n.children) {\n traverse(child);\n }\n }\n }\n\n traverse(node);\n\n return {\n pass,\n warn,\n fail,\n totalNodes: pass + warn + fail,\n };\n}\n","/**\n * Pure SQL schema verification function.\n *\n * This module provides a pure function that verifies a SqlSchemaIR against\n * a SqlContract without requiring a database connection. It can be reused\n * by migration planners and other tools that need to compare schema states.\n */\n\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';\nimport type {\n OperationContext,\n SchemaIssue,\n SchemaVerificationNode,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/core-control-plane/types';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { ComponentDatabaseDependency } from '../migrations/types';\nimport {\n computeCounts,\n verifyDatabaseDependencies,\n verifyForeignKeys,\n verifyIndexes,\n verifyPrimaryKey,\n verifyUniqueConstraints,\n} from './verify-helpers';\n\n/**\n * Options for the pure schema verification function.\n */\nexport interface VerifySqlSchemaOptions {\n /** The validated SQL contract to verify against */\n readonly contract: SqlContract<SqlStorage>;\n /** The schema IR from introspection (or another source) */\n readonly schema: SqlSchemaIR;\n /** Whether to run in strict mode (detects extra tables/columns) */\n readonly strict: boolean;\n /** Optional operation context for metadata */\n readonly context?: OperationContext;\n /** Type metadata registry for codec consistency warnings */\n readonly typeMetadataRegistry: ReadonlyMap<string, { nativeType?: string }>;\n /**\n * Active framework components participating in this composition.\n * All components must have matching familyId ('sql') and targetId.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Verifies that a SqlSchemaIR matches a SqlContract.\n *\n * This is a pure function that does NOT perform any database I/O.\n * It takes an already-introspected schema IR and compares it against\n * the contract requirements.\n *\n * @param options - Verification options\n * @returns VerifyDatabaseSchemaResult with verification tree and issues\n */\nexport function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult {\n const { contract, schema, strict, context, typeMetadataRegistry } = options;\n const startTime = Date.now();\n\n // Extract contract hashes and target\n const contractCoreHash = contract.coreHash;\n const contractProfileHash =\n 'profileHash' in contract && typeof contract.profileHash === 'string'\n ? contract.profileHash\n : undefined;\n const contractTarget = contract.target;\n\n // Compare contract vs schema IR\n const issues: SchemaIssue[] = [];\n const rootChildren: SchemaVerificationNode[] = [];\n\n // Compare tables\n const contractTables = contract.storage.tables;\n const schemaTables = schema.tables;\n\n for (const [tableName, contractTable] of Object.entries(contractTables)) {\n const schemaTable = schemaTables[tableName];\n const tablePath = `storage.tables.${tableName}`;\n\n if (!schemaTable) {\n // Missing table\n issues.push({\n kind: 'missing_table',\n table: tableName,\n message: `Table \"${tableName}\" is missing from database`,\n });\n rootChildren.push({\n status: 'fail',\n kind: 'table',\n name: `table ${tableName}`,\n contractPath: tablePath,\n code: 'missing_table',\n message: `Table \"${tableName}\" is missing`,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n continue;\n }\n\n // Table exists - compare columns, constraints, etc.\n const tableChildren: SchemaVerificationNode[] = [];\n const columnNodes: SchemaVerificationNode[] = [];\n\n // Compare columns\n for (const [columnName, contractColumn] of Object.entries(contractTable.columns)) {\n const schemaColumn = schemaTable.columns[columnName];\n const columnPath = `${tablePath}.columns.${columnName}`;\n\n if (!schemaColumn) {\n // Missing column\n issues.push({\n kind: 'missing_column',\n table: tableName,\n column: columnName,\n message: `Column \"${tableName}\".\"${columnName}\" is missing from database`,\n });\n columnNodes.push({\n status: 'fail',\n kind: 'column',\n name: `${columnName}: missing`,\n contractPath: columnPath,\n code: 'missing_column',\n message: `Column \"${columnName}\" is missing`,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n continue;\n }\n\n // Column exists - compare type and nullability\n const columnChildren: SchemaVerificationNode[] = [];\n let columnStatus: 'pass' | 'warn' | 'fail' = 'pass';\n\n // Compare type using nativeType directly\n // Both contractColumn.nativeType and schemaColumn.nativeType are required by their types\n const contractNativeType = contractColumn.nativeType;\n const schemaNativeType = schemaColumn.nativeType;\n\n if (contractNativeType !== schemaNativeType) {\n // Compare native types directly\n issues.push({\n kind: 'type_mismatch',\n table: tableName,\n column: columnName,\n expected: contractNativeType,\n actual: schemaNativeType,\n message: `Column \"${tableName}\".\"${columnName}\" has type mismatch: expected \"${contractNativeType}\", got \"${schemaNativeType}\"`,\n });\n columnChildren.push({\n status: 'fail',\n kind: 'type',\n name: 'type',\n contractPath: `${columnPath}.nativeType`,\n code: 'type_mismatch',\n message: `Type mismatch: expected ${contractNativeType}, got ${schemaNativeType}`,\n expected: contractNativeType,\n actual: schemaNativeType,\n children: [],\n });\n columnStatus = 'fail';\n }\n\n // Optionally validate that codecId (if present) and nativeType agree with registry\n if (contractColumn.codecId) {\n const typeMetadata = typeMetadataRegistry.get(contractColumn.codecId);\n if (!typeMetadata) {\n // Warning: codecId not found in registry\n columnChildren.push({\n status: 'warn',\n kind: 'type',\n name: 'type_metadata_missing',\n contractPath: `${columnPath}.codecId`,\n code: 'type_metadata_missing',\n message: `codecId \"${contractColumn.codecId}\" not found in type metadata registry`,\n expected: contractColumn.codecId,\n actual: undefined,\n children: [],\n });\n } else if (typeMetadata.nativeType && typeMetadata.nativeType !== contractNativeType) {\n // Warning: codecId and nativeType don't agree with registry\n columnChildren.push({\n status: 'warn',\n kind: 'type',\n name: 'type_consistency',\n contractPath: `${columnPath}.codecId`,\n code: 'type_consistency_warning',\n message: `codecId \"${contractColumn.codecId}\" maps to nativeType \"${typeMetadata.nativeType}\" in registry, but contract has \"${contractNativeType}\"`,\n expected: typeMetadata.nativeType,\n actual: contractNativeType,\n children: [],\n });\n }\n }\n\n // Compare nullability\n if (contractColumn.nullable !== schemaColumn.nullable) {\n issues.push({\n kind: 'nullability_mismatch',\n table: tableName,\n column: columnName,\n expected: String(contractColumn.nullable),\n actual: String(schemaColumn.nullable),\n message: `Column \"${tableName}\".\"${columnName}\" has nullability mismatch: expected ${contractColumn.nullable ? 'nullable' : 'not null'}, got ${schemaColumn.nullable ? 'nullable' : 'not null'}`,\n });\n columnChildren.push({\n status: 'fail',\n kind: 'nullability',\n name: 'nullability',\n contractPath: `${columnPath}.nullable`,\n code: 'nullability_mismatch',\n message: `Nullability mismatch: expected ${contractColumn.nullable ? 'nullable' : 'not null'}, got ${schemaColumn.nullable ? 'nullable' : 'not null'}`,\n expected: contractColumn.nullable,\n actual: schemaColumn.nullable,\n children: [],\n });\n columnStatus = 'fail';\n }\n\n // Compute column status from children (fail > warn > pass)\n const computedColumnStatus = columnChildren.some((c) => c.status === 'fail')\n ? 'fail'\n : columnChildren.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n // Use computed status if we have children, otherwise use the manually set status\n const finalColumnStatus = columnChildren.length > 0 ? computedColumnStatus : columnStatus;\n\n // Build column node\n const nullableText = contractColumn.nullable ? 'nullable' : 'not nullable';\n const columnTypeDisplay = contractColumn.codecId\n ? `${contractNativeType} (${contractColumn.codecId})`\n : contractNativeType;\n // Collect failure messages from children to create a summary message\n const failureMessages = columnChildren\n .filter((child) => child.status === 'fail' && child.message)\n .map((child) => child.message)\n .filter((msg): msg is string => typeof msg === 'string' && msg.length > 0);\n const columnMessage =\n finalColumnStatus === 'fail' && failureMessages.length > 0\n ? failureMessages.join('; ')\n : '';\n // Extract code from first child if status indicates an issue\n const columnCode =\n (finalColumnStatus === 'fail' || finalColumnStatus === 'warn') && columnChildren[0]\n ? columnChildren[0].code\n : '';\n columnNodes.push({\n status: finalColumnStatus,\n kind: 'column',\n name: `${columnName}: ${columnTypeDisplay} (${nullableText})`,\n contractPath: columnPath,\n code: columnCode,\n message: columnMessage,\n expected: undefined,\n actual: undefined,\n children: columnChildren,\n });\n }\n\n // Group columns under a \"columns\" header if we have any columns\n if (columnNodes.length > 0) {\n const columnsStatus = columnNodes.some((c) => c.status === 'fail')\n ? 'fail'\n : columnNodes.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n tableChildren.push({\n status: columnsStatus,\n kind: 'columns',\n name: 'columns',\n contractPath: `${tablePath}.columns`,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: columnNodes,\n });\n }\n\n // Check for extra columns in strict mode\n if (strict) {\n for (const [columnName, { nativeType }] of Object.entries(schemaTable.columns)) {\n if (!contractTable.columns[columnName]) {\n issues.push({\n kind: 'extra_column',\n table: tableName,\n column: columnName,\n message: `Extra column \"${tableName}\".\"${columnName}\" found in database (not in contract)`,\n });\n columnNodes.push({\n status: 'fail',\n kind: 'column',\n name: `${columnName}: extra`,\n contractPath: `${tablePath}.columns.${columnName}`,\n code: 'extra_column',\n message: `Extra column \"${columnName}\" found`,\n expected: undefined,\n actual: nativeType,\n children: [],\n });\n }\n }\n }\n\n // Compare primary key\n if (contractTable.primaryKey) {\n const pkStatus = verifyPrimaryKey(\n contractTable.primaryKey,\n schemaTable.primaryKey,\n tableName,\n issues,\n );\n if (pkStatus === 'fail') {\n tableChildren.push({\n status: 'fail',\n kind: 'primaryKey',\n name: `primary key: ${contractTable.primaryKey.columns.join(', ')}`,\n contractPath: `${tablePath}.primaryKey`,\n code: 'primary_key_mismatch',\n message: 'Primary key mismatch',\n expected: contractTable.primaryKey,\n actual: schemaTable.primaryKey,\n children: [],\n });\n } else {\n tableChildren.push({\n status: 'pass',\n kind: 'primaryKey',\n name: `primary key: ${contractTable.primaryKey.columns.join(', ')}`,\n contractPath: `${tablePath}.primaryKey`,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n } else if (schemaTable.primaryKey && strict) {\n // Extra primary key in strict mode\n issues.push({\n kind: 'extra_primary_key',\n table: tableName,\n message: 'Extra primary key found in database (not in contract)',\n });\n tableChildren.push({\n status: 'fail',\n kind: 'primaryKey',\n name: `primary key: ${schemaTable.primaryKey.columns.join(', ')}`,\n contractPath: `${tablePath}.primaryKey`,\n code: 'extra_primary_key',\n message: 'Extra primary key found',\n expected: undefined,\n actual: schemaTable.primaryKey,\n children: [],\n });\n }\n\n // Compare foreign keys\n const fkStatuses = verifyForeignKeys(\n contractTable.foreignKeys,\n schemaTable.foreignKeys,\n tableName,\n tablePath,\n issues,\n strict,\n );\n tableChildren.push(...fkStatuses);\n\n // Compare unique constraints\n // Pass schemaIndexes so unique indexes can satisfy unique constraint requirements\n const uniqueStatuses = verifyUniqueConstraints(\n contractTable.uniques,\n schemaTable.uniques,\n schemaTable.indexes,\n tableName,\n tablePath,\n issues,\n strict,\n );\n tableChildren.push(...uniqueStatuses);\n\n // Compare indexes\n // Pass schemaUniques so unique constraints can satisfy index requirements\n const indexStatuses = verifyIndexes(\n contractTable.indexes,\n schemaTable.indexes,\n schemaTable.uniques,\n tableName,\n tablePath,\n issues,\n strict,\n );\n tableChildren.push(...indexStatuses);\n\n // Build table node\n const tableStatus = tableChildren.some((c) => c.status === 'fail')\n ? 'fail'\n : tableChildren.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n // Collect failure messages from children to create a summary message\n const tableFailureMessages = tableChildren\n .filter((child) => child.status === 'fail' && child.message)\n .map((child) => child.message)\n .filter((msg): msg is string => typeof msg === 'string' && msg.length > 0);\n const tableMessage =\n tableStatus === 'fail' && tableFailureMessages.length > 0\n ? `${tableFailureMessages.length} issue${tableFailureMessages.length === 1 ? '' : 's'}`\n : '';\n const tableCode =\n tableStatus === 'fail' && tableChildren.length > 0 && tableChildren[0]\n ? tableChildren[0].code\n : '';\n rootChildren.push({\n status: tableStatus,\n kind: 'table',\n name: `table ${tableName}`,\n contractPath: tablePath,\n code: tableCode,\n message: tableMessage,\n expected: undefined,\n actual: undefined,\n children: tableChildren,\n });\n }\n\n // Check for extra tables in strict mode\n if (strict) {\n for (const tableName of Object.keys(schemaTables)) {\n if (!contractTables[tableName]) {\n issues.push({\n kind: 'extra_table',\n table: tableName,\n message: `Extra table \"${tableName}\" found in database (not in contract)`,\n });\n rootChildren.push({\n status: 'fail',\n kind: 'table',\n name: `table ${tableName}`,\n contractPath: `storage.tables.${tableName}`,\n code: 'extra_table',\n message: `Extra table \"${tableName}\" found`,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n }\n\n // Validate that all extension packs declared in the contract are present in frameworkComponents\n // This is a configuration integrity check - if the contract was emitted with an extension,\n // that extension must be provided in the current configuration.\n // Note: contract.extensionPacks includes adapter.id and target.id (from extractExtensionIds),\n // so we check for matches as extension, adapter, or target components.\n const contractExtensionPacks = contract.extensionPacks ?? {};\n for (const extensionNamespace of Object.keys(contractExtensionPacks)) {\n const hasComponent = options.frameworkComponents.some(\n (component) =>\n component.id === extensionNamespace &&\n (component.kind === 'extension' ||\n component.kind === 'adapter' ||\n component.kind === 'target'),\n );\n if (!hasComponent) {\n throw new Error(\n `Extension pack '${extensionNamespace}' is declared in the contract but not found in framework components. ` +\n 'This indicates a configuration mismatch - the contract was emitted with this extension pack, ' +\n 'but it is not provided in the current configuration.',\n );\n }\n }\n\n // Compare component-owned database dependencies (pure, deterministic)\n // Per ADR 154: We do NOT infer dependencies from contract extension packs.\n // Dependencies are only collected from frameworkComponents provided by the CLI.\n const databaseDependencies = collectDependenciesFromFrameworkComponents(\n options.frameworkComponents,\n );\n const dependencyStatuses = verifyDatabaseDependencies(databaseDependencies, schema, issues);\n rootChildren.push(...dependencyStatuses);\n\n // Build root node\n const rootStatus = rootChildren.some((c) => c.status === 'fail')\n ? 'fail'\n : rootChildren.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n const root: SchemaVerificationNode = {\n status: rootStatus,\n kind: 'contract',\n name: 'contract',\n contractPath: '',\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: rootChildren,\n };\n\n // Compute counts\n const counts = computeCounts(root);\n\n // Set ok flag\n const ok = counts.fail === 0;\n\n // Set code\n const code = ok ? undefined : 'PN-SCHEMA-0001';\n\n // Set summary\n const summary = ok\n ? 'Database schema satisfies contract'\n : `Database schema does not satisfy contract (${counts.fail} failure${counts.fail === 1 ? '' : 's'})`;\n\n const totalTime = Date.now() - startTime;\n\n return {\n ok,\n ...ifDefined('code', code),\n summary,\n contract: {\n coreHash: contractCoreHash,\n ...ifDefined('profileHash', contractProfileHash),\n },\n target: {\n expected: contractTarget,\n actual: contractTarget,\n },\n schema: {\n issues,\n root,\n counts,\n },\n meta: {\n strict,\n ...ifDefined('contractPath', context?.contractPath),\n ...ifDefined('configPath', context?.configPath),\n },\n timings: {\n total: totalTime,\n },\n };\n}\n\n/**\n * Type predicate to check if a component has database dependencies with an init array.\n * The familyId check is redundant since TargetBoundComponentDescriptor<'sql', T> already\n * guarantees familyId is 'sql' at the type level, so we don't need runtime checks for it.\n */\nfunction hasDatabaseDependenciesInit<T extends string>(\n component: TargetBoundComponentDescriptor<'sql', T>,\n): component is TargetBoundComponentDescriptor<'sql', T> & {\n readonly databaseDependencies: {\n readonly init: readonly ComponentDatabaseDependency<T>[];\n };\n} {\n if (!('databaseDependencies' in component)) {\n return false;\n }\n const dbDeps = (component as Record<string, unknown>)['databaseDependencies'];\n if (dbDeps === undefined || dbDeps === null || typeof dbDeps !== 'object') {\n return false;\n }\n const depsRecord = dbDeps as Record<string, unknown>;\n const init = depsRecord['init'];\n if (init === undefined || !Array.isArray(init)) {\n return false;\n }\n return true;\n}\n\nfunction collectDependenciesFromFrameworkComponents<T extends string>(\n components: ReadonlyArray<TargetBoundComponentDescriptor<'sql', T>>,\n): ReadonlyArray<ComponentDatabaseDependency<T>> {\n const dependencies: ComponentDatabaseDependency<T>[] = [];\n for (const component of components) {\n if (hasDatabaseDependenciesInit(component)) {\n dependencies.push(...component.databaseDependencies.init);\n }\n }\n return dependencies;\n}\n"],"mappings":";AAuBO,SAAS,YAAY,GAAsB,GAA+B;AAC/E,MAAI,EAAE,WAAW,EAAE,QAAQ;AACzB,WAAO;AAAA,EACT;AACA,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,QAAI,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG;AACjB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AASO,SAAS,iBACd,YACA,UACA,WACA,QACiB;AACjB,MAAI,CAAC,UAAU;AAC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7LN2UH.js";
|
|
5
5
|
import {
|
|
6
6
|
verifySqlSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-D6DIM7UR.js";
|
|
8
8
|
|
|
9
9
|
// src/core/assembly.ts
|
|
10
10
|
import { createOperationRegistry } from "@prisma-next/operations";
|
|
@@ -586,4 +586,4 @@ export {
|
|
|
586
586
|
convertOperationManifest,
|
|
587
587
|
createSqlFamilyInstance
|
|
588
588
|
};
|
|
589
|
-
//# sourceMappingURL=chunk-
|
|
589
|
+
//# sourceMappingURL=chunk-DI4IPJTV.js.map
|
|
@@ -13,23 +13,43 @@ export declare function arraysEqual(a: readonly string[], b: readonly string[]):
|
|
|
13
13
|
/**
|
|
14
14
|
* Verifies primary key matches between contract and schema.
|
|
15
15
|
* Returns 'pass' or 'fail'.
|
|
16
|
+
*
|
|
17
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
18
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
16
19
|
*/
|
|
17
20
|
export declare function verifyPrimaryKey(contractPK: PrimaryKey, schemaPK: PrimaryKey | undefined, tableName: string, issues: SchemaIssue[]): 'pass' | 'fail';
|
|
18
21
|
/**
|
|
19
22
|
* Verifies foreign keys match between contract and schema.
|
|
20
23
|
* Returns verification nodes for the tree.
|
|
24
|
+
*
|
|
25
|
+
* Uses semantic satisfaction: identity is based on (table + columns + referenced table + referenced columns).
|
|
26
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
21
27
|
*/
|
|
22
28
|
export declare function verifyForeignKeys(contractFKs: readonly ForeignKey[], schemaFKs: readonly SqlForeignKeyIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
23
29
|
/**
|
|
24
30
|
* Verifies unique constraints match between contract and schema.
|
|
25
31
|
* Returns verification nodes for the tree.
|
|
32
|
+
*
|
|
33
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
34
|
+
* A unique constraint requirement can be satisfied by either:
|
|
35
|
+
* - A unique constraint with the same columns, or
|
|
36
|
+
* - A unique index with the same columns
|
|
37
|
+
*
|
|
38
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
26
39
|
*/
|
|
27
|
-
export declare function verifyUniqueConstraints(contractUniques: readonly UniqueConstraint[], schemaUniques: readonly SqlUniqueIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
40
|
+
export declare function verifyUniqueConstraints(contractUniques: readonly UniqueConstraint[], schemaUniques: readonly SqlUniqueIR[], schemaIndexes: readonly SqlIndexIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
28
41
|
/**
|
|
29
42
|
* Verifies indexes match between contract and schema.
|
|
30
43
|
* Returns verification nodes for the tree.
|
|
44
|
+
*
|
|
45
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
46
|
+
* A non-unique index requirement can be satisfied by either:
|
|
47
|
+
* - A non-unique index with the same columns, or
|
|
48
|
+
* - A unique index with the same columns (stronger satisfies weaker)
|
|
49
|
+
*
|
|
50
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
31
51
|
*/
|
|
32
|
-
export declare function verifyIndexes(contractIndexes: readonly Index[], schemaIndexes: readonly SqlIndexIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
52
|
+
export declare function verifyIndexes(contractIndexes: readonly Index[], schemaIndexes: readonly SqlIndexIR[], schemaUniques: readonly SqlUniqueIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
33
53
|
/**
|
|
34
54
|
* Verifies database dependencies are installed using component-owned verification hooks.
|
|
35
55
|
* Each dependency provides a pure verifyDatabaseDependencyInstalled function that checks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-helpers.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAU/E;AAED
|
|
1
|
+
{"version":3,"file":"verify-helpers.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAU/E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,UAAU,GAAG,SAAS,EAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,GACpB,MAAM,GAAG,MAAM,CA0BjB;AAED;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-sql-schema.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-sql-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAGhB,0BAA0B,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAYpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,0BAA0B,
|
|
1
|
+
{"version":3,"file":"verify-sql-schema.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-sql-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAGhB,0BAA0B,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAYpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,0BAA0B,CAye3F"}
|
package/dist/exports/control.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSqlFamilyInstance
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DI4IPJTV.js";
|
|
4
4
|
import "../chunk-SU7LN2UH.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-D6DIM7UR.js";
|
|
6
6
|
|
|
7
7
|
// src/core/descriptor.ts
|
|
8
8
|
import { sqlTargetFamilyHook } from "@prisma-next/sql-contract-emitter";
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
extractCodecTypeImports,
|
|
5
5
|
extractExtensionIds,
|
|
6
6
|
extractOperationTypeImports
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-DI4IPJTV.js";
|
|
8
8
|
import "../chunk-SU7LN2UH.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-D6DIM7UR.js";
|
|
10
10
|
export {
|
|
11
11
|
assembleOperationRegistry,
|
|
12
12
|
convertOperationManifest,
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/family-sql",
|
|
3
|
-
"version": "0.3.0-pr.
|
|
3
|
+
"version": "0.3.0-pr.87.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "SQL family descriptor for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.0.0",
|
|
9
|
-
"@prisma-next/cli": "0.3.0-pr.
|
|
10
|
-
"@prisma-next/contract": "0.3.0-pr.
|
|
11
|
-
"@prisma-next/core-control-plane": "0.3.0-pr.
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/sql-contract
|
|
16
|
-
"@prisma-next/sql-
|
|
17
|
-
"@prisma-next/sql-
|
|
18
|
-
"@prisma-next/sql-
|
|
19
|
-
"@prisma-next/sql-
|
|
20
|
-
"@prisma-next/
|
|
21
|
-
"@prisma-next/
|
|
22
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/cli": "0.3.0-pr.87.1",
|
|
10
|
+
"@prisma-next/contract": "0.3.0-pr.87.1",
|
|
11
|
+
"@prisma-next/core-control-plane": "0.3.0-pr.87.1",
|
|
12
|
+
"@prisma-next/core-execution-plane": "0.3.0-pr.87.1",
|
|
13
|
+
"@prisma-next/operations": "0.3.0-pr.87.1",
|
|
14
|
+
"@prisma-next/runtime-executor": "0.3.0-pr.87.1",
|
|
15
|
+
"@prisma-next/sql-contract": "0.3.0-pr.87.1",
|
|
16
|
+
"@prisma-next/sql-contract-emitter": "0.3.0-pr.87.1",
|
|
17
|
+
"@prisma-next/sql-contract-ts": "0.3.0-pr.87.1",
|
|
18
|
+
"@prisma-next/sql-relational-core": "0.3.0-pr.87.1",
|
|
19
|
+
"@prisma-next/sql-operations": "0.3.0-pr.87.1",
|
|
20
|
+
"@prisma-next/sql-runtime": "0.3.0-pr.87.1",
|
|
21
|
+
"@prisma-next/sql-schema-ir": "0.3.0-pr.87.1",
|
|
22
|
+
"@prisma-next/utils": "0.3.0-pr.87.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@vitest/coverage-v8": "4.0.16",
|
|
26
26
|
"tsup": "8.5.1",
|
|
27
27
|
"typescript": "5.9.3",
|
|
28
28
|
"vitest": "4.0.16",
|
|
29
|
-
"@prisma-next/driver-postgres": "0.3.0-pr.
|
|
29
|
+
"@prisma-next/driver-postgres": "0.3.0-pr.87.1",
|
|
30
30
|
"@prisma-next/test-utils": "0.0.1"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
@@ -36,6 +36,9 @@ export function arraysEqual(a: readonly string[], b: readonly string[]): boolean
|
|
|
36
36
|
/**
|
|
37
37
|
* Verifies primary key matches between contract and schema.
|
|
38
38
|
* Returns 'pass' or 'fail'.
|
|
39
|
+
*
|
|
40
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
41
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
39
42
|
*/
|
|
40
43
|
export function verifyPrimaryKey(
|
|
41
44
|
contractPK: PrimaryKey,
|
|
@@ -64,18 +67,8 @@ export function verifyPrimaryKey(
|
|
|
64
67
|
return 'fail';
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
issues.push({
|
|
70
|
-
kind: 'primary_key_mismatch',
|
|
71
|
-
table: tableName,
|
|
72
|
-
indexOrConstraint: contractPK.name,
|
|
73
|
-
expected: contractPK.name,
|
|
74
|
-
actual: schemaPK.name,
|
|
75
|
-
message: `Table "${tableName}" has primary key name mismatch: expected "${contractPK.name}", got "${schemaPK.name}"`,
|
|
76
|
-
});
|
|
77
|
-
return 'fail';
|
|
78
|
-
}
|
|
70
|
+
// Name differences are ignored for semantic satisfaction.
|
|
71
|
+
// Names are persisted for deterministic DDL and diagnostics but are not identity.
|
|
79
72
|
|
|
80
73
|
return 'pass';
|
|
81
74
|
}
|
|
@@ -83,6 +76,9 @@ export function verifyPrimaryKey(
|
|
|
83
76
|
/**
|
|
84
77
|
* Verifies foreign keys match between contract and schema.
|
|
85
78
|
* Returns verification nodes for the tree.
|
|
79
|
+
*
|
|
80
|
+
* Uses semantic satisfaction: identity is based on (table + columns + referenced table + referenced columns).
|
|
81
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
86
82
|
*/
|
|
87
83
|
export function verifyForeignKeys(
|
|
88
84
|
contractFKs: readonly ForeignKey[],
|
|
@@ -124,40 +120,19 @@ export function verifyForeignKeys(
|
|
|
124
120
|
children: [],
|
|
125
121
|
});
|
|
126
122
|
} else {
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
name: `foreignKey(${contractFK.columns.join(', ')})`,
|
|
141
|
-
contractPath: fkPath,
|
|
142
|
-
code: 'foreign_key_mismatch',
|
|
143
|
-
message: 'Foreign key name mismatch',
|
|
144
|
-
expected: contractFK.name,
|
|
145
|
-
actual: matchingFK.name,
|
|
146
|
-
children: [],
|
|
147
|
-
});
|
|
148
|
-
} else {
|
|
149
|
-
nodes.push({
|
|
150
|
-
status: 'pass',
|
|
151
|
-
kind: 'foreignKey',
|
|
152
|
-
name: `foreignKey(${contractFK.columns.join(', ')})`,
|
|
153
|
-
contractPath: fkPath,
|
|
154
|
-
code: '',
|
|
155
|
-
message: '',
|
|
156
|
-
expected: undefined,
|
|
157
|
-
actual: undefined,
|
|
158
|
-
children: [],
|
|
159
|
-
});
|
|
160
|
-
}
|
|
123
|
+
// Name differences are ignored for semantic satisfaction.
|
|
124
|
+
// Names are persisted for deterministic DDL and diagnostics but are not identity.
|
|
125
|
+
nodes.push({
|
|
126
|
+
status: 'pass',
|
|
127
|
+
kind: 'foreignKey',
|
|
128
|
+
name: `foreignKey(${contractFK.columns.join(', ')})`,
|
|
129
|
+
contractPath: fkPath,
|
|
130
|
+
code: '',
|
|
131
|
+
message: '',
|
|
132
|
+
expected: undefined,
|
|
133
|
+
actual: undefined,
|
|
134
|
+
children: [],
|
|
135
|
+
});
|
|
161
136
|
}
|
|
162
137
|
}
|
|
163
138
|
|
|
@@ -199,10 +174,18 @@ export function verifyForeignKeys(
|
|
|
199
174
|
/**
|
|
200
175
|
* Verifies unique constraints match between contract and schema.
|
|
201
176
|
* Returns verification nodes for the tree.
|
|
177
|
+
*
|
|
178
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
179
|
+
* A unique constraint requirement can be satisfied by either:
|
|
180
|
+
* - A unique constraint with the same columns, or
|
|
181
|
+
* - A unique index with the same columns
|
|
182
|
+
*
|
|
183
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
202
184
|
*/
|
|
203
185
|
export function verifyUniqueConstraints(
|
|
204
186
|
contractUniques: readonly UniqueConstraint[],
|
|
205
187
|
schemaUniques: readonly SqlUniqueIR[],
|
|
188
|
+
schemaIndexes: readonly SqlIndexIR[],
|
|
206
189
|
tableName: string,
|
|
207
190
|
tablePath: string,
|
|
208
191
|
issues: SchemaIssue[],
|
|
@@ -213,11 +196,18 @@ export function verifyUniqueConstraints(
|
|
|
213
196
|
// Check each contract unique exists in schema
|
|
214
197
|
for (const contractUnique of contractUniques) {
|
|
215
198
|
const uniquePath = `${tablePath}.uniques[${contractUnique.columns.join(',')}]`;
|
|
199
|
+
|
|
200
|
+
// First check for a matching unique constraint
|
|
216
201
|
const matchingUnique = schemaUniques.find((u) =>
|
|
217
202
|
arraysEqual(u.columns, contractUnique.columns),
|
|
218
203
|
);
|
|
219
204
|
|
|
220
|
-
|
|
205
|
+
// If no matching constraint, check for a unique index with the same columns
|
|
206
|
+
const matchingUniqueIndex =
|
|
207
|
+
!matchingUnique &&
|
|
208
|
+
schemaIndexes.find((idx) => idx.unique && arraysEqual(idx.columns, contractUnique.columns));
|
|
209
|
+
|
|
210
|
+
if (!matchingUnique && !matchingUniqueIndex) {
|
|
221
211
|
issues.push({
|
|
222
212
|
kind: 'unique_constraint_mismatch',
|
|
223
213
|
table: tableName,
|
|
@@ -236,44 +226,19 @@ export function verifyUniqueConstraints(
|
|
|
236
226
|
children: [],
|
|
237
227
|
});
|
|
238
228
|
} else {
|
|
239
|
-
//
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
});
|
|
253
|
-
nodes.push({
|
|
254
|
-
status: 'fail',
|
|
255
|
-
kind: 'unique',
|
|
256
|
-
name: `unique(${contractUnique.columns.join(', ')})`,
|
|
257
|
-
contractPath: uniquePath,
|
|
258
|
-
code: 'unique_constraint_mismatch',
|
|
259
|
-
message: 'Unique constraint name mismatch',
|
|
260
|
-
expected: contractUnique.name,
|
|
261
|
-
actual: matchingUnique.name,
|
|
262
|
-
children: [],
|
|
263
|
-
});
|
|
264
|
-
} else {
|
|
265
|
-
nodes.push({
|
|
266
|
-
status: 'pass',
|
|
267
|
-
kind: 'unique',
|
|
268
|
-
name: `unique(${contractUnique.columns.join(', ')})`,
|
|
269
|
-
contractPath: uniquePath,
|
|
270
|
-
code: '',
|
|
271
|
-
message: '',
|
|
272
|
-
expected: undefined,
|
|
273
|
-
actual: undefined,
|
|
274
|
-
children: [],
|
|
275
|
-
});
|
|
276
|
-
}
|
|
229
|
+
// Name differences are ignored for semantic satisfaction.
|
|
230
|
+
// Names are persisted for deterministic DDL and diagnostics but are not identity.
|
|
231
|
+
nodes.push({
|
|
232
|
+
status: 'pass',
|
|
233
|
+
kind: 'unique',
|
|
234
|
+
name: `unique(${contractUnique.columns.join(', ')})`,
|
|
235
|
+
contractPath: uniquePath,
|
|
236
|
+
code: '',
|
|
237
|
+
message: '',
|
|
238
|
+
expected: undefined,
|
|
239
|
+
actual: undefined,
|
|
240
|
+
children: [],
|
|
241
|
+
});
|
|
277
242
|
}
|
|
278
243
|
}
|
|
279
244
|
|
|
@@ -311,10 +276,18 @@ export function verifyUniqueConstraints(
|
|
|
311
276
|
/**
|
|
312
277
|
* Verifies indexes match between contract and schema.
|
|
313
278
|
* Returns verification nodes for the tree.
|
|
279
|
+
*
|
|
280
|
+
* Uses semantic satisfaction: identity is based on (table + kind + columns).
|
|
281
|
+
* A non-unique index requirement can be satisfied by either:
|
|
282
|
+
* - A non-unique index with the same columns, or
|
|
283
|
+
* - A unique index with the same columns (stronger satisfies weaker)
|
|
284
|
+
*
|
|
285
|
+
* Name differences are ignored by default (names are for DDL/diagnostics, not identity).
|
|
314
286
|
*/
|
|
315
287
|
export function verifyIndexes(
|
|
316
288
|
contractIndexes: readonly Index[],
|
|
317
289
|
schemaIndexes: readonly SqlIndexIR[],
|
|
290
|
+
schemaUniques: readonly SqlUniqueIR[],
|
|
318
291
|
tableName: string,
|
|
319
292
|
tablePath: string,
|
|
320
293
|
issues: SchemaIssue[],
|
|
@@ -325,11 +298,18 @@ export function verifyIndexes(
|
|
|
325
298
|
// Check each contract index exists in schema
|
|
326
299
|
for (const contractIndex of contractIndexes) {
|
|
327
300
|
const indexPath = `${tablePath}.indexes[${contractIndex.columns.join(',')}]`;
|
|
328
|
-
|
|
329
|
-
|
|
301
|
+
|
|
302
|
+
// Check for any matching index (unique or non-unique)
|
|
303
|
+
// A unique index can satisfy a non-unique index requirement (stronger satisfies weaker)
|
|
304
|
+
const matchingIndex = schemaIndexes.find((idx) =>
|
|
305
|
+
arraysEqual(idx.columns, contractIndex.columns),
|
|
330
306
|
);
|
|
331
307
|
|
|
332
|
-
if
|
|
308
|
+
// Also check if a unique constraint satisfies the index requirement
|
|
309
|
+
const matchingUniqueConstraint =
|
|
310
|
+
!matchingIndex && schemaUniques.find((u) => arraysEqual(u.columns, contractIndex.columns));
|
|
311
|
+
|
|
312
|
+
if (!matchingIndex && !matchingUniqueConstraint) {
|
|
333
313
|
issues.push({
|
|
334
314
|
kind: 'index_mismatch',
|
|
335
315
|
table: tableName,
|
|
@@ -348,40 +328,19 @@ export function verifyIndexes(
|
|
|
348
328
|
children: [],
|
|
349
329
|
});
|
|
350
330
|
} else {
|
|
351
|
-
//
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
name: `index(${contractIndex.columns.join(', ')})`,
|
|
365
|
-
contractPath: indexPath,
|
|
366
|
-
code: 'index_mismatch',
|
|
367
|
-
message: 'Index name mismatch',
|
|
368
|
-
expected: contractIndex.name,
|
|
369
|
-
actual: matchingIndex.name,
|
|
370
|
-
children: [],
|
|
371
|
-
});
|
|
372
|
-
} else {
|
|
373
|
-
nodes.push({
|
|
374
|
-
status: 'pass',
|
|
375
|
-
kind: 'index',
|
|
376
|
-
name: `index(${contractIndex.columns.join(', ')})`,
|
|
377
|
-
contractPath: indexPath,
|
|
378
|
-
code: '',
|
|
379
|
-
message: '',
|
|
380
|
-
expected: undefined,
|
|
381
|
-
actual: undefined,
|
|
382
|
-
children: [],
|
|
383
|
-
});
|
|
384
|
-
}
|
|
331
|
+
// Name differences are ignored for semantic satisfaction.
|
|
332
|
+
// Names are persisted for deterministic DDL and diagnostics but are not identity.
|
|
333
|
+
nodes.push({
|
|
334
|
+
status: 'pass',
|
|
335
|
+
kind: 'index',
|
|
336
|
+
name: `index(${contractIndex.columns.join(', ')})`,
|
|
337
|
+
contractPath: indexPath,
|
|
338
|
+
code: '',
|
|
339
|
+
message: '',
|
|
340
|
+
expected: undefined,
|
|
341
|
+
actual: undefined,
|
|
342
|
+
children: [],
|
|
343
|
+
});
|
|
385
344
|
}
|
|
386
345
|
}
|
|
387
346
|
|
|
@@ -373,9 +373,11 @@ export function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabase
|
|
|
373
373
|
tableChildren.push(...fkStatuses);
|
|
374
374
|
|
|
375
375
|
// Compare unique constraints
|
|
376
|
+
// Pass schemaIndexes so unique indexes can satisfy unique constraint requirements
|
|
376
377
|
const uniqueStatuses = verifyUniqueConstraints(
|
|
377
378
|
contractTable.uniques,
|
|
378
379
|
schemaTable.uniques,
|
|
380
|
+
schemaTable.indexes,
|
|
379
381
|
tableName,
|
|
380
382
|
tablePath,
|
|
381
383
|
issues,
|
|
@@ -384,9 +386,11 @@ export function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabase
|
|
|
384
386
|
tableChildren.push(...uniqueStatuses);
|
|
385
387
|
|
|
386
388
|
// Compare indexes
|
|
389
|
+
// Pass schemaUniques so unique constraints can satisfy index requirements
|
|
387
390
|
const indexStatuses = verifyIndexes(
|
|
388
391
|
contractTable.indexes,
|
|
389
392
|
schemaTable.indexes,
|
|
393
|
+
schemaTable.uniques,
|
|
390
394
|
tableName,
|
|
391
395
|
tablePath,
|
|
392
396
|
issues,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/schema-verify/verify-helpers.ts","../src/core/schema-verify/verify-sql-schema.ts"],"sourcesContent":["/**\n * Pure verification helper functions for SQL schema verification.\n * These functions verify schema IR against contract requirements.\n */\n\nimport type { SchemaIssue, SchemaVerificationNode } from '@prisma-next/core-control-plane/types';\nimport type {\n ForeignKey,\n Index,\n PrimaryKey,\n UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport type {\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport type { ComponentDatabaseDependency } from '../migrations/types';\n\n/**\n * Compares two arrays of strings for equality (order-sensitive).\n */\nexport function arraysEqual(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Verifies primary key matches between contract and schema.\n * Returns 'pass' or 'fail'.\n */\nexport function verifyPrimaryKey(\n contractPK: PrimaryKey,\n schemaPK: PrimaryKey | undefined,\n tableName: string,\n issues: SchemaIssue[],\n): 'pass' | 'fail' {\n if (!schemaPK) {\n issues.push({\n kind: 'primary_key_mismatch',\n table: tableName,\n expected: contractPK.columns.join(', '),\n message: `Table \"${tableName}\" is missing primary key`,\n });\n return 'fail';\n }\n\n if (!arraysEqual(contractPK.columns, schemaPK.columns)) {\n issues.push({\n kind: 'primary_key_mismatch',\n table: tableName,\n expected: contractPK.columns.join(', '),\n actual: schemaPK.columns.join(', '),\n message: `Table \"${tableName}\" has primary key mismatch: expected columns [${contractPK.columns.join(', ')}], got [${schemaPK.columns.join(', ')}]`,\n });\n return 'fail';\n }\n\n // Compare name if both are modeled\n if (contractPK.name && schemaPK.name && contractPK.name !== schemaPK.name) {\n issues.push({\n kind: 'primary_key_mismatch',\n table: tableName,\n indexOrConstraint: contractPK.name,\n expected: contractPK.name,\n actual: schemaPK.name,\n message: `Table \"${tableName}\" has primary key name mismatch: expected \"${contractPK.name}\", got \"${schemaPK.name}\"`,\n });\n return 'fail';\n }\n\n return 'pass';\n}\n\n/**\n * Verifies foreign keys match between contract and schema.\n * Returns verification nodes for the tree.\n */\nexport function verifyForeignKeys(\n contractFKs: readonly ForeignKey[],\n schemaFKs: readonly SqlForeignKeyIR[],\n tableName: string,\n tablePath: string,\n issues: SchemaIssue[],\n strict: boolean,\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n // Check each contract FK exists in schema\n for (const contractFK of contractFKs) {\n const fkPath = `${tablePath}.foreignKeys[${contractFK.columns.join(',')}]`;\n const matchingFK = schemaFKs.find((fk) => {\n return (\n arraysEqual(fk.columns, contractFK.columns) &&\n fk.referencedTable === contractFK.references.table &&\n arraysEqual(fk.referencedColumns, contractFK.references.columns)\n );\n });\n\n if (!matchingFK) {\n issues.push({\n kind: 'foreign_key_mismatch',\n table: tableName,\n expected: `${contractFK.columns.join(', ')} -> ${contractFK.references.table}(${contractFK.references.columns.join(', ')})`,\n message: `Table \"${tableName}\" is missing foreign key: ${contractFK.columns.join(', ')} -> ${contractFK.references.table}(${contractFK.references.columns.join(', ')})`,\n });\n nodes.push({\n status: 'fail',\n kind: 'foreignKey',\n name: `foreignKey(${contractFK.columns.join(', ')})`,\n contractPath: fkPath,\n code: 'foreign_key_mismatch',\n message: 'Foreign key missing',\n expected: contractFK,\n actual: undefined,\n children: [],\n });\n } else {\n // Compare name if both are modeled\n if (contractFK.name && matchingFK.name && contractFK.name !== matchingFK.name) {\n issues.push({\n kind: 'foreign_key_mismatch',\n table: tableName,\n indexOrConstraint: contractFK.name,\n expected: contractFK.name,\n actual: matchingFK.name,\n message: `Table \"${tableName}\" has foreign key name mismatch: expected \"${contractFK.name}\", got \"${matchingFK.name}\"`,\n });\n nodes.push({\n status: 'fail',\n kind: 'foreignKey',\n name: `foreignKey(${contractFK.columns.join(', ')})`,\n contractPath: fkPath,\n code: 'foreign_key_mismatch',\n message: 'Foreign key name mismatch',\n expected: contractFK.name,\n actual: matchingFK.name,\n children: [],\n });\n } else {\n nodes.push({\n status: 'pass',\n kind: 'foreignKey',\n name: `foreignKey(${contractFK.columns.join(', ')})`,\n contractPath: fkPath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n }\n\n // Check for extra FKs in strict mode\n if (strict) {\n for (const schemaFK of schemaFKs) {\n const matchingFK = contractFKs.find((fk) => {\n return (\n arraysEqual(fk.columns, schemaFK.columns) &&\n fk.references.table === schemaFK.referencedTable &&\n arraysEqual(fk.references.columns, schemaFK.referencedColumns)\n );\n });\n\n if (!matchingFK) {\n issues.push({\n kind: 'extra_foreign_key',\n table: tableName,\n message: `Extra foreign key found in database (not in contract): ${schemaFK.columns.join(', ')} -> ${schemaFK.referencedTable}(${schemaFK.referencedColumns.join(', ')})`,\n });\n nodes.push({\n status: 'fail',\n kind: 'foreignKey',\n name: `foreignKey(${schemaFK.columns.join(', ')})`,\n contractPath: `${tablePath}.foreignKeys[${schemaFK.columns.join(',')}]`,\n code: 'extra_foreign_key',\n message: 'Extra foreign key found',\n expected: undefined,\n actual: schemaFK,\n children: [],\n });\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Verifies unique constraints match between contract and schema.\n * Returns verification nodes for the tree.\n */\nexport function verifyUniqueConstraints(\n contractUniques: readonly UniqueConstraint[],\n schemaUniques: readonly SqlUniqueIR[],\n tableName: string,\n tablePath: string,\n issues: SchemaIssue[],\n strict: boolean,\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n // Check each contract unique exists in schema\n for (const contractUnique of contractUniques) {\n const uniquePath = `${tablePath}.uniques[${contractUnique.columns.join(',')}]`;\n const matchingUnique = schemaUniques.find((u) =>\n arraysEqual(u.columns, contractUnique.columns),\n );\n\n if (!matchingUnique) {\n issues.push({\n kind: 'unique_constraint_mismatch',\n table: tableName,\n expected: contractUnique.columns.join(', '),\n message: `Table \"${tableName}\" is missing unique constraint: ${contractUnique.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'unique',\n name: `unique(${contractUnique.columns.join(', ')})`,\n contractPath: uniquePath,\n code: 'unique_constraint_mismatch',\n message: 'Unique constraint missing',\n expected: contractUnique,\n actual: undefined,\n children: [],\n });\n } else {\n // Compare name if both are modeled\n if (\n contractUnique.name &&\n matchingUnique.name &&\n contractUnique.name !== matchingUnique.name\n ) {\n issues.push({\n kind: 'unique_constraint_mismatch',\n table: tableName,\n indexOrConstraint: contractUnique.name,\n expected: contractUnique.name,\n actual: matchingUnique.name,\n message: `Table \"${tableName}\" has unique constraint name mismatch: expected \"${contractUnique.name}\", got \"${matchingUnique.name}\"`,\n });\n nodes.push({\n status: 'fail',\n kind: 'unique',\n name: `unique(${contractUnique.columns.join(', ')})`,\n contractPath: uniquePath,\n code: 'unique_constraint_mismatch',\n message: 'Unique constraint name mismatch',\n expected: contractUnique.name,\n actual: matchingUnique.name,\n children: [],\n });\n } else {\n nodes.push({\n status: 'pass',\n kind: 'unique',\n name: `unique(${contractUnique.columns.join(', ')})`,\n contractPath: uniquePath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n }\n\n // Check for extra uniques in strict mode\n if (strict) {\n for (const schemaUnique of schemaUniques) {\n const matchingUnique = contractUniques.find((u) =>\n arraysEqual(u.columns, schemaUnique.columns),\n );\n\n if (!matchingUnique) {\n issues.push({\n kind: 'extra_unique_constraint',\n table: tableName,\n message: `Extra unique constraint found in database (not in contract): ${schemaUnique.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'unique',\n name: `unique(${schemaUnique.columns.join(', ')})`,\n contractPath: `${tablePath}.uniques[${schemaUnique.columns.join(',')}]`,\n code: 'extra_unique_constraint',\n message: 'Extra unique constraint found',\n expected: undefined,\n actual: schemaUnique,\n children: [],\n });\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Verifies indexes match between contract and schema.\n * Returns verification nodes for the tree.\n */\nexport function verifyIndexes(\n contractIndexes: readonly Index[],\n schemaIndexes: readonly SqlIndexIR[],\n tableName: string,\n tablePath: string,\n issues: SchemaIssue[],\n strict: boolean,\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n // Check each contract index exists in schema\n for (const contractIndex of contractIndexes) {\n const indexPath = `${tablePath}.indexes[${contractIndex.columns.join(',')}]`;\n const matchingIndex = schemaIndexes.find(\n (idx) => arraysEqual(idx.columns, contractIndex.columns) && idx.unique === false,\n );\n\n if (!matchingIndex) {\n issues.push({\n kind: 'index_mismatch',\n table: tableName,\n expected: contractIndex.columns.join(', '),\n message: `Table \"${tableName}\" is missing index: ${contractIndex.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'index',\n name: `index(${contractIndex.columns.join(', ')})`,\n contractPath: indexPath,\n code: 'index_mismatch',\n message: 'Index missing',\n expected: contractIndex,\n actual: undefined,\n children: [],\n });\n } else {\n // Compare name if both are modeled\n if (contractIndex.name && matchingIndex.name && contractIndex.name !== matchingIndex.name) {\n issues.push({\n kind: 'index_mismatch',\n table: tableName,\n indexOrConstraint: contractIndex.name,\n expected: contractIndex.name,\n actual: matchingIndex.name,\n message: `Table \"${tableName}\" has index name mismatch: expected \"${contractIndex.name}\", got \"${matchingIndex.name}\"`,\n });\n nodes.push({\n status: 'fail',\n kind: 'index',\n name: `index(${contractIndex.columns.join(', ')})`,\n contractPath: indexPath,\n code: 'index_mismatch',\n message: 'Index name mismatch',\n expected: contractIndex.name,\n actual: matchingIndex.name,\n children: [],\n });\n } else {\n nodes.push({\n status: 'pass',\n kind: 'index',\n name: `index(${contractIndex.columns.join(', ')})`,\n contractPath: indexPath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n }\n\n // Check for extra indexes in strict mode\n if (strict) {\n for (const schemaIndex of schemaIndexes) {\n // Skip unique indexes (they're handled as unique constraints)\n if (schemaIndex.unique) {\n continue;\n }\n\n const matchingIndex = contractIndexes.find((idx) =>\n arraysEqual(idx.columns, schemaIndex.columns),\n );\n\n if (!matchingIndex) {\n issues.push({\n kind: 'extra_index',\n table: tableName,\n message: `Extra index found in database (not in contract): ${schemaIndex.columns.join(', ')}`,\n });\n nodes.push({\n status: 'fail',\n kind: 'index',\n name: `index(${schemaIndex.columns.join(', ')})`,\n contractPath: `${tablePath}.indexes[${schemaIndex.columns.join(',')}]`,\n code: 'extra_index',\n message: 'Extra index found',\n expected: undefined,\n actual: schemaIndex,\n children: [],\n });\n }\n }\n }\n\n return nodes;\n}\n\n/**\n * Verifies database dependencies are installed using component-owned verification hooks.\n * Each dependency provides a pure verifyDatabaseDependencyInstalled function that checks\n * whether the dependency is satisfied based on the in-memory schema IR (no DB I/O).\n *\n * Returns verification nodes for the tree.\n */\nexport function verifyDatabaseDependencies(\n dependencies: ReadonlyArray<ComponentDatabaseDependency<unknown>>,\n schema: SqlSchemaIR,\n issues: SchemaIssue[],\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n\n for (const dependency of dependencies) {\n const depIssues = dependency.verifyDatabaseDependencyInstalled(schema);\n const depPath = `dependencies.${dependency.id}`;\n\n if (depIssues.length > 0) {\n // Dependency is not satisfied\n issues.push(...depIssues);\n const issuesMessage = depIssues.map((i) => i.message).join('; ');\n const nodeMessage = issuesMessage ? `${dependency.id}: ${issuesMessage}` : dependency.id;\n nodes.push({\n status: 'fail',\n kind: 'databaseDependency',\n name: dependency.label,\n contractPath: depPath,\n code: 'dependency_missing',\n message: nodeMessage,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n } else {\n // Dependency is satisfied\n nodes.push({\n status: 'pass',\n kind: 'databaseDependency',\n name: dependency.label,\n contractPath: depPath,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n\n return nodes;\n}\n\n/**\n * Computes counts of pass/warn/fail nodes by traversing the tree.\n */\nexport function computeCounts(node: SchemaVerificationNode): {\n pass: number;\n warn: number;\n fail: number;\n totalNodes: number;\n} {\n let pass = 0;\n let warn = 0;\n let fail = 0;\n\n function traverse(n: SchemaVerificationNode): void {\n if (n.status === 'pass') {\n pass++;\n } else if (n.status === 'warn') {\n warn++;\n } else if (n.status === 'fail') {\n fail++;\n }\n\n if (n.children) {\n for (const child of n.children) {\n traverse(child);\n }\n }\n }\n\n traverse(node);\n\n return {\n pass,\n warn,\n fail,\n totalNodes: pass + warn + fail,\n };\n}\n","/**\n * Pure SQL schema verification function.\n *\n * This module provides a pure function that verifies a SqlSchemaIR against\n * a SqlContract without requiring a database connection. It can be reused\n * by migration planners and other tools that need to compare schema states.\n */\n\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';\nimport type {\n OperationContext,\n SchemaIssue,\n SchemaVerificationNode,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/core-control-plane/types';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { ComponentDatabaseDependency } from '../migrations/types';\nimport {\n computeCounts,\n verifyDatabaseDependencies,\n verifyForeignKeys,\n verifyIndexes,\n verifyPrimaryKey,\n verifyUniqueConstraints,\n} from './verify-helpers';\n\n/**\n * Options for the pure schema verification function.\n */\nexport interface VerifySqlSchemaOptions {\n /** The validated SQL contract to verify against */\n readonly contract: SqlContract<SqlStorage>;\n /** The schema IR from introspection (or another source) */\n readonly schema: SqlSchemaIR;\n /** Whether to run in strict mode (detects extra tables/columns) */\n readonly strict: boolean;\n /** Optional operation context for metadata */\n readonly context?: OperationContext;\n /** Type metadata registry for codec consistency warnings */\n readonly typeMetadataRegistry: ReadonlyMap<string, { nativeType?: string }>;\n /**\n * Active framework components participating in this composition.\n * All components must have matching familyId ('sql') and targetId.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Verifies that a SqlSchemaIR matches a SqlContract.\n *\n * This is a pure function that does NOT perform any database I/O.\n * It takes an already-introspected schema IR and compares it against\n * the contract requirements.\n *\n * @param options - Verification options\n * @returns VerifyDatabaseSchemaResult with verification tree and issues\n */\nexport function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult {\n const { contract, schema, strict, context, typeMetadataRegistry } = options;\n const startTime = Date.now();\n\n // Extract contract hashes and target\n const contractCoreHash = contract.coreHash;\n const contractProfileHash =\n 'profileHash' in contract && typeof contract.profileHash === 'string'\n ? contract.profileHash\n : undefined;\n const contractTarget = contract.target;\n\n // Compare contract vs schema IR\n const issues: SchemaIssue[] = [];\n const rootChildren: SchemaVerificationNode[] = [];\n\n // Compare tables\n const contractTables = contract.storage.tables;\n const schemaTables = schema.tables;\n\n for (const [tableName, contractTable] of Object.entries(contractTables)) {\n const schemaTable = schemaTables[tableName];\n const tablePath = `storage.tables.${tableName}`;\n\n if (!schemaTable) {\n // Missing table\n issues.push({\n kind: 'missing_table',\n table: tableName,\n message: `Table \"${tableName}\" is missing from database`,\n });\n rootChildren.push({\n status: 'fail',\n kind: 'table',\n name: `table ${tableName}`,\n contractPath: tablePath,\n code: 'missing_table',\n message: `Table \"${tableName}\" is missing`,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n continue;\n }\n\n // Table exists - compare columns, constraints, etc.\n const tableChildren: SchemaVerificationNode[] = [];\n const columnNodes: SchemaVerificationNode[] = [];\n\n // Compare columns\n for (const [columnName, contractColumn] of Object.entries(contractTable.columns)) {\n const schemaColumn = schemaTable.columns[columnName];\n const columnPath = `${tablePath}.columns.${columnName}`;\n\n if (!schemaColumn) {\n // Missing column\n issues.push({\n kind: 'missing_column',\n table: tableName,\n column: columnName,\n message: `Column \"${tableName}\".\"${columnName}\" is missing from database`,\n });\n columnNodes.push({\n status: 'fail',\n kind: 'column',\n name: `${columnName}: missing`,\n contractPath: columnPath,\n code: 'missing_column',\n message: `Column \"${columnName}\" is missing`,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n continue;\n }\n\n // Column exists - compare type and nullability\n const columnChildren: SchemaVerificationNode[] = [];\n let columnStatus: 'pass' | 'warn' | 'fail' = 'pass';\n\n // Compare type using nativeType directly\n // Both contractColumn.nativeType and schemaColumn.nativeType are required by their types\n const contractNativeType = contractColumn.nativeType;\n const schemaNativeType = schemaColumn.nativeType;\n\n if (contractNativeType !== schemaNativeType) {\n // Compare native types directly\n issues.push({\n kind: 'type_mismatch',\n table: tableName,\n column: columnName,\n expected: contractNativeType,\n actual: schemaNativeType,\n message: `Column \"${tableName}\".\"${columnName}\" has type mismatch: expected \"${contractNativeType}\", got \"${schemaNativeType}\"`,\n });\n columnChildren.push({\n status: 'fail',\n kind: 'type',\n name: 'type',\n contractPath: `${columnPath}.nativeType`,\n code: 'type_mismatch',\n message: `Type mismatch: expected ${contractNativeType}, got ${schemaNativeType}`,\n expected: contractNativeType,\n actual: schemaNativeType,\n children: [],\n });\n columnStatus = 'fail';\n }\n\n // Optionally validate that codecId (if present) and nativeType agree with registry\n if (contractColumn.codecId) {\n const typeMetadata = typeMetadataRegistry.get(contractColumn.codecId);\n if (!typeMetadata) {\n // Warning: codecId not found in registry\n columnChildren.push({\n status: 'warn',\n kind: 'type',\n name: 'type_metadata_missing',\n contractPath: `${columnPath}.codecId`,\n code: 'type_metadata_missing',\n message: `codecId \"${contractColumn.codecId}\" not found in type metadata registry`,\n expected: contractColumn.codecId,\n actual: undefined,\n children: [],\n });\n } else if (typeMetadata.nativeType && typeMetadata.nativeType !== contractNativeType) {\n // Warning: codecId and nativeType don't agree with registry\n columnChildren.push({\n status: 'warn',\n kind: 'type',\n name: 'type_consistency',\n contractPath: `${columnPath}.codecId`,\n code: 'type_consistency_warning',\n message: `codecId \"${contractColumn.codecId}\" maps to nativeType \"${typeMetadata.nativeType}\" in registry, but contract has \"${contractNativeType}\"`,\n expected: typeMetadata.nativeType,\n actual: contractNativeType,\n children: [],\n });\n }\n }\n\n // Compare nullability\n if (contractColumn.nullable !== schemaColumn.nullable) {\n issues.push({\n kind: 'nullability_mismatch',\n table: tableName,\n column: columnName,\n expected: String(contractColumn.nullable),\n actual: String(schemaColumn.nullable),\n message: `Column \"${tableName}\".\"${columnName}\" has nullability mismatch: expected ${contractColumn.nullable ? 'nullable' : 'not null'}, got ${schemaColumn.nullable ? 'nullable' : 'not null'}`,\n });\n columnChildren.push({\n status: 'fail',\n kind: 'nullability',\n name: 'nullability',\n contractPath: `${columnPath}.nullable`,\n code: 'nullability_mismatch',\n message: `Nullability mismatch: expected ${contractColumn.nullable ? 'nullable' : 'not null'}, got ${schemaColumn.nullable ? 'nullable' : 'not null'}`,\n expected: contractColumn.nullable,\n actual: schemaColumn.nullable,\n children: [],\n });\n columnStatus = 'fail';\n }\n\n // Compute column status from children (fail > warn > pass)\n const computedColumnStatus = columnChildren.some((c) => c.status === 'fail')\n ? 'fail'\n : columnChildren.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n // Use computed status if we have children, otherwise use the manually set status\n const finalColumnStatus = columnChildren.length > 0 ? computedColumnStatus : columnStatus;\n\n // Build column node\n const nullableText = contractColumn.nullable ? 'nullable' : 'not nullable';\n const columnTypeDisplay = contractColumn.codecId\n ? `${contractNativeType} (${contractColumn.codecId})`\n : contractNativeType;\n // Collect failure messages from children to create a summary message\n const failureMessages = columnChildren\n .filter((child) => child.status === 'fail' && child.message)\n .map((child) => child.message)\n .filter((msg): msg is string => typeof msg === 'string' && msg.length > 0);\n const columnMessage =\n finalColumnStatus === 'fail' && failureMessages.length > 0\n ? failureMessages.join('; ')\n : '';\n // Extract code from first child if status indicates an issue\n const columnCode =\n (finalColumnStatus === 'fail' || finalColumnStatus === 'warn') && columnChildren[0]\n ? columnChildren[0].code\n : '';\n columnNodes.push({\n status: finalColumnStatus,\n kind: 'column',\n name: `${columnName}: ${columnTypeDisplay} (${nullableText})`,\n contractPath: columnPath,\n code: columnCode,\n message: columnMessage,\n expected: undefined,\n actual: undefined,\n children: columnChildren,\n });\n }\n\n // Group columns under a \"columns\" header if we have any columns\n if (columnNodes.length > 0) {\n const columnsStatus = columnNodes.some((c) => c.status === 'fail')\n ? 'fail'\n : columnNodes.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n tableChildren.push({\n status: columnsStatus,\n kind: 'columns',\n name: 'columns',\n contractPath: `${tablePath}.columns`,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: columnNodes,\n });\n }\n\n // Check for extra columns in strict mode\n if (strict) {\n for (const [columnName, { nativeType }] of Object.entries(schemaTable.columns)) {\n if (!contractTable.columns[columnName]) {\n issues.push({\n kind: 'extra_column',\n table: tableName,\n column: columnName,\n message: `Extra column \"${tableName}\".\"${columnName}\" found in database (not in contract)`,\n });\n columnNodes.push({\n status: 'fail',\n kind: 'column',\n name: `${columnName}: extra`,\n contractPath: `${tablePath}.columns.${columnName}`,\n code: 'extra_column',\n message: `Extra column \"${columnName}\" found`,\n expected: undefined,\n actual: nativeType,\n children: [],\n });\n }\n }\n }\n\n // Compare primary key\n if (contractTable.primaryKey) {\n const pkStatus = verifyPrimaryKey(\n contractTable.primaryKey,\n schemaTable.primaryKey,\n tableName,\n issues,\n );\n if (pkStatus === 'fail') {\n tableChildren.push({\n status: 'fail',\n kind: 'primaryKey',\n name: `primary key: ${contractTable.primaryKey.columns.join(', ')}`,\n contractPath: `${tablePath}.primaryKey`,\n code: 'primary_key_mismatch',\n message: 'Primary key mismatch',\n expected: contractTable.primaryKey,\n actual: schemaTable.primaryKey,\n children: [],\n });\n } else {\n tableChildren.push({\n status: 'pass',\n kind: 'primaryKey',\n name: `primary key: ${contractTable.primaryKey.columns.join(', ')}`,\n contractPath: `${tablePath}.primaryKey`,\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n } else if (schemaTable.primaryKey && strict) {\n // Extra primary key in strict mode\n issues.push({\n kind: 'extra_primary_key',\n table: tableName,\n message: 'Extra primary key found in database (not in contract)',\n });\n tableChildren.push({\n status: 'fail',\n kind: 'primaryKey',\n name: `primary key: ${schemaTable.primaryKey.columns.join(', ')}`,\n contractPath: `${tablePath}.primaryKey`,\n code: 'extra_primary_key',\n message: 'Extra primary key found',\n expected: undefined,\n actual: schemaTable.primaryKey,\n children: [],\n });\n }\n\n // Compare foreign keys\n const fkStatuses = verifyForeignKeys(\n contractTable.foreignKeys,\n schemaTable.foreignKeys,\n tableName,\n tablePath,\n issues,\n strict,\n );\n tableChildren.push(...fkStatuses);\n\n // Compare unique constraints\n const uniqueStatuses = verifyUniqueConstraints(\n contractTable.uniques,\n schemaTable.uniques,\n tableName,\n tablePath,\n issues,\n strict,\n );\n tableChildren.push(...uniqueStatuses);\n\n // Compare indexes\n const indexStatuses = verifyIndexes(\n contractTable.indexes,\n schemaTable.indexes,\n tableName,\n tablePath,\n issues,\n strict,\n );\n tableChildren.push(...indexStatuses);\n\n // Build table node\n const tableStatus = tableChildren.some((c) => c.status === 'fail')\n ? 'fail'\n : tableChildren.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n // Collect failure messages from children to create a summary message\n const tableFailureMessages = tableChildren\n .filter((child) => child.status === 'fail' && child.message)\n .map((child) => child.message)\n .filter((msg): msg is string => typeof msg === 'string' && msg.length > 0);\n const tableMessage =\n tableStatus === 'fail' && tableFailureMessages.length > 0\n ? `${tableFailureMessages.length} issue${tableFailureMessages.length === 1 ? '' : 's'}`\n : '';\n const tableCode =\n tableStatus === 'fail' && tableChildren.length > 0 && tableChildren[0]\n ? tableChildren[0].code\n : '';\n rootChildren.push({\n status: tableStatus,\n kind: 'table',\n name: `table ${tableName}`,\n contractPath: tablePath,\n code: tableCode,\n message: tableMessage,\n expected: undefined,\n actual: undefined,\n children: tableChildren,\n });\n }\n\n // Check for extra tables in strict mode\n if (strict) {\n for (const tableName of Object.keys(schemaTables)) {\n if (!contractTables[tableName]) {\n issues.push({\n kind: 'extra_table',\n table: tableName,\n message: `Extra table \"${tableName}\" found in database (not in contract)`,\n });\n rootChildren.push({\n status: 'fail',\n kind: 'table',\n name: `table ${tableName}`,\n contractPath: `storage.tables.${tableName}`,\n code: 'extra_table',\n message: `Extra table \"${tableName}\" found`,\n expected: undefined,\n actual: undefined,\n children: [],\n });\n }\n }\n }\n\n // Validate that all extension packs declared in the contract are present in frameworkComponents\n // This is a configuration integrity check - if the contract was emitted with an extension,\n // that extension must be provided in the current configuration.\n // Note: contract.extensionPacks includes adapter.id and target.id (from extractExtensionIds),\n // so we check for matches as extension, adapter, or target components.\n const contractExtensionPacks = contract.extensionPacks ?? {};\n for (const extensionNamespace of Object.keys(contractExtensionPacks)) {\n const hasComponent = options.frameworkComponents.some(\n (component) =>\n component.id === extensionNamespace &&\n (component.kind === 'extension' ||\n component.kind === 'adapter' ||\n component.kind === 'target'),\n );\n if (!hasComponent) {\n throw new Error(\n `Extension pack '${extensionNamespace}' is declared in the contract but not found in framework components. ` +\n 'This indicates a configuration mismatch - the contract was emitted with this extension pack, ' +\n 'but it is not provided in the current configuration.',\n );\n }\n }\n\n // Compare component-owned database dependencies (pure, deterministic)\n // Per ADR 154: We do NOT infer dependencies from contract extension packs.\n // Dependencies are only collected from frameworkComponents provided by the CLI.\n const databaseDependencies = collectDependenciesFromFrameworkComponents(\n options.frameworkComponents,\n );\n const dependencyStatuses = verifyDatabaseDependencies(databaseDependencies, schema, issues);\n rootChildren.push(...dependencyStatuses);\n\n // Build root node\n const rootStatus = rootChildren.some((c) => c.status === 'fail')\n ? 'fail'\n : rootChildren.some((c) => c.status === 'warn')\n ? 'warn'\n : 'pass';\n const root: SchemaVerificationNode = {\n status: rootStatus,\n kind: 'contract',\n name: 'contract',\n contractPath: '',\n code: '',\n message: '',\n expected: undefined,\n actual: undefined,\n children: rootChildren,\n };\n\n // Compute counts\n const counts = computeCounts(root);\n\n // Set ok flag\n const ok = counts.fail === 0;\n\n // Set code\n const code = ok ? undefined : 'PN-SCHEMA-0001';\n\n // Set summary\n const summary = ok\n ? 'Database schema satisfies contract'\n : `Database schema does not satisfy contract (${counts.fail} failure${counts.fail === 1 ? '' : 's'})`;\n\n const totalTime = Date.now() - startTime;\n\n return {\n ok,\n ...ifDefined('code', code),\n summary,\n contract: {\n coreHash: contractCoreHash,\n ...ifDefined('profileHash', contractProfileHash),\n },\n target: {\n expected: contractTarget,\n actual: contractTarget,\n },\n schema: {\n issues,\n root,\n counts,\n },\n meta: {\n strict,\n ...ifDefined('contractPath', context?.contractPath),\n ...ifDefined('configPath', context?.configPath),\n },\n timings: {\n total: totalTime,\n },\n };\n}\n\n/**\n * Type predicate to check if a component has database dependencies with an init array.\n * The familyId check is redundant since TargetBoundComponentDescriptor<'sql', T> already\n * guarantees familyId is 'sql' at the type level, so we don't need runtime checks for it.\n */\nfunction hasDatabaseDependenciesInit<T extends string>(\n component: TargetBoundComponentDescriptor<'sql', T>,\n): component is TargetBoundComponentDescriptor<'sql', T> & {\n readonly databaseDependencies: {\n readonly init: readonly ComponentDatabaseDependency<T>[];\n };\n} {\n if (!('databaseDependencies' in component)) {\n return false;\n }\n const dbDeps = (component as Record<string, unknown>)['databaseDependencies'];\n if (dbDeps === undefined || dbDeps === null || typeof dbDeps !== 'object') {\n return false;\n }\n const depsRecord = dbDeps as Record<string, unknown>;\n const init = depsRecord['init'];\n if (init === undefined || !Array.isArray(init)) {\n return false;\n }\n return true;\n}\n\nfunction collectDependenciesFromFrameworkComponents<T extends string>(\n components: ReadonlyArray<TargetBoundComponentDescriptor<'sql', T>>,\n): ReadonlyArray<ComponentDatabaseDependency<T>> {\n const dependencies: ComponentDatabaseDependency<T>[] = [];\n for (const component of components) {\n if (hasDatabaseDependenciesInit(component)) {\n dependencies.push(...component.databaseDependencies.init);\n }\n }\n return dependencies;\n}\n"],"mappings":";AAuBO,SAAS,YAAY,GAAsB,GAA+B;AAC/E,MAAI,EAAE,WAAW,EAAE,QAAQ;AACzB,WAAO;AAAA,EACT;AACA,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,QAAI,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG;AACjB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAMO,SAAS,iBACd,YACA,UACA,WACA,QACiB;AACjB,MAAI,CAAC,UAAU;AACb,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,OAAO;AAAA,MACP,UAAU,WAAW,QAAQ,KAAK,IAAI;AAAA,MACtC,SAAS,UAAU,SAAS;AAAA,IAC9B,CAAC;AACD,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,YA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