@prisma/orm-target-sqlite 8.0.0-rc.19 → 8.0.0-rc.19-dev.2
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-DtwSwFvA.d.mts → adapter-rNrGhNM6.d.mts} +6 -6
- package/dist/{adapter-DtwSwFvA.d.mts.map → adapter-rNrGhNM6.d.mts.map} +1 -1
- package/dist/adapter.d.mts +1 -1
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__control.mjs +1 -5
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/{aggregates-DD6XxtyA.d.mts → aggregates-C91ltL9M.d.mts} +6 -6
- package/dist/{aggregates-DD6XxtyA.d.mts.map → aggregates-C91ltL9M.d.mts.map} +1 -1
- package/dist/{control-BY0lE0MI.d.mts → control-CqSlwRpm.d.mts} +4 -4
- package/dist/{control-BY0lE0MI.d.mts.map → control-CqSlwRpm.d.mts.map} +1 -1
- package/dist/descriptor-meta-BWlR2rDN-Y8Y4_jie.mjs +109 -0
- package/dist/descriptor-meta-BWlR2rDN-Y8Y4_jie.mjs.map +1 -0
- package/dist/{migration-DLJQnUxF.d.mts → migration-p83G5mtQ.d.mts} +3 -3
- package/dist/{migration-DLJQnUxF.d.mts.map → migration-p83G5mtQ.d.mts.map} +1 -1
- package/dist/{op-factory-call-DAI1NqNz.d.mts → op-factory-call-CnufFdpE.d.mts} +2 -2
- package/dist/{op-factory-call-DAI1NqNz.d.mts.map → op-factory-call-CnufFdpE.d.mts.map} +1 -1
- package/dist/{pack-DVMuQib7.d.mts → pack-D09sgwDC.d.mts} +92 -4
- package/dist/{pack-DVMuQib7.d.mts.map → pack-D09sgwDC.d.mts.map} +1 -1
- package/dist/{planner-D65FzuZZ.d.mts → planner-ChwhExQU.d.mts} +2 -2
- package/dist/{planner-D65FzuZZ.d.mts.map → planner-ChwhExQU.d.mts.map} +1 -1
- package/dist/planner-produced-sqlite-migration-D0aHh8Z9.d.mts +1 -0
- package/dist/{planner-produced-sqlite-migration-CkHb8T4n-DD8b29qz.d.mts → planner-produced-sqlite-migration-DuM9c3YI-COeeqS8N.d.mts} +3 -3
- package/dist/planner-produced-sqlite-migration-DuM9c3YI-COeeqS8N.d.mts.map +1 -0
- package/dist/{sqlite-migration-BqbQmUY1-CdxaTXni.d.mts → sqlite-migration-CLIMaHLy-BQ6vv7gq.d.mts} +3 -3
- package/dist/{sqlite-migration-BqbQmUY1-CdxaTXni.d.mts.map → sqlite-migration-CLIMaHLy-BQ6vv7gq.d.mts.map} +1 -1
- package/dist/{tables-DD_EmImp-B8ZaVBMr.d.mts → tables-C6oejIsc-BgxW5wBn.d.mts} +3 -3
- package/dist/{tables-DD_EmImp-B8ZaVBMr.d.mts.map → tables-C6oejIsc-BgxW5wBn.d.mts.map} +1 -1
- package/dist/target.d.mts +10 -10
- package/dist/target.mjs +2 -2
- package/dist/target__aggregates.d.mts +1 -1
- package/dist/target__control.d.mts +2 -2
- package/dist/target__control.mjs +522 -3
- package/dist/target__control.mjs.map +1 -0
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__op-factory-call.d.mts +1 -1
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
- package/dist/target__planner.d.mts +1 -1
- package/package.json +9 -9
- package/dist/control-Oq9sp9Tq.mjs +0 -574
- package/dist/control-Oq9sp9Tq.mjs.map +0 -1
- package/dist/descriptor-meta-B9drv0U6-DoV55ut2.mjs +0 -54
- package/dist/descriptor-meta-B9drv0U6-DoV55ut2.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-AnV25lXu.d.mts +0 -1
- package/dist/planner-produced-sqlite-migration-CkHb8T4n-DD8b29qz.d.mts.map +0 -1
package/dist/target__control.mjs
CHANGED
|
@@ -1,3 +1,522 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
3
|
-
|
|
1
|
+
import { n as sqliteError } from "./errors-DnR-sMHS-KkMLIP2U.mjs";
|
|
2
|
+
import { n as sqliteTargetDescriptorMeta, t as sqliteScalarTypeConstructors } from "./descriptor-meta-BWlR2rDN-Y8Y4_jie.mjs";
|
|
3
|
+
import { r as quoteIdentifier } from "./sql-utils-XGT5Esi2-5k9pvJeF.mjs";
|
|
4
|
+
import { g as conversionCopyOf, p as affinityStorageClasses, y as rebuiltTableName } from "./op-factory-call-Dzsgcf3B-B7IaqEjE.mjs";
|
|
5
|
+
import { i as sqliteCreateNamespace, r as SqliteUnboundDatabase, t as SqliteContractSerializer } from "./sqlite-contract-view-CJ895eER-n57Mabt2.mjs";
|
|
6
|
+
import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-B7LD9iDG-BTpw_zNF.mjs";
|
|
7
|
+
import { n as createSqliteMigrationPlanner } from "./planner-DD8nGrZ_-BcGCsYVP.mjs";
|
|
8
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
9
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
10
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
11
|
+
import { APP_SPACE_ID, failedPrecheckWhy, schemaCheckWhy, withFailingSpace } from "@prisma/orm-framework/components/control";
|
|
12
|
+
import { convertedColumnOf, fieldOfColumn, requiredColumnsOfMigration, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
|
|
13
|
+
import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
|
|
14
|
+
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
15
|
+
import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
|
|
16
|
+
import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
|
|
17
|
+
import { SqlQueryError } from "@prisma/orm-family-sql/errors";
|
|
18
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/control.mjs
|
|
19
|
+
const NOT_NULL_VIOLATION_SQLSTATE = "23502";
|
|
20
|
+
function createSqliteMigrationRunner(family) {
|
|
21
|
+
return new SqliteMigrationRunner(family);
|
|
22
|
+
}
|
|
23
|
+
var SqliteMigrationRunner = class {
|
|
24
|
+
family;
|
|
25
|
+
constructor(family) {
|
|
26
|
+
this.family = family;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Apply the plan against an already-open connection without managing
|
|
30
|
+
* the transaction lifecycle. The caller ({@link SqliteMigrationRunner.execute})
|
|
31
|
+
* owns BEGIN/COMMIT/ROLLBACK and any connection-level setup (FK pragma
|
|
32
|
+
* toggle, FK integrity check).
|
|
33
|
+
*/
|
|
34
|
+
async executeOnConnection(options) {
|
|
35
|
+
const driver = options.driver;
|
|
36
|
+
if (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: {
|
|
37
|
+
space: options.space,
|
|
38
|
+
planSpaceId: options.plan.spaceId
|
|
39
|
+
} });
|
|
40
|
+
const space = options.plan.spaceId;
|
|
41
|
+
const planOps = blindCast(await Promise.all(options.plan.operations));
|
|
42
|
+
const destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);
|
|
43
|
+
if (!destinationCheck.ok) return destinationCheck;
|
|
44
|
+
const policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);
|
|
45
|
+
if (!policyCheck.ok) return policyCheck;
|
|
46
|
+
const ensureResult = await this.ensureControlTables(driver, options.destinationContract);
|
|
47
|
+
if (!ensureResult.ok) return ensureResult;
|
|
48
|
+
const existingMarker = await this.family.readMarker({
|
|
49
|
+
driver,
|
|
50
|
+
space
|
|
51
|
+
});
|
|
52
|
+
const markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);
|
|
53
|
+
if (!markerCheck.ok) return markerCheck;
|
|
54
|
+
const markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);
|
|
55
|
+
const isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;
|
|
56
|
+
const skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;
|
|
57
|
+
let operationsExecuted;
|
|
58
|
+
let executedOperations;
|
|
59
|
+
if (skipOperations) {
|
|
60
|
+
operationsExecuted = 0;
|
|
61
|
+
executedOperations = [];
|
|
62
|
+
} else {
|
|
63
|
+
const applyResult = await this.applyPlan(driver, options, planOps);
|
|
64
|
+
if (!applyResult.ok) return applyResult;
|
|
65
|
+
operationsExecuted = applyResult.value.operationsExecuted;
|
|
66
|
+
executedOperations = applyResult.value.executedOperations;
|
|
67
|
+
}
|
|
68
|
+
if (space === APP_SPACE_ID) {
|
|
69
|
+
const schemaNode = await this.family.introspect({
|
|
70
|
+
driver,
|
|
71
|
+
contract: options.destinationContract
|
|
72
|
+
});
|
|
73
|
+
const schemaVerifyResult = verifySqliteDatabaseSchema({
|
|
74
|
+
contract: options.destinationContract,
|
|
75
|
+
actualSchema: schemaNode,
|
|
76
|
+
strict: options.strictVerification ?? true,
|
|
77
|
+
frameworkComponents: options.frameworkComponents
|
|
78
|
+
});
|
|
79
|
+
if (!schemaVerifyResult.ok) return runnerFailure("MIGRATION.SCHEMA_VERIFY_FAILED", schemaVerifyResult.summary, {
|
|
80
|
+
why: schemaCheckWhy(schemaVerifyResult.schema.issues),
|
|
81
|
+
meta: { schemaIssues: schemaVerifyResult.schema.issues }
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const incomingInvariants = options.plan.providedInvariants;
|
|
85
|
+
const existingInvariants = new Set(existingMarker?.invariants ?? []);
|
|
86
|
+
const incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));
|
|
87
|
+
if (!(isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting)) {
|
|
88
|
+
const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
|
|
89
|
+
if (!markerResult.ok) return markerResult;
|
|
90
|
+
await this.recordLedgerEntries(driver, options, executedOperations);
|
|
91
|
+
}
|
|
92
|
+
return runnerSuccess({
|
|
93
|
+
operationsPlanned: planOps.length,
|
|
94
|
+
operationsExecuted
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async execute(options) {
|
|
98
|
+
const driver = options.driver;
|
|
99
|
+
const perSpaceOptions = options.perSpaceOptions;
|
|
100
|
+
if (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });
|
|
101
|
+
const fkWasEnabled = await this.readForeignKeysEnabled(driver);
|
|
102
|
+
if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = OFF");
|
|
103
|
+
try {
|
|
104
|
+
await this.beginExclusiveTransaction(driver);
|
|
105
|
+
let committed = false;
|
|
106
|
+
try {
|
|
107
|
+
const perSpaceResults = [];
|
|
108
|
+
let lastProcessedSpace;
|
|
109
|
+
for (const spaceOptions of perSpaceOptions) {
|
|
110
|
+
const space = spaceOptions.space ?? spaceOptions.plan.spaceId;
|
|
111
|
+
const result = await this.executeOnConnection({
|
|
112
|
+
...spaceOptions,
|
|
113
|
+
driver,
|
|
114
|
+
space
|
|
115
|
+
});
|
|
116
|
+
if (!result.ok) return notOk(withFailingSpace(result.failure, space));
|
|
117
|
+
perSpaceResults.push({
|
|
118
|
+
space,
|
|
119
|
+
value: result.value
|
|
120
|
+
});
|
|
121
|
+
lastProcessedSpace = space;
|
|
122
|
+
}
|
|
123
|
+
if (fkWasEnabled) {
|
|
124
|
+
const fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);
|
|
125
|
+
if (!fkIntegrityCheck.ok) return notOk(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));
|
|
126
|
+
}
|
|
127
|
+
await this.commitTransaction(driver);
|
|
128
|
+
committed = true;
|
|
129
|
+
return ok({ perSpaceResults });
|
|
130
|
+
} finally {
|
|
131
|
+
if (!committed) await this.rollbackTransaction(driver);
|
|
132
|
+
}
|
|
133
|
+
} finally {
|
|
134
|
+
if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = ON");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async readForeignKeysEnabled(driver) {
|
|
138
|
+
return (await driver.query("PRAGMA foreign_keys")).rows[0]?.foreign_keys === 1;
|
|
139
|
+
}
|
|
140
|
+
async verifyForeignKeyIntegrity(driver) {
|
|
141
|
+
const result = await driver.query("PRAGMA foreign_key_check");
|
|
142
|
+
if (result.rows.length === 0) return okVoid();
|
|
143
|
+
return runnerFailure("MIGRATION.FOREIGN_KEY_VIOLATION", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {
|
|
144
|
+
why: "PRAGMA foreign_key_check reported violations after applying recreate-table operations.",
|
|
145
|
+
meta: { violations: result.rows }
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async applyPlan(driver, options, ops) {
|
|
149
|
+
const checks = options.executionChecks;
|
|
150
|
+
const runPrechecks = checks?.prechecks !== false;
|
|
151
|
+
const runPostchecks = checks?.postchecks !== false;
|
|
152
|
+
const runIdempotency = checks?.idempotencyChecks !== false;
|
|
153
|
+
let operationsExecuted = 0;
|
|
154
|
+
const executedOperations = [];
|
|
155
|
+
for (const operation of ops) {
|
|
156
|
+
options.callbacks?.onOperationStart?.(operation);
|
|
157
|
+
try {
|
|
158
|
+
if (runPostchecks && runIdempotency) {
|
|
159
|
+
if (await this.expectationsAreSatisfied(driver, operation.postcheck)) {
|
|
160
|
+
executedOperations.push(this.createSkipRecord(operation));
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (runPrechecks) {
|
|
165
|
+
const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck");
|
|
166
|
+
if (!precheckResult.ok) return precheckResult;
|
|
167
|
+
}
|
|
168
|
+
const executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {
|
|
169
|
+
contract: options.destinationContract,
|
|
170
|
+
operationIndex: ops.indexOf(operation),
|
|
171
|
+
operations: ops,
|
|
172
|
+
edges: options.migrationEdges
|
|
173
|
+
});
|
|
174
|
+
if (!executeResult.ok) return executeResult;
|
|
175
|
+
if (runPostchecks) {
|
|
176
|
+
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck", {
|
|
177
|
+
contract: options.destinationContract,
|
|
178
|
+
operationIndex: ops.indexOf(operation)
|
|
179
|
+
});
|
|
180
|
+
if (!postcheckResult.ok) return postcheckResult;
|
|
181
|
+
}
|
|
182
|
+
executedOperations.push(operation);
|
|
183
|
+
operationsExecuted += 1;
|
|
184
|
+
} finally {
|
|
185
|
+
options.callbacks?.onOperationComplete?.(operation);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return ok({
|
|
189
|
+
operationsExecuted,
|
|
190
|
+
executedOperations
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async ensureControlTables(driver, contract) {
|
|
194
|
+
const lowererContext = { contract };
|
|
195
|
+
for (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));
|
|
196
|
+
return okVoid();
|
|
197
|
+
}
|
|
198
|
+
async runExpectationSteps(driver, steps, operation, phase, plan) {
|
|
199
|
+
for (const step of steps) {
|
|
200
|
+
const result = await driver.query(step.sql, step.params ?? []);
|
|
201
|
+
if (!this.stepResultIsTrue(result.rows)) {
|
|
202
|
+
const code = phase === "precheck" ? "MIGRATION.PRECHECK_FAILED" : "MIGRATION.POSTCHECK_FAILED";
|
|
203
|
+
const field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);
|
|
204
|
+
const converted = convertedColumnOf(step);
|
|
205
|
+
const failedCheck = {
|
|
206
|
+
operationId: operation.id,
|
|
207
|
+
phase,
|
|
208
|
+
description: step.description
|
|
209
|
+
};
|
|
210
|
+
const unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);
|
|
211
|
+
return runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {
|
|
212
|
+
...ifDefined("why", unconverted ?? (phase === "precheck" ? failedPrecheckWhy(failedCheck) : void 0)),
|
|
213
|
+
meta: {
|
|
214
|
+
failedCheck,
|
|
215
|
+
...ifDefined("failedTypeChange", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === "conversion" ? {
|
|
216
|
+
field,
|
|
217
|
+
by: "conversion",
|
|
218
|
+
reason: "invalidResult",
|
|
219
|
+
operationIndex: plan.operationIndex
|
|
220
|
+
} : {
|
|
221
|
+
field,
|
|
222
|
+
by: "cast",
|
|
223
|
+
reason: "value",
|
|
224
|
+
operationIndex: plan.operationIndex
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return okVoid();
|
|
231
|
+
}
|
|
232
|
+
/** Names the first value of a retyped column that kept a storage class its new type does not hold. */
|
|
233
|
+
async unconvertedValueText(driver, cast) {
|
|
234
|
+
const typeSql = (await driver.query("SELECT type FROM pragma_table_info(?) WHERE name = ?", [cast.table, cast.column])).rows[0]?.type;
|
|
235
|
+
if (typeSql === void 0) return void 0;
|
|
236
|
+
const column = quoteIdentifier(cast.column);
|
|
237
|
+
const classes = ["null", ...affinityStorageClasses(typeSql)];
|
|
238
|
+
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];
|
|
239
|
+
if (row === void 0) return void 0;
|
|
240
|
+
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.`;
|
|
241
|
+
}
|
|
242
|
+
async runExecuteSteps(driver, steps, operation, plan) {
|
|
243
|
+
for (const step of steps) try {
|
|
244
|
+
await driver.query(step.sql, step.params ?? []);
|
|
245
|
+
} catch (error) {
|
|
246
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
247
|
+
const failed = `Operation ${operation.id} failed during execution: ${step.description}`;
|
|
248
|
+
const rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);
|
|
249
|
+
const failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;
|
|
250
|
+
return runnerFailure("MIGRATION.EXECUTION_FAILED", rowsWithoutValue?.summary ?? failed, {
|
|
251
|
+
why: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,
|
|
252
|
+
meta: {
|
|
253
|
+
operationId: operation.id,
|
|
254
|
+
stepDescription: step.description,
|
|
255
|
+
sql: step.sql,
|
|
256
|
+
...ifDefined("rowsWithoutValue", rowsWithoutValue?.reports),
|
|
257
|
+
...ifDefined("failedTypeChange", failedConversion)
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
return okVoid();
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The conversion that failed, when the failed step is the copy of a rebuild that converts columns
|
|
265
|
+
* and there is evidence for it: a copy expression that fails on its own has an error in its
|
|
266
|
+
* expression, and a constraint of the new table that names a converted column was broken by a
|
|
267
|
+
* value the conversion produced. Any other failure of the copy is not the conversion's.
|
|
268
|
+
*/
|
|
269
|
+
async failedConversion(driver, step, error, plan) {
|
|
270
|
+
const copy = conversionCopyOf(step);
|
|
271
|
+
if (copy === void 0) return void 0;
|
|
272
|
+
const columns = Object.keys(copy.expressions);
|
|
273
|
+
const failed = async (column) => {
|
|
274
|
+
try {
|
|
275
|
+
await driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);
|
|
276
|
+
return false;
|
|
277
|
+
} catch {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
for (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, "expressionError");
|
|
282
|
+
const constrainedList = SqlQueryError.is(error) ? error.constraint : void 0;
|
|
283
|
+
if (constrainedList === void 0) return void 0;
|
|
284
|
+
const constrained = new Set(constrainedList.split(", "));
|
|
285
|
+
const column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));
|
|
286
|
+
return column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, "invalidResult");
|
|
287
|
+
}
|
|
288
|
+
conversionOf(plan, table, column, reason) {
|
|
289
|
+
const field = fieldOfColumn(plan.contract, table, column);
|
|
290
|
+
return field === void 0 ? void 0 : {
|
|
291
|
+
field,
|
|
292
|
+
by: "conversion",
|
|
293
|
+
reason,
|
|
294
|
+
operationIndex: plan.operationIndex
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the
|
|
299
|
+
* new table: the columns the rebuild's postchecks mark as becoming required are counted, the
|
|
300
|
+
* rebuild's own first, then those of every other operation of its migration.
|
|
301
|
+
*/
|
|
302
|
+
rowsWithoutValue(driver, error, plan) {
|
|
303
|
+
if (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) return Promise.resolve(void 0);
|
|
304
|
+
const marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);
|
|
305
|
+
return rowsWithoutValueFailure({
|
|
306
|
+
failed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),
|
|
307
|
+
others: marks,
|
|
308
|
+
count: async ({ required }) => {
|
|
309
|
+
const where = required.reason !== "newField" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : "";
|
|
310
|
+
return (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;
|
|
311
|
+
},
|
|
312
|
+
contract: plan.contract
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
stepResultIsTrue(rows) {
|
|
316
|
+
if (!rows || rows.length === 0) return false;
|
|
317
|
+
const firstRow = rows[0];
|
|
318
|
+
const firstValue = firstRow ? Object.values(firstRow)[0] : void 0;
|
|
319
|
+
if (typeof firstValue === "number") return firstValue !== 0;
|
|
320
|
+
if (typeof firstValue === "boolean") return firstValue;
|
|
321
|
+
if (typeof firstValue === "string") {
|
|
322
|
+
const lower = firstValue.toLowerCase();
|
|
323
|
+
if (lower === "true" || lower === "1") return true;
|
|
324
|
+
if (lower === "false" || lower === "0") return false;
|
|
325
|
+
return firstValue.length > 0;
|
|
326
|
+
}
|
|
327
|
+
return Boolean(firstValue);
|
|
328
|
+
}
|
|
329
|
+
async expectationsAreSatisfied(driver, steps) {
|
|
330
|
+
if (steps.length === 0) return false;
|
|
331
|
+
for (const step of steps) {
|
|
332
|
+
const result = await driver.query(step.sql, step.params ?? []);
|
|
333
|
+
if (!this.stepResultIsTrue(result.rows)) return false;
|
|
334
|
+
}
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
createSkipRecord(operation) {
|
|
338
|
+
return Object.freeze({
|
|
339
|
+
id: operation.id,
|
|
340
|
+
label: operation.label,
|
|
341
|
+
...ifDefined("summary", operation.summary),
|
|
342
|
+
operationClass: operation.operationClass,
|
|
343
|
+
target: operation.target,
|
|
344
|
+
precheck: Object.freeze([]),
|
|
345
|
+
execute: Object.freeze([]),
|
|
346
|
+
postcheck: Object.freeze([...operation.postcheck]),
|
|
347
|
+
meta: Object.freeze({
|
|
348
|
+
...operation.meta ?? {},
|
|
349
|
+
runner: Object.freeze({
|
|
350
|
+
skipped: true,
|
|
351
|
+
reason: "postcheck_pre_satisfied"
|
|
352
|
+
})
|
|
353
|
+
})
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
markerMatchesDestination(marker, plan) {
|
|
357
|
+
if (!marker) return false;
|
|
358
|
+
if (marker.storageHash !== plan.destination.storageHash) return false;
|
|
359
|
+
if (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
enforcePolicyCompatibility(policy, operations) {
|
|
363
|
+
const allowedClasses = new Set(policy.allowedOperationClasses);
|
|
364
|
+
for (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.`, {
|
|
365
|
+
why: `Policy only allows: ${policy.allowedOperationClasses.join(", ")}.`,
|
|
366
|
+
meta: {
|
|
367
|
+
operationId: operation.id,
|
|
368
|
+
operationClass: operation.operationClass,
|
|
369
|
+
allowedClasses: policy.allowedOperationClasses
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
return okVoid();
|
|
373
|
+
}
|
|
374
|
+
ensureMarkerCompatibility(marker, plan) {
|
|
375
|
+
const origin = plan.origin ?? null;
|
|
376
|
+
if (!origin) return okVoid();
|
|
377
|
+
if (!marker) return runnerFailure("MIGRATION.MARKER_ORIGIN_MISMATCH", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });
|
|
378
|
+
if (marker.storageHash !== origin.storageHash) return runnerFailure("MIGRATION.MARKER_ORIGIN_MISMATCH", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {
|
|
379
|
+
markerStorageHash: marker.storageHash,
|
|
380
|
+
expectedOriginStorageHash: origin.storageHash
|
|
381
|
+
} });
|
|
382
|
+
if (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: {
|
|
383
|
+
markerProfileHash: marker.profileHash,
|
|
384
|
+
expectedOriginProfileHash: origin.profileHash
|
|
385
|
+
} });
|
|
386
|
+
return okVoid();
|
|
387
|
+
}
|
|
388
|
+
ensurePlanMatchesDestinationContract(destination, contract) {
|
|
389
|
+
if (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: {
|
|
390
|
+
planStorageHash: destination.storageHash,
|
|
391
|
+
contractStorageHash: contract.storage.storageHash
|
|
392
|
+
} });
|
|
393
|
+
if (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: {
|
|
394
|
+
planProfileHash: destination.profileHash,
|
|
395
|
+
contractProfileHash: contract.profileHash
|
|
396
|
+
} });
|
|
397
|
+
return okVoid();
|
|
398
|
+
}
|
|
399
|
+
async upsertMarker(driver, options, existingMarker, space) {
|
|
400
|
+
const destination = {
|
|
401
|
+
storageHash: options.plan.destination.storageHash,
|
|
402
|
+
profileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,
|
|
403
|
+
invariants: options.plan.providedInvariants ?? []
|
|
404
|
+
};
|
|
405
|
+
if (!existingMarker) {
|
|
406
|
+
await this.family.initMarker({
|
|
407
|
+
driver,
|
|
408
|
+
space,
|
|
409
|
+
destination
|
|
410
|
+
});
|
|
411
|
+
return okVoid();
|
|
412
|
+
}
|
|
413
|
+
if (!await this.family.updateMarker({
|
|
414
|
+
driver,
|
|
415
|
+
space,
|
|
416
|
+
expectedFrom: existingMarker.storageHash,
|
|
417
|
+
destination
|
|
418
|
+
})) {
|
|
419
|
+
const found = await this.family.readMarker({
|
|
420
|
+
driver,
|
|
421
|
+
space
|
|
422
|
+
});
|
|
423
|
+
return runnerFailure("MIGRATION.MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
|
|
424
|
+
space,
|
|
425
|
+
expectedStorageHash: existingMarker.storageHash,
|
|
426
|
+
foundStorageHash: found?.storageHash ?? null,
|
|
427
|
+
destinationStorageHash: options.plan.destination.storageHash
|
|
428
|
+
} });
|
|
429
|
+
}
|
|
430
|
+
return okVoid();
|
|
431
|
+
}
|
|
432
|
+
async recordLedgerEntries(driver, options, executedOperations) {
|
|
433
|
+
const plan = options.plan;
|
|
434
|
+
const space = plan.spaceId;
|
|
435
|
+
const edges = options.migrationEdges;
|
|
436
|
+
const totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);
|
|
437
|
+
if (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);
|
|
438
|
+
let offset = 0;
|
|
439
|
+
for (const edge of edges) {
|
|
440
|
+
const edgeOps = executedOperations.slice(offset, offset + edge.operationCount);
|
|
441
|
+
offset += edge.operationCount;
|
|
442
|
+
await this.family.writeLedgerEntry({
|
|
443
|
+
driver,
|
|
444
|
+
space,
|
|
445
|
+
entry: {
|
|
446
|
+
edgeId: `${edge.from}->${edge.to}`,
|
|
447
|
+
from: edge.from,
|
|
448
|
+
to: edge.to,
|
|
449
|
+
migrationName: edge.dirName,
|
|
450
|
+
migrationHash: edge.migrationHash,
|
|
451
|
+
operations: edgeOps
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
async beginExclusiveTransaction(driver) {
|
|
457
|
+
await driver.query("BEGIN EXCLUSIVE");
|
|
458
|
+
}
|
|
459
|
+
async commitTransaction(driver) {
|
|
460
|
+
await driver.query("COMMIT");
|
|
461
|
+
}
|
|
462
|
+
async rollbackTransaction(driver) {
|
|
463
|
+
await driver.query("ROLLBACK");
|
|
464
|
+
}
|
|
465
|
+
async executeStatement(driver, statement) {
|
|
466
|
+
await driver.query(statement.sql, statement.params);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres
|
|
471
|
+
* shape: hooks return the empty list pending the call-site migration
|
|
472
|
+
* that routes the existing verifier behaviour through the SPI.
|
|
473
|
+
*/
|
|
474
|
+
var SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {
|
|
475
|
+
verifyCommonSqlSchema(_options) {
|
|
476
|
+
return [];
|
|
477
|
+
}
|
|
478
|
+
verifyTargetExtensions(_options) {
|
|
479
|
+
return [];
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
function isSqlContract(contract) {
|
|
483
|
+
return contract === null || contract.storage instanceof SqlStorage;
|
|
484
|
+
}
|
|
485
|
+
const sqliteControlTargetDescriptor = {
|
|
486
|
+
...sqliteTargetDescriptorMeta,
|
|
487
|
+
contractSerializer: new SqliteContractSerializer(),
|
|
488
|
+
schemaVerifier: new SqliteSchemaVerifier(),
|
|
489
|
+
diffSchema(input) {
|
|
490
|
+
return diffSqliteSchema(input);
|
|
491
|
+
},
|
|
492
|
+
classifySubjectGranularity: relationalNodeGranularity,
|
|
493
|
+
classifyEntityKind: relationalNodeEntityKind,
|
|
494
|
+
migrations: {
|
|
495
|
+
createPlanner(adapter) {
|
|
496
|
+
return createSqliteMigrationPlanner(adapter);
|
|
497
|
+
},
|
|
498
|
+
createRunner(family) {
|
|
499
|
+
return createSqliteMigrationRunner(family);
|
|
500
|
+
},
|
|
501
|
+
contractToSchema(contract, frameworkComponents) {
|
|
502
|
+
if (!isSqlContract(contract)) throw sqliteError("CONTRACT.TARGET_MISMATCH", "sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>");
|
|
503
|
+
return sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
create() {
|
|
507
|
+
return {
|
|
508
|
+
familyId: "sql",
|
|
509
|
+
targetId: "sqlite"
|
|
510
|
+
};
|
|
511
|
+
},
|
|
512
|
+
createPlanner(adapter) {
|
|
513
|
+
return createSqliteMigrationPlanner(adapter);
|
|
514
|
+
},
|
|
515
|
+
createRunner(family) {
|
|
516
|
+
return createSqliteMigrationRunner(family);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
//#endregion
|
|
520
|
+
export { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };
|
|
521
|
+
|
|
522
|
+
//# sourceMappingURL=target__control.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target__control.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { n as sqliteScalarTypeConstructors, t as sqliteTargetDescriptorMeta } from \"./descriptor-meta-BWlR2rDN.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-B7LD9iDG.mjs\";\nimport { _ as conversionCopyOf, m as affinityStorageClasses, v as rebuiltTableName } from \"./op-factory-call-Dzsgcf3B.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-DD8nGrZ_.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-CJ895eER.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { APP_SPACE_ID, failedPrecheckWhy, schemaCheckWhy, withFailingSpace } 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 { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\n//#region src/core/migrations/runner.ts\nconst NOT_NULL_VIOLATION_SQLSTATE = \"23502\";\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: schemaCheckWhy(schemaVerifyResult.schema.issues),\n\t\t\t\tmeta: { schemaIssues: 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(withFailingSpace(result.failure, space));\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(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));\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 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 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\tconst failedCheck = {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tphase,\n\t\t\t\t\tdescription: step.description\n\t\t\t\t};\n\t\t\t\tconst unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);\n\t\t\t\treturn runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\t\t...ifDefined(\"why\", unconverted ?? (phase === \"precheck\" ? failedPrecheckWhy(failedCheck) : void 0)),\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tfailedCheck,\n\t\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\t\tfield,\n\t\t\t\t\t\t\tby: \"conversion\",\n\t\t\t\t\t\t\treason: \"invalidResult\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t} : {\n\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\tby: \"cast\",\n\t\t\t\t\t\t\treason: \"value\",\n\t\t\t\t\t\t\toperationIndex: plan.operationIndex\n\t\t\t\t\t\t})\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, error, plan);\n\t\t\tconst failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, 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\t...ifDefined(\"rowsWithoutValue\", rowsWithoutValue?.reports),\n\t\t\t\t\t...ifDefined(\"failedTypeChange\", failedConversion)\n\t\t\t\t}\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, error, 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 = SqlQueryError.is(error) ? error.constraint : void 0;\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, error, plan) {\n\t\tif (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) 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\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqliteScalarTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,8BAA8B;AACpC,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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ACD;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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
2
|
-
import { a as fn, c as placeholder, d as sql, f as unique, i as dataTransform, l as primaryKey, n as MigrationCLI, o as foreignKey, r as col, s as lit, t as DataTransformOptions, u as rawSql } from "./migration-
|
|
1
|
+
import { t as SqliteMigration } from "./sqlite-migration-CLIMaHLy-BQ6vv7gq.mjs";
|
|
2
|
+
import { a as fn, c as placeholder, d as sql, f as unique, i as dataTransform, l as primaryKey, n as MigrationCLI, o as foreignKey, r as col, s as lit, t as DataTransformOptions, u as rawSql } from "./migration-p83G5mtQ.mjs";
|
|
3
3
|
export { type DataTransformOptions, SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, sql, unique };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DropColumnCall, c as RawSqlCall, d as RenameTableCall, f as SqliteOpFactoryCall, i as DataTransformCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as RenameColumnCall } from "./op-factory-call-
|
|
1
|
+
import { a as DropColumnCall, c as RawSqlCall, d as RenameTableCall, f as SqliteOpFactoryCall, i as DataTransformCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as RenameColumnCall } from "./op-factory-call-CnufFdpE.mjs";
|
|
2
2
|
export { AddColumnCall, CreateIndexCall, CreateTableCall, DataTransformCall, DropColumnCall, DropIndexCall, DropTableCall, RawSqlCall, RecreateTableCall, RenameColumnCall, RenameTableCall, type SqliteOpFactoryCall };
|
package/dist/target__pack.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as sqliteTargetDescriptorMeta } from "./pack-
|
|
1
|
+
import { t as sqliteTargetDescriptorMeta } from "./pack-D09sgwDC.mjs";
|
|
2
2
|
export { sqliteTargetDescriptorMeta as default };
|
package/dist/target__pack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as sqliteTargetDescriptorMeta } from "./descriptor-meta-BWlR2rDN-Y8Y4_jie.mjs";
|
|
2
2
|
export { sqliteTargetDescriptorMeta as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as TypeScriptRenderableSqliteMigration, t as SqliteMigrationDestinationInfo } from "./planner-produced-sqlite-migration-
|
|
2
|
-
import "./planner-produced-sqlite-migration-
|
|
1
|
+
import { n as TypeScriptRenderableSqliteMigration, t as SqliteMigrationDestinationInfo } from "./planner-produced-sqlite-migration-DuM9c3YI-COeeqS8N.mjs";
|
|
2
|
+
import "./planner-produced-sqlite-migration-D0aHh8Z9.mjs";
|
|
3
3
|
export { type SqliteMigrationDestinationInfo, TypeScriptRenderableSqliteMigration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SqlitePlanResult, r as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-
|
|
1
|
+
import { n as SqlitePlanResult, r as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-ChwhExQU.mjs";
|
|
2
2
|
export { SqliteMigrationPlanner, type SqlitePlanResult, createSqliteMigrationPlanner };
|