@prisma/orm-target-sqlite 8.0.0-rc.18-dev.12 → 8.0.0-rc.18-dev.14
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-g66WhBm8.d.mts → adapter-BxyK_xh_.d.mts} +6 -6
- package/dist/{adapter-g66WhBm8.d.mts.map → adapter-BxyK_xh_.d.mts.map} +1 -1
- package/dist/{adapter-DEhaeqzN-C0ZrfwQ-.mjs → adapter-CsuIDFCl-VPvqA3aN.mjs} +25 -4
- package/dist/adapter-CsuIDFCl-VPvqA3aN.mjs.map +1 -0
- package/dist/adapter.d.mts +1 -1
- package/dist/adapter.mjs +1 -1
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +1 -1
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{aggregates-CR6j7ac7.d.mts → aggregates-C0639xga.d.mts} +6 -6
- package/dist/{aggregates-CR6j7ac7.d.mts.map → aggregates-C0639xga.d.mts.map} +1 -1
- package/dist/{control-CPwTTMNh.mjs → control-B36x0WJy.mjs} +9 -4
- package/dist/control-B36x0WJy.mjs.map +1 -0
- package/dist/{migration-9FS12QGo.mjs → migration-DCerLxfE.mjs} +2 -2
- package/dist/{migration-9FS12QGo.mjs.map → migration-DCerLxfE.mjs.map} +1 -1
- package/dist/{op-factory-call-BP8q3moB-BhWwqgfW.mjs → op-factory-call-DOyJsczD-DbvU0p5_.mjs} +95 -8
- package/dist/op-factory-call-DOyJsczD-DbvU0p5_.mjs.map +1 -0
- package/dist/{planner-CHVsFdYX-BXkj8Yt8.mjs → planner-Dwty_fUe-D0-TzhkE.mjs} +5 -5
- package/dist/{planner-CHVsFdYX-BXkj8Yt8.mjs.map → planner-Dwty_fUe-D0-TzhkE.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-DxKNqhIl-DrkwVEyy.mjs → planner-produced-sqlite-migration-DC-1t9EA-CNp-PgLE.mjs} +4 -4
- package/dist/{planner-produced-sqlite-migration-DxKNqhIl-DrkwVEyy.mjs.map → planner-produced-sqlite-migration-DC-1t9EA-CNp-PgLE.mjs.map} +1 -1
- package/dist/{render-ops-BxptR4vb-CO94GBBd.mjs → render-ops-Z0s3TTq--ifvvn9yX.mjs} +3 -3
- package/dist/{render-ops-BxptR4vb-CO94GBBd.mjs.map → render-ops-Z0s3TTq--ifvvn9yX.mjs.map} +1 -1
- package/dist/{sqlite-migration-Dn0aIhV7-B1eALxxb.mjs → sqlite-migration-DTN2snAw-DW3tNXzB.mjs} +23 -9
- package/dist/sqlite-migration-DTN2snAw-DW3tNXzB.mjs.map +1 -0
- package/dist/target.d.mts +1 -1
- package/dist/target.mjs +7 -7
- package/dist/target__aggregates.d.mts +1 -1
- package/dist/target__control.mjs +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/package.json +9 -9
- package/dist/adapter-DEhaeqzN-C0ZrfwQ-.mjs.map +0 -1
- package/dist/control-CPwTTMNh.mjs.map +0 -1
- package/dist/op-factory-call-BP8q3moB-BhWwqgfW.mjs.map +0 -1
- package/dist/sqlite-migration-Dn0aIhV7-B1eALxxb.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-B36x0WJy.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-DOyJsczD.mjs\";\nimport { _ as diffSqliteSchema, b as verifySqliteDatabaseSchema, y as sqliteContractToSchema } from \"./sqlite-migration-DTN2snAw.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-Dwty_fUe.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\tfailedCheck: {\n\t\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\t\tphase,\n\t\t\t\t\t\tdescription: 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"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S,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,5 +1,5 @@
|
|
|
1
1
|
import { t as buildTargetDetails } from "./planner-target-details-CIQ789Gc-C5U4yVY9.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { T as step } from "./op-factory-call-DOyJsczD-DbvU0p5_.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-DCerLxfE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-DCerLxfE.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.mjs"],"sourcesContent":["import { S as step } from \"./op-factory-call-DOyJsczD.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-DTN2snAw.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"}
|
package/dist/{op-factory-call-BP8q3moB-BhWwqgfW.mjs → op-factory-call-DOyJsczD-DbvU0p5_.mjs}
RENAMED
|
@@ -17,7 +17,7 @@ import { assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
|
17
17
|
import { errorMigrationOperationOptionRemoved, unfilledPlaceholderOperation } from "@prisma/orm-framework/errors/migration";
|
|
18
18
|
import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
|
|
19
19
|
import { TsExpression, jsonToTsSource, tsArraySource, tsObjectSource, tsQuotedTextSource } from "@prisma/orm-framework/ts-render";
|
|
20
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call-
|
|
20
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call-DOyJsczD.mjs
|
|
21
21
|
/**
|
|
22
22
|
* Low-level DDL fragment builders for SQLite migrations.
|
|
23
23
|
*
|
|
@@ -84,6 +84,8 @@ function step(description, sql, params) {
|
|
|
84
84
|
...ifDefined("params", params)
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
+
/** The text a `DdlColumn`'s type ends with when the column is SQLite's inline `INTEGER PRIMARY KEY AUTOINCREMENT`. */
|
|
88
|
+
const INLINE_AUTOINCREMENT_PRIMARY_KEY = " PRIMARY KEY AUTOINCREMENT";
|
|
87
89
|
/** The DDL default of a contract default: `autoincrement()` is written as part of the column's type instead. */
|
|
88
90
|
function sqliteDefaultToDdlColumnDefault(columnDefault) {
|
|
89
91
|
if (!columnDefault) return void 0;
|
|
@@ -149,6 +151,36 @@ function renderForeignKeyClause(fk) {
|
|
|
149
151
|
if (fk.onUpdate !== void 0) sql += ` ON UPDATE ${REFERENTIAL_ACTION_SQL[fk.onUpdate]}`;
|
|
150
152
|
return sql;
|
|
151
153
|
}
|
|
154
|
+
function text(value) {
|
|
155
|
+
return `'${escapeLiteral(value)}'`;
|
|
156
|
+
}
|
|
157
|
+
function columnRow(column) {
|
|
158
|
+
return `(${text(column.name)}, ${text(column.typeSql.toLowerCase())}, ${column.notNull ? 1 : 0}, ${column.primaryKeyPosition})`;
|
|
159
|
+
}
|
|
160
|
+
/** Checks that the table has exactly these columns, each with its type, nullability and primary key position. */
|
|
161
|
+
function tableColumnsCheck(tableName, columns) {
|
|
162
|
+
const info = `pragma_table_info(${text(tableName)})`;
|
|
163
|
+
return {
|
|
164
|
+
description: `verify table "${tableName}" has exactly its columns`,
|
|
165
|
+
sql: `SELECT (SELECT COUNT(*) FROM ${info}) = ${columns.length} AND (SELECT COUNT(*) FROM ${info} WHERE (name, LOWER(type), "notnull", pk) IN (VALUES ${columns.map(columnRow).join(", ")})) = ${columns.length}`
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** Checks the column's type and nullability. */
|
|
169
|
+
function columnShapeCheck(tableName, column) {
|
|
170
|
+
return {
|
|
171
|
+
description: `verify column "${column.name}" on "${tableName}" has type ${column.typeSql} and ${column.notNull ? "is required" : "is optional"}`,
|
|
172
|
+
sql: `SELECT COUNT(*) > 0 FROM pragma_table_info(${text(tableName)}) WHERE name = ${text(column.name)} AND LOWER(type) = ${text(column.typeSql.toLowerCase())} AND "notnull" = ${column.notNull ? 1 : 0}`
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/** Checks that the index is on the table, covers exactly these columns in this order, and is unique or not. */
|
|
176
|
+
function indexDefinitionCheck(tableName, indexName, columns, unique) {
|
|
177
|
+
const positions = columns.map((column, seqno) => `(${seqno}, ${text(column)})`).join(", ");
|
|
178
|
+
const info = `pragma_index_info(${text(indexName)})`;
|
|
179
|
+
return {
|
|
180
|
+
description: `verify index "${indexName}" on "${tableName}" covers (${columns.join(", ")})`,
|
|
181
|
+
sql: `SELECT EXISTS (SELECT 1 FROM pragma_index_list(${text(tableName)}) WHERE name = ${text(indexName)} AND "unique" = ${unique ? 1 : 0}) AND (SELECT COUNT(*) FROM ${info}) = ${columns.length} AND (SELECT COUNT(*) FROM ${info} WHERE (seqno, name) IN (VALUES ${positions})) = ${columns.length}`
|
|
182
|
+
};
|
|
183
|
+
}
|
|
152
184
|
function addColumnExecuteSql(tableName, column, defaultClause) {
|
|
153
185
|
return [
|
|
154
186
|
`ALTER TABLE ${quoteIdentifier(tableName)}`,
|
|
@@ -177,7 +209,11 @@ async function addColumn(tableName, column, lowerer) {
|
|
|
177
209
|
},
|
|
178
210
|
precheck: [step(`ensure column "${column.name}" is missing`, absent.sql, absent.params)],
|
|
179
211
|
execute: [step(`add column "${column.name}"`, addColumnExecuteSql(tableName, column, defaultClause))],
|
|
180
|
-
postcheck: [step(`verify column "${column.name}" exists`, present.sql, present.params)
|
|
212
|
+
postcheck: [step(`verify column "${column.name}" exists`, present.sql, present.params), columnShapeCheck(tableName, {
|
|
213
|
+
name: column.name,
|
|
214
|
+
typeSql: column.typeSql,
|
|
215
|
+
notNull: !column.nullable
|
|
216
|
+
})]
|
|
181
217
|
};
|
|
182
218
|
}
|
|
183
219
|
function renameColumnExecuteSql(tableName, fromName, toName) {
|
|
@@ -303,7 +339,11 @@ async function recreateTable(args, lowerer) {
|
|
|
303
339
|
id: "sqlite",
|
|
304
340
|
details: buildTargetDetails("table", tableName)
|
|
305
341
|
},
|
|
306
|
-
precheck: [
|
|
342
|
+
precheck: [
|
|
343
|
+
step(`ensure table "${tableName}" exists`, tableSteps.present.sql, tableSteps.present.params),
|
|
344
|
+
step(`ensure temp table "${tempName}" does not exist`, tempSteps.absent.sql, tempSteps.absent.params),
|
|
345
|
+
sourceColumnsCheck(tableName, schemaColumnNames)
|
|
346
|
+
],
|
|
307
347
|
execute: [
|
|
308
348
|
step(`create new table "${tempName}" with desired schema`, renderCreateTableSql(tempName, contractTable, defaultClauses)),
|
|
309
349
|
...copyStep,
|
|
@@ -314,6 +354,7 @@ async function recreateTable(args, lowerer) {
|
|
|
314
354
|
postcheck: [
|
|
315
355
|
step(`verify table "${tableName}" exists`, tableSteps.present.sql, tableSteps.present.params),
|
|
316
356
|
step(`verify temp table "${tempName}" is gone`, tempSteps.absent.sql, tempSteps.absent.params),
|
|
357
|
+
rebuiltTableCheck(tableName, renderCreateTableSql(tableName, contractTable, defaultClauses)),
|
|
317
358
|
...postchecks.flatMap((check) => "sql" in check ? [markedStep(tableName, check)] : defaultPostcheck(tableName, check, clauseByColumn.get(check.columnDefault))),
|
|
318
359
|
...contractTable.columns.flatMap((column) => {
|
|
319
360
|
const by = Object.hasOwn(conversions, column.name) ? "conversion" : retypedColumns.includes(column.name) ? "cast" : void 0;
|
|
@@ -325,6 +366,31 @@ async function recreateTable(args, lowerer) {
|
|
|
325
366
|
]
|
|
326
367
|
};
|
|
327
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Checks that the table has exactly the columns the rebuild reads, the ones it copies and the ones it
|
|
371
|
+
* leaves out. The rebuild copies only the columns it knows, so on a table with another column, such
|
|
372
|
+
* as one a later migration added, it would drop that column and its values.
|
|
373
|
+
*/
|
|
374
|
+
function sourceColumnsCheck(tableName, columns) {
|
|
375
|
+
const info = `pragma_table_info('${escapeLiteral(tableName)}')`;
|
|
376
|
+
const named = columns.length === 0 ? "" : ` AND (SELECT COUNT(*) FROM ${info} WHERE name IN (${quoteSqlList(columns)})) = ${columns.length}`;
|
|
377
|
+
return {
|
|
378
|
+
description: `ensure table "${tableName}" has exactly the columns the rebuild copies or leaves out (${columns.join(", ")})`,
|
|
379
|
+
sql: `SELECT (SELECT COUNT(*) FROM ${info}) = ${columns.length}${named}`
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Checks that the table is stored as the statement the rebuild writes. SQLite keeps a table's
|
|
384
|
+
* `CREATE TABLE` text as written, and renaming the rebuilt table only replaces its name, so this holds
|
|
385
|
+
* once the rebuild ran and not before, whatever text an earlier table had. It is the only check of
|
|
386
|
+
* what SQLite keeps in that text alone, such as `AUTOINCREMENT`.
|
|
387
|
+
*/
|
|
388
|
+
function rebuiltTableCheck(tableName, statement) {
|
|
389
|
+
return {
|
|
390
|
+
description: `verify "${tableName}" is stored as the rebuilt table`,
|
|
391
|
+
sql: `SELECT (SELECT sql FROM sqlite_master WHERE type = 'table' AND name = '${escapeLiteral(tableName)}') = '${escapeLiteral(statement)}'`
|
|
392
|
+
};
|
|
393
|
+
}
|
|
328
394
|
function markedStep(tableName, check) {
|
|
329
395
|
const { requiredColumn, ...step } = check;
|
|
330
396
|
const meta = { ...requiredColumn === void 0 ? {} : requiredColumnMeta(tableName, requiredColumn.column, requiredColumn.reason) };
|
|
@@ -426,6 +492,10 @@ function expectedPrimaryKeyColumns(spec) {
|
|
|
426
492
|
const inlinePk = spec.columns.find((c) => c.inlineAutoincrementPrimaryKey);
|
|
427
493
|
return inlinePk ? [inlinePk.name] : [];
|
|
428
494
|
}
|
|
495
|
+
/** The text `pragma_foreign_key_list` reports for a referential action; SQLite reads an absent action as `NO ACTION`. */
|
|
496
|
+
function referentialActionText(action) {
|
|
497
|
+
return REFERENTIAL_ACTION_SQL[action ?? "noAction"];
|
|
498
|
+
}
|
|
429
499
|
function quoteSqlList(values) {
|
|
430
500
|
return values.map((v) => `'${escapeLiteral(v)}'`).join(", ");
|
|
431
501
|
}
|
|
@@ -572,7 +642,7 @@ function buildRecreatePostchecks(tableName, issues, spec, copiedColumns = /* @__
|
|
|
572
642
|
const description = `verify foreign key (${fk.columns.join(", ")}) → ${fk.references.table}(${fk.references.columns.join(", ")}) on "${tableName}"`;
|
|
573
643
|
checks.push({
|
|
574
644
|
description,
|
|
575
|
-
sql: `SELECT EXISTS (SELECT 1 FROM pragma_foreign_key_list('${t}') f WHERE f."table" = '${refTable}' GROUP BY f.id HAVING COUNT(*) = ${colCount} AND SUM(CASE WHEN (f."from", f."to") IN (${tuples}) THEN 1 ELSE 0 END) = ${colCount})`
|
|
645
|
+
sql: `SELECT EXISTS (SELECT 1 FROM pragma_foreign_key_list('${t}') f WHERE f."table" = '${refTable}' AND f.on_delete = '${referentialActionText(fk.onDelete)}' AND f.on_update = '${referentialActionText(fk.onUpdate)}' GROUP BY f.id HAVING COUNT(*) = ${colCount} AND SUM(CASE WHEN (f."from", f."to") IN (${tuples}) THEN 1 ELSE 0 END) = ${colCount})`
|
|
576
646
|
});
|
|
577
647
|
}
|
|
578
648
|
const expected = spec.foreignKeys?.length ?? 0;
|
|
@@ -652,6 +722,23 @@ function defaultImportSymbols(columns) {
|
|
|
652
722
|
else if (col.default?.kind === "function") symbols.add("fn");
|
|
653
723
|
return [...symbols];
|
|
654
724
|
}
|
|
725
|
+
function columnShapesOf(columns, constraints) {
|
|
726
|
+
const primaryKey = constraints?.find((constraint) => constraint.kind === "primary-key");
|
|
727
|
+
return columns.map((column) => {
|
|
728
|
+
if (column.type.endsWith(" PRIMARY KEY AUTOINCREMENT")) return {
|
|
729
|
+
name: column.name,
|
|
730
|
+
typeSql: column.type.slice(0, -26),
|
|
731
|
+
notNull: false,
|
|
732
|
+
primaryKeyPosition: 1
|
|
733
|
+
};
|
|
734
|
+
return {
|
|
735
|
+
name: column.name,
|
|
736
|
+
typeSql: column.type,
|
|
737
|
+
notNull: column.notNull === true,
|
|
738
|
+
primaryKeyPosition: column.primaryKey ? 1 : (primaryKey?.columns.indexOf(column.name) ?? -1) + 1
|
|
739
|
+
};
|
|
740
|
+
});
|
|
741
|
+
}
|
|
655
742
|
var CreateTableCall = class extends SqliteOpFactoryCallNode {
|
|
656
743
|
factoryName = "createTable";
|
|
657
744
|
operationClass = "additive";
|
|
@@ -697,7 +784,7 @@ var CreateTableCall = class extends SqliteOpFactoryCallNode {
|
|
|
697
784
|
sql: statement.sql,
|
|
698
785
|
params: statement.params ?? []
|
|
699
786
|
}],
|
|
700
|
-
postcheck: [step(`verify table "${tableName}" exists`, present.sql, present.params)]
|
|
787
|
+
postcheck: [step(`verify table "${tableName}" exists`, present.sql, present.params), tableColumnsCheck(tableName, columnShapesOf(this.columns, this.constraints))]
|
|
701
788
|
};
|
|
702
789
|
}
|
|
703
790
|
renderTypeScript() {
|
|
@@ -1180,7 +1267,7 @@ var CreateIndexCall = class extends SqliteOpFactoryCallNode {
|
|
|
1180
1267
|
},
|
|
1181
1268
|
precheck: [step(`ensure index "${this.indexName}" is missing`, absent.sql, absent.params)],
|
|
1182
1269
|
execute: [step(`create index "${this.indexName}"`, buildCreateIndexSql(this.tableName, this.indexName, this.columns))],
|
|
1183
|
-
postcheck: [step(`verify index "${this.indexName}" exists`, present.sql, present.params)]
|
|
1270
|
+
postcheck: [step(`verify index "${this.indexName}" exists`, present.sql, present.params), indexDefinitionCheck(this.tableName, this.indexName, this.columns, false)]
|
|
1184
1271
|
};
|
|
1185
1272
|
}
|
|
1186
1273
|
renderTypeScript() {
|
|
@@ -1363,6 +1450,6 @@ function renderPostcheck(postcheck) {
|
|
|
1363
1450
|
}));
|
|
1364
1451
|
}
|
|
1365
1452
|
//#endregion
|
|
1366
|
-
export {
|
|
1453
|
+
export { sqliteDefaultToDdlColumnDefault as C, renderDefaultLiteral as S, step as T, conversionCopyOf as _, DropColumnCall as a, rebuiltTableName as b, INLINE_AUTOINCREMENT_PRIMARY_KEY as c, RenameColumnCall as d, RenameTableCall as f, buildRecreateSummary as g, buildRecreatePostchecks as h, DataTransformCall as i, RawSqlCall as l, buildColumnTypeSql as m, CreateIndexCall as n, DropIndexCall as o, affinityStorageClasses as p, CreateTableCall as r, DropTableCall as s, AddColumnCall as t, RecreateTableCall as u, indexReplacementCalls as v, sqliteIdentifiersCollide as w, renameTableSteps as x, isSqliteOpFactoryCall as y };
|
|
1367
1454
|
|
|
1368
|
-
//# sourceMappingURL=op-factory-call-
|
|
1455
|
+
//# sourceMappingURL=op-factory-call-DOyJsczD-DbvU0p5_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"op-factory-call-DOyJsczD-DbvU0p5_.mjs","names":["#written","#slotsSource"],"sources":["../../../../3-targets/3-targets/sqlite/dist/op-factory-call-DOyJsczD.mjs"],"sourcesContent":["import \"./codec-ids-KMliSCRp.mjs\";\nimport { o as sqliteInteger } from \"./data-types-pFQMl37_.mjs\";\nimport { n as sqliteError } from \"./errors-DnR-sMHS.mjs\";\nimport { n as decodeSqliteDatetime, r as encodeSqliteDatetime } from \"./codecs-Ea350Hl_.mjs\";\nimport { r as stripOuterParens } from \"./default-normalizer-Ch3VFnEH.mjs\";\nimport { n as escapeLiteral, r as quoteIdentifier, t as SQLITE_QUOTING } from \"./sql-utils-XGT5Esi2.mjs\";\nimport { a as tableExistsAst, i as indexExistsAst, n as columnExistsAst, o as tableNameTakenAst, r as columnNameTakenAst, t as createTable } from \"./ddl-CDoa1Ehx.mjs\";\nimport { t as buildTargetDetails } from \"./planner-target-details-CIQ789Gc.mjs\";\nimport { DdlColumn, FunctionColumnDefault, LiteralColumnDefault, opaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { dataTypeParams, renderSqlTypeName, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\nimport { type } from \"arktype\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { checkSqlExpressionText, convertedColumnMeta, createSqlTextSources, isUnfilledSlot, requiredColumnMeta, slotSource, sqlOfSlot } from \"@internal/family-sql/control\";\nimport { RelationalSchemaNodeKind } from \"@internal/sql-schema-ir/types\";\nimport { assertNever } from \"@internal/utils/internal-error\";\nimport { errorMigrationOperationOptionRemoved, unfilledPlaceholderOperation } from \"@internal/errors/migration\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { TsExpression, jsonToTsSource, tsArraySource, tsObjectSource, tsQuotedTextSource } from \"@internal/ts-render\";\n//#region src/core/migrations/planner-ddl-builders.ts\n/**\n* Low-level DDL fragment builders for SQLite migrations.\n*\n* These helpers consume `StorageColumn` (the contract shape, possibly with\n* `typeRef`) and produce string fragments. They are called once per column\n* at the call-construction boundary in `issue-planner.ts` / strategies to\n* build flat `SqliteColumnSpec`s; the operation factories themselves never\n* see `StorageColumn` or `storageTypes`.\n*/\n/**\n* Renders the column's DDL type token (e.g. `\"INTEGER\"`, `\"TEXT\"`): the name the data type of its\n* codec is written with, in upper case. Resolves `typeRef` against `storageTypes`.\n*/\nfunction buildColumnTypeSql(column, types, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst dataType = sqlDataTypeOfCodec(resolved.codecId, types);\n\treturn renderSqlTypeName(dataType, dataTypeParams(dataType, resolved.typeParams)).toUpperCase();\n}\nconst DIGIT_TEXT = /^-?\\d+$/;\n/**\n* A literal default in SQL. An `integer` column stores digit text in the contract, which is written\n* as the integer it names. A datetime default is the stored value itself in SQLite, which compares\n* text byte by byte, so it is written as the text the column's codec writes for every row, not as\n* its canonical form.\n*/\nfunction renderDefaultLiteral(value, column) {\n\tif (column?.dataType === sqliteInteger.id && typeof value === \"string\" && DIGIT_TEXT.test(value)) return value;\n\tif (value instanceof Date) return `'${escapeLiteral(encodeSqliteDatetime(value))}'`;\n\tif (typeof value === \"string\" && column?.codecId === \"sqlite/datetime@1\") return `'${escapeLiteral(encodeSqliteDatetime(decodeSqliteDatetime(value)))}'`;\n\tif (typeof value === \"string\") return `'${escapeLiteral(value)}'`;\n\tif (typeof value === \"number\" || typeof value === \"bigint\") return String(value);\n\tif (typeof value === \"boolean\") return value ? \"1\" : \"0\";\n\tif (value === null) return \"NULL\";\n\treturn `'${escapeLiteral(JSON.stringify(value))}'`;\n}\nfunction buildCreateIndexSql(tableName, indexName, columns, unique = false) {\n\treturn `CREATE ${unique ? \"UNIQUE \" : \"\"}INDEX ${quoteIdentifier(indexName)} ON ${quoteIdentifier(tableName)} (${columns.map(quoteIdentifier).join(\", \")})`;\n}\nfunction buildDropIndexSql(indexName) {\n\treturn `DROP INDEX IF EXISTS ${quoteIdentifier(indexName)}`;\n}\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referencedType = storageTypes[column.typeRef];\n\tif (!referencedType) throw sqliteError(\"CONTRACT.TYPE_UNKNOWN\", `Storage type \"${column.typeRef}\" referenced by column is not defined in storage.types.`, { meta: { typeRef: column.typeRef } });\n\treturn {\n\t\tcodecId: referencedType.codecId,\n\t\ttypeParams: referencedType.typeParams\n\t};\n}\n//#endregion\n//#region src/core/migrations/identifier-case.ts\nfunction foldAsciiLetters(identifier) {\n\treturn identifier.replace(/[A-Z]/g, (letter) => letter.toLowerCase());\n}\n/**\n* Whether SQLite takes two identifiers for the same name. It compares table and index names without regard to the case of ASCII letters, and compares every other character exactly.\n*/\nfunction sqliteIdentifiersCollide(left, right) {\n\treturn foldAsciiLetters(left) === foldAsciiLetters(right);\n}\n//#endregion\n//#region src/core/migrations/operations/shared.ts\nfunction step(description, sql, params) {\n\treturn {\n\t\tdescription,\n\t\tsql,\n\t\t...ifDefined(\"params\", params)\n\t};\n}\n/** The text a `DdlColumn`'s type ends with when the column is SQLite's inline `INTEGER PRIMARY KEY AUTOINCREMENT`. */\nconst INLINE_AUTOINCREMENT_PRIMARY_KEY = \" PRIMARY KEY AUTOINCREMENT\";\n/** The DDL default of a contract default: `autoincrement()` is written as part of the column's type instead. */\nfunction sqliteDefaultToDdlColumnDefault(columnDefault) {\n\tif (!columnDefault) return void 0;\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return new LiteralColumnDefault(columnDefault.value);\n\t\tcase \"function\":\n\t\t\tif (columnDefault.expression === \"autoincrement()\") return void 0;\n\t\t\treturn new FunctionColumnDefault(opaqueSql(columnDefault.expression));\n\t\tdefault: {\n\t\t\tconst exhaustive = columnDefault;\n\t\t\treturn assertNever(exhaustive, `sqliteDefaultToDdlColumnDefault: unhandled kind \"${blindCast(exhaustive).kind}\"`);\n\t\t}\n\t}\n}\n/**\n* A column spec an earlier version wrote carries its default as SQL text in `defaultSql`, empty when it has none.\n*/\nfunction refuseEarlierColumnSpecs(operation, tableName, columns) {\n\tconst earlier = columns.find((column) => Object.hasOwn(column, \"defaultSql\"));\n\tif (earlier === void 0) return;\n\tthrow errorMigrationOperationOptionRemoved({\n\t\toperation,\n\t\toption: \"defaultSql\",\n\t\tsubject: `column ${JSON.stringify(earlier.name)} of table ${JSON.stringify(tableName)}`,\n\t\trewrite: \"Write the column's default as `default: { kind: 'literal', value }` or `default: { kind: 'function', expression }`, with the column's `codecRef`, in place of `defaultSql`, and delete an empty `defaultSql`.\",\n\t\tupgradeEntry: \"migration-ts-column-defaults\"\n\t});\n}\n/** The `DEFAULT …` clause the adapter writes for a column spec, `''` when it has none. */\nfunction renderSpecDefault$1(column, tableName, lowerer) {\n\tconst ddlDefault = column.inlineAutoincrementPrimaryKey ? void 0 : sqliteDefaultToDdlColumnDefault(column.default);\n\treturn lowerer.renderColumnDefault(new DdlColumn({\n\t\tname: column.name,\n\t\ttype: column.typeSql,\n\t\t...ifDefined(\"default\", ddlDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef)\n\t}), tableName);\n}\n/**\n* Renders a single column's inline DDL fragment within a `CREATE TABLE`\n* statement. Honours the `inlineAutoincrementPrimaryKey` flag — SQLite\n* treats `INTEGER PRIMARY KEY AUTOINCREMENT` as a special form that aliases\n* `rowid`, and the column must not carry a `DEFAULT` or repeat `NOT NULL`.\n*/\nfunction renderColumnDefinition(column, defaultClause) {\n\tconst parts = [quoteIdentifier(column.name), column.typeSql];\n\tif (column.inlineAutoincrementPrimaryKey) parts.push(\"PRIMARY KEY AUTOINCREMENT\");\n\telse {\n\t\tif (defaultClause) parts.push(defaultClause);\n\t\tif (!column.nullable) parts.push(\"NOT NULL\");\n\t}\n\treturn parts.join(\" \");\n}\n/**\n* Renders an inline FOREIGN KEY constraint clause for a `CREATE TABLE`\n* body. Every `SqliteForeignKeySpec` is constraint-bearing by construction\n* (`tableSpecFromNode` only ever builds specs from schema-IR FK nodes, which\n* are themselves constraint-only — a non-constraint FK contributes no node).\n*/\nfunction renderForeignKeyClause(fk) {\n\tlet sql = `${fk.name ? `CONSTRAINT ${quoteIdentifier(fk.name)} ` : \"\"}FOREIGN KEY (${fk.columns.map(quoteIdentifier).join(\", \")}) REFERENCES ${quoteIdentifier(fk.references.table)} (${fk.references.columns.map(quoteIdentifier).join(\", \")})`;\n\tif (fk.onDelete !== void 0) sql += ` ON DELETE ${REFERENTIAL_ACTION_SQL[fk.onDelete]}`;\n\tif (fk.onUpdate !== void 0) sql += ` ON UPDATE ${REFERENTIAL_ACTION_SQL[fk.onUpdate]}`;\n\treturn sql;\n}\n//#endregion\n//#region src/core/migrations/operations/structure-checks.ts\nfunction text(value) {\n\treturn `'${escapeLiteral(value)}'`;\n}\nfunction columnRow(column) {\n\treturn `(${text(column.name)}, ${text(column.typeSql.toLowerCase())}, ${column.notNull ? 1 : 0}, ${column.primaryKeyPosition})`;\n}\n/** Checks that the table has exactly these columns, each with its type, nullability and primary key position. */\nfunction tableColumnsCheck(tableName, columns) {\n\tconst info = `pragma_table_info(${text(tableName)})`;\n\treturn {\n\t\tdescription: `verify table \"${tableName}\" has exactly its columns`,\n\t\tsql: `SELECT (SELECT COUNT(*) FROM ${info}) = ${columns.length} AND (SELECT COUNT(*) FROM ${info} WHERE (name, LOWER(type), \"notnull\", pk) IN (VALUES ${columns.map(columnRow).join(\", \")})) = ${columns.length}`\n\t};\n}\n/** Checks the column's type and nullability. */\nfunction columnShapeCheck(tableName, column) {\n\treturn {\n\t\tdescription: `verify column \"${column.name}\" on \"${tableName}\" has type ${column.typeSql} and ${column.notNull ? \"is required\" : \"is optional\"}`,\n\t\tsql: `SELECT COUNT(*) > 0 FROM pragma_table_info(${text(tableName)}) WHERE name = ${text(column.name)} AND LOWER(type) = ${text(column.typeSql.toLowerCase())} AND \"notnull\" = ${column.notNull ? 1 : 0}`\n\t};\n}\n/** Checks that the index is on the table, covers exactly these columns in this order, and is unique or not. */\nfunction indexDefinitionCheck(tableName, indexName, columns, unique) {\n\tconst positions = columns.map((column, seqno) => `(${seqno}, ${text(column)})`).join(\", \");\n\tconst info = `pragma_index_info(${text(indexName)})`;\n\treturn {\n\t\tdescription: `verify index \"${indexName}\" on \"${tableName}\" covers (${columns.join(\", \")})`,\n\t\tsql: `SELECT EXISTS (SELECT 1 FROM pragma_index_list(${text(tableName)}) WHERE name = ${text(indexName)} AND \"unique\" = ${unique ? 1 : 0}) AND (SELECT COUNT(*) FROM ${info}) = ${columns.length} AND (SELECT COUNT(*) FROM ${info} WHERE (seqno, name) IN (VALUES ${positions})) = ${columns.length}`\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations/columns.ts\nfunction addColumnExecuteSql(tableName, column, defaultClause) {\n\treturn [\n\t\t`ALTER TABLE ${quoteIdentifier(tableName)}`,\n\t\t`ADD COLUMN ${quoteIdentifier(column.name)} ${column.typeSql}`,\n\t\tdefaultClause,\n\t\tcolumn.nullable ? \"\" : \"NOT NULL\"\n\t].filter(Boolean).join(\" \");\n}\nfunction dropColumnExecuteSql(tableName, columnName) {\n\treturn `ALTER TABLE ${quoteIdentifier(tableName)} DROP COLUMN ${quoteIdentifier(columnName)}`;\n}\nasync function addColumn(tableName, column, lowerer) {\n\trefuseEarlierColumnSpecs(\"addColumn\", tableName, [column]);\n\tconst defaultClause = await renderSpecDefault$1(column, tableName, lowerer);\n\tconst checks = columnExistsAst(tableName, column.name);\n\tconst absent = await lowerer.lowerToExecuteRequest(checks.columnAbsent());\n\tconst present = await lowerer.lowerToExecuteRequest(checks.columnPresent());\n\treturn {\n\t\tid: `column.${tableName}.${column.name}`,\n\t\tlabel: `Add column ${column.name} on ${tableName}`,\n\t\tsummary: `Adds column ${column.name} on ${tableName}`,\n\t\toperationClass: \"additive\",\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"column\", column.name, tableName)\n\t\t},\n\t\tprecheck: [step(`ensure column \"${column.name}\" is missing`, absent.sql, absent.params)],\n\t\texecute: [step(`add column \"${column.name}\"`, addColumnExecuteSql(tableName, column, defaultClause))],\n\t\tpostcheck: [step(`verify column \"${column.name}\" exists`, present.sql, present.params), columnShapeCheck(tableName, {\n\t\t\tname: column.name,\n\t\t\ttypeSql: column.typeSql,\n\t\t\tnotNull: !column.nullable\n\t\t})]\n\t};\n}\nfunction renameColumnExecuteSql(tableName, fromName, toName) {\n\treturn `ALTER TABLE ${quoteIdentifier(tableName)} RENAME COLUMN ${quoteIdentifier(fromName)} TO ${quoteIdentifier(toName)}`;\n}\n/**\n* Renames a column. SQLite updates the indexes, foreign keys and triggers that name it, and keeps\n* index names. SQLite takes names that differ only in case for the same name, so the new name\n* must be free whatever its case, except in a rename that only changes case, which SQLite performs\n* in one statement.\n*/\nfunction renameColumnOperationId(tableName, fromName) {\n\treturn `renameColumn.${tableName}.${fromName}`;\n}\nasync function renameColumn(tableName, fromName, toName, lowerer) {\n\tconst fromChecks = columnExistsAst(tableName, fromName);\n\tconst toChecks = columnExistsAst(tableName, toName);\n\tconst fromPresent = await lowerer.lowerToExecuteRequest(fromChecks.columnPresent());\n\tconst toAbsent = await lowerer.lowerToExecuteRequest(sqliteIdentifiersCollide(fromName, toName) ? toChecks.columnAbsent() : columnNameTakenAst(tableName, toName).nameFree());\n\tconst toPresent = await lowerer.lowerToExecuteRequest(toChecks.columnPresent());\n\tconst fromAbsent = await lowerer.lowerToExecuteRequest(fromChecks.columnAbsent());\n\treturn {\n\t\tid: renameColumnOperationId(tableName, fromName),\n\t\tlabel: `Rename column ${fromName} on ${tableName} to ${toName}`,\n\t\tsummary: `Renames column ${fromName} on ${tableName} to ${toName}, keeping its values`,\n\t\toperationClass: \"widening\",\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"column\", toName, tableName)\n\t\t},\n\t\tprecheck: [step(`ensure column \"${fromName}\" exists on \"${tableName}\"`, fromPresent.sql, fromPresent.params), step(`ensure column \"${toName}\" does not exist on \"${tableName}\"`, toAbsent.sql, toAbsent.params)],\n\t\texecute: [step(`rename column \"${fromName}\" on \"${tableName}\" to \"${toName}\"`, renameColumnExecuteSql(tableName, fromName, toName))],\n\t\tpostcheck: [step(`verify column \"${toName}\" exists on \"${tableName}\"`, toPresent.sql, toPresent.params), step(`verify column \"${fromName}\" no longer exists on \"${tableName}\"`, fromAbsent.sql, fromAbsent.params)]\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations/tables.ts\nasync function tableExistsSteps(lowerer, tableName) {\n\tconst checks = tableExistsAst(tableName);\n\treturn {\n\t\tpresent: await lowerer.lowerToExecuteRequest(checks.tablePresent()),\n\t\tabsent: await lowerer.lowerToExecuteRequest(checks.tableAbsent())\n\t};\n}\n/**\n* Renders the body of a `CREATE TABLE <name> ( … )` statement from a flat\n* `SqliteTableSpec`. SQLite's `INTEGER PRIMARY KEY AUTOINCREMENT` form is\n* inline on the column; the table-level PRIMARY KEY clause is emitted only\n* when no column carries `inlineAutoincrementPrimaryKey`.\n*/\nfunction renderCreateTableSql(tableName, spec, defaultClauses) {\n\tconst columnDefs = spec.columns.map((column, index) => renderColumnDefinition(column, defaultClauses[index] ?? \"\"));\n\tconst constraintDefs = [];\n\tconst hasInlinePk = spec.columns.some((c) => c.inlineAutoincrementPrimaryKey);\n\tif (spec.primaryKey && !hasInlinePk) constraintDefs.push(`PRIMARY KEY (${spec.primaryKey.columns.map(quoteIdentifier).join(\", \")})`);\n\tfor (const u of spec.uniques ?? []) {\n\t\tconst name = u.name ? `CONSTRAINT ${quoteIdentifier(u.name)} ` : \"\";\n\t\tconstraintDefs.push(`${name}UNIQUE (${u.columns.map(quoteIdentifier).join(\", \")})`);\n\t}\n\tfor (const fk of spec.foreignKeys ?? []) {\n\t\tconst clause = renderForeignKeyClause(fk);\n\t\tif (clause) constraintDefs.push(clause);\n\t}\n\tconst allDefs = [...columnDefs, ...constraintDefs];\n\treturn `CREATE TABLE ${quoteIdentifier(tableName)} (\\n ${allDefs.join(\",\\n \")}\\n)`;\n}\nfunction renameTableViaName(toName) {\n\treturn `_prisma_rename_${toName}`;\n}\nfunction renameChangesOnlyCase(fromName, toName) {\n\treturn sqliteIdentifiersCollide(fromName, toName);\n}\n/**\n* SQLite takes names that differ only in the case of ASCII letters for the\n* same name, so such a rename (`userProfile` to `UserProfile`) is refused as\n* \"already exists\" when done in one statement. It goes through a temporary name.\n*/\nfunction renameTableSteps(fromName, toName) {\n\tconst from = quoteIdentifier(fromName);\n\tconst to = quoteIdentifier(toName);\n\tif (!renameChangesOnlyCase(fromName, toName)) return [step(`rename table \"${fromName}\" to \"${toName}\"`, `ALTER TABLE ${from} RENAME TO ${to}`)];\n\tconst viaName = renameTableViaName(toName);\n\tconst via = quoteIdentifier(viaName);\n\treturn [step(`rename table \"${fromName}\" to \"${viaName}\" (SQLite table names are case-insensitive)`, `ALTER TABLE ${from} RENAME TO ${via}`), step(`rename table \"${viaName}\" to \"${toName}\"`, `ALTER TABLE ${via} RENAME TO ${to}`)];\n}\n/** The table a rebuild of `tableName` creates, copies into, and renames to `tableName`. */\nfunction rebuiltTableName(tableName) {\n\treturn `_prisma_new_${tableName}`;\n}\nasync function recreateTable(args, lowerer) {\n\tconst { tableName, contractTable, schemaColumnNames, indexes, summary, postchecks, operationClass, copyExpressions = {}, temporaryValues = {}, retypedColumns = [] } = args;\n\trefuseEarlierColumnSpecs(\"recreateTable\", tableName, contractTable.columns);\n\tconst tempName = rebuiltTableName(tableName);\n\tconst liveSet = new Set(schemaColumnNames);\n\tconst convertedBy = (column) => Object.hasOwn(copyExpressions, column) ? copyExpressions[column] : void 0;\n\tconst copiedFrom = (column) => convertedBy(column) ?? (Object.hasOwn(temporaryValues, column) ? temporaryValues[column] : void 0);\n\tconst sharedColumns = contractTable.columns.filter((c) => liveSet.has(c.name) || copiedFrom(c.name) !== void 0).map((c) => c.name);\n\tconst columnList = sharedColumns.map(quoteIdentifier).join(\", \");\n\tconst selectList = sharedColumns.map((column) => copiedFrom(column) ?? quoteIdentifier(column)).join(\", \");\n\tconst indexStatements = indexes.map((idx) => ({\n\t\tdescription: `recreate index \"${idx.name}\" on \"${tableName}\"`,\n\t\tsql: buildCreateIndexSql(tableName, idx.name, idx.columns)\n\t}));\n\tconst conversions = Object.fromEntries(sharedColumns.flatMap((column) => {\n\t\tconst expression = convertedBy(column);\n\t\treturn expression === void 0 ? [] : [[column, expression]];\n\t}));\n\tconst copyStep = sharedColumns.length > 0 ? [{\n\t\t...step(`copy data from \"${tableName}\" to \"${tempName}\"`, `INSERT INTO ${quoteIdentifier(tempName)} (${columnList}) SELECT ${selectList} FROM ${quoteIdentifier(tableName)}`),\n\t\t...Object.keys(conversions).length === 0 ? {} : { meta: { conversionCopy: {\n\t\t\ttable: tableName,\n\t\t\texpressions: conversions\n\t\t} } }\n\t}] : [];\n\tconst defaultClauses = await renderSpecDefaults(contractTable, tableName, lowerer);\n\tconst clauseByColumn = new Map(contractTable.columns.map((column, index) => [column.name, defaultClauses[index] ?? \"\"]));\n\tconst tableSteps = await tableExistsSteps(lowerer, tableName);\n\tconst tempSteps = await tableExistsSteps(lowerer, tempName);\n\treturn {\n\t\tid: `recreateTable.${tableName}`,\n\t\tlabel: `Recreate table ${tableName}`,\n\t\tsummary,\n\t\toperationClass,\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"table\", tableName)\n\t\t},\n\t\tprecheck: [\n\t\t\tstep(`ensure table \"${tableName}\" exists`, tableSteps.present.sql, tableSteps.present.params),\n\t\t\tstep(`ensure temp table \"${tempName}\" does not exist`, tempSteps.absent.sql, tempSteps.absent.params),\n\t\t\tsourceColumnsCheck(tableName, schemaColumnNames)\n\t\t],\n\t\texecute: [\n\t\t\tstep(`create new table \"${tempName}\" with desired schema`, renderCreateTableSql(tempName, contractTable, defaultClauses)),\n\t\t\t...copyStep,\n\t\t\tstep(`drop old table \"${tableName}\"`, `DROP TABLE ${quoteIdentifier(tableName)}`),\n\t\t\tstep(`rename \"${tempName}\" to \"${tableName}\"`, `ALTER TABLE ${quoteIdentifier(tempName)} RENAME TO ${quoteIdentifier(tableName)}`),\n\t\t\t...indexStatements\n\t\t],\n\t\tpostcheck: [\n\t\t\tstep(`verify table \"${tableName}\" exists`, tableSteps.present.sql, tableSteps.present.params),\n\t\t\tstep(`verify temp table \"${tempName}\" is gone`, tempSteps.absent.sql, tempSteps.absent.params),\n\t\t\trebuiltTableCheck(tableName, renderCreateTableSql(tableName, contractTable, defaultClauses)),\n\t\t\t...postchecks.flatMap((check) => \"sql\" in check ? [markedStep(tableName, check)] : defaultPostcheck(tableName, check, clauseByColumn.get(check.columnDefault))),\n\t\t\t...contractTable.columns.flatMap((column) => {\n\t\t\t\tconst by = Object.hasOwn(conversions, column.name) ? \"conversion\" : retypedColumns.includes(column.name) ? \"cast\" : void 0;\n\t\t\t\treturn by === void 0 ? [] : [{\n\t\t\t\t\t...storageClassCheck(tableName, column),\n\t\t\t\t\tmeta: convertedColumnMeta(tableName, column.name, by)\n\t\t\t\t}];\n\t\t\t})\n\t\t]\n\t};\n}\n/**\n* Checks that the table has exactly the columns the rebuild reads, the ones it copies and the ones it\n* leaves out. The rebuild copies only the columns it knows, so on a table with another column, such\n* as one a later migration added, it would drop that column and its values.\n*/\nfunction sourceColumnsCheck(tableName, columns) {\n\tconst info = `pragma_table_info('${escapeLiteral(tableName)}')`;\n\tconst named = columns.length === 0 ? \"\" : ` AND (SELECT COUNT(*) FROM ${info} WHERE name IN (${quoteSqlList(columns)})) = ${columns.length}`;\n\treturn {\n\t\tdescription: `ensure table \"${tableName}\" has exactly the columns the rebuild copies or leaves out (${columns.join(\", \")})`,\n\t\tsql: `SELECT (SELECT COUNT(*) FROM ${info}) = ${columns.length}${named}`\n\t};\n}\n/**\n* Checks that the table is stored as the statement the rebuild writes. SQLite keeps a table's\n* `CREATE TABLE` text as written, and renaming the rebuilt table only replaces its name, so this holds\n* once the rebuild ran and not before, whatever text an earlier table had. It is the only check of\n* what SQLite keeps in that text alone, such as `AUTOINCREMENT`.\n*/\nfunction rebuiltTableCheck(tableName, statement) {\n\treturn {\n\t\tdescription: `verify \"${tableName}\" is stored as the rebuilt table`,\n\t\tsql: `SELECT (SELECT sql FROM sqlite_master WHERE type = 'table' AND name = '${escapeLiteral(tableName)}') = '${escapeLiteral(statement)}'`\n\t};\n}\nfunction markedStep(tableName, check) {\n\tconst { requiredColumn, ...step } = check;\n\tconst meta = { ...requiredColumn === void 0 ? {} : requiredColumnMeta(tableName, requiredColumn.column, requiredColumn.reason) };\n\treturn Object.keys(meta).length === 0 ? step : {\n\t\t...step,\n\t\tmeta\n\t};\n}\n/**\n* The storage classes SQLite keeps a value in once a column of `typeSql` has taken it: the column's\n* type affinity converts what it can, so a value of another class is one it could not convert.\n* See https://www.sqlite.org/datatype3.html#determination_of_column_affinity.\n*/\nfunction affinityStorageClasses(typeSql) {\n\tconst declared = typeSql.toUpperCase();\n\tif (declared.includes(\"INT\")) return [\"integer\"];\n\tif ([\n\t\t\"CHAR\",\n\t\t\"CLOB\",\n\t\t\"TEXT\"\n\t].some((part) => declared.includes(part))) return [\"text\"];\n\tif (declared === \"\" || declared.includes(\"BLOB\")) return [\"blob\"];\n\tif ([\n\t\t\"REAL\",\n\t\t\"FLOA\",\n\t\t\"DOUB\"\n\t].some((part) => declared.includes(part))) return [\"real\"];\n\treturn [\"integer\", \"real\"];\n}\n/**\n* The check that the copy into a rebuilt table converted every value of a retyped column to the\n* column's new type. SQLite keeps a value it cannot convert in its old storage class, so a value of\n* any other class than the column's affinity keeps fails the check.\n*/\nfunction storageClassCheck(tableName, column) {\n\tconst classes = [\"null\", ...affinityStorageClasses(column.typeSql)].map((storageClass) => `'${storageClass}'`).join(\", \");\n\treturn {\n\t\tdescription: `verify every value of \"${column.name}\" on \"${tableName}\" is stored as ${column.typeSql}`,\n\t\tsql: `SELECT NOT EXISTS (SELECT 1 FROM ${quoteIdentifier(tableName)} WHERE typeof(${quoteIdentifier(column.name)}) NOT IN (${classes}))`\n\t};\n}\nconst ConversionCopyMeta = type({ conversionCopy: {\n\ttable: \"string\",\n\texpressions: \"Record<string, string>\"\n} });\n/**\n* The table a rebuild's copy step reads and the copy expression of each column its conversions\n* convert, when the step converts any: an error of the step may be an error of one of them.\n*/\nfunction conversionCopyOf(step) {\n\tconst meta = ConversionCopyMeta(step.meta ?? {});\n\treturn meta instanceof type.errors ? void 0 : meta.conversionCopy;\n}\nfunction renderSpecDefaults(spec, tableName, lowerer) {\n\treturn Promise.all(spec.columns.map((column) => renderSpecDefault$1(column, tableName, lowerer)));\n}\n/**\n* Checks the column's default is the text of its `DEFAULT …` clause. SQLite's\n* `pragma_table_info.dflt_value` strips the outer parentheses of an expression\n* default, so `(strftime('%Y-%m-%dT%H:%M:%fZ','now'))` is stored as `strftime('%Y-%m-%dT%H:%M:%fZ','now')`; they are\n* stripped here too.\n*/\nfunction defaultPostcheck(tableName, check, clause) {\n\tif (clause === void 0 || !clause.startsWith(\"DEFAULT \")) return [];\n\tconst expectedRaw = stripOuterParens(clause.slice(8));\n\treturn [{\n\t\tdescription: check.description,\n\t\tsql: `SELECT COUNT(*) > 0 FROM pragma_table_info('${escapeLiteral(tableName)}') WHERE name = '${escapeLiteral(check.columnDefault)}' AND dflt_value = '${escapeLiteral(expectedRaw)}'`\n\t}];\n}\n/**\n* Build a one-line summary of a recreate-table operation from the schema-diff\n* issues that triggered it. Lives next to `recreateTable` so the planner\n* (which has the issues) can produce the same description the factory\n* used to build inline. Keeping the formatting target-side keeps\n* `RecreateTableCall` issue-free at the IR layer. `SchemaDiffIssue` carries\n* no rendered message, so this renders one from each issue's path.\n*/\nfunction buildRecreateSummary(tableName, issues) {\n\treturn `Recreates table ${tableName} to apply schema changes: ${issues.map((i) => i.path.join(\"/\")).join(\"; \")}`;\n}\nfunction nodeKindOf(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node).nodeKind;\n}\n/** Mirrors `SqlColumnIR.isEqualTo`'s type comparison, isolated so a `not-equal` column issue's postcheck can target type drift and nullability drift independently. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* Returns the columns the contract expects as the table's primary key. Picks\n* up SQLite's inline `INTEGER PRIMARY KEY AUTOINCREMENT` form when no\n* explicit `primaryKey` clause is set on the spec.\n*/\nfunction expectedPrimaryKeyColumns(spec) {\n\tif (spec.primaryKey) return spec.primaryKey.columns;\n\tconst inlinePk = spec.columns.find((c) => c.inlineAutoincrementPrimaryKey);\n\treturn inlinePk ? [inlinePk.name] : [];\n}\n/** The text `pragma_foreign_key_list` reports for a referential action; SQLite reads an absent action as `NO ACTION`. */\nfunction referentialActionText(action) {\n\treturn REFERENTIAL_ACTION_SQL[action ?? \"noAction\"];\n}\nfunction quoteSqlList(values) {\n\treturn values.map((v) => `'${escapeLiteral(v)}'`).join(\", \");\n}\n/**\n* A condition on the index aliased `l`: it covers exactly these columns. Order is not checked, because SQLite identifies a unique index by its column set.\n*/\nfunction indexCoversExactly(columns) {\n\treturn `(SELECT COUNT(*) FROM pragma_index_info(l.name)) = ${columns.length} AND (SELECT COUNT(*) FROM pragma_index_info(l.name) WHERE name IN (${quoteSqlList(columns)})) = ${columns.length}`;\n}\nfunction columnNameFromNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node).name;\n}\n/**\n* A column-default issue's own node has no back-reference to its owning\n* column — it's a transient child built by `SqlColumnIR.children()`. The\n* column's id (`column:<name>`) is always the diff path's second-to-last\n* segment for a default issue (`[..., tableId, columnId, 'default']`), so\n* the name is recovered from the path rather than the node.\n*/\nfunction columnNameFromDefaultIssuePath(issue) {\n\tconst columnId = issue.path[issue.path.length - 2];\n\tif (columnId === void 0) return void 0;\n\treturn columnId.startsWith(\"column:\") ? columnId.slice(7) : columnId;\n}\n/**\n* Per-issue postchecks verifying the recreated table's shape against the\n* expected spec. Column-level issues (`sql-column` `not-equal`,\n* `sql-column-default` any reason) emit one targeted check each;\n* constraint-level issues (`sql-primary-key`, `sql-unique`, `sql-foreign-key`,\n* any reason) emit one `pragma_*`-driven check per declared constraint in the\n* expected spec, so a recreated table with the right columns but the wrong\n* PK / unique / FK shape fails the postcheck instead of passing silently.\n* Exported so the planner can pre-build the list at construction time and\n* `RecreateTableCall` doesn't have to carry `SchemaDiffIssue` objects through\n* to render time.\n*/\nfunction buildRecreatePostchecks(tableName, issues, spec, copiedColumns = /* @__PURE__ */ new Set(), backfilledColumns = /* @__PURE__ */ new Set()) {\n\tconst checks = [];\n\tconst t = escapeLiteral(tableName);\n\tconst byName = new Map(spec.columns.map((c) => [c.name, c]));\n\tlet hasPkIssue = false;\n\tlet hasUniqueIssue = false;\n\tlet hasFkIssue = false;\n\tfor (const issue of issues) {\n\t\tconst nodeKind = nodeKindOf(issue);\n\t\tif (nodeKind === RelationalSchemaNodeKind.column && issueOutcome(issue) === \"not-found\") {\n\t\t\tconst columnName = columnNameFromNode(issue);\n\t\t\tconst column = columnName === void 0 ? void 0 : byName.get(columnName);\n\t\t\tif (columnName === void 0 || column === void 0) continue;\n\t\t\tconst takesNoValue = !column.nullable && column.default === void 0 && !copiedColumns.has(columnName);\n\t\t\tchecks.push({\n\t\t\t\tdescription: `verify \"${columnName}\" nullability on \"${tableName}\"`,\n\t\t\t\tsql: `SELECT COUNT(*) > 0 FROM pragma_table_info('${t}') WHERE name = '${escapeLiteral(columnName)}' AND \"notnull\" = ${column.nullable ? 0 : 1}`,\n\t\t\t\t...backfilledColumns.has(columnName) ? { requiredColumn: {\n\t\t\t\t\tcolumn: columnName,\n\t\t\t\t\treason: \"backfillMissedRows\"\n\t\t\t\t} } : takesNoValue ? { requiredColumn: {\n\t\t\t\t\tcolumn: columnName,\n\t\t\t\t\treason: \"newField\"\n\t\t\t\t} } : {}\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (nodeKind === RelationalSchemaNodeKind.column && issueOutcome(issue) === \"not-equal\") {\n\t\t\tconst columnName = columnNameFromNode(issue);\n\t\t\tif (columnName === void 0) continue;\n\t\t\tconst c = escapeLiteral(columnName);\n\t\t\tconst expected = blindCast(issue.expected);\n\t\t\tconst actual = blindCast(issue.actual);\n\t\t\tif (expected.nullable !== actual.nullable) checks.push({\n\t\t\t\tdescription: `verify \"${columnName}\" nullability on \"${tableName}\"`,\n\t\t\t\tsql: `SELECT COUNT(*) > 0 FROM pragma_table_info('${t}') WHERE name = '${c}' AND \"notnull\" = ${expected.nullable ? 0 : 1}`,\n\t\t\t\t...expected.nullable ? {} : { requiredColumn: {\n\t\t\t\t\tcolumn: columnName,\n\t\t\t\t\treason: backfilledColumns.has(columnName) ? \"backfillMissedRows\" : \"nullValues\"\n\t\t\t\t} }\n\t\t\t});\n\t\t\tif (columnTypeChanged(expected, actual)) {\n\t\t\t\tconst colSpec = byName.get(columnName);\n\t\t\t\tif (colSpec) checks.push({\n\t\t\t\t\tdescription: `verify \"${columnName}\" type on \"${tableName}\"`,\n\t\t\t\t\tsql: `SELECT COUNT(*) > 0 FROM pragma_table_info('${t}') WHERE name = '${c}' AND LOWER(type) = '${escapeLiteral(colSpec.typeSql.toLowerCase())}'`\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (nodeKind === RelationalSchemaNodeKind.columnDefault) {\n\t\t\tconst columnName = columnNameFromDefaultIssuePath(issue);\n\t\t\tif (columnName === void 0) continue;\n\t\t\tconst c = escapeLiteral(columnName);\n\t\t\tif (issueOutcome(issue) === \"not-expected\") {\n\t\t\t\tchecks.push({\n\t\t\t\t\tdescription: `verify \"${columnName}\" has no default on \"${tableName}\"`,\n\t\t\t\t\tsql: `SELECT COUNT(*) > 0 FROM pragma_table_info('${t}') WHERE name = '${c}' AND dflt_value IS NULL`\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (byName.get(columnName)?.default !== void 0) checks.push({\n\t\t\t\tdescription: `verify \"${columnName}\" default on \"${tableName}\"`,\n\t\t\t\tcolumnDefault: columnName\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (nodeKind === RelationalSchemaNodeKind.primaryKey) hasPkIssue = true;\n\t\tif (nodeKind === RelationalSchemaNodeKind.unique) hasUniqueIssue = true;\n\t\tif (nodeKind === RelationalSchemaNodeKind.foreignKey) hasFkIssue = true;\n\t}\n\tif (hasPkIssue) {\n\t\tconst pkColumns = expectedPrimaryKeyColumns(spec);\n\t\tconst colCount = pkColumns.length;\n\t\tif (colCount === 0) checks.push({\n\t\t\tdescription: `verify \"${tableName}\" has no primary key`,\n\t\t\tsql: `SELECT (SELECT COUNT(*) FROM pragma_table_info('${t}') WHERE pk > 0) = 0`\n\t\t});\n\t\telse checks.push({\n\t\t\tdescription: `verify primary key on \"${tableName}\"`,\n\t\t\tsql: `SELECT (SELECT COUNT(*) FROM pragma_table_info('${t}') WHERE pk > 0) = ${colCount} AND (SELECT COUNT(*) FROM pragma_table_info('${t}') WHERE pk > 0 AND name IN (${quoteSqlList(pkColumns)})) = ${colCount}`\n\t\t});\n\t}\n\tif (hasUniqueIssue) for (const u of spec.uniques ?? []) {\n\t\tconst description = u.name ? `verify unique constraint \"${u.name}\" on \"${tableName}\"` : `verify unique constraint (${u.columns.join(\", \")}) on \"${tableName}\"`;\n\t\tchecks.push({\n\t\t\tdescription,\n\t\t\tsql: `SELECT EXISTS (SELECT 1 FROM pragma_index_list('${t}') l WHERE l.\"unique\" = 1 AND ${indexCoversExactly(u.columns)})`\n\t\t});\n\t}\n\tif (hasUniqueIssue) {\n\t\tconst expected = (spec.uniques ?? []).map((u) => `(${indexCoversExactly(u.columns)})`);\n\t\tchecks.push({\n\t\t\tdescription: `verify \"${tableName}\" has no unique constraint besides the expected ones`,\n\t\t\tsql: `SELECT NOT EXISTS (SELECT 1 FROM pragma_index_list('${t}') l WHERE l.origin = 'u' AND NOT (${expected.length === 0 ? \"0\" : expected.join(\" OR \")}))`\n\t\t});\n\t}\n\tif (hasFkIssue) {\n\t\tfor (const fk of spec.foreignKeys ?? []) {\n\t\t\tconst refTable = escapeLiteral(fk.references.table);\n\t\t\tconst colCount = fk.columns.length;\n\t\t\tconst tuples = fk.columns.map((from, i) => {\n\t\t\t\tconst to = fk.references.columns[i] ?? from;\n\t\t\t\treturn `('${escapeLiteral(from)}', '${escapeLiteral(to)}')`;\n\t\t\t}).join(\", \");\n\t\t\tconst description = `verify foreign key (${fk.columns.join(\", \")}) → ${fk.references.table}(${fk.references.columns.join(\", \")}) on \"${tableName}\"`;\n\t\t\tchecks.push({\n\t\t\t\tdescription,\n\t\t\t\tsql: `SELECT EXISTS (SELECT 1 FROM pragma_foreign_key_list('${t}') f WHERE f.\"table\" = '${refTable}' AND f.on_delete = '${referentialActionText(fk.onDelete)}' AND f.on_update = '${referentialActionText(fk.onUpdate)}' GROUP BY f.id HAVING COUNT(*) = ${colCount} AND SUM(CASE WHEN (f.\"from\", f.\"to\") IN (${tuples}) THEN 1 ELSE 0 END) = ${colCount})`\n\t\t\t});\n\t\t}\n\t\tconst expected = spec.foreignKeys?.length ?? 0;\n\t\tchecks.push({\n\t\t\tdescription: `verify \"${tableName}\" has exactly ${expected} foreign keys`,\n\t\t\tsql: `SELECT (SELECT COUNT(DISTINCT id) FROM pragma_foreign_key_list('${t}')) = ${expected}`\n\t\t});\n\t}\n\treturn checks;\n}\n//#endregion\n//#region src/core/migrations/op-factory-call.ts\nconst TARGET_MIGRATION_MODULE = \"@internal/sqlite/migration\";\nvar SqliteOpFactoryCallNode = class extends TsExpression {\n\t/** The operations this call lowers to, in order: one, unless the call carries companions. */\n\ttoOps(lowerer) {\n\t\treturn [this.toOp(lowerer)];\n\t}\n\timportRequirements() {\n\t\treturn [{\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: this.factoryName\n\t\t}];\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n};\n/** Whether `call` is one of this target's calls, which lower through {@link SqliteOpFactoryCallNode.toOps}. */\nfunction isSqliteOpFactoryCall(call) {\n\treturn call instanceof SqliteOpFactoryCallNode;\n}\nfunction renderDdlColumnDefault(def, sql) {\n\tif (!def) return \"\";\n\tif (def.kind === \"literal\") return `lit(${jsonToTsSource(def.value)})`;\n\treturn `fn(${sql.source(def.expression.text)})`;\n}\nfunction renderDdlColumnAsTsCall(column, sql) {\n\tconst opts = [];\n\tif (column.notNull) opts.push(\"notNull: true\");\n\tif (column.primaryKey) opts.push(\"primaryKey: true\");\n\tif (column.default) opts.push(`default: ${renderDdlColumnDefault(column.default, sql)}`);\n\tif (column.codecRef) opts.push(`codecRef: ${jsonToTsSource(column.codecRef)}`);\n\tconst optsStr = opts.length > 0 ? `, { ${opts.join(\", \")} }` : \"\";\n\treturn `col(${jsonToTsSource(column.name)}, ${jsonToTsSource(column.type)}${optsStr})`;\n}\nfunction renderDdlConstraintAsTsCall(constraint) {\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": {\n\t\t\tconst nameOpt = constraint.name ? `, { name: ${jsonToTsSource(constraint.name)} }` : \"\";\n\t\t\treturn `primaryKey(${jsonToTsSource(constraint.columns)}${nameOpt})`;\n\t\t}\n\t\tcase \"foreign-key\": {\n\t\t\tconst opts = [];\n\t\t\tif (constraint.name) opts.push(`name: ${jsonToTsSource(constraint.name)}`);\n\t\t\tif (constraint.onDelete) opts.push(`onDelete: ${jsonToTsSource(constraint.onDelete)}`);\n\t\t\tif (constraint.onUpdate) opts.push(`onUpdate: ${jsonToTsSource(constraint.onUpdate)}`);\n\t\t\tconst optsStr = opts.length > 0 ? `, { ${opts.join(\", \")} }` : \"\";\n\t\t\treturn `foreignKey(${jsonToTsSource(constraint.columns)}, ${jsonToTsSource(constraint.refTable)}, ${jsonToTsSource(constraint.refColumns)}${optsStr})`;\n\t\t}\n\t\tcase \"unique\": {\n\t\t\tconst nameOpt = constraint.name ? `, { name: ${jsonToTsSource(constraint.name)} }` : \"\";\n\t\t\treturn `unique(${jsonToTsSource(constraint.columns)}${nameOpt})`;\n\t\t}\n\t\tcase \"check-expression\": throw sqliteError(\"CONTRACT.CONSTRAINT_INVALID\", `The SQLite target does not support CHECK constraints (constraint \"${constraint.name}\"). The \"checkConstraint\" capability is Postgres-only — remove the \"@@check\" / \"check()\" declaration, or target Postgres.`, { meta: { constraintName: constraint.name } });\n\t}\n}\nfunction constraintImportSymbols(constraints) {\n\tif (!constraints || constraints.length === 0) return [];\n\tconst symbols = /* @__PURE__ */ new Set();\n\tfor (const c of constraints) if (c.kind === \"primary-key\") symbols.add(\"primaryKey\");\n\telse if (c.kind === \"foreign-key\") symbols.add(\"foreignKey\");\n\telse if (c.kind === \"unique\") symbols.add(\"unique\");\n\treturn [...symbols];\n}\nfunction defaultImportSymbols(columns) {\n\tconst symbols = /* @__PURE__ */ new Set();\n\tfor (const col of columns) if (col.default?.kind === \"literal\") symbols.add(\"lit\");\n\telse if (col.default?.kind === \"function\") symbols.add(\"fn\");\n\treturn [...symbols];\n}\nfunction columnShapesOf(columns, constraints) {\n\tconst primaryKey = constraints?.find((constraint) => constraint.kind === \"primary-key\");\n\treturn columns.map((column) => {\n\t\tif (column.type.endsWith(\" PRIMARY KEY AUTOINCREMENT\")) return {\n\t\t\tname: column.name,\n\t\t\ttypeSql: column.type.slice(0, -26),\n\t\t\tnotNull: false,\n\t\t\tprimaryKeyPosition: 1\n\t\t};\n\t\treturn {\n\t\t\tname: column.name,\n\t\t\ttypeSql: column.type,\n\t\t\tnotNull: column.notNull === true,\n\t\t\tprimaryKeyPosition: column.primaryKey ? 1 : (primaryKey?.columns.indexOf(column.name) ?? -1) + 1\n\t\t};\n\t});\n}\nvar CreateTableCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"createTable\";\n\toperationClass = \"additive\";\n\ttableName;\n\tcolumns;\n\tconstraints;\n\tlabel;\n\tconstructor(tableName, columns, constraints) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columns = Object.freeze([...columns]);\n\t\tthis.constraints = constraints ? Object.freeze([...constraints]) : void 0;\n\t\tthis.label = `Create table ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `CreateTableCall.toOp: a DDL lowerer is required on the SQLite planner path (table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName\n\t\t} });\n\t\tconst ddlNode = createTable({\n\t\t\ttable: this.tableName,\n\t\t\tcolumns: this.columns,\n\t\t\t...ifDefined(\"constraints\", this.constraints)\n\t\t});\n\t\tconst statement = await lowerer.lowerToExecuteRequest(ddlNode);\n\t\tconst tableName = this.tableName;\n\t\tconst tableChecks = tableExistsAst(tableName);\n\t\tconst absent = await lowerer.lowerToExecuteRequest(tableChecks.tableAbsent());\n\t\tconst present = await lowerer.lowerToExecuteRequest(tableChecks.tablePresent());\n\t\treturn {\n\t\t\tid: `table.${tableName}`,\n\t\t\tlabel: `Create table ${tableName}`,\n\t\t\tsummary: `Creates table ${tableName} with required columns`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: \"sqlite\",\n\t\t\t\tdetails: buildTargetDetails(\"table\", tableName)\n\t\t\t},\n\t\t\tprecheck: [step(`ensure table \"${tableName}\" does not exist`, absent.sql, absent.params)],\n\t\t\texecute: [{\n\t\t\t\tdescription: `create table \"${tableName}\"`,\n\t\t\t\tsql: statement.sql,\n\t\t\t\tparams: statement.params ?? []\n\t\t\t}],\n\t\t\tpostcheck: [step(`verify table \"${tableName}\" exists`, present.sql, present.params), tableColumnsCheck(tableName, columnShapesOf(this.columns, this.constraints))]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(TARGET_MIGRATION_MODULE);\n\t\tconst columnsList = this.columns.map((column) => renderDdlColumnAsTsCall(column, sql)).join(\", \");\n\t\tconst constraintsList = this.constraints ? this.constraints.map(renderDdlConstraintAsTsCall).join(\", \") : void 0;\n\t\tconst opts = [];\n\t\topts.push(`table: ${jsonToTsSource(this.tableName)}`);\n\t\topts.push(`columns: [${columnsList}]`);\n\t\tif (constraintsList) opts.push(`constraints: [${constraintsList}]`);\n\t\treturn {\n\t\t\tsource: `this.createTable({ ${opts.join(\", \")} })`,\n\t\t\timports: sql.imports()\n\t\t};\n\t}\n\timportRequirements() {\n\t\tconst req = [];\n\t\tif (this.columns.length > 0) {\n\t\t\treq.push({\n\t\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\t\tsymbol: \"col\"\n\t\t\t});\n\t\t\tfor (const sym of defaultImportSymbols(this.columns)) req.push({\n\t\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\t\tsymbol: sym\n\t\t\t});\n\t\t}\n\t\tfor (const sym of constraintImportSymbols(this.constraints)) req.push({\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: sym\n\t\t});\n\t\treq.push(...this.#written().imports);\n\t\treturn req;\n\t}\n};\nvar DropTableCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"dropTable\";\n\toperationClass = \"destructive\";\n\ttableName;\n\tlabel;\n\tconstructor(tableName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.label = `Drop table ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `DropTableCall.toOp: a lowerer is required on the SQLite planner path (table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName\n\t\t} });\n\t\tconst checks = tableExistsAst(this.tableName);\n\t\tconst present = await lowerer.lowerToExecuteRequest(checks.tablePresent());\n\t\tconst absent = await lowerer.lowerToExecuteRequest(checks.tableAbsent());\n\t\treturn {\n\t\t\tid: `dropTable.${this.tableName}`,\n\t\t\tlabel: `Drop table ${this.tableName}`,\n\t\t\tsummary: `Drops table ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"destructive\",\n\t\t\ttarget: {\n\t\t\t\tid: \"sqlite\",\n\t\t\t\tdetails: buildTargetDetails(\"table\", this.tableName)\n\t\t\t},\n\t\t\tprecheck: [step(`ensure table \"${this.tableName}\" exists`, present.sql, present.params)],\n\t\t\texecute: [step(`drop table \"${this.tableName}\"`, `DROP TABLE ${quoteIdentifier(this.tableName)}`)],\n\t\t\tpostcheck: [step(`verify table \"${this.tableName}\" is gone`, absent.sql, absent.params)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropTable({ table: ${jsonToTsSource(this.tableName)} })`;\n\t}\n\timportRequirements() {\n\t\treturn [];\n\t}\n};\n/** The replaced indexes' drops, then their creates, since a create may take a dropped name. */\nfunction indexReplacementCalls(replacements) {\n\treturn [...replacements.map(({ drop }) => drop), ...replacements.map(({ create }) => create)];\n}\nvar RenameTableCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"renameTable\";\n\toperationClass = \"widening\";\n\toldTableName;\n\t/** The new name: the table's contract-side identity after the rename. */\n\ttableName;\n\tlabel;\n\t/** The indexes named after the old table, which SQLite cannot rename, so it replaces them. */\n\tindexReplacements;\n\t/**\n\t* The replacements' drops, then their creates. They run after the table rename and are never\n\t* rendered on their own.\n\t*/\n\tcompanions;\n\tconstructor(oldTableName, tableName, indexReplacements) {\n\t\tsuper();\n\t\tthis.oldTableName = oldTableName;\n\t\tthis.tableName = tableName;\n\t\tthis.label = `Rename table ${oldTableName} to ${tableName}`;\n\t\tthis.indexReplacements = Object.freeze([...indexReplacements]);\n\t\tthis.companions = Object.freeze(indexReplacementCalls(indexReplacements));\n\t\tthis.freeze();\n\t}\n\t/** The id of the operation this call lowers to. */\n\tget operationId() {\n\t\treturn `renameTable.${this.oldTableName}`;\n\t}\n\ttoOps(lowerer) {\n\t\treturn [this.toOp(lowerer), ...this.companions.map((companion) => companion.toOp(lowerer))];\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `RenameTableCall.toOp: a lowerer is required on the SQLite planner path (table \"${this.oldTableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.oldTableName\n\t\t} });\n\t\tconst fromChecks = tableExistsAst(this.oldTableName);\n\t\tconst toChecks = tableExistsAst(this.tableName);\n\t\tconst fromPresent = await lowerer.lowerToExecuteRequest(fromChecks.tablePresent());\n\t\tconst onlyCase = renameChangesOnlyCase(this.oldTableName, this.tableName);\n\t\tconst toAbsent = await lowerer.lowerToExecuteRequest(onlyCase ? toChecks.tableAbsent() : tableNameTakenAst(this.tableName).nameFree());\n\t\tconst viaName = renameTableViaName(this.tableName);\n\t\tconst viaAbsent = onlyCase ? await lowerer.lowerToExecuteRequest(tableExistsAst(viaName).tableAbsent()) : void 0;\n\t\tconst toPresent = await lowerer.lowerToExecuteRequest(toChecks.tablePresent());\n\t\tconst fromAbsent = await lowerer.lowerToExecuteRequest(fromChecks.tableAbsent());\n\t\treturn {\n\t\t\tid: this.operationId,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Renames table ${this.oldTableName} to ${this.tableName}, keeping its rows`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: \"sqlite\",\n\t\t\t\tdetails: buildTargetDetails(\"table\", this.tableName)\n\t\t\t},\n\t\t\tprecheck: [\n\t\t\t\tstep(`ensure table \"${this.oldTableName}\" exists`, fromPresent.sql, fromPresent.params),\n\t\t\t\tstep(onlyCase ? `ensure table \"${this.tableName}\" does not exist` : `ensure no table or index is named \"${this.tableName}\" in any case`, toAbsent.sql, toAbsent.params),\n\t\t\t\t...viaAbsent === void 0 ? [] : [step(`ensure table \"${viaName}\" does not exist (a rename that only changes case passes through this temporary name, because SQLite compares table names without case)`, viaAbsent.sql, viaAbsent.params)]\n\t\t\t],\n\t\t\texecute: renameTableSteps(this.oldTableName, this.tableName),\n\t\t\tpostcheck: [step(`verify table \"${this.tableName}\" exists`, toPresent.sql, toPresent.params), step(`verify table \"${this.oldTableName}\" no longer exists`, fromAbsent.sql, fromAbsent.params)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `...this.renameTable({ table: ${jsonToTsSource(this.oldTableName)}, to: ${jsonToTsSource(this.tableName)} })`;\n\t}\n\timportRequirements() {\n\t\treturn [];\n\t}\n};\nvar RenameColumnCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"renameColumn\";\n\toperationClass = \"widening\";\n\ttableName;\n\toldColumnName;\n\t/** The new name: the column's contract-side identity after the rename. */\n\tcolumnName;\n\tlabel;\n\t/** The indexes on the column whose wire names change, which SQLite cannot rename. */\n\tindexReplacements;\n\t/**\n\t* The replacements' drops, then their creates. They run after the column rename and are never\n\t* rendered on their own.\n\t*/\n\tcompanions;\n\tconstructor(tableName, oldColumnName, columnName, indexReplacements) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.oldColumnName = oldColumnName;\n\t\tthis.columnName = columnName;\n\t\tthis.label = `Rename column ${oldColumnName} on ${tableName} to ${columnName}`;\n\t\tthis.indexReplacements = Object.freeze([...indexReplacements]);\n\t\tthis.companions = Object.freeze(indexReplacementCalls(indexReplacements));\n\t\tthis.freeze();\n\t}\n\ttoOps(lowerer) {\n\t\treturn [this.toOp(lowerer), ...this.companions.map((companion) => companion.toOp(lowerer))];\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `RenameColumnCall.toOp: a lowerer is required on the SQLite planner path (column \"${this.oldColumnName}\" on table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName\n\t\t} });\n\t\treturn renameColumn(this.tableName, this.oldColumnName, this.columnName, lowerer);\n\t}\n\trenderTypeScript() {\n\t\treturn `...this.renameColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${jsonToTsSource(this.oldColumnName)}, to: ${jsonToTsSource(this.columnName)} })`;\n\t}\n\timportRequirements() {\n\t\treturn [];\n\t}\n};\nfunction refuseUnsafeCopyExpressions(tableName, option, expressions) {\n\tfor (const [column, expression] of Object.entries(expressions)) {\n\t\tif (expression.kind !== \"sql\") continue;\n\t\tconst refused = checkSqlExpressionText(expression.sql, SQLITE_QUOTING);\n\t\tif (refused === void 0) continue;\n\t\tconst call = `recreateTable({ tableName: ${jsonToTsSource(tableName)} })`;\n\t\tthrow sqliteError(\"MIGRATION.SQL_EXPRESSION_INVALID\", `${call}: ${option}.${column} ${JSON.stringify(expression.sql)} holds ${refused}, which could end or extend the INSERT … SELECT statement it is written into`, {\n\t\t\twhy: \"A copy expression or a temporary value is written into the SELECT that copies the rows into the rebuilt table. The check refuses a semicolon, a SQL comment, dollar quoting, and a comma or a statement keyword outside parentheses, since each could end or extend that statement; it does not check that the text is valid SQL.\",\n\t\t\tfix: `Write ${option}.${column} as one SQL expression over the old table's columns, such as CAST(\"${column}\" AS INTEGER). If it holds a comma or a keyword such as FROM outside parentheses, wrap it in parentheses.`,\n\t\t\tmeta: {\n\t\t\t\tcall,\n\t\t\t\tfield: `${option}.${column}`,\n\t\t\t\texpression: expression.sql,\n\t\t\t\trefused\n\t\t\t}\n\t\t});\n\t}\n}\nfunction refuseUnknownCopyExpressionColumns(tableName, contractTable, named) {\n\tconst columns = contractTable.columns.map((column) => column.name);\n\tconst unknown = [\n\t\t...Object.keys(named.copyExpressions).map((key) => ({\n\t\t\toption: `copyExpressions.${key}`,\n\t\t\tkey\n\t\t})),\n\t\t...Object.keys(named.temporaryValues).map((key) => ({\n\t\t\toption: `temporaryValues.${key}`,\n\t\t\tkey\n\t\t})),\n\t\t...named.retypedColumns.map((key) => ({\n\t\t\toption: `retypedColumns entry ${JSON.stringify(key)}`,\n\t\t\tkey\n\t\t}))\n\t].find(({ key }) => !columns.includes(key));\n\tif (unknown === void 0) return;\n\tconst call = `recreateTable({ tableName: ${jsonToTsSource(tableName)} })`;\n\tthrow sqliteError(\"MIGRATION.COPY_EXPRESSION_COLUMN_UNKNOWN\", `${call}: ${unknown.option} names no column of the new table. Its columns are ${columns.map((column) => JSON.stringify(column)).join(\", \")}.`, {\n\t\twhy: \"Each key of copyExpressions and temporaryValues, and each entry of retypedColumns, names a column of the new table. One that names no column applies to nothing, so the column meant would be copied unchanged or left without a value, or its values would go unchecked.\",\n\t\tfix: \"Name a column in contractTable.columns, with the same letters and case.\",\n\t\tmeta: {\n\t\t\tcall,\n\t\t\tkey: unknown.key,\n\t\t\tcolumns\n\t\t}\n\t});\n}\n/**\n* A temporary value fills a column the old table does not have, and only that: for a column the\n* old table has it would replace every existing value, and a column with a copy expression is\n* already filled by its conversion.\n*/\nfunction refuseMisplacedTemporaryValues(tableName, schemaColumnNames, copyExpressions, temporaryValues) {\n\tconst call = `recreateTable({ tableName: ${jsonToTsSource(tableName)} })`;\n\tfor (const column of Object.keys(temporaryValues)) {\n\t\tif (schemaColumnNames.includes(column)) throw sqliteError(\"MIGRATION.TEMPORARY_VALUE_INVALID\", `${call}: temporaryValues.${column} names a column the old table already has, so the copy would replace every value of it.`, {\n\t\t\twhy: \"A temporary value fills a new column in the existing rows. A column the old table has keeps its values through the copy, or is converted by a copy expression.\",\n\t\t\tfix: `Remove temporaryValues.${column}. To change the values of \"${column}\", write a conversion in copyExpressions.${column} instead.`,\n\t\t\tmeta: {\n\t\t\t\tcall,\n\t\t\t\tcolumn,\n\t\t\t\treason: \"existingColumn\"\n\t\t\t}\n\t\t});\n\t\tif (Object.hasOwn(copyExpressions, column)) throw sqliteError(\"MIGRATION.TEMPORARY_VALUE_INVALID\", `${call}: \"${column}\" is named in both copyExpressions and temporaryValues, so it would be filled twice.`, {\n\t\t\twhy: \"A column is filled either by the conversion in copyExpressions or by a temporary value, not both.\",\n\t\t\tfix: `Keep one of copyExpressions.${column} and temporaryValues.${column}.`,\n\t\t\tmeta: {\n\t\t\t\tcall,\n\t\t\t\tcolumn,\n\t\t\t\treason: \"alsoConverted\"\n\t\t\t}\n\t\t});\n\t}\n}\nfunction sqlOfSlots(slots) {\n\treturn Object.fromEntries(Object.entries(slots).flatMap(([column, slot]) => {\n\t\tconst sql = sqlOfSlot(slot);\n\t\treturn sql === void 0 ? [] : [[column, sql]];\n\t}));\n}\nvar RecreateTableCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"recreateTable\";\n\toperationClass;\n\ttableName;\n\tcontractTable;\n\tschemaColumnNames;\n\tindexes;\n\tsummary;\n\tpostchecks;\n\tlabel;\n\t/** The conversion each named column of the new table is copied through, in place of the live column. */\n\tcopyExpressions;\n\t/** The value each named new column takes in the existing rows. */\n\ttemporaryValues;\n\t/** 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. */\n\tretypedColumns;\n\tconstructor(args) {\n\t\tsuper();\n\t\trefuseUnsafeCopyExpressions(args.tableName, \"copyExpressions\", args.copyExpressions ?? {});\n\t\trefuseUnsafeCopyExpressions(args.tableName, \"temporaryValues\", args.temporaryValues ?? {});\n\t\trefuseUnknownCopyExpressionColumns(args.tableName, args.contractTable, {\n\t\t\tcopyExpressions: args.copyExpressions ?? {},\n\t\t\ttemporaryValues: args.temporaryValues ?? {},\n\t\t\tretypedColumns: args.retypedColumns ?? []\n\t\t});\n\t\trefuseMisplacedTemporaryValues(args.tableName, args.schemaColumnNames, args.copyExpressions ?? {}, args.temporaryValues ?? {});\n\t\tthis.copyExpressions = Object.freeze({ ...args.copyExpressions });\n\t\tthis.temporaryValues = Object.freeze({ ...args.temporaryValues });\n\t\tthis.retypedColumns = Object.freeze([...args.retypedColumns ?? []]);\n\t\tthis.tableName = args.tableName;\n\t\tthis.contractTable = args.contractTable;\n\t\tthis.schemaColumnNames = args.schemaColumnNames;\n\t\tthis.indexes = args.indexes;\n\t\tthis.summary = args.summary;\n\t\tthis.postchecks = args.postchecks;\n\t\tthis.operationClass = args.operationClass;\n\t\tthis.label = `Recreate table ${args.tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `RecreateTableCall.toOp: a lowerer is required on the SQLite planner path (table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName\n\t\t} });\n\t\tconst copies = Object.entries(this.copyExpressions);\n\t\tif (copies.some(([, expression]) => isUnfilledSlot(expression))) return unfilledPlaceholderOperation(this.label);\n\t\treturn recreateTable({\n\t\t\ttableName: this.tableName,\n\t\t\tcontractTable: this.contractTable,\n\t\t\tschemaColumnNames: this.schemaColumnNames,\n\t\t\tindexes: this.indexes,\n\t\t\tsummary: this.summary,\n\t\t\tpostchecks: this.postchecks,\n\t\t\toperationClass: this.operationClass,\n\t\t\tretypedColumns: this.retypedColumns,\n\t\t\t...copies.length === 0 ? {} : { copyExpressions: sqlOfSlots(this.copyExpressions) },\n\t\t\t...Object.keys(this.temporaryValues).length === 0 ? {} : { temporaryValues: sqlOfSlots(this.temporaryValues) }\n\t\t}, lowerer);\n\t}\n\t#slotsSource(slots, sql) {\n\t\treturn `{ ${Object.entries(slots).map(([column, expression]) => `${jsonToTsSource(column)}: ${slotSource(expression, sql)}`).join(\", \")} }`;\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\timportRequirements() {\n\t\treturn [...Object.values(this.copyExpressions).some(isUnfilledSlot) ? [{\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: \"placeholder\"\n\t\t}] : [], ...this.#written().imports];\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(TARGET_MIGRATION_MODULE);\n\t\treturn {\n\t\t\tsource: `this.recreateTable(${tsObjectSource([\n\t\t\t\t[\"tableName\", jsonToTsSource(this.tableName)],\n\t\t\t\t[\"contractTable\", renderTableSpec(this.contractTable, sql)],\n\t\t\t\t[\"schemaColumnNames\", jsonToTsSource(this.schemaColumnNames)],\n\t\t\t\t[\"indexes\", jsonToTsSource(this.indexes)],\n\t\t\t\t[\"summary\", jsonToTsSource(this.summary)],\n\t\t\t\t[\"postchecks\", tsArraySource(this.postchecks.map(renderPostcheck))],\n\t\t\t\t[\"operationClass\", jsonToTsSource(this.operationClass)],\n\t\t\t\t...Object.keys(this.copyExpressions).length === 0 ? [] : [[\"copyExpressions\", this.#slotsSource(this.copyExpressions, sql)]],\n\t\t\t\t...Object.keys(this.temporaryValues).length === 0 ? [] : [[\"temporaryValues\", this.#slotsSource(this.temporaryValues, sql)]],\n\t\t\t\t...this.retypedColumns.length === 0 ? [] : [[\"retypedColumns\", jsonToTsSource(this.retypedColumns)]]\n\t\t\t])})`,\n\t\t\timports: sql.imports()\n\t\t};\n\t}\n};\nvar AddColumnCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"addColumn\";\n\toperationClass = \"additive\";\n\ttableName;\n\tcolumnName;\n\tcolumn;\n\tlabel;\n\tconstructor(tableName, column) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columnName = column.name;\n\t\tthis.column = column;\n\t\tthis.label = `Add column ${column.name} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `AddColumnCall.toOp: a lowerer is required on the SQLite planner path (column \"${this.column.name}\" on table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName,\n\t\t\tcolumnName: this.column.name\n\t\t} });\n\t\treturn addColumn(this.tableName, this.column, lowerer);\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\timportRequirements() {\n\t\treturn this.#written().imports;\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(TARGET_MIGRATION_MODULE);\n\t\treturn {\n\t\t\tsource: `this.addColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${renderColumnSpec(this.column, sql)} })`,\n\t\t\timports: sql.imports()\n\t\t};\n\t}\n};\nvar DropColumnCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"dropColumn\";\n\toperationClass = \"destructive\";\n\ttableName;\n\tcolumnName;\n\tlabel;\n\tconstructor(tableName, columnName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columnName = columnName;\n\t\tthis.label = `Drop column ${columnName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `DropColumnCall.toOp: a lowerer is required on the SQLite planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName,\n\t\t\tcolumnName: this.columnName\n\t\t} });\n\t\tconst checks = columnExistsAst(this.tableName, this.columnName);\n\t\tconst present = await lowerer.lowerToExecuteRequest(checks.columnPresent());\n\t\tconst absent = await lowerer.lowerToExecuteRequest(checks.columnAbsent());\n\t\treturn {\n\t\t\tid: `dropColumn.${this.tableName}.${this.columnName}`,\n\t\t\tlabel: `Drop column ${this.columnName} on ${this.tableName}`,\n\t\t\tsummary: `Drops column ${this.columnName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"destructive\",\n\t\t\ttarget: {\n\t\t\t\tid: \"sqlite\",\n\t\t\t\tdetails: buildTargetDetails(\"column\", this.columnName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [step(`ensure column \"${this.columnName}\" exists on \"${this.tableName}\"`, present.sql, present.params)],\n\t\t\texecute: [step(`drop column \"${this.columnName}\" from \"${this.tableName}\"`, dropColumnExecuteSql(this.tableName, this.columnName))],\n\t\t\tpostcheck: [step(`verify column \"${this.columnName}\" is gone from \"${this.tableName}\"`, absent.sql, absent.params)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${jsonToTsSource(this.columnName)} })`;\n\t}\n\timportRequirements() {\n\t\treturn [];\n\t}\n};\nvar CreateIndexCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"createIndex\";\n\toperationClass = \"additive\";\n\ttableName;\n\tindexName;\n\tcolumns;\n\tlabel;\n\tconstructor(tableName, indexName, columns) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.indexName = indexName;\n\t\tthis.columns = columns;\n\t\tthis.label = `Create index ${indexName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\t/** The id of the operation this call lowers to. */\n\tget operationId() {\n\t\treturn `index.${this.tableName}.${this.indexName}`;\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `CreateIndexCall.toOp: a lowerer is required on the SQLite planner path (index \"${this.indexName}\" on table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName,\n\t\t\tindexName: this.indexName\n\t\t} });\n\t\tconst checks = indexExistsAst(this.indexName);\n\t\tconst absent = await lowerer.lowerToExecuteRequest(checks.indexAbsent());\n\t\tconst present = await lowerer.lowerToExecuteRequest(checks.indexPresent());\n\t\treturn {\n\t\t\tid: this.operationId,\n\t\t\tlabel: `Create index ${this.indexName} on ${this.tableName}`,\n\t\t\tsummary: `Creates index ${this.indexName} on ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: \"sqlite\",\n\t\t\t\tdetails: buildTargetDetails(\"index\", this.indexName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [step(`ensure index \"${this.indexName}\" is missing`, absent.sql, absent.params)],\n\t\t\texecute: [step(`create index \"${this.indexName}\"`, buildCreateIndexSql(this.tableName, this.indexName, this.columns))],\n\t\t\tpostcheck: [step(`verify index \"${this.indexName}\" exists`, present.sql, present.params), indexDefinitionCheck(this.tableName, this.indexName, this.columns, false)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.createIndex({ table: ${jsonToTsSource(this.tableName)}, index: ${jsonToTsSource(this.indexName)}, columns: ${jsonToTsSource(this.columns)} })`;\n\t}\n\timportRequirements() {\n\t\treturn [];\n\t}\n};\nvar DropIndexCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"dropIndex\";\n\toperationClass = \"widening\";\n\ttableName;\n\tindexName;\n\tlabel;\n\tconstructor(tableName, indexName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.indexName = indexName;\n\t\tthis.label = `Drop index ${indexName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\t/** The id of the operation this call lowers to. */\n\tget operationId() {\n\t\treturn `dropIndex.${this.tableName}.${this.indexName}`;\n\t}\n\tasync toOp(lowerer) {\n\t\tif (lowerer === void 0) throw sqliteError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `DropIndexCall.toOp: a lowerer is required on the SQLite planner path (index \"${this.indexName}\" on table \"${this.tableName}\"). Pass the control adapter to createSqliteMigrationPlanner.`, { meta: {\n\t\t\tfactory: this.factoryName,\n\t\t\ttableName: this.tableName,\n\t\t\tindexName: this.indexName\n\t\t} });\n\t\tconst checks = indexExistsAst(this.indexName);\n\t\tconst present = await lowerer.lowerToExecuteRequest(checks.indexPresent());\n\t\tconst absent = await lowerer.lowerToExecuteRequest(checks.indexAbsent());\n\t\treturn {\n\t\t\tid: this.operationId,\n\t\t\tlabel: `Drop index ${this.indexName} on ${this.tableName}`,\n\t\t\tsummary: `Drops index ${this.indexName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: \"sqlite\",\n\t\t\t\tdetails: buildTargetDetails(\"index\", this.indexName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [step(`ensure index \"${this.indexName}\" exists`, present.sql, present.params)],\n\t\t\texecute: [step(`drop index \"${this.indexName}\"`, buildDropIndexSql(this.indexName))],\n\t\t\tpostcheck: [step(`verify index \"${this.indexName}\" is gone`, absent.sql, absent.params)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropIndex({ table: ${jsonToTsSource(this.tableName)}, index: ${jsonToTsSource(this.indexName)} })`;\n\t}\n\timportRequirements() {\n\t\treturn [];\n\t}\n};\n/**\n* A planner-generated data-transform stub. The current default strategy\n* (`nullabilityTighteningBackfillStrategy`) emits one of these with a\n* backfill-flavored `id`/`label` when the policy allows `'data'` and the\n* contract tightens a column's nullability, but the op itself is generic —\n* any future strategy that needs a placeholder data step can construct one\n* with its own id/label.\n*\n* `toOp()` always rejects with `MIGRATION.UNFILLED_PLACEHOLDER`: the planner cannot lower a stubbed\n* transform to a runtime op — the user must edit the rendered\n* `migration.ts` and re-emit.\n*/\nvar DataTransformCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"dataTransform\";\n\toperationClass = \"data\";\n\tid;\n\tlabel;\n\ttableName;\n\tcolumnName;\n\t/** The slot the user fills with the statement that fills the column: `<Model.field>:run`. */\n\tslot;\n\tconstructor(id, label, tableName, columnName, slot) {\n\t\tsuper();\n\t\tthis.id = id;\n\t\tthis.label = label;\n\t\tthis.tableName = tableName;\n\t\tthis.columnName = columnName;\n\t\tthis.slot = slot;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer) {\n\t\treturn unfilledPlaceholderOperation(this.label);\n\t}\n\trenderTypeScript() {\n\t\tconst slot = this.slot;\n\t\treturn [\n\t\t\t\"dataTransform({\",\n\t\t\t` id: ${jsonToTsSource(this.id)},`,\n\t\t\t` label: ${jsonToTsSource(this.label)},`,\n\t\t\t` table: ${jsonToTsSource(this.tableName)},`,\n\t\t\t` description: ${jsonToTsSource(`Backfill NULL ${this.columnName} values in ${this.tableName}`)},`,\n\t\t\t` run: () => placeholder(${jsonToTsSource(slot)}),`,\n\t\t\t\"})\"\n\t\t].join(\"\\n\");\n\t}\n\timportRequirements() {\n\t\treturn [{\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: this.factoryName\n\t\t}, {\n\t\t\tmoduleSpecifier: TARGET_MIGRATION_MODULE,\n\t\t\tsymbol: \"placeholder\"\n\t\t}];\n\t}\n};\n/**\n* Laundered pre-built operation. Mirrors Postgres's `RawSqlCall`: wraps an\n* already-materialized `SqlMigrationPlanOperation` (typically produced by a\n* SQL-family helper or a codec lifecycle hook) so the planner can carry it\n* alongside structured call IR. `toOp()` returns the stored op unchanged;\n* `renderTypeScript()` emits `rawSql({...})` with the op serialized as a\n* JSON literal — round-tripping requires every field on the op to be\n* JSON-serializable (no closures).\n*/\nvar RawSqlCall = class extends SqliteOpFactoryCallNode {\n\tfactoryName = \"rawSql\";\n\toperationClass;\n\tlabel;\n\top;\n\tconstructor(op) {\n\t\tsuper();\n\t\tthis.op = op;\n\t\tthis.label = op.label;\n\t\tthis.operationClass = op.operationClass;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer) {\n\t\treturn this.op;\n\t}\n\trenderTypeScript() {\n\t\treturn `rawSql(${jsonToTsSource(this.op)})`;\n\t}\n};\nfunction definedSourceEntries(sources) {\n\treturn Object.entries(sources).flatMap(([key, source]) => source === void 0 ? [] : [[key, source]]);\n}\nfunction renderIfDefined(value) {\n\treturn value === void 0 ? void 0 : jsonToTsSource(value);\n}\nfunction renderColumnSpec(column, sql) {\n\treturn tsObjectSource(definedSourceEntries({\n\t\tname: jsonToTsSource(column.name),\n\t\ttypeSql: jsonToTsSource(column.typeSql),\n\t\tdefault: column.default === void 0 ? void 0 : renderSpecDefault(column.default, sql),\n\t\tcodecRef: renderIfDefined(column.codecRef),\n\t\tnullable: jsonToTsSource(column.nullable),\n\t\tinlineAutoincrementPrimaryKey: renderIfDefined(column.inlineAutoincrementPrimaryKey)\n\t}));\n}\nfunction renderTableSpec(table, sql) {\n\treturn tsObjectSource(definedSourceEntries({\n\t\tcolumns: tsArraySource(table.columns.map((column) => renderColumnSpec(column, sql))),\n\t\tprimaryKey: renderIfDefined(table.primaryKey),\n\t\tuniques: renderIfDefined(table.uniques),\n\t\tforeignKeys: renderIfDefined(table.foreignKeys)\n\t}));\n}\nfunction renderSpecDefault(columnDefault, sql) {\n\tif (columnDefault.kind === \"literal\") return jsonToTsSource(columnDefault);\n\treturn tsObjectSource(definedSourceEntries({\n\t\tkind: jsonToTsSource(columnDefault.kind),\n\t\texpression: sql.source(columnDefault.expression)\n\t}));\n}\nfunction renderPostcheck(postcheck) {\n\tif (\"sql\" in postcheck) return tsObjectSource(definedSourceEntries({\n\t\tdescription: jsonToTsSource(postcheck.description),\n\t\tsql: tsQuotedTextSource(postcheck.sql),\n\t\trequiredColumn: postcheck.requiredColumn === void 0 ? void 0 : jsonToTsSource(postcheck.requiredColumn)\n\t}));\n\treturn tsObjectSource(definedSourceEntries({\n\t\tdescription: jsonToTsSource(postcheck.description),\n\t\tcolumnDefault: jsonToTsSource(postcheck.columnDefault)\n\t}));\n}\n//#endregion\nexport { sqliteIdentifiersCollide as C, step as S, renderDefaultLiteral as T, conversionCopyOf as _, DropColumnCall as a, INLINE_AUTOINCREMENT_PRIMARY_KEY as b, RawSqlCall as c, RenameTableCall as d, indexReplacementCalls as f, buildRecreateSummary as g, buildRecreatePostchecks as h, DataTransformCall as i, RecreateTableCall as l, affinityStorageClasses as m, CreateIndexCall as n, DropIndexCall as o, isSqliteOpFactoryCall as p, CreateTableCall as r, DropTableCall as s, AddColumnCall as t, RenameColumnCall as u, rebuiltTableName as v, buildColumnTypeSql as w, sqliteDefaultToDdlColumnDefault as x, renameTableSteps as y };\n\n//# sourceMappingURL=op-factory-call-DOyJsczD.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,mBAAmB,QAAQ,OAAO,eAAe,CAAC,GAAG;CAC7D,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,MAAM,WAAW,mBAAmB,SAAS,SAAS,KAAK;CAC3D,OAAO,kBAAkB,UAAU,eAAe,UAAU,SAAS,UAAU,CAAC,CAAC,CAAC,YAAY;AAC/F;AACA,MAAM,aAAa;;;;;;;AAOnB,SAAS,qBAAqB,OAAO,QAAQ;CAC5C,IAAI,QAAQ,aAAa,cAAc,MAAM,OAAO,UAAU,YAAY,WAAW,KAAK,KAAK,GAAG,OAAO;CACzG,IAAI,iBAAiB,MAAM,OAAO,IAAI,cAAc,qBAAqB,KAAK,CAAC,EAAE;CACjF,IAAI,OAAO,UAAU,YAAY,QAAQ,YAAY,qBAAqB,OAAO,IAAI,cAAc,qBAAqB,qBAAqB,KAAK,CAAC,CAAC,EAAE;CACtJ,IAAI,OAAO,UAAU,UAAU,OAAO,IAAI,cAAc,KAAK,EAAE;CAC/D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU,OAAO,OAAO,KAAK;CAC/E,IAAI,OAAO,UAAU,WAAW,OAAO,QAAQ,MAAM;CACrD,IAAI,UAAU,MAAM,OAAO;CAC3B,OAAO,IAAI,cAAc,KAAK,UAAU,KAAK,CAAC,EAAE;AACjD;AACA,SAAS,oBAAoB,WAAW,WAAW,SAAS,SAAS,OAAO;CAC3E,OAAO,UAAU,SAAS,YAAY,GAAG,QAAQ,gBAAgB,SAAS,EAAE,MAAM,gBAAgB,SAAS,EAAE,IAAI,QAAQ,IAAI,eAAe,CAAC,CAAC,KAAK,IAAI,EAAE;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|
|
1
|
-
import { a as DropColumnCall,
|
|
2
|
-
import { _ as sqliteSchemaTables, a as createWorkingSchema, c as issueNode, d as renameTableByHandStatements, f as renderRenameTableCall, g as sqlitePlannerStrategies, i as conflictForDisallowedCall, l as pairIndexReplacements, m as sqliteColumnRenameCall, n as buildSqlitePlanDiff, p as sqliteActualSchema, r as coalesceSubtreeIssues, s as indexNameCaseChange, u as planIssues, v as sqliteTableRenameByHand, y as sqliteTableRenameCall } from "./sqlite-migration-
|
|
3
|
-
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-
|
|
1
|
+
import { a as DropColumnCall, l as RawSqlCall, s as DropTableCall, u as RecreateTableCall } from "./op-factory-call-DOyJsczD-DbvU0p5_.mjs";
|
|
2
|
+
import { _ as sqliteSchemaTables, a as createWorkingSchema, c as issueNode, d as renameTableByHandStatements, f as renderRenameTableCall, g as sqlitePlannerStrategies, i as conflictForDisallowedCall, l as pairIndexReplacements, m as sqliteColumnRenameCall, n as buildSqlitePlanDiff, p as sqliteActualSchema, r as coalesceSubtreeIssues, s as indexNameCaseChange, u as planIssues, v as sqliteTableRenameByHand, y as sqliteTableRenameCall } from "./sqlite-migration-DTN2snAw-DW3tNXzB.mjs";
|
|
3
|
+
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-DC-1t9EA-CNp-PgLE.mjs";
|
|
4
4
|
import { isRenameStatement, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
5
5
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
6
6
|
import { appliedStatementsInOrder, backfillOfDefaultedField, columnTakesTemporaryValue, detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, fieldStatementColumns, planFieldEventCalls, planStatements, plannerFailure, storageNameOfOperation, subjectsOfCalls, unknownCallNames } from "@prisma/orm-family-sql/family/control";
|
|
7
7
|
import { RelationalSchemaNodeKind, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types";
|
|
8
8
|
import { ok } from "@prisma/orm-framework/utils/result";
|
|
9
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/planner-
|
|
9
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-Dwty_fUe.mjs
|
|
10
10
|
function lost(target, loss = "drop") {
|
|
11
11
|
return {
|
|
12
12
|
...target,
|
|
@@ -358,4 +358,4 @@ function retainUnownedExtras(issues, ownership) {
|
|
|
358
358
|
//#endregion
|
|
359
359
|
export { createSqliteMigrationPlanner as n, SqliteMigrationPlanner as t };
|
|
360
360
|
|
|
361
|
-
//# sourceMappingURL=planner-
|
|
361
|
+
//# sourceMappingURL=planner-Dwty_fUe-D0-TzhkE.mjs.map
|