@prisma/orm-target-sqlite 8.0.0-rc.17-dev.18 → 8.0.0-rc.17-dev.19

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.
Files changed (61) hide show
  1. package/dist/{adapter-Cfp6xn4m-C6mXiIUR.mjs → adapter-Cfp6xn4m-BtODbERC.mjs} +2 -2
  2. package/dist/{adapter-Cfp6xn4m-C6mXiIUR.mjs.map → adapter-Cfp6xn4m-BtODbERC.mjs.map} +1 -1
  3. package/dist/adapter.d.mts +1 -1
  4. package/dist/adapter.mjs +1 -1
  5. package/dist/adapter__adapter.mjs +1 -1
  6. package/dist/adapter__control.d.mts +1 -1
  7. package/dist/adapter__control.mjs +2 -2
  8. package/dist/adapter__runtime.mjs +1 -1
  9. package/dist/adapter__sql-renderer.mjs +1 -1
  10. package/dist/{control-wWiQrj5H.d.mts → control-CzVFdxZ-.d.mts} +2 -2
  11. package/dist/{control-wWiQrj5H.d.mts.map → control-CzVFdxZ-.d.mts.map} +1 -1
  12. package/dist/{control-L6vqj4xm.mjs → control-DFTHNTG7.mjs} +4 -4
  13. package/dist/{control-L6vqj4xm.mjs.map → control-DFTHNTG7.mjs.map} +1 -1
  14. package/dist/{control-Cg2ATcBk.d.mts → control-Xdac0VSQ.d.mts} +2 -2
  15. package/dist/{control-Cg2ATcBk.d.mts.map → control-Xdac0VSQ.d.mts.map} +1 -1
  16. package/dist/{migration-CGyA6YVp.d.mts → migration-BsYgVFeM.d.mts} +5 -4
  17. package/dist/migration-BsYgVFeM.d.mts.map +1 -0
  18. package/dist/{migration-DNLfgvkg.mjs → migration-CIKnw9my.mjs} +4 -3
  19. package/dist/{migration-DNLfgvkg.mjs.map → migration-CIKnw9my.mjs.map} +1 -1
  20. package/dist/{op-factory-call-BsGdsm8Y.d.mts → op-factory-call-C-6Lxtlm.d.mts} +6 -3
  21. package/dist/op-factory-call-C-6Lxtlm.d.mts.map +1 -0
  22. package/dist/{op-factory-call-Cwsf4slr-DRGuq5SV.mjs → op-factory-call-gwVgzGbc-caCULmpj.mjs} +49 -26
  23. package/dist/op-factory-call-gwVgzGbc-caCULmpj.mjs.map +1 -0
  24. package/dist/{planner-BWkNzmeL-BolB7hXm.mjs → planner-BMV6uAgt-5I9GVELd.mjs} +6 -6
  25. package/dist/{planner-BWkNzmeL-BolB7hXm.mjs.map → planner-BMV6uAgt-5I9GVELd.mjs.map} +1 -1
  26. package/dist/{planner-BOOV5W-E.d.mts → planner-DRDXnFF-.d.mts} +2 -2
  27. package/dist/{planner-BOOV5W-E.d.mts.map → planner-DRDXnFF-.d.mts.map} +1 -1
  28. package/dist/planner-produced-sqlite-migration-CWUahMOX.d.mts +1 -0
  29. package/dist/{planner-produced-sqlite-migration-aUyGmguF-BORtY3yL.d.mts → planner-produced-sqlite-migration-D50U99OT--9-v0jj6.d.mts} +3 -3
  30. package/dist/planner-produced-sqlite-migration-D50U99OT--9-v0jj6.d.mts.map +1 -0
  31. package/dist/{planner-produced-sqlite-migration-Da1JOGGe-Cibm7mK1.mjs → planner-produced-sqlite-migration-lz_ul9te-DoBx4YeG.mjs} +4 -4
  32. package/dist/{planner-produced-sqlite-migration-Da1JOGGe-Cibm7mK1.mjs.map → planner-produced-sqlite-migration-lz_ul9te-DoBx4YeG.mjs.map} +1 -1
  33. package/dist/{render-ops-BfFXRHIV-x1i1WAHz.mjs → render-ops-CBkWzmKj-6vfxyU3K.mjs} +3 -3
  34. package/dist/{render-ops-BfFXRHIV-x1i1WAHz.mjs.map → render-ops-CBkWzmKj-6vfxyU3K.mjs.map} +1 -1
  35. package/dist/{sqlite-migration-Bz7SwolX-CHLtwGNa.mjs → sqlite-migration-DocfLYRw-Bry1VeFm.mjs} +27 -6
  36. package/dist/sqlite-migration-DocfLYRw-Bry1VeFm.mjs.map +1 -0
  37. package/dist/{sqlite-migration-Kqf6dAgP-DDc4wuXM.d.mts → sqlite-migration-omhBdJEh-CizoFjMg.d.mts} +20 -7
  38. package/dist/sqlite-migration-omhBdJEh-CizoFjMg.d.mts.map +1 -0
  39. package/dist/{tables-CvLOKCiJ-Ca1eFkWN.d.mts → tables-CvLOKCiJ-DYQkJ90L.d.mts} +2 -2
  40. package/dist/{tables-CvLOKCiJ-Ca1eFkWN.d.mts.map → tables-CvLOKCiJ-DYQkJ90L.d.mts.map} +1 -1
  41. package/dist/target.d.mts +8 -8
  42. package/dist/target.mjs +8 -8
  43. package/dist/target__control.d.mts +1 -1
  44. package/dist/target__control.mjs +1 -1
  45. package/dist/target__migration.d.mts +3 -3
  46. package/dist/target__migration.mjs +3 -3
  47. package/dist/target__op-factory-call.d.mts +1 -1
  48. package/dist/target__op-factory-call.mjs +1 -1
  49. package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
  50. package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
  51. package/dist/target__planner.d.mts +1 -1
  52. package/dist/target__planner.mjs +1 -1
  53. package/dist/target__render-ops.mjs +1 -1
  54. package/package.json +9 -9
  55. package/dist/migration-CGyA6YVp.d.mts.map +0 -1
  56. package/dist/op-factory-call-BsGdsm8Y.d.mts.map +0 -1
  57. package/dist/op-factory-call-Cwsf4slr-DRGuq5SV.mjs.map +0 -1
  58. package/dist/planner-produced-sqlite-migration-CBmtR7UQ.d.mts +0 -1
  59. package/dist/planner-produced-sqlite-migration-aUyGmguF-BORtY3yL.d.mts.map +0 -1
  60. package/dist/sqlite-migration-Bz7SwolX-CHLtwGNa.mjs.map +0 -1
  61. package/dist/sqlite-migration-Kqf6dAgP-DDc4wuXM.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"control-L6vqj4xm.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 { n as quoteIdentifier } from \"./sql-utils-C2O4zVkP.mjs\";\nimport { g as diffSqliteSchema, v as sqliteContractToSchema, y as verifySqliteDatabaseSchema } from \"./sqlite-migration-Bz7SwolX.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BWkNzmeL.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-BrXalcTm.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { runnerFailure, runnerSuccess, sqlTypeLookupsOf } 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\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\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) {\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 runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\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\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: 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});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\n//#region src/core/type-constructors.ts\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel. Each names a codec; the column's database type is its data type's.\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*\n* These are the constructors only PSL offers. They are defined here, next to the codecs they name, but the adapter contributes them: the TypeScript contract builder builds its `type.*` helpers from the target, so a target contribution would add `type.String()` and the like there. The constructors that should also be `type.*` helpers are the target's own (`sqliteAuthoringTypes`).\n*/\nconst sqlitePslTypeConstructors = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Variable-length text stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript number.\",\n\t\toutput: { codecId: SQLITE_INTEGER_CODEC_ID }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript bigint.\",\n\t\toutput: { codecId: SQLITE_BIGINT_CODEC_ID }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A floating-point number stored as SQLite real.\",\n\t\toutput: { codecId: SQLITE_REAL_CODEC_ID }\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A decimal value stored and represented as text to preserve precision.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_DATETIME_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value serialized to SQLite text.\",\n\t\toutput: { codecId: SQLITE_JSON_CODEC_ID }\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Binary data stored as a SQLite blob.\",\n\t\toutput: { codecId: SQLITE_BLOB_CODEC_ID }\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqlitePslTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAAC,YAAY,IAAI,OAAO;EAC5B,MAAM,eAAe,MAAM,KAAK,oBAAoB,QAAQ,QAAQ,mBAAmB;EACvF,IAAI,CAAC,aAAa,IAAI,OAAO;EAC7B,MAAM,iBAAiB,MAAM,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EACjB,OAAO,iBAAiB,KAAK;CAC9B;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,6BAA6B,OAAO;EAC5C;EACA,aAAa,QAAQ;GACpB,OAAO,4BAA4B,MAAM;EAC1C;EACA,iBAAiB,UAAU,qBAAqB;GAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,YAAY,4BAA4B,2GAA2G;GACvL,OAAO,uBAAuB,UAAU,iBAAiB,mBAAmB,CAAC;EAC9E;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;CACA,cAAc,SAAS;EACtB,OAAO,6BAA6B,OAAO;CAC5C;CACA,aAAa,QAAQ;EACpB,OAAO,4BAA4B,MAAM;CAC1C;AACD;;;;;;;;;;AAYA,MAAM,4BAA4B;CACjC,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,KAAK;EACJ,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,wBAAwB;CAC5C;CACA,QAAQ;EACP,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,uBAAuB;CAC3C;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,SAAS;EACR,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,UAAU;EACT,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,yBAAyB;CAC7C;CACA,MAAM;EACL,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;CACA,OAAO;EACN,MAAM;EACN,eAAe;EACf,QAAQ,EAAE,SAAS,qBAAqB;CACzC;AACD"}
1
+ {"version":3,"file":"control-DFTHNTG7.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 { n as quoteIdentifier } from \"./sql-utils-C2O4zVkP.mjs\";\nimport { g as diffSqliteSchema, v as sqliteContractToSchema, y as verifySqliteDatabaseSchema } from \"./sqlite-migration-DocfLYRw.mjs\";\nimport { r as MARKER_TABLE_NAME } from \"./control-tables-D_o8dKRB.mjs\";\nimport { n as createSqliteMigrationPlanner } from \"./planner-BMV6uAgt.mjs\";\nimport { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from \"./sqlite-contract-view-BrXalcTm.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { runnerFailure, runnerSuccess, sqlTypeLookupsOf } 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\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\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) {\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 runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\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\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: 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});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreateSkipRecord(operation) {\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\t\tmeta: Object.freeze({\n\t\t\t\t...operation.meta ?? {},\n\t\t\t\trunner: Object.freeze({\n\t\t\t\t\tskipped: true,\n\t\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t\t})\n\t\t\t})\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) {\n\t\t\tconst found = await this.family.readMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace\n\t\t\t});\n\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\tspace,\n\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations) {\n\t\tconst plan = options.plan;\n\t\tconst space = plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync beginExclusiveTransaction(driver) {\n\t\tawait driver.query(\"BEGIN EXCLUSIVE\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/sqlite-schema-verifier.ts\n/**\n* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres\n* shape: hooks return the empty list pending the call-site migration\n* that routes the existing verifier behaviour through the SPI.\n*/\nvar SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\nconst sqliteControlTargetDescriptor = {\n\t...sqliteTargetDescriptorMeta,\n\tcontractSerializer: new SqliteContractSerializer(),\n\tschemaVerifier: new SqliteSchemaVerifier(),\n\tdiffSchema(input) {\n\t\treturn diffSqliteSchema(input);\n\t},\n\tclassifySubjectGranularity: relationalNodeGranularity,\n\tclassifyEntityKind: relationalNodeEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createSqliteMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createSqliteMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tif (!isSqlContract(contract)) throw sqliteError(\"CONTRACT.TARGET_MISMATCH\", \"sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>\");\n\t\t\treturn sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"sqlite\"\n\t\t};\n\t},\n\tcreatePlanner(adapter) {\n\t\treturn createSqliteMigrationPlanner(adapter);\n\t},\n\tcreateRunner(family) {\n\t\treturn createSqliteMigrationRunner(family);\n\t}\n};\n//#endregion\n//#region src/core/type-constructors.ts\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel. Each names a codec; the column's database type is its data type's.\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*\n* These are the constructors only PSL offers. They are defined here, next to the codecs they name, but the adapter contributes them: the TypeScript contract builder builds its `type.*` helpers from the target, so a target contribution would add `type.String()` and the like there. The constructors that should also be `type.*` helpers are the target's own (`sqliteAuthoringTypes`).\n*/\nconst sqlitePslTypeConstructors = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Variable-length text stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript number.\",\n\t\toutput: { codecId: SQLITE_INTEGER_CODEC_ID }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer stored as SQLite integer and represented as a JavaScript bigint.\",\n\t\toutput: { codecId: SQLITE_BIGINT_CODEC_ID }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A floating-point number stored as SQLite real.\",\n\t\toutput: { codecId: SQLITE_REAL_CODEC_ID }\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A decimal value stored and represented as text to preserve precision.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_DATETIME_CODEC_ID }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value serialized to SQLite text.\",\n\t\toutput: { codecId: SQLITE_JSON_CODEC_ID }\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Binary data stored as a SQLite blob.\",\n\t\toutput: { codecId: SQLITE_BLOB_CODEC_ID }\n\t}\n};\n//#endregion\nexport { SqliteUnboundDatabase, sqliteControlTargetDescriptor as default, sqliteCreateNamespace, sqlitePslTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,4BAA4B,QAAQ;CAC5C,OAAO,IAAI,sBAAsB,MAAM;AACxC;AACA,IAAI,wBAAwB,MAAM;CACjC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;;CAOA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ;EACvB,IAAI,QAAQ,UAAU,KAAK,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,MAAM,YAAY,sCAAsC,sCAAsC,QAAQ,MAAM,iCAAiC,QAAQ,KAAK,QAAQ,IAAI,EAAE,MAAM;GACrP,OAAO,QAAQ;GACf,aAAa,QAAQ,KAAK;EAC3B,EAAE,CAAC;EACH,MAAM,QAAQ,QAAQ,KAAK;EAC3B,MAAM,UAAU,UAAU,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,CAAC;EACpE,MAAM,mBAAmB,KAAK,qCAAqC,QAAQ,KAAK,aAAa,QAAQ,mBAAmB;EACxH,IAAI,CAAC,iBAAiB,IAAI,OAAO;EACjC,MAAM,cAAc,KAAK,2BAA2B,QAAQ,QAAQ,OAAO;EAC3E,IAAI,CAAC,YAAY,IAAI,OA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ACD"}
@@ -1,6 +1,6 @@
1
1
  import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
2
- import { SqlNamespaceBase, SqlNamespaceEntries, SqlNamespaceInput, StorageTable } from "@prisma/orm-family-sql/contract/types";
3
2
  import { SqlControlTargetDescriptor } from "@prisma/orm-family-sql/family/control";
3
+ import { SqlNamespaceBase, SqlNamespaceEntries, SqlNamespaceInput, StorageTable } from "@prisma/orm-family-sql/contract/types";
4
4
  //#region ../../../3-targets/3-targets/sqlite/dist/control.d.mts
5
5
  //#region src/core/control-target.d.ts
6
6
  declare const sqliteControlTargetDescriptor: SqlControlTargetDescriptor<'sqlite', SqlitePlanTargetDetails>;
@@ -127,4 +127,4 @@ declare const sqlitePslTypeConstructors: {
127
127
  };
128
128
  //#endregion
129
129
  export { sqlitePslTypeConstructors as i, sqliteControlTargetDescriptor as n, sqliteCreateNamespace as r, SqliteUnboundDatabase as t };
130
- //# sourceMappingURL=control-Cg2ATcBk.d.mts.map
130
+ //# sourceMappingURL=control-Xdac0VSQ.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-Cg2ATcBk.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.d.mts"],"mappings":";;;;;cAIc,+BAA+B,qCAAqC;;;KAG7E;WACM;WACA,SAAS;;;;;;;cAON,uBAAuB;WAC1B;WACA;WACA,SAAS;EAClB,YAAY,OAAO;MACf,SAAS,SAAS,eAAe;EACrC;EACA,aAAa;;;;;;;;;;;;;;;;;;;cAmBD,8BAA8B;kBAC1B,UAAU;UAClB;;;;;;;;;;;;iBAYO,sBAAsB,OAAO,oBAAoB,iBAAiB;;;;;;;;;;;;cAYrE;WACH;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE"}
1
+ {"version":3,"file":"control-Xdac0VSQ.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/control.d.mts"],"mappings":";;;;;cAIc,+BAA+B,qCAAqC;;;KAG7E;WACM;WACA,SAAS;;;;;;;cAON,uBAAuB;WAC1B;WACA;WACA,SAAS;EAClB,YAAY,OAAO;MACf,SAAS,SAAS,eAAe;EACrC;EACA,aAAa;;;;;;;;;;;;;;;;;;;cAmBD,8BAA8B;kBAC1B,UAAU;UAClB;;;;;;;;;;;;iBAYO,sBAAsB,OAAO,oBAAoB,iBAAiB;;;;;;;;;;;;cAYrE;WACH;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE;;;WAGJ;aACE;aACA;aACA;eACE"}
@@ -1,8 +1,9 @@
1
- import { t as Op } from "./tables-CvLOKCiJ-Ca1eFkWN.mjs";
2
- import "./sqlite-migration-Kqf6dAgP-DDc4wuXM.mjs";
1
+ import { t as Op } from "./tables-CvLOKCiJ-DYQkJ90L.mjs";
2
+ import "./sqlite-migration-omhBdJEh-CizoFjMg.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";
6
+ import { sql } from "@prisma/orm-family-sql/contract/sql-expression";
6
7
  //#region ../../../3-targets/3-targets/sqlite/dist/migration.d.mts
7
8
  //#region src/core/migrations/operations/data-transform.d.ts
8
9
  interface DataTransformOptions {
@@ -39,5 +40,5 @@ declare function dataTransform(opts: DataTransformOptions): Op;
39
40
  */
40
41
  declare function rawSql(op: Op): Op;
41
42
  //#endregion
42
- export { fn$1 as a, placeholder as c, unique as d, dataTransform as i, primaryKey as l, MigrationCLI as n, foreignKey as o, col$1 as r, lit$1 as s, DataTransformOptions as t, rawSql as u };
43
- //# sourceMappingURL=migration-CGyA6YVp.d.mts.map
43
+ export { fn$1 as a, placeholder as c, sql as d, unique as f, dataTransform as i, primaryKey as l, MigrationCLI as n, foreignKey as o, col$1 as r, lit$1 as s, DataTransformOptions as t, rawSql as u };
44
+ //# sourceMappingURL=migration-BsYgVFeM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-BsYgVFeM.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.d.mts"],"mappings":";;;;;;;;UAOU;;WAEC;;WAEA;;WAEA;;;;;WAKA;;;;;;;;;WASA;;iBAEM,cAAc,MAAM,uBAAuB;;;;;;;;;;iBAU3C,OAAO,IAAI,KAAK"}
@@ -1,8 +1,9 @@
1
1
  import { t as buildTargetDetails } from "./planner-target-details-CIQ789Gc-C5U4yVY9.mjs";
2
- import { x as step } from "./op-factory-call-Cwsf4slr-DRGuq5SV.mjs";
2
+ import { x as step } from "./op-factory-call-gwVgzGbc-caCULmpj.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";
6
+ import { sql } from "@prisma/orm-family-sql/contract/sql-expression";
6
7
  //#region ../../../3-targets/3-targets/sqlite/dist/migration.mjs
7
8
  /**
8
9
  * User-facing `dataTransform` factory for the SQLite migration authoring
@@ -42,6 +43,6 @@ function rawSql(op) {
42
43
  return op;
43
44
  }
44
45
  //#endregion
45
- export { foreignKey as a, primaryKey as c, fn$1 as i, rawSql as l, col$1 as n, lit$1 as o, dataTransform as r, placeholder as s, MigrationCLI as t, unique as u };
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 };
46
47
 
47
- //# sourceMappingURL=migration-DNLfgvkg.mjs.map
48
+ //# sourceMappingURL=migration-CIKnw9my.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-DNLfgvkg.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.mjs"],"sourcesContent":["import { v as step } from \"./op-factory-call-Cwsf4slr.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-Bz7SwolX.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\";\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, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAAS,cAAc,MAAM;CAC5B,OAAO;EACN,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GACP,IAAI;GACJ,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAChD;EACA,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACb;AACD;;;;;;;;AAUA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
1
+ {"version":3,"file":"migration-CIKnw9my.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.mjs"],"sourcesContent":["import { v as step } from \"./op-factory-call-gwVgzGbc.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-DocfLYRw.mjs\";\nimport { t as buildTargetDetails } from \"./planner-target-details-CIQ789Gc.mjs\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\nimport { sql } from \"@internal/sql-contract/sql-expression\";\n//#region src/core/migrations/operations/data-transform.ts\n/**\n* User-facing `dataTransform` factory for the SQLite migration authoring\n* surface. Invoked directly inside a `migration.ts` file to supply a\n* user-authored SQL statement that runs with operation class `'data'`.\n*\n* Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL\n* tightening requires a backfill. The rendered `migration.ts` exposes the\n* backfill as a `placeholder(\"…\")` slot the user fills in with an\n* `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`\n* invocation returns a runnable operation the runner executes before the\n* subsequent recreate-table op copies data into the tightened schema.\n*/\nfunction dataTransform(opts) {\n\treturn {\n\t\tid: opts.id,\n\t\tlabel: opts.label,\n\t\tsummary: opts.description,\n\t\toperationClass: \"data\",\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"table\", opts.table)\n\t\t},\n\t\tprecheck: [],\n\t\texecute: [step(opts.description, opts.run())],\n\t\tpostcheck: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized\n* `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres\n* `rawSql` factory: the planner uses this to carry ops produced by SQL-family\n* paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured\n* call IR without reverse-engineering their shape.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, sql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAS,cAAc,MAAM;CAC5B,OAAO;EACN,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GACP,IAAI;GACJ,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAChD;EACA,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACb;AACD;;;;;;;;AAUA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
@@ -1,9 +1,9 @@
1
1
  import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
2
- import { a as SqliteTableSpec, i as SqliteIndexSpec, n as RecreatePostcheck, r as SqliteColumnSpec } from "./tables-CvLOKCiJ-Ca1eFkWN.mjs";
2
+ import { a as SqliteTableSpec, i as SqliteIndexSpec, n as RecreatePostcheck, r as SqliteColumnSpec } from "./tables-CvLOKCiJ-DYQkJ90L.mjs";
3
3
  import { DdlColumn, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
4
4
  import { OpFactoryCall } from "@prisma/orm-framework/components/control";
5
- import { ImportRequirement, TsExpression } from "@prisma/orm-framework/ts-render";
6
5
  import { MigrationOperationClass, SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
6
+ import { ImportRequirement, TsExpression } from "@prisma/orm-framework/ts-render";
7
7
  import { ExecuteRequestLowerer, Lowerer } from "@prisma/orm-family-sql/family/control-adapter";
8
8
  //#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call.d.mts
9
9
  //#region src/core/migrations/op-factory-call.d.ts
@@ -19,6 +19,7 @@ declare abstract class SqliteOpFactoryCallNode extends TsExpression implements O
19
19
  protected freeze(): void;
20
20
  }
21
21
  declare class CreateTableCall extends SqliteOpFactoryCallNode {
22
+ #private;
22
23
  readonly factoryName: "createTable";
23
24
  readonly operationClass: "additive";
24
25
  readonly tableName: string;
@@ -91,6 +92,7 @@ declare class RenameColumnCall extends SqliteOpFactoryCallNode {
91
92
  importRequirements(): readonly ImportRequirement[];
92
93
  }
93
94
  declare class RecreateTableCall extends SqliteOpFactoryCallNode {
95
+ #private;
94
96
  readonly factoryName: "recreateTable";
95
97
  readonly operationClass: MigrationOperationClass;
96
98
  readonly tableName: string;
@@ -119,6 +121,7 @@ declare class RecreateTableCall extends SqliteOpFactoryCallNode {
119
121
  importRequirements(): readonly ImportRequirement[];
120
122
  }
121
123
  declare class AddColumnCall extends SqliteOpFactoryCallNode {
124
+ #private;
122
125
  readonly factoryName: "addColumn";
123
126
  readonly operationClass: "additive";
124
127
  readonly tableName: string;
@@ -213,4 +216,4 @@ declare class RawSqlCall extends SqliteOpFactoryCallNode {
213
216
  type SqliteOpFactoryCall = CreateTableCall | DropTableCall | RecreateTableCall | RenameTableCall | RenameColumnCall | AddColumnCall | DropColumnCall | CreateIndexCall | DropIndexCall | DataTransformCall | RawSqlCall;
214
217
  //#endregion
215
218
  export { DropColumnCall as a, RawSqlCall as c, RenameTableCall as d, SqliteOpFactoryCall as f, DataTransformCall as i, RecreateTableCall as l, CreateIndexCall as n, DropIndexCall as o, CreateTableCall as r, DropTableCall as s, AddColumnCall as t, RenameColumnCall as u };
216
- //# sourceMappingURL=op-factory-call-BsGdsm8Y.d.mts.map
219
+ //# sourceMappingURL=op-factory-call-C-6Lxtlm.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"op-factory-call-C-6Lxtlm.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/op-factory-call.d.mts"],"mappings":";;;;;;;;;KAQK,KAAK,0BAA0B;uBACb,gCAAgC,wBAAwB;oBAC3D;oBACA,gBAAgB;oBAChB;WACT,KAAK,UAAU,UAAU,KAAK,QAAQ;;EAE/C,MAAM,UAAU,kCAAkC,KAAK,QAAQ;EAC/D,+BAA+B;YACrB;;cAEE,wBAAwB;;WAE3B;WACA;WACA;WACA,kBAAkB;WAClB,sBAAsB;WACtB;EACT,YAAY,mBAAmB,kBAAkB,aAAa,uBAAuB;EACrF,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,sBAAsB;WACzB;WACA;WACA;WACA;EACT,YAAY;EACZ,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;;UAGvB;WACC,MAAM;WACN,QAAQ;;;KAGd,sBAAsB,gBAAgB;cAC7B,wBAAwB;WAC3B;WACA;WACA;;WAEA;WACA;;WAEA,4BAA4B;;;;;WAK5B,qBAAqB;EAC9B,YAAY,sBAAsB,mBAAmB,4BAA4B;;MAE7E;EACJ,MAAM,UAAU,iCAAiC,QAAQ;EACzD,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,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AAW,UAAU;EAC1B;;KAEG,sBAAsB,kBAAkB,gBAAgB,oBAAoB,kBAAkB,mBAAmB,gBAAgB,iBAAiB,kBAAkB,gBAAgB,oBAAoB"}
@@ -10,12 +10,13 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
11
  import { dataTypeParams, renderSqlTypeName, sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
12
12
  import { issueOutcome } from "@prisma/orm-framework/components/control";
13
+ import { createSqlTextSources } from "@prisma/orm-family-sql/family/control";
13
14
  import { RelationalSchemaNodeKind } from "@prisma/orm-family-sql/schema-ir/types";
14
15
  import { assertNever } from "@prisma/orm-framework/utils/internal-error";
15
16
  import { errorMigrationOperationOptionRemoved, unfilledPlaceholderOperation } from "@prisma/orm-framework/errors/migration";
16
17
  import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
17
18
  import { TsExpression, jsonToTsSource, tsArraySource, tsObjectSource, tsQuotedTextSource } from "@prisma/orm-framework/ts-render";
18
- //#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call-Cwsf4slr.mjs
19
+ //#region ../../../3-targets/3-targets/sqlite/dist/op-factory-call-gwVgzGbc.mjs
19
20
  /**
20
21
  * Low-level DDL fragment builders for SQLite migrations.
21
22
  *
@@ -502,16 +503,16 @@ var SqliteOpFactoryCallNode = class extends TsExpression {
502
503
  function isSqliteOpFactoryCall(call) {
503
504
  return call instanceof SqliteOpFactoryCallNode;
504
505
  }
505
- function renderDdlColumnDefault(def) {
506
+ function renderDdlColumnDefault(def, sql) {
506
507
  if (!def) return "";
507
508
  if (def.kind === "literal") return `lit(${jsonToTsSource(def.value)})`;
508
- return `fn(${tsQuotedTextSource(def.expression.text)})`;
509
+ return `fn(${sql.source(def.expression.text)})`;
509
510
  }
510
- function renderDdlColumnAsTsCall(column) {
511
+ function renderDdlColumnAsTsCall(column, sql) {
511
512
  const opts = [];
512
513
  if (column.notNull) opts.push("notNull: true");
513
514
  if (column.primaryKey) opts.push("primaryKey: true");
514
- if (column.default) opts.push(`default: ${renderDdlColumnDefault(column.default)}`);
515
+ if (column.default) opts.push(`default: ${renderDdlColumnDefault(column.default, sql)}`);
515
516
  if (column.codecRef) opts.push(`codecRef: ${jsonToTsSource(column.codecRef)}`);
516
517
  const optsStr = opts.length > 0 ? `, { ${opts.join(", ")} }` : "";
517
518
  return `col(${jsonToTsSource(column.name)}, ${jsonToTsSource(column.type)}${optsStr})`;
@@ -600,13 +601,20 @@ var CreateTableCall = class extends SqliteOpFactoryCallNode {
600
601
  };
601
602
  }
602
603
  renderTypeScript() {
603
- const columnsList = this.columns.map(renderDdlColumnAsTsCall).join(", ");
604
+ return this.#written().source;
605
+ }
606
+ #written() {
607
+ const sql = createSqlTextSources(TARGET_MIGRATION_MODULE);
608
+ const columnsList = this.columns.map((column) => renderDdlColumnAsTsCall(column, sql)).join(", ");
604
609
  const constraintsList = this.constraints ? this.constraints.map(renderDdlConstraintAsTsCall).join(", ") : void 0;
605
610
  const opts = [];
606
611
  opts.push(`table: ${jsonToTsSource(this.tableName)}`);
607
612
  opts.push(`columns: [${columnsList}]`);
608
613
  if (constraintsList) opts.push(`constraints: [${constraintsList}]`);
609
- return `this.createTable({ ${opts.join(", ")} })`;
614
+ return {
615
+ source: `this.createTable({ ${opts.join(", ")} })`,
616
+ imports: sql.imports()
617
+ };
610
618
  }
611
619
  importRequirements() {
612
620
  const req = [];
@@ -624,6 +632,7 @@ var CreateTableCall = class extends SqliteOpFactoryCallNode {
624
632
  moduleSpecifier: TARGET_MIGRATION_MODULE,
625
633
  symbol: sym
626
634
  });
635
+ req.push(...this.#written().imports);
627
636
  return req;
628
637
  }
629
638
  };
@@ -826,18 +835,25 @@ var RecreateTableCall = class extends SqliteOpFactoryCallNode {
826
835
  }, lowerer);
827
836
  }
828
837
  renderTypeScript() {
829
- return `this.recreateTable(${tsObjectSource([
830
- ["tableName", jsonToTsSource(this.tableName)],
831
- ["contractTable", renderTableSpec(this.contractTable)],
832
- ["schemaColumnNames", jsonToTsSource(this.schemaColumnNames)],
833
- ["indexes", jsonToTsSource(this.indexes)],
834
- ["summary", jsonToTsSource(this.summary)],
835
- ["postchecks", tsArraySource(this.postchecks.map(renderPostcheck))],
836
- ["operationClass", jsonToTsSource(this.operationClass)]
837
- ])})`;
838
+ return this.#written().source;
838
839
  }
839
840
  importRequirements() {
840
- return [];
841
+ return this.#written().imports;
842
+ }
843
+ #written() {
844
+ const sql = createSqlTextSources(TARGET_MIGRATION_MODULE);
845
+ return {
846
+ source: `this.recreateTable(${tsObjectSource([
847
+ ["tableName", jsonToTsSource(this.tableName)],
848
+ ["contractTable", renderTableSpec(this.contractTable, sql)],
849
+ ["schemaColumnNames", jsonToTsSource(this.schemaColumnNames)],
850
+ ["indexes", jsonToTsSource(this.indexes)],
851
+ ["summary", jsonToTsSource(this.summary)],
852
+ ["postchecks", tsArraySource(this.postchecks.map(renderPostcheck))],
853
+ ["operationClass", jsonToTsSource(this.operationClass)]
854
+ ])})`,
855
+ imports: sql.imports()
856
+ };
841
857
  }
842
858
  };
843
859
  var AddColumnCall = class extends SqliteOpFactoryCallNode {
@@ -864,10 +880,17 @@ var AddColumnCall = class extends SqliteOpFactoryCallNode {
864
880
  return addColumn(this.tableName, this.column, lowerer);
865
881
  }
866
882
  renderTypeScript() {
867
- return `this.addColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${renderColumnSpec(this.column)} })`;
883
+ return this.#written().source;
868
884
  }
869
885
  importRequirements() {
870
- return [];
886
+ return this.#written().imports;
887
+ }
888
+ #written() {
889
+ const sql = createSqlTextSources(TARGET_MIGRATION_MODULE);
890
+ return {
891
+ source: `this.addColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${renderColumnSpec(this.column, sql)} })`,
892
+ imports: sql.imports()
893
+ };
871
894
  }
872
895
  };
873
896
  var DropColumnCall = class extends SqliteOpFactoryCallNode {
@@ -1095,29 +1118,29 @@ function definedSourceEntries(sources) {
1095
1118
  function renderIfDefined(value) {
1096
1119
  return value === void 0 ? void 0 : jsonToTsSource(value);
1097
1120
  }
1098
- function renderColumnSpec(column) {
1121
+ function renderColumnSpec(column, sql) {
1099
1122
  return tsObjectSource(definedSourceEntries({
1100
1123
  name: jsonToTsSource(column.name),
1101
1124
  typeSql: jsonToTsSource(column.typeSql),
1102
- default: column.default === void 0 ? void 0 : renderSpecDefault(column.default),
1125
+ default: column.default === void 0 ? void 0 : renderSpecDefault(column.default, sql),
1103
1126
  codecRef: renderIfDefined(column.codecRef),
1104
1127
  nullable: jsonToTsSource(column.nullable),
1105
1128
  inlineAutoincrementPrimaryKey: renderIfDefined(column.inlineAutoincrementPrimaryKey)
1106
1129
  }));
1107
1130
  }
1108
- function renderTableSpec(table) {
1131
+ function renderTableSpec(table, sql) {
1109
1132
  return tsObjectSource(definedSourceEntries({
1110
- columns: tsArraySource(table.columns.map(renderColumnSpec)),
1133
+ columns: tsArraySource(table.columns.map((column) => renderColumnSpec(column, sql))),
1111
1134
  primaryKey: renderIfDefined(table.primaryKey),
1112
1135
  uniques: renderIfDefined(table.uniques),
1113
1136
  foreignKeys: renderIfDefined(table.foreignKeys)
1114
1137
  }));
1115
1138
  }
1116
- function renderSpecDefault(columnDefault) {
1139
+ function renderSpecDefault(columnDefault, sql) {
1117
1140
  if (columnDefault.kind === "literal") return jsonToTsSource(columnDefault);
1118
1141
  return tsObjectSource(definedSourceEntries({
1119
1142
  kind: jsonToTsSource(columnDefault.kind),
1120
- expression: tsQuotedTextSource(columnDefault.expression)
1143
+ expression: sql.source(columnDefault.expression)
1121
1144
  }));
1122
1145
  }
1123
1146
  function renderPostcheck(postcheck) {
@@ -1133,4 +1156,4 @@ function renderPostcheck(postcheck) {
1133
1156
  //#endregion
1134
1157
  export { renameTableSteps as _, DropColumnCall as a, sqliteIdentifiersCollide as b, RawSqlCall as c, RenameTableCall as d, buildColumnTypeSql as f, isSqliteOpFactoryCall as g, indexReplacementCalls as h, DataTransformCall as i, RecreateTableCall as l, buildRecreateSummary as m, CreateIndexCall as n, DropIndexCall as o, buildRecreatePostchecks as p, CreateTableCall as r, DropTableCall as s, AddColumnCall as t, RenameColumnCall as u, renderDefaultLiteral as v, step as x, sqliteDefaultToDdlColumnDefault as y };
1135
1158
 
1136
- //# sourceMappingURL=op-factory-call-Cwsf4slr-DRGuq5SV.mjs.map
1159
+ //# sourceMappingURL=op-factory-call-gwVgzGbc-caCULmpj.mjs.map