@prisma/orm-target-sqlite 8.0.0-rc.17-dev.37 → 8.0.0-rc.17-dev.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-Cfp6xn4m-BtODbERC.mjs → adapter-Cfp6xn4m-CqnRsbnV.mjs} +2 -2
- package/dist/{adapter-Cfp6xn4m-BtODbERC.mjs.map → adapter-Cfp6xn4m-CqnRsbnV.mjs.map} +1 -1
- package/dist/adapter.mjs +2 -2
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +3 -3
- package/dist/adapter__runtime.mjs +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{control-DJq7MF_s.mjs → control-CVmnzYUI.mjs} +113 -18
- package/dist/control-CVmnzYUI.mjs.map +1 -0
- package/dist/{control-4njwExvT.mjs → control-DKT_rL3s.mjs} +11 -3
- package/dist/control-DKT_rL3s.mjs.map +1 -0
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/{migration-CIKnw9my.mjs → migration-DOkUBr8w.mjs} +2 -2
- package/dist/{migration-CIKnw9my.mjs.map → migration-DOkUBr8w.mjs.map} +1 -1
- package/dist/{migration-BsYgVFeM.d.mts → migration-wH0Hw2VD.d.mts} +3 -3
- package/dist/{migration-BsYgVFeM.d.mts.map → migration-wH0Hw2VD.d.mts.map} +1 -1
- package/dist/{op-factory-call-C-6Lxtlm.d.mts → op-factory-call-DAI1NqNz.d.mts} +16 -10
- package/dist/op-factory-call-DAI1NqNz.d.mts.map +1 -0
- package/dist/{op-factory-call-gwVgzGbc-caCULmpj.mjs → op-factory-call-hxIbAMSY-CinxsQHg.mjs} +234 -25
- package/dist/op-factory-call-hxIbAMSY-CinxsQHg.mjs.map +1 -0
- package/dist/{planner-Ddpm7j-w-BzyQ-raY.mjs → planner-BENMBCnG-CW6-1do-.mjs} +65 -23
- package/dist/planner-BENMBCnG-CW6-1do-.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-CB9UDEdR.d.mts +1 -0
- package/dist/{planner-produced-sqlite-migration-D50U99OT--9-v0jj6.d.mts → planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.d.mts} +3 -3
- package/dist/planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.d.mts.map +1 -0
- package/dist/{planner-produced-sqlite-migration-Cj_QCROn-0eatEGzt.mjs → planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs} +4 -4
- package/dist/{planner-produced-sqlite-migration-Cj_QCROn-0eatEGzt.mjs.map → planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs.map} +1 -1
- package/dist/{planner-DRDXnFF-.d.mts → planner-tv5z1cn8.d.mts} +5 -4
- package/dist/planner-tv5z1cn8.d.mts.map +1 -0
- package/dist/{render-ops-CBkWzmKj-6vfxyU3K.mjs → render-ops-B889CY71-JvEeW9B4.mjs} +3 -3
- package/dist/{render-ops-CBkWzmKj-6vfxyU3K.mjs.map → render-ops-B889CY71-JvEeW9B4.mjs.map} +1 -1
- package/dist/{sql-utils-C2O4zVkP-Dz3Hb85I.mjs → sql-utils-XGT5Esi2-5k9pvJeF.mjs} +30 -3
- package/dist/sql-utils-XGT5Esi2-5k9pvJeF.mjs.map +1 -0
- package/dist/{sqlite-contract-view-BrXalcTm-DYDH4LQC.mjs → sqlite-contract-view-TELBWEt4-CVsdZnpX.mjs} +3 -3
- package/dist/{sqlite-contract-view-BrXalcTm-DYDH4LQC.mjs.map → sqlite-contract-view-TELBWEt4-CVsdZnpX.mjs.map} +1 -1
- package/dist/{sqlite-migration-omhBdJEh-CizoFjMg.d.mts → sqlite-migration-BqbQmUY1-CTmurARU.d.mts} +9 -3
- package/dist/{sqlite-migration-omhBdJEh-CizoFjMg.d.mts.map → sqlite-migration-BqbQmUY1-CTmurARU.d.mts.map} +1 -1
- package/dist/{sqlite-migration-D7DWt0JL-D_5jFkOx.mjs → sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs} +235 -66
- package/dist/sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs.map +1 -0
- package/dist/{tables-CvLOKCiJ-DYQkJ90L.d.mts → tables-DD_EmImp-B8ZaVBMr.d.mts} +16 -7
- package/dist/tables-DD_EmImp-B8ZaVBMr.d.mts.map +1 -0
- package/dist/target.d.mts +6 -6
- package/dist/target.mjs +9 -9
- package/dist/target__control.mjs +2 -2
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +1 -1
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.mjs +1 -1
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/package.json +9 -9
- package/dist/control-4njwExvT.mjs.map +0 -1
- package/dist/control-DJq7MF_s.mjs.map +0 -1
- package/dist/op-factory-call-C-6Lxtlm.d.mts.map +0 -1
- package/dist/op-factory-call-gwVgzGbc-caCULmpj.mjs.map +0 -1
- package/dist/planner-DRDXnFF-.d.mts.map +0 -1
- package/dist/planner-Ddpm7j-w-BzyQ-raY.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-CWUahMOX.d.mts +0 -1
- package/dist/planner-produced-sqlite-migration-D50U99OT--9-v0jj6.d.mts.map +0 -1
- package/dist/sql-utils-C2O4zVkP-Dz3Hb85I.mjs.map +0 -1
- package/dist/sqlite-migration-D7DWt0JL-D_5jFkOx.mjs.map +0 -1
- package/dist/tables-CvLOKCiJ-DYQkJ90L.d.mts.map +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-KMliSCRp-BhTbmbGr.mjs";
|
|
2
2
|
import { n as sqliteError } from "./errors-DnR-sMHS-KkMLIP2U.mjs";
|
|
3
3
|
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-CthMyZ9m-BJfUmecN.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { r as quoteIdentifier } from "./sql-utils-XGT5Esi2-5k9pvJeF.mjs";
|
|
5
|
+
import { f as affinityStorageClasses, g as conversionCopyOf, y as rebuiltTableName } from "./op-factory-call-hxIbAMSY-CinxsQHg.mjs";
|
|
5
6
|
import { r as MARKER_TABLE_NAME } from "./control-tables-D_o8dKRB-BXi43noL.mjs";
|
|
6
|
-
import { t as SqliteContractSerializer } from "./sqlite-contract-view-
|
|
7
|
-
import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-
|
|
8
|
-
import { n as createSqliteMigrationPlanner } from "./planner-
|
|
7
|
+
import { t as SqliteContractSerializer } from "./sqlite-contract-view-TELBWEt4-CVsdZnpX.mjs";
|
|
8
|
+
import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs";
|
|
9
|
+
import { n as createSqliteMigrationPlanner } from "./planner-BENMBCnG-CW6-1do-.mjs";
|
|
9
10
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
10
11
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
11
12
|
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
12
|
-
import { runnerFailure, runnerSuccess, sqlTypeLookupsOf } from "@prisma/orm-family-sql/family/control";
|
|
13
|
+
import { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
|
|
13
14
|
import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
|
|
14
15
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
15
16
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
@@ -170,10 +171,18 @@ var SqliteMigrationRunner = class {
|
|
|
170
171
|
const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck");
|
|
171
172
|
if (!precheckResult.ok) return precheckResult;
|
|
172
173
|
}
|
|
173
|
-
const executeResult = await this.runExecuteSteps(driver, operation.execute, operation
|
|
174
|
+
const executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {
|
|
175
|
+
contract: options.destinationContract,
|
|
176
|
+
operationIndex: ops.indexOf(operation),
|
|
177
|
+
operations: ops,
|
|
178
|
+
edges: options.migrationEdges
|
|
179
|
+
});
|
|
174
180
|
if (!executeResult.ok) return executeResult;
|
|
175
181
|
if (runPostchecks) {
|
|
176
|
-
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck"
|
|
182
|
+
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck", {
|
|
183
|
+
contract: options.destinationContract,
|
|
184
|
+
operationIndex: ops.indexOf(operation)
|
|
185
|
+
});
|
|
177
186
|
if (!postcheckResult.ok) return postcheckResult;
|
|
178
187
|
}
|
|
179
188
|
executedOperations.push(operation);
|
|
@@ -204,33 +213,119 @@ var SqliteMigrationRunner = class {
|
|
|
204
213
|
columns: [...columns].sort()
|
|
205
214
|
} });
|
|
206
215
|
}
|
|
207
|
-
async runExpectationSteps(driver, steps, operation, phase) {
|
|
216
|
+
async runExpectationSteps(driver, steps, operation, phase, plan) {
|
|
208
217
|
for (const step of steps) {
|
|
209
218
|
const result = await driver.query(step.sql, step.params ?? []);
|
|
210
|
-
if (!this.stepResultIsTrue(result.rows))
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
if (!this.stepResultIsTrue(result.rows)) {
|
|
220
|
+
const code = phase === "precheck" ? "MIGRATION.PRECHECK_FAILED" : "MIGRATION.POSTCHECK_FAILED";
|
|
221
|
+
const field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);
|
|
222
|
+
const converted = convertedColumnOf(step);
|
|
223
|
+
return runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {
|
|
224
|
+
meta: {
|
|
225
|
+
operationId: operation.id,
|
|
226
|
+
phase,
|
|
227
|
+
stepDescription: step.description
|
|
228
|
+
},
|
|
229
|
+
...ifDefined("why", converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted)),
|
|
230
|
+
...ifDefined("failedTypeChange", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === "conversion" ? {
|
|
231
|
+
field,
|
|
232
|
+
by: "conversion",
|
|
233
|
+
reason: "invalidResult",
|
|
234
|
+
operationIndex: plan.operationIndex
|
|
235
|
+
} : {
|
|
236
|
+
field,
|
|
237
|
+
by: "cast",
|
|
238
|
+
reason: "value",
|
|
239
|
+
operationIndex: plan.operationIndex
|
|
240
|
+
})
|
|
241
|
+
});
|
|
242
|
+
}
|
|
215
243
|
}
|
|
216
244
|
return okVoid();
|
|
217
245
|
}
|
|
218
|
-
|
|
246
|
+
/** Names the first value of a retyped column that kept a storage class its new type does not hold. */
|
|
247
|
+
async unconvertedValueText(driver, cast) {
|
|
248
|
+
const typeSql = (await driver.query("SELECT type FROM pragma_table_info(?) WHERE name = ?", [cast.table, cast.column])).rows[0]?.type;
|
|
249
|
+
if (typeSql === void 0) return void 0;
|
|
250
|
+
const column = quoteIdentifier(cast.column);
|
|
251
|
+
const classes = ["null", ...affinityStorageClasses(typeSql)];
|
|
252
|
+
const row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => "?").join(", ")}) LIMIT 1`, classes)).rows[0];
|
|
253
|
+
if (row === void 0) return void 0;
|
|
254
|
+
return `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column "${cast.column}" on "${cast.table}" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;
|
|
255
|
+
}
|
|
256
|
+
async runExecuteSteps(driver, steps, operation, plan) {
|
|
219
257
|
for (const step of steps) try {
|
|
220
258
|
await driver.query(step.sql, step.params ?? []);
|
|
221
259
|
} catch (error) {
|
|
222
260
|
const message = error instanceof Error ? error.message : String(error);
|
|
223
|
-
|
|
224
|
-
|
|
261
|
+
const failed = `Operation ${operation.id} failed during execution: ${step.description}`;
|
|
262
|
+
const rowsWithoutValue = await this.rowsWithoutValue(driver, message, plan);
|
|
263
|
+
const failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, message, plan) : void 0;
|
|
264
|
+
return runnerFailure("MIGRATION.EXECUTION_FAILED", rowsWithoutValue?.summary ?? failed, {
|
|
265
|
+
why: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,
|
|
225
266
|
meta: {
|
|
226
267
|
operationId: operation.id,
|
|
227
268
|
stepDescription: step.description,
|
|
228
269
|
sql: step.sql
|
|
229
|
-
}
|
|
270
|
+
},
|
|
271
|
+
rowsWithoutValue: rowsWithoutValue?.reports,
|
|
272
|
+
failedTypeChange: failedConversion
|
|
230
273
|
});
|
|
231
274
|
}
|
|
232
275
|
return okVoid();
|
|
233
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* The conversion that failed, when the failed step is the copy of a rebuild that converts columns
|
|
279
|
+
* and there is evidence for it: a copy expression that fails on its own has an error in its
|
|
280
|
+
* expression, and a constraint of the new table that names a converted column was broken by a
|
|
281
|
+
* value the conversion produced. Any other failure of the copy is not the conversion's.
|
|
282
|
+
*/
|
|
283
|
+
async failedConversion(driver, step, message, plan) {
|
|
284
|
+
const copy = conversionCopyOf(step);
|
|
285
|
+
if (copy === void 0) return void 0;
|
|
286
|
+
const columns = Object.keys(copy.expressions);
|
|
287
|
+
const failed = async (column) => {
|
|
288
|
+
try {
|
|
289
|
+
await driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);
|
|
290
|
+
return false;
|
|
291
|
+
} catch {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
for (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, "expressionError");
|
|
296
|
+
const [, constrainedList] = message.split("constraint failed: ");
|
|
297
|
+
if (constrainedList === void 0) return void 0;
|
|
298
|
+
const constrained = new Set(constrainedList.split(", "));
|
|
299
|
+
const column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));
|
|
300
|
+
return column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, "invalidResult");
|
|
301
|
+
}
|
|
302
|
+
conversionOf(plan, table, column, reason) {
|
|
303
|
+
const field = fieldOfColumn(plan.contract, table, column);
|
|
304
|
+
return field === void 0 ? void 0 : {
|
|
305
|
+
field,
|
|
306
|
+
by: "conversion",
|
|
307
|
+
reason,
|
|
308
|
+
operationIndex: plan.operationIndex
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the
|
|
313
|
+
* new table: the columns the rebuild's postchecks mark as becoming required are counted, the
|
|
314
|
+
* rebuild's own first, then those of every other operation of its migration.
|
|
315
|
+
*/
|
|
316
|
+
rowsWithoutValue(driver, message, plan) {
|
|
317
|
+
if (!message.includes("NOT NULL constraint failed")) return Promise.resolve(void 0);
|
|
318
|
+
const marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);
|
|
319
|
+
return rowsWithoutValueFailure({
|
|
320
|
+
failed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),
|
|
321
|
+
others: marks,
|
|
322
|
+
count: async ({ required }) => {
|
|
323
|
+
const where = required.reason !== "newField" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : "";
|
|
324
|
+
return (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;
|
|
325
|
+
},
|
|
326
|
+
contract: plan.contract
|
|
327
|
+
});
|
|
328
|
+
}
|
|
234
329
|
stepResultIsTrue(rows) {
|
|
235
330
|
if (!rows || rows.length === 0) return false;
|
|
236
331
|
const firstRow = rows[0];
|
|
@@ -489,4 +584,4 @@ const sqlitePslTypeConstructors = {
|
|
|
489
584
|
//#endregion
|
|
490
585
|
export { sqlitePslTypeConstructors as n, sqliteControlTargetDescriptor as t };
|
|
491
586
|
|
|
492
|
-
//# sourceMappingURL=control-
|
|
587
|
+
//# sourceMappingURL=control-CVmnzYUI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-CVmnzYUI.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { a as SQLITE_INTEGER_CODEC_ID, c as SQLITE_TEXT_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, o as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_REAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from \"./codec-ids-KMliSCRp.mjs\";\nimport { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-CthMyZ9m.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-hxIbAMSY.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-CTNkjYJ1.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BENMBCnG.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-TELBWEt4.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/runner.ts\nfunction createSqliteMigrationRunner(family) {\n\treturn new SqliteMigrationRunner(family);\n}\nvar SqliteMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Apply the plan against an already-open connection without managing\n\t* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})\n\t* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma\n\t* toggle, FK integrity check).\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw sqliteError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet operationsExecuted;\n\t\tlet executedOperations;\n\t\tif (skipOperations) {\n\t\t\toperationsExecuted = 0;\n\t\t\texecutedOperations = [];\n\t\t} else {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\toperationsExecuted = applyResult.value.operationsExecuted;\n\t\t\texecutedOperations = applyResult.value.executedOperations;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = verifySqliteDatabaseSchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tactualSchema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants;\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, executedOperations);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tconst fkWasEnabled = await this.readForeignKeysEnabled(driver);\n\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = OFF\");\n\t\ttry {\n\t\t\tawait this.beginExclusiveTransaction(driver);\n\t\t\tlet committed = false;\n\t\t\ttry {\n\t\t\t\tconst perSpaceResults = [];\n\t\t\t\tlet lastProcessedSpace;\n\t\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t\t...spaceOptions,\n\t\t\t\t\t\tdriver,\n\t\t\t\t\t\tspace\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t\t...result.failure,\n\t\t\t\t\t\tfailingSpace: space\n\t\t\t\t\t});\n\t\t\t\t\tperSpaceResults.push({\n\t\t\t\t\t\tspace,\n\t\t\t\t\t\tvalue: result.value\n\t\t\t\t\t});\n\t\t\t\t\tlastProcessedSpace = space;\n\t\t\t\t}\n\t\t\t\tif (fkWasEnabled) {\n\t\t\t\t\tconst fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);\n\t\t\t\t\tif (!fkIntegrityCheck.ok) return notOk({\n\t\t\t\t\t\t...fkIntegrityCheck.failure,\n\t\t\t\t\t\tfailingSpace: lastProcessedSpace ?? APP_SPACE_ID\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tawait this.commitTransaction(driver);\n\t\t\t\tcommitted = true;\n\t\t\t\treturn ok({ perSpaceResults });\n\t\t\t} finally {\n\t\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t\t}\n\t\t} finally {\n\t\t\tif (fkWasEnabled) await driver.query(\"PRAGMA foreign_keys = ON\");\n\t\t}\n\t}\n\tasync readForeignKeysEnabled(driver) {\n\t\treturn (await driver.query(\"PRAGMA foreign_keys\")).rows[0]?.foreign_keys === 1;\n\t}\n\tasync verifyForeignKeyIntegrity(driver) {\n\t\tconst result = await driver.query(\"PRAGMA foreign_key_check\");\n\t\tif (result.rows.length === 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.FOREIGN_KEY_VIOLATION\", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {\n\t\t\twhy: \"PRAGMA foreign_key_check reported violations after applying recreate-table operations.\",\n\t\t\tmeta: { violations: result.rows }\n\t\t});\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {\n\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\toperationIndex: ops.indexOf(operation),\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tedges: options.migrationEdges\n\t\t\t\t});\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\", {\n\t\t\t\t\t\tcontract: options.destinationContract,\n\t\t\t\t\t\toperationIndex: ops.indexOf(operation)\n\t\t\t\t\t});\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tconst lowererContext = { contract };\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst tableInfo = await driver.query(`PRAGMA table_info(${quoteIdentifier(MARKER_TABLE_NAME)})`);\n\t\tif (tableInfo.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(tableInfo.rows.map((row) => row.name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \\`space\\` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \\`${MARKER_TABLE_NAME}\\` and re-run \\`dbInit\\` to reinitialise from a clean baseline.`, { meta: {\n\t\t\ttable: MARKER_TABLE_NAME,\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase, plan) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) {\n\t\t\t\tconst code = phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\";\n\t\t\t\tconst field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);\n\t\t\t\tconst converted = convertedColumnOf(step);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\t\tphase,\n\t\t\t\t\t\tstepDescription: step.description\n\t\t\t\t\t},\n\t\t\t\t\t...ifDefined(\"why\", converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted)),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === \"conversion\" ? {\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t} : {\n\t\t\t\t\t\tfield,\n\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Names the first value of a retyped column that kept a storage class its new type does not hold. */\n\tasync unconvertedValueText(driver, cast) {\n\t\tconst typeSql = (await driver.query(\"SELECT type FROM pragma_table_info(?) WHERE name = ?\", [cast.table, cast.column])).rows[0]?.type;\n\t\tif (typeSql === void 0) return void 0;\n\t\tconst column = quoteIdentifier(cast.column);\n\t\tconst classes = [\"null\", ...affinityStorageClasses(typeSql)];\n\t\tconst row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => \"?\").join(\", \")}) LIMIT 1`, classes)).rows[0];\n\t\tif (row === void 0) return void 0;\n\t\treturn `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column \"${cast.column}\" on \"${cast.table}\" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;\n\t}\n\tasync runExecuteSteps(driver, steps, operation, plan) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst failed = `Operation ${operation.id} failed during execution: ${step.description}`;\n\t\t\tconst rowsWithoutValue = await this.rowsWithoutValue(driver, message, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, message, plan) : void 0;\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", rowsWithoutValue?.summary ?? failed, {\n\t\t\t\twhy: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t},\n\t\t\t\trowsWithoutValue: rowsWithoutValue?.reports,\n\t\t\t\tfailedTypeChange: failedConversion\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/**\n\t* The conversion that failed, when the failed step is the copy of a rebuild that converts columns\n\t* and there is evidence for it: a copy expression that fails on its own has an error in its\n\t* expression, and a constraint of the new table that names a converted column was broken by a\n\t* value the conversion produced. Any other failure of the copy is not the conversion's.\n\t*/\n\tasync failedConversion(driver, step, message, plan) {\n\t\tconst copy = conversionCopyOf(step);\n\t\tif (copy === void 0) return void 0;\n\t\tconst columns = Object.keys(copy.expressions);\n\t\tconst failed = async (column) => {\n\t\t\ttry {\n\t\t\t\tawait driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);\n\t\t\t\treturn false;\n\t\t\t} catch {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\t\tfor (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, \"expressionError\");\n\t\tconst [, constrainedList] = message.split(\"constraint failed: \");\n\t\tif (constrainedList === void 0) return void 0;\n\t\tconst constrained = new Set(constrainedList.split(\", \"));\n\t\tconst column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));\n\t\treturn column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, \"invalidResult\");\n\t}\n\tconversionOf(plan, table, column, reason) {\n\t\tconst field = fieldOfColumn(plan.contract, table, column);\n\t\treturn field === void 0 ? void 0 : {\n\t\t\tfield,\n\t\t\tby: \"conversion\",\n\t\t\treason,\n\t\t\toperationIndex: plan.operationIndex\n\t\t};\n\t}\n\t/**\n\t* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the\n\t* new table: the columns the rebuild's postchecks mark as becoming required are counted, the\n\t* rebuild's own first, then those of every other operation of its migration.\n\t*/\n\trowsWithoutValue(driver, message, plan) {\n\t\tif (!message.includes(\"NOT NULL constraint failed\")) return Promise.resolve(void 0);\n\t\tconst marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);\n\t\treturn rowsWithoutValueFailure({\n\t\t\tfailed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),\n\t\t\tothers: marks,\n\t\t\tcount: async ({ required }) => {\n\t\t\t\tconst where = required.reason !== \"newField\" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : \"\";\n\t\t\t\treturn (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;\n\t\t\t},\n\t\t\tcontract: plan.contract\n\t\t});\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\n//#region src/core/type-constructors.ts\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel. Each names a codec; the column's database type is its data type's.\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*\n* These are the constructors only PSL offers. They are defined here, next to the codecs they name, but the adapter contributes them: the TypeScript contract builder builds its `type.*` helpers from the target, so a target contribution would add `type.String()` and the like there. The constructors that should also be `type.*` helpers are the target's own (`sqliteAuthoringTypes`).\n*/\nconst sqlitePslTypeConstructors = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Variable-length text stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript number.\",\n\t\toutput: { codecId: SQLITE_INTEGER_CODEC_ID }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript bigint.\",\n\t\toutput: { codecId: SQLITE_BIGINT_CODEC_ID }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A floating-point number stored as SQLite real.\",\n\t\toutput: { codecId: SQLITE_REAL_CODEC_ID }\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A decimal value stored and represented as text to preserve precision.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_DATETIME_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value serialized to SQLite text.\",\n\t\toutput: { codecId: SQLITE_JSON_CODEC_ID }\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Binary data stored as a SQLite blob.\",\n\t\toutput: { codecId: SQLITE_BLOB_CODEC_ID }\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqlitePslTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM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A4B,2GAA2G;GACvL,OAAO,uBAAuB,UAAU,iBAAiB,mBAAmB,CAAC;EAC9E;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD;;;;;;;;;;AAYA,MAAM,4BAA4B;CACjC,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,KAAK;EACJ,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,wBAAwB;CAC5C;CACA,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,uBAAuB;CAC3C;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,SAAS;EACR,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,UAAU;EACT,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,yBAAyB;CAC7C;CACA,MAAM;EACL,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;AACD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as sqliteDriverDescriptorMeta, r as sqliteParams, t as normalizeSqliteError } from "./descriptor-meta-cwy5CXTT-DSRaq_b-.mjs";
|
|
2
2
|
import { errorRuntime } from "@prisma/orm-framework/errors/execution";
|
|
3
3
|
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
4
5
|
import { basename } from "pathe";
|
|
5
6
|
//#region ../../../3-targets/7-drivers/sqlite/dist/control.mjs
|
|
6
7
|
var SqliteControlDriver = class {
|
|
@@ -28,11 +29,18 @@ var SqliteControlDriver = class {
|
|
|
28
29
|
this.db.close();
|
|
29
30
|
}
|
|
30
31
|
};
|
|
32
|
+
/** The file as a URI that SQLite opens for reading and writing, failing rather than creating it. */
|
|
33
|
+
function existingFileOnly(pathOrMemory) {
|
|
34
|
+
if (pathOrMemory === ":memory:") return pathOrMemory;
|
|
35
|
+
const uri = pathToFileURL(pathOrMemory);
|
|
36
|
+
uri.searchParams.set("mode", "rw");
|
|
37
|
+
return uri;
|
|
38
|
+
}
|
|
31
39
|
const sqliteDriverDescriptor = {
|
|
32
40
|
...sqliteDriverDescriptorMeta,
|
|
33
|
-
async create(pathOrMemory) {
|
|
41
|
+
async create(pathOrMemory, options) {
|
|
34
42
|
try {
|
|
35
|
-
const db = new DatabaseSync(pathOrMemory);
|
|
43
|
+
const db = new DatabaseSync(options?.existingDatabaseOnly === true ? existingFileOnly(pathOrMemory) : pathOrMemory);
|
|
36
44
|
db.exec("PRAGMA foreign_keys = ON");
|
|
37
45
|
db.exec("PRAGMA busy_timeout = 5000");
|
|
38
46
|
return new SqliteControlDriver(db, pathOrMemory);
|
|
@@ -49,4 +57,4 @@ const sqliteDriverDescriptor = {
|
|
|
49
57
|
//#endregion
|
|
50
58
|
export { sqliteDriverDescriptor as n, SqliteControlDriver as t };
|
|
51
59
|
|
|
52
|
-
//# sourceMappingURL=control-
|
|
60
|
+
//# sourceMappingURL=control-DKT_rL3s.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-DKT_rL3s.mjs","names":[],"sources":["../../../../3-targets/7-drivers/sqlite/dist/control.mjs"],"sourcesContent":["import { n as sqliteParams, r as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-cwy5CXTT.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { pathToFileURL } from \"node:url\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { basename } from \"pathe\";\n//#region src/core/control-driver.ts\nvar SqliteControlDriver = class {\n\tdb;\n\tlocation;\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\tconstructor(db, location) {\n\t\tthis.db = db;\n\t\tthis.location = location;\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(sql).all(...sqliteParams(params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync databaseName() {\n\t\tif (this.location === \":memory:\" || this.location.length === 0) return;\n\t\tconst name = basename(this.location);\n\t\treturn name.length > 0 ? name : void 0;\n\t}\n\tasync close() {\n\t\tthis.db.close();\n\t}\n};\n/** The file as a URI that SQLite opens for reading and writing, failing rather than creating it. */\nfunction existingFileOnly(pathOrMemory) {\n\tif (pathOrMemory === \":memory:\") return pathOrMemory;\n\tconst uri = pathToFileURL(pathOrMemory);\n\turi.searchParams.set(\"mode\", \"rw\");\n\treturn uri;\n}\nconst sqliteDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tasync create(pathOrMemory, options) {\n\t\ttry {\n\t\t\tconst db = new DatabaseSync(options?.existingDatabaseOnly === true ? existingFileOnly(pathOrMemory) : pathOrMemory);\n\t\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\t\treturn new SqliteControlDriver(db, pathOrMemory);\n\t\t} catch (error) {\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\t\tfix: \"Verify the database file path exists and is accessible\",\n\t\t\t\tmeta: { path: pathOrMemory },\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { SqliteControlDriver, sqliteDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;AAMA,IAAI,sBAAsB,MAAM;CAC/B;CACA;CACA,WAAW;CACX,WAAW;CACX,YAAY,IAAI,UAAU;EACzB,KAAK,KAAK;EACV,KAAK,WAAW;CACjB;CACA,MAAM,MAAM,KAAK,QAAQ;EACxB,IAAI;GACH,OAAO,EAAE,MAAM,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC,IAAI,GAAG,aAAa,MAAM,CAAC,EAAE;EAClE,SAAS,OAAO;GACf,MAAM,qBAAqB,KAAK;EACjC;CACD;CACA,MAAM,eAAe;EACpB,IAAI,KAAK,aAAa,cAAc,KAAK,SAAS,WAAW,GAAG;EAChE,MAAM,OAAO,SAAS,KAAK,QAAQ;EACnC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK;CACtC;CACA,MAAM,QAAQ;EACb,KAAK,GAAG,MAAM;CACf;AACD;;AAEA,SAAS,iBAAiB,cAAc;CACvC,IAAI,iBAAiB,YAAY,OAAO;CACxC,MAAM,MAAM,cAAc,YAAY;CACtC,IAAI,aAAa,IAAI,QAAQ,IAAI;CACjC,OAAO;AACR;AACA,MAAM,yBAAyB;CAC9B,GAAG;CACH,MAAM,OAAO,cAAc,SAAS;EACnC,IAAI;GACH,MAAM,KAAK,IAAI,aAAa,SAAS,yBAAyB,OAAO,iBAAiB,YAAY,IAAI,YAAY;GAClH,GAAG,KAAK,0BAA0B;GAClC,GAAG,KAAK,4BAA4B;GACpC,OAAO,IAAI,oBAAoB,IAAI,YAAY;EAChD,SAAS,OAAO;GACf,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;IAC1D,KAAK;IACL,MAAM,EAAE,MAAM,aAAa;IAC3B,OAAO;GACR,CAAC;EACF;CACD;AACD"}
|
package/dist/driver.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SqliteControlDriver } from "./control-
|
|
1
|
+
import { t as SqliteControlDriver } from "./control-DKT_rL3s.mjs";
|
|
2
2
|
export { SqliteControlDriver };
|
package/dist/driver__control.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-
|
|
1
|
+
import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-DKT_rL3s.mjs";
|
|
2
2
|
export { SqliteControlDriver, sqliteDriverDescriptor as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as buildTargetDetails } from "./planner-target-details-CIQ789Gc-C5U4yVY9.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { w as step } from "./op-factory-call-hxIbAMSY-CinxsQHg.mjs";
|
|
3
3
|
import { col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
4
4
|
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
5
5
|
import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
|
|
@@ -45,4 +45,4 @@ function rawSql(op) {
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { foreignKey as a, primaryKey as c, unique as d, fn$1 as i, rawSql as l, col$1 as n, lit$1 as o, dataTransform as r, placeholder as s, MigrationCLI as t, sql as u };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=migration-
|
|
48
|
+
//# sourceMappingURL=migration-DOkUBr8w.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-DOkUBr8w.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.mjs"],"sourcesContent":["import { x as step } from \"./op-factory-call-hxIbAMSY.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-CTNkjYJ1.mjs\";\nimport { t as buildTargetDetails } from \"./planner-target-details-CIQ789Gc.mjs\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\nimport { sql } from \"@internal/sql-contract/sql-expression\";\n//#region src/core/migrations/operations/data-transform.ts\n/**\n* User-facing `dataTransform` factory for the SQLite migration authoring\n* surface. Invoked directly inside a `migration.ts` file to supply a\n* user-authored SQL statement that runs with operation class `'data'`.\n*\n* Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL\n* tightening requires a backfill. The rendered `migration.ts` exposes the\n* backfill as a `placeholder(\"…\")` slot the user fills in with an\n* `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`\n* invocation returns a runnable operation the runner executes before the\n* subsequent recreate-table op copies data into the tightened schema.\n*/\nfunction dataTransform(opts) {\n\treturn {\n\t\tid: opts.id,\n\t\tlabel: opts.label,\n\t\tsummary: opts.description,\n\t\toperationClass: \"data\",\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"table\", opts.table)\n\t\t},\n\t\tprecheck: [],\n\t\texecute: [step(opts.description, opts.run())],\n\t\tpostcheck: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized\n* `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres\n* `rawSql` factory: the planner uses this to carry ops produced by SQL-family\n* paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured\n* call IR without reverse-engineering their shape.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, sql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAS,cAAc,MAAM;CAC5B,OAAO;EACN,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GACP,IAAI;GACJ,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAChD;EACA,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACb;AACD;;;;;;;;AAUA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Op } from "./tables-
|
|
2
|
-
import "./sqlite-migration-
|
|
1
|
+
import { t as Op } from "./tables-DD_EmImp-B8ZaVBMr.mjs";
|
|
2
|
+
import "./sqlite-migration-BqbQmUY1-CTmurARU.mjs";
|
|
3
3
|
import { col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
4
4
|
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
5
5
|
import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
|
|
@@ -41,4 +41,4 @@ declare function dataTransform(opts: DataTransformOptions): Op;
|
|
|
41
41
|
declare function rawSql(op: Op): Op;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { fn$1 as a, placeholder as c, sql as d, unique as f, dataTransform as i, primaryKey as l, MigrationCLI as n, foreignKey as o, col$1 as r, lit$1 as s, DataTransformOptions as t, rawSql as u };
|
|
44
|
-
//# sourceMappingURL=migration-
|
|
44
|
+
//# sourceMappingURL=migration-wH0Hw2VD.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-wH0Hw2VD.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.d.mts"],"mappings":";;;;;;;;UAOU;;WAEC;;WAEA;;WAEA;;;;;WAKA;;;;;;;;;WASA;;iBAEM,cAAc,MAAM,uBAAuB;;;;;;;;;;iBAU3C,OAAO,IAAI,KAAK"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
-
import { a as SqliteTableSpec, i as SqliteIndexSpec, n as RecreatePostcheck, r as SqliteColumnSpec } from "./tables-
|
|
2
|
+
import { a as SqliteTableSpec, i as SqliteIndexSpec, n as RecreatePostcheck, r as SqliteColumnSpec } from "./tables-DD_EmImp-B8ZaVBMr.mjs";
|
|
3
3
|
import { DdlColumn, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
4
|
import { OpFactoryCall } from "@prisma/orm-framework/components/control";
|
|
5
|
-
import { MigrationOperationClass, SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
5
|
+
import { MigrationOperationClass, SqlMigrationPlanOperation, SqlSlot } from "@prisma/orm-family-sql/family/control";
|
|
6
6
|
import { ImportRequirement, TsExpression } from "@prisma/orm-framework/ts-render";
|
|
7
7
|
import { ExecuteRequestLowerer, Lowerer } from "@prisma/orm-family-sql/family/control-adapter";
|
|
8
8
|
//#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call.d.mts
|
|
@@ -102,11 +102,12 @@ declare class RecreateTableCall extends SqliteOpFactoryCallNode {
|
|
|
102
102
|
readonly summary: string;
|
|
103
103
|
readonly postchecks: readonly RecreatePostcheck[];
|
|
104
104
|
readonly label: string;
|
|
105
|
-
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
/** The conversion each named column of the new table is copied through, in place of the live column. */
|
|
106
|
+
readonly copyExpressions: Readonly<Record<string, SqlSlot>>;
|
|
107
|
+
/** The value each named new column takes in the existing rows. */
|
|
108
|
+
readonly temporaryValues: Readonly<Record<string, SqlSlot>>;
|
|
109
|
+
/** The columns whose type changes; the rebuild checks each after its copy, as a conversion when it has a copy expression and as SQLite's cast otherwise. */
|
|
110
|
+
readonly retypedColumns: readonly string[];
|
|
110
111
|
constructor(args: {
|
|
111
112
|
tableName: string;
|
|
112
113
|
contractTable: SqliteTableSpec;
|
|
@@ -115,7 +116,10 @@ declare class RecreateTableCall extends SqliteOpFactoryCallNode {
|
|
|
115
116
|
summary: string;
|
|
116
117
|
postchecks: readonly RecreatePostcheck[];
|
|
117
118
|
operationClass: MigrationOperationClass;
|
|
118
|
-
|
|
119
|
+
copyExpressions?: Readonly<Record<string, SqlSlot>>;
|
|
120
|
+
temporaryValues?: Readonly<Record<string, SqlSlot>>;
|
|
121
|
+
retypedColumns?: readonly string[];
|
|
122
|
+
});
|
|
119
123
|
toOp(lowerer?: ExecuteRequestLowerer): Promise<Op>;
|
|
120
124
|
renderTypeScript(): string;
|
|
121
125
|
importRequirements(): readonly ImportRequirement[];
|
|
@@ -190,7 +194,9 @@ declare class DataTransformCall extends SqliteOpFactoryCallNode {
|
|
|
190
194
|
readonly label: string;
|
|
191
195
|
readonly tableName: string;
|
|
192
196
|
readonly columnName: string;
|
|
193
|
-
|
|
197
|
+
/** The slot the user fills with the statement that fills the column: `<Model.field>:run`. */
|
|
198
|
+
readonly slot: string;
|
|
199
|
+
constructor(id: string, label: string, tableName: string, columnName: string, slot: string);
|
|
194
200
|
toOp(_lowerer?: Lowerer): Promise<Op>;
|
|
195
201
|
renderTypeScript(): string;
|
|
196
202
|
importRequirements(): readonly ImportRequirement[];
|
|
@@ -216,4 +222,4 @@ declare class RawSqlCall extends SqliteOpFactoryCallNode {
|
|
|
216
222
|
type SqliteOpFactoryCall = CreateTableCall | DropTableCall | RecreateTableCall | RenameTableCall | RenameColumnCall | AddColumnCall | DropColumnCall | CreateIndexCall | DropIndexCall | DataTransformCall | RawSqlCall;
|
|
217
223
|
//#endregion
|
|
218
224
|
export { DropColumnCall as a, RawSqlCall as c, RenameTableCall as d, SqliteOpFactoryCall as f, DataTransformCall as i, RecreateTableCall as l, CreateIndexCall as n, DropIndexCall as o, CreateTableCall as r, DropTableCall as s, AddColumnCall as t, RenameColumnCall as u };
|
|
219
|
-
//# sourceMappingURL=op-factory-call-
|
|
225
|
+
//# sourceMappingURL=op-factory-call-DAI1NqNz.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"op-factory-call-DAI1NqNz.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/op-factory-call.d.mts"],"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