@prisma/orm-target-sqlite 8.0.0-rc.17-dev.37 → 8.0.0-rc.17-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-Cfp6xn4m-BtODbERC.mjs → adapter-Cfp6xn4m-CqnRsbnV.mjs} +2 -2
- package/dist/{adapter-Cfp6xn4m-BtODbERC.mjs.map → adapter-Cfp6xn4m-CqnRsbnV.mjs.map} +1 -1
- package/dist/adapter.mjs +2 -2
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +3 -3
- package/dist/adapter__runtime.mjs +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{control-DJq7MF_s.mjs → control-CVmnzYUI.mjs} +113 -18
- package/dist/control-CVmnzYUI.mjs.map +1 -0
- package/dist/{control-4njwExvT.mjs → control-DKT_rL3s.mjs} +11 -3
- package/dist/control-DKT_rL3s.mjs.map +1 -0
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/{migration-CIKnw9my.mjs → migration-DOkUBr8w.mjs} +2 -2
- package/dist/{migration-CIKnw9my.mjs.map → migration-DOkUBr8w.mjs.map} +1 -1
- package/dist/{migration-BsYgVFeM.d.mts → migration-wH0Hw2VD.d.mts} +3 -3
- package/dist/{migration-BsYgVFeM.d.mts.map → migration-wH0Hw2VD.d.mts.map} +1 -1
- package/dist/{op-factory-call-C-6Lxtlm.d.mts → op-factory-call-DAI1NqNz.d.mts} +16 -10
- package/dist/op-factory-call-DAI1NqNz.d.mts.map +1 -0
- package/dist/{op-factory-call-gwVgzGbc-caCULmpj.mjs → op-factory-call-hxIbAMSY-CinxsQHg.mjs} +234 -25
- package/dist/op-factory-call-hxIbAMSY-CinxsQHg.mjs.map +1 -0
- package/dist/{planner-Ddpm7j-w-BzyQ-raY.mjs → planner-BENMBCnG-CW6-1do-.mjs} +65 -23
- package/dist/planner-BENMBCnG-CW6-1do-.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-CB9UDEdR.d.mts +1 -0
- package/dist/{planner-produced-sqlite-migration-D50U99OT--9-v0jj6.d.mts → planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.d.mts} +3 -3
- package/dist/planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.d.mts.map +1 -0
- package/dist/{planner-produced-sqlite-migration-Cj_QCROn-0eatEGzt.mjs → planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs} +4 -4
- package/dist/{planner-produced-sqlite-migration-Cj_QCROn-0eatEGzt.mjs.map → planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs.map} +1 -1
- package/dist/{planner-DRDXnFF-.d.mts → planner-tv5z1cn8.d.mts} +5 -4
- package/dist/planner-tv5z1cn8.d.mts.map +1 -0
- package/dist/{render-ops-CBkWzmKj-6vfxyU3K.mjs → render-ops-B889CY71-JvEeW9B4.mjs} +3 -3
- package/dist/{render-ops-CBkWzmKj-6vfxyU3K.mjs.map → render-ops-B889CY71-JvEeW9B4.mjs.map} +1 -1
- package/dist/{sql-utils-C2O4zVkP-Dz3Hb85I.mjs → sql-utils-XGT5Esi2-5k9pvJeF.mjs} +30 -3
- package/dist/sql-utils-XGT5Esi2-5k9pvJeF.mjs.map +1 -0
- package/dist/{sqlite-contract-view-BrXalcTm-DYDH4LQC.mjs → sqlite-contract-view-TELBWEt4-CVsdZnpX.mjs} +3 -3
- package/dist/{sqlite-contract-view-BrXalcTm-DYDH4LQC.mjs.map → sqlite-contract-view-TELBWEt4-CVsdZnpX.mjs.map} +1 -1
- package/dist/{sqlite-migration-omhBdJEh-CizoFjMg.d.mts → sqlite-migration-BqbQmUY1-CTmurARU.d.mts} +9 -3
- package/dist/{sqlite-migration-omhBdJEh-CizoFjMg.d.mts.map → sqlite-migration-BqbQmUY1-CTmurARU.d.mts.map} +1 -1
- package/dist/{sqlite-migration-D7DWt0JL-D_5jFkOx.mjs → sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs} +235 -66
- package/dist/sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs.map +1 -0
- package/dist/{tables-CvLOKCiJ-DYQkJ90L.d.mts → tables-DD_EmImp-B8ZaVBMr.d.mts} +16 -7
- package/dist/tables-DD_EmImp-B8ZaVBMr.d.mts.map +1 -0
- package/dist/target.d.mts +6 -6
- package/dist/target.mjs +9 -9
- package/dist/target__control.mjs +2 -2
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +1 -1
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.mjs +1 -1
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/package.json +9 -9
- package/dist/control-4njwExvT.mjs.map +0 -1
- package/dist/control-DJq7MF_s.mjs.map +0 -1
- package/dist/op-factory-call-C-6Lxtlm.d.mts.map +0 -1
- package/dist/op-factory-call-gwVgzGbc-caCULmpj.mjs.map +0 -1
- package/dist/planner-DRDXnFF-.d.mts.map +0 -1
- package/dist/planner-Ddpm7j-w-BzyQ-raY.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-CWUahMOX.d.mts +0 -1
- package/dist/planner-produced-sqlite-migration-D50U99OT--9-v0jj6.d.mts.map +0 -1
- package/dist/sql-utils-C2O4zVkP-Dz3Hb85I.mjs.map +0 -1
- package/dist/sqlite-migration-D7DWt0JL-D_5jFkOx.mjs.map +0 -1
- package/dist/tables-CvLOKCiJ-DYQkJ90L.d.mts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"op-factory-call-hxIbAMSY-CinxsQHg.mjs","names":["#written","#slotsSource"],"sources":["../../../../3-targets/3-targets/sqlite/dist/op-factory-call-hxIbAMSY.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-BctEWIFt.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 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/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)]\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: [step(`ensure table \"${tableName}\" exists`, tableSteps.present.sql, tableSteps.present.params), step(`ensure temp table \"${tempName}\" does not exist`, tempSteps.absent.sql, tempSteps.absent.params)],\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\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}\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}\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}' 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}\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)]\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)]\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 { buildColumnTypeSql as C, sqliteIdentifiersCollide as S, conversionCopyOf as _, DropColumnCall as a, sqliteDefaultToDdlColumnDefault 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, renderDefaultLiteral as w, step as x, renameTableSteps as y };\n\n//# sourceMappingURL=op-factory-call-hxIbAMSY.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,cAA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,eAAe,aAAa;CACzE,OAAO,eAAe,qBAAqB;EAC1C,MAAM,eAAe,cAAc,IAAI;EACvC,YAAY,IAAI,OAAO,cAAc,UAAU;CAChD,CAAC,CAAC;AACH;AACA,SAAS,gBAAgB,WAAW;CACnC,IAAI,SAAS,WAAW,OAAO,eAAe,qBAAqB;EAClE,aAAa,eAAe,UAAU,WAAW;EACjD,KAAK,mBAAmB,UAAU,GAAG;EACrC,gBAAgB,UAAU,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,UAAU,cAAc;CACvG,CAAC,CAAC;CACF,OAAO,eAAe,qBAAqB;EAC1C,aAAa,eAAe,UAAU,WAAW;EACjD,eAAe,eAAe,UAAU,aAAa;CACtD,CAAC,CAAC;AACH"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { a as DropColumnCall, c as RawSqlCall, l as RecreateTableCall, s as DropTableCall } from "./op-factory-call-
|
|
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-
|
|
4
|
-
import { issueOutcome } from "@prisma/orm-framework/components/control";
|
|
1
|
+
import { a as DropColumnCall, c as RawSqlCall, l as RecreateTableCall, s as DropTableCall } from "./op-factory-call-hxIbAMSY-CinxsQHg.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-CTNkjYJ1-eRdmsbpK.mjs";
|
|
3
|
+
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs";
|
|
4
|
+
import { isRenameStatement, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
5
5
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
6
|
-
import { detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, planFieldEventCalls, planStatements, plannerFailure, storageNameOfOperation, subjectsOfCalls, unknownCallNames } from "@prisma/orm-family-sql/family/control";
|
|
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-BENMBCnG.mjs
|
|
10
|
+
function lost(target, loss = "drop") {
|
|
11
|
+
return {
|
|
12
|
+
...target,
|
|
13
|
+
loss
|
|
14
|
+
};
|
|
15
|
+
}
|
|
10
16
|
function tableTarget(table) {
|
|
11
17
|
return {
|
|
12
18
|
storageName: table,
|
|
@@ -32,56 +38,84 @@ function operationCountOf(call) {
|
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* The columns a recreate loses: those the new table leaves out, whose values the copy drops, and,
|
|
35
|
-
* when the recreate is destructive, those whose type it changes.
|
|
41
|
+
* when the recreate is destructive, those whose type it changes with no copy expression to convert them.
|
|
36
42
|
*/
|
|
37
43
|
function recreateLosses(call) {
|
|
38
44
|
const kept = new Set(call.contractTable.columns.map((column) => column.name));
|
|
39
|
-
|
|
45
|
+
const dropped = call.schemaColumnNames.filter((column) => !kept.has(column));
|
|
46
|
+
const retyped = call.operationClass === "destructive" ? call.retypedColumns.filter((column) => !Object.hasOwn(call.copyExpressions, column)) : [];
|
|
47
|
+
return [...dropped.map((column) => ({
|
|
48
|
+
column,
|
|
49
|
+
loss: "drop"
|
|
50
|
+
})), ...retyped.map((column) => ({
|
|
51
|
+
column,
|
|
52
|
+
loss: "typeChange"
|
|
53
|
+
}))];
|
|
54
|
+
}
|
|
55
|
+
/** The columns a recreate adds with a value its copy writes into every existing row. */
|
|
56
|
+
function temporaryValuesOf(call) {
|
|
57
|
+
const copied = new Set(call.schemaColumnNames);
|
|
58
|
+
return Object.entries(call.temporaryValues).flatMap(([column, expression]) => copied.has(column) || expression.kind !== "sql" ? [] : [{
|
|
59
|
+
table: call.tableName,
|
|
60
|
+
column,
|
|
61
|
+
value: expression.sql
|
|
62
|
+
}]);
|
|
40
63
|
}
|
|
41
64
|
/**
|
|
42
65
|
* What each call of a SQLite plan loses. A recreate that leaves a column out loses its values
|
|
43
66
|
* itself, so a later drop of that column is not listed again.
|
|
44
67
|
*/
|
|
45
68
|
function sqliteCallSubjects(calls, fieldEvents) {
|
|
46
|
-
const
|
|
69
|
+
const lostColumns = /* @__PURE__ */ new Set();
|
|
47
70
|
const unknownNames = unknownCallNames(calls.filter((call) => call.operationClass === "destructive" && !(call instanceof RecreateTableCall) && !(call instanceof DropColumnCall) && !(call instanceof DropTableCall) && !(call instanceof RawSqlCall) && !fieldEvents.has(call)));
|
|
48
71
|
return calls.map((call) => {
|
|
49
72
|
const operationCount = operationCountOf(call);
|
|
73
|
+
const { label } = call;
|
|
50
74
|
if (call instanceof RecreateTableCall) {
|
|
51
75
|
const columns = recreateLosses(call);
|
|
52
|
-
for (const column of columns)
|
|
76
|
+
for (const { column } of columns) lostColumns.add(`${call.tableName}.${column}`);
|
|
53
77
|
return {
|
|
54
78
|
operationCount,
|
|
55
|
-
|
|
56
|
-
|
|
79
|
+
label,
|
|
80
|
+
dataLoss: columns.length === 0 && call.operationClass === "destructive" ? [lost(tableTarget(call.tableName))] : columns.map(({ column, loss }) => lost(columnTarget(call.tableName, column), loss)),
|
|
81
|
+
accessWidening: [],
|
|
82
|
+
temporaryValues: temporaryValuesOf(call)
|
|
57
83
|
};
|
|
58
84
|
}
|
|
59
85
|
if (call instanceof DropColumnCall) return {
|
|
60
86
|
operationCount,
|
|
61
|
-
|
|
62
|
-
|
|
87
|
+
label,
|
|
88
|
+
dataLoss: lostColumns.has(`${call.tableName}.${call.columnName}`) ? [] : [lost(columnTarget(call.tableName, call.columnName))],
|
|
89
|
+
accessWidening: [],
|
|
90
|
+
temporaryValues: []
|
|
63
91
|
};
|
|
64
92
|
if (call instanceof DropTableCall) return {
|
|
65
93
|
operationCount,
|
|
66
|
-
|
|
67
|
-
|
|
94
|
+
label,
|
|
95
|
+
dataLoss: [lost(tableTarget(call.tableName))],
|
|
96
|
+
accessWidening: [],
|
|
97
|
+
temporaryValues: []
|
|
68
98
|
};
|
|
69
99
|
if (call.operationClass !== "destructive") return {
|
|
70
100
|
operationCount,
|
|
101
|
+
label,
|
|
71
102
|
dataLoss: [],
|
|
72
|
-
accessWidening: []
|
|
103
|
+
accessWidening: [],
|
|
104
|
+
temporaryValues: []
|
|
73
105
|
};
|
|
74
106
|
const fieldEvent = fieldEvents.get(call);
|
|
75
107
|
return {
|
|
76
108
|
operationCount,
|
|
77
|
-
|
|
109
|
+
label,
|
|
110
|
+
dataLoss: [lost(call instanceof RawSqlCall ? {
|
|
78
111
|
storageName: storageNameOfOperation(call.op),
|
|
79
112
|
table: void 0
|
|
80
113
|
} : fieldEvent !== void 0 ? fieldEventStorage(fieldEvent) : {
|
|
81
114
|
storageName: unknownNames.get(call) ?? call.factoryName,
|
|
82
115
|
table: void 0
|
|
83
|
-
}],
|
|
84
|
-
accessWidening: []
|
|
116
|
+
})],
|
|
117
|
+
accessWidening: [],
|
|
118
|
+
temporaryValues: []
|
|
85
119
|
};
|
|
86
120
|
});
|
|
87
121
|
}
|
|
@@ -141,6 +175,8 @@ var SqliteMigrationPlanner = class {
|
|
|
141
175
|
defaultNamespaceId: UNBOUND_NAMESPACE_ID
|
|
142
176
|
});
|
|
143
177
|
if (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);
|
|
178
|
+
const defaultedBackfill = backfillOfDefaultedField(options.statements, options.fromContract, options.contract);
|
|
179
|
+
if (defaultedBackfill !== void 0) return plannerFailure([defaultedBackfill]);
|
|
144
180
|
const codecHooks = extractCodecControlHooks(options.frameworkComponents);
|
|
145
181
|
const result = planIssues({
|
|
146
182
|
issues,
|
|
@@ -148,6 +184,12 @@ var SqliteMigrationPlanner = class {
|
|
|
148
184
|
actual,
|
|
149
185
|
policy: options.policy,
|
|
150
186
|
frameworkComponents: options.frameworkComponents,
|
|
187
|
+
statementColumns: fieldStatementColumns(options.statements, options.contract),
|
|
188
|
+
originCodecId: (table, column) => options.fromContract?.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.table?.[table]?.columns[column]?.codecId,
|
|
189
|
+
takesTemporaryValue: (table, column) => {
|
|
190
|
+
const storageTable = options.contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.table?.[table];
|
|
191
|
+
return storageTable !== void 0 && columnTakesTemporaryValue(storageTable, column);
|
|
192
|
+
},
|
|
151
193
|
strategies: sqlitePlannerStrategies
|
|
152
194
|
});
|
|
153
195
|
if (!result.ok) return plannerFailure(result.failure);
|
|
@@ -175,7 +217,7 @@ var SqliteMigrationPlanner = class {
|
|
|
175
217
|
from: options.origin?.storageHash ?? null,
|
|
176
218
|
to: options.contract.storage.storageHash
|
|
177
219
|
}, options.spaceId, options.snapshotsImportPath, destination, this.#lowerer),
|
|
178
|
-
appliedStatements: statements.value.appliedStatements,
|
|
220
|
+
appliedStatements: appliedStatementsInOrder(options.statements, statements.value.appliedStatements),
|
|
179
221
|
...subjectsOfCalls(sqliteCallSubjects(calls, new Map(fieldEventCalls.map((fieldEvent) => [fieldEvent.call, fieldEvent]))), {
|
|
180
222
|
fromContract: options.fromContract,
|
|
181
223
|
contract: options.contract,
|
|
@@ -192,7 +234,7 @@ var SqliteMigrationPlanner = class {
|
|
|
192
234
|
planStatements(options) {
|
|
193
235
|
const working = createWorkingSchema(sqliteActualSchema(options.schema));
|
|
194
236
|
const planned = planStatements({
|
|
195
|
-
statements: options.statements,
|
|
237
|
+
statements: options.statements.filter(isRenameStatement),
|
|
196
238
|
fromContract: options.fromContract,
|
|
197
239
|
contract: options.contract,
|
|
198
240
|
policy: options.policy,
|
|
@@ -316,4 +358,4 @@ function retainUnownedExtras(issues, ownership) {
|
|
|
316
358
|
//#endregion
|
|
317
359
|
export { createSqliteMigrationPlanner as n, SqliteMigrationPlanner as t };
|
|
318
360
|
|
|
319
|
-
//# sourceMappingURL=planner-
|
|
361
|
+
//# sourceMappingURL=planner-BENMBCnG-CW6-1do-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-BENMBCnG-CW6-1do-.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-BENMBCnG.mjs"],"sourcesContent":["import { a as DropColumnCall, c as RawSqlCall, l as RecreateTableCall, s as DropTableCall } from \"./op-factory-call-hxIbAMSY.mjs\";\nimport { a as sqliteTableRenameByHand, c as sqliteSchemaTables, d as coalesceSubtreeIssues, f as conflictForDisallowedCall, g as buildSqlitePlanDiff, h as sqlitePlannerStrategies, i as sqliteColumnRenameCall, l as indexNameCaseChange, m as planIssues, n as renameTableByHandStatements, o as sqliteTableRenameCall, p as issueNode, r as renderRenameTableCall, s as createWorkingSchema, u as pairIndexReplacements, v as sqliteActualSchema } from \"./sqlite-migration-CTNkjYJ1.mjs\";\nimport { t as TypeScriptRenderableSqliteMigration } from \"./planner-produced-sqlite-migration-DjEZTiif.mjs\";\nimport { isRenameStatement, issueOutcome } from \"@internal/framework-components/control\";\nimport { appliedStatementsInOrder, backfillOfDefaultedField, columnTakesTemporaryValue, detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, fieldStatementColumns, planFieldEventCalls, planStatements, plannerFailure, storageNameOfOperation, subjectsOfCalls, unknownCallNames } from \"@internal/family-sql/control\";\nimport { RelationalSchemaNodeKind, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ok } from \"@internal/utils/result\";\n//#region src/core/migrations/operation-subjects.ts\nfunction lost(target, loss = \"drop\") {\n\treturn {\n\t\t...target,\n\t\tloss\n\t};\n}\nfunction tableTarget(table) {\n\treturn {\n\t\tstorageName: table,\n\t\ttable: {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\ttable,\n\t\t\tcolumn: void 0\n\t\t}\n\t};\n}\nfunction columnTarget(table, column) {\n\treturn {\n\t\tstorageName: `${table}.${column}`,\n\t\ttable: {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\ttable,\n\t\t\tcolumn\n\t\t}\n\t};\n}\nfunction operationCountOf(call) {\n\treturn \"companions\" in call && Array.isArray(call.companions) ? 1 + call.companions.length : 1;\n}\n/**\n* The columns a recreate loses: those the new table leaves out, whose values the copy drops, and,\n* when the recreate is destructive, those whose type it changes with no copy expression to convert them.\n*/\nfunction recreateLosses(call) {\n\tconst kept = new Set(call.contractTable.columns.map((column) => column.name));\n\tconst dropped = call.schemaColumnNames.filter((column) => !kept.has(column));\n\tconst retyped = call.operationClass === \"destructive\" ? call.retypedColumns.filter((column) => !Object.hasOwn(call.copyExpressions, column)) : [];\n\treturn [...dropped.map((column) => ({\n\t\tcolumn,\n\t\tloss: \"drop\"\n\t})), ...retyped.map((column) => ({\n\t\tcolumn,\n\t\tloss: \"typeChange\"\n\t}))];\n}\n/** The columns a recreate adds with a value its copy writes into every existing row. */\nfunction temporaryValuesOf(call) {\n\tconst copied = new Set(call.schemaColumnNames);\n\treturn Object.entries(call.temporaryValues).flatMap(([column, expression]) => copied.has(column) || expression.kind !== \"sql\" ? [] : [{\n\t\ttable: call.tableName,\n\t\tcolumn,\n\t\tvalue: expression.sql\n\t}]);\n}\n/**\n* What each call of a SQLite plan loses. A recreate that leaves a column out loses its values\n* itself, so a later drop of that column is not listed again.\n*/\nfunction sqliteCallSubjects(calls, fieldEvents) {\n\tconst lostColumns = /* @__PURE__ */ new Set();\n\tconst unknownNames = unknownCallNames(calls.filter((call) => call.operationClass === \"destructive\" && !(call instanceof RecreateTableCall) && !(call instanceof DropColumnCall) && !(call instanceof DropTableCall) && !(call instanceof RawSqlCall) && !fieldEvents.has(call)));\n\treturn calls.map((call) => {\n\t\tconst operationCount = operationCountOf(call);\n\t\tconst { label } = call;\n\t\tif (call instanceof RecreateTableCall) {\n\t\t\tconst columns = recreateLosses(call);\n\t\t\tfor (const { column } of columns) lostColumns.add(`${call.tableName}.${column}`);\n\t\t\treturn {\n\t\t\t\toperationCount,\n\t\t\t\tlabel,\n\t\t\t\tdataLoss: columns.length === 0 && call.operationClass === \"destructive\" ? [lost(tableTarget(call.tableName))] : columns.map(({ column, loss }) => lost(columnTarget(call.tableName, column), loss)),\n\t\t\t\taccessWidening: [],\n\t\t\t\ttemporaryValues: temporaryValuesOf(call)\n\t\t\t};\n\t\t}\n\t\tif (call instanceof DropColumnCall) return {\n\t\t\toperationCount,\n\t\t\tlabel,\n\t\t\tdataLoss: lostColumns.has(`${call.tableName}.${call.columnName}`) ? [] : [lost(columnTarget(call.tableName, call.columnName))],\n\t\t\taccessWidening: [],\n\t\t\ttemporaryValues: []\n\t\t};\n\t\tif (call instanceof DropTableCall) return {\n\t\t\toperationCount,\n\t\t\tlabel,\n\t\t\tdataLoss: [lost(tableTarget(call.tableName))],\n\t\t\taccessWidening: [],\n\t\t\ttemporaryValues: []\n\t\t};\n\t\tif (call.operationClass !== \"destructive\") return {\n\t\t\toperationCount,\n\t\t\tlabel,\n\t\t\tdataLoss: [],\n\t\t\taccessWidening: [],\n\t\t\ttemporaryValues: []\n\t\t};\n\t\tconst fieldEvent = fieldEvents.get(call);\n\t\treturn {\n\t\t\toperationCount,\n\t\t\tlabel,\n\t\t\tdataLoss: [lost(call instanceof RawSqlCall ? {\n\t\t\t\tstorageName: storageNameOfOperation(call.op),\n\t\t\t\ttable: void 0\n\t\t\t} : fieldEvent !== void 0 ? fieldEventStorage(fieldEvent) : {\n\t\t\t\tstorageName: unknownNames.get(call) ?? call.factoryName,\n\t\t\t\ttable: void 0\n\t\t\t})],\n\t\t\taccessWidening: [],\n\t\t\ttemporaryValues: []\n\t\t};\n\t});\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction createSqliteMigrationPlanner(lowerer) {\n\treturn new SqliteMigrationPlanner(lowerer);\n}\n/**\n* SQLite migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the live schema against the target contract via the one\n* differ (`buildSqlitePlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the registered strategies. Strategies\n* absorb groups of related issues into composite recipes (e.g. recreating a\n* table to apply type/nullability/default/constraint changes at once);\n* anything not absorbed by a strategy flows through `mapNodeIssueToCall` in\n* the issue planner as a one-off call.\n*\n* FK-backing indexes are already merged into the expected table node's\n* `indexes` at derivation (`contractToSchemaIR`'s `convertTable`), so\n* `mapNodeIssueToCall` handles them uniformly alongside user-declared\n* indexes — no separate expansion step in the planner.\n*/\nvar SqliteMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(options);\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderableSqliteMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, void 0, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tconst statements = this.planStatements(options);\n\t\tif (!statements.ok) return plannerFailure([statements.failure]);\n\t\tconst { expected, actual, issues: diffIssues } = this.collectSchemaIssues(options, statements.value.schema);\n\t\tconst replacedIndexes = pairIndexReplacements(diffIssues, indexNameCaseChange);\n\t\tconst disallowedIndexCalls = replacedIndexes.calls.filter((call) => !options.policy.allowedOperationClasses.includes(call.operationClass));\n\t\tif (disallowedIndexCalls.length > 0) return plannerFailure(disallowedIndexCalls.map((call) => conflictForDisallowedCall(call, options.policy.allowedOperationClasses)));\n\t\tconst issues = diffIssues.filter((issue) => !replacedIndexes.consumed.has(issue));\n\t\tconst caseChangeConflicts = detectTableNameCaseChanges({\n\t\t\tissues,\n\t\t\ttableOf: (issue) => {\n\t\t\t\tconst node = issueNode(issue);\n\t\t\t\treturn node instanceof SqlTableIR ? node : void 0;\n\t\t\t},\n\t\t\tnamespaceIdOf: () => UNBOUND_NAMESPACE_ID,\n\t\t\trenameByHandStatements: renameTableByHandStatements,\n\t\t\trenameTableCall: renderRenameTableCall,\n\t\t\tcontract: options.contract,\n\t\t\tdefaultNamespaceId: UNBOUND_NAMESPACE_ID\n\t\t});\n\t\tif (caseChangeConflicts.length > 0) return plannerFailure(caseChangeConflicts);\n\t\tconst defaultedBackfill = backfillOfDefaultedField(options.statements, options.fromContract, options.contract);\n\t\tif (defaultedBackfill !== void 0) return plannerFailure([defaultedBackfill]);\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst result = planIssues({\n\t\t\tissues,\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstatementColumns: fieldStatementColumns(options.statements, options.contract),\n\t\t\toriginCodecId: (table, column) => options.fromContract?.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.table?.[table]?.columns[column]?.codecId,\n\t\t\ttakesTemporaryValue: (table, column) => {\n\t\t\t\tconst storageTable = options.contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.table?.[table];\n\t\t\t\treturn storageTable !== void 0 && columnTakesTemporaryValue(storageTable, column);\n\t\t\t},\n\t\t\tstrategies: sqlitePlannerStrategies\n\t\t});\n\t\tif (!result.ok) return plannerFailure(result.failure);\n\t\tconst fieldEventCalls = planFieldEventCalls({\n\t\t\tpriorContract: options.origin === null ? null : options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks,\n\t\t\ttableRenames: statements.value.tableRenames,\n\t\t\tcolumnRenames: statements.value.columnRenames\n\t\t});\n\t\tconst fieldEventOps = fieldEventCalls.map(({ call }) => call);\n\t\tconst calls = [\n\t\t\t...statements.value.calls,\n\t\t\t...replacedIndexes.calls,\n\t\t\t...result.value.calls,\n\t\t\t...fieldEventOps\n\t\t];\n\t\tconst destination = {\n\t\t\tstorageHash: options.contract.storage.storageHash,\n\t\t\t...options.contract.profileHash !== void 0 ? { profileHash: options.contract.profileHash } : {}\n\t\t};\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderableSqliteMigration(calls, {\n\t\t\t\tfrom: options.origin?.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, destination, this.#lowerer),\n\t\t\tappliedStatements: appliedStatementsInOrder(options.statements, statements.value.appliedStatements),\n\t\t\t...subjectsOfCalls(sqliteCallSubjects(calls, new Map(fieldEventCalls.map((fieldEvent) => [fieldEvent.call, fieldEvent]))), {\n\t\t\t\tfromContract: options.fromContract,\n\t\t\t\tcontract: options.contract,\n\t\t\t\tstatements: options.statements,\n\t\t\t\tbyHand: sqliteTableRenameByHand\n\t\t\t})\n\t\t};\n\t}\n\t/**\n\t* Plans the statements against a working copy of the schema the plan starts from, in order, so\n\t* each rename's index replacements are computed against the schema the earlier statements left.\n\t* The diff then runs on that schema.\n\t*/\n\tplanStatements(options) {\n\t\tconst working = createWorkingSchema(sqliteActualSchema(options.schema));\n\t\tconst planned = planStatements({\n\t\t\tstatements: options.statements.filter(isRenameStatement),\n\t\t\tfromContract: options.fromContract,\n\t\t\tcontract: options.contract,\n\t\t\tpolicy: options.policy,\n\t\t\ttarget: {\n\t\t\t\ttables: () => sqliteSchemaTables(working.current),\n\t\t\t\trenameTableCall: (rename) => sqliteTableRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\trenameColumnCall: (rename) => sqliteColumnRenameCall({\n\t\t\t\t\tprevious: working.current,\n\t\t\t\t\tcontract: options.contract,\n\t\t\t\t\trename,\n\t\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t\t}),\n\t\t\t\tapply: (call) => working.apply(call),\n\t\t\t\t...sqliteTableRenameByHand\n\t\t\t}\n\t\t});\n\t\tif (!planned.ok) return planned;\n\t\treturn ok({\n\t\t\t...planned.value,\n\t\t\tschema: working.current\n\t\t});\n\t}\n\tensureAdditivePolicy(policy) {\n\t\tif (!policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\treturn null;\n\t}\n\t/**\n\t* Diffs the target contract against the live schema via the one differ\n\t* (the same tree-building `diffSqliteSchema` uses, plus the\n\t* op-render stamper) and prepares the issue list `planIssues` consumes.\n\t*\n\t* Three passes, in order:\n\t* 1. Subtree coalescing — the differ is total (a missing/extra table also\n\t* emits an issue for every column/constraint under it); those nested\n\t* issues are redundant once the table-level `CreateTable`/`DropTable`\n\t* call already accounts for the whole subtree. Runs FIRST, over the\n\t* complete diff: a sibling-owned extra table's column issues must\n\t* collapse into its one table-level issue before the ownership pass,\n\t* because a bare column node carries no table reference — if coalescing\n\t* ran after ownership dropped the table-level issue, the orphaned column\n\t* issues would survive and the planner would emit drops against a\n\t* sibling space's table.\n\t* 2. Ownership — a live extra is only this plan's to drop when no contract\n\t* space owns it. The differ ran against THIS space's contract, so a\n\t* table a sibling owns surfaces here as `not-expected`; the planner asks\n\t* the ownership oracle (the passive aggregate) whether any space declares\n\t* it and, if so, leaves it alone. A table no space owns stays a genuine\n\t* extra. Ownership lives in the aggregate; the planner only asks. No\n\t* oracle (single-space) keeps every extra.\n\t* 3. Strict-mode extras gating — `not-expected` (extra table/column/\n\t* constraint) issues are dropped entirely outside strict mode, mirroring\n\t* the retired coordinate walk's `if (strict) { ...extra_* } }` guards:\n\t* an additive-only plan must never even consider dropping an unclaimed\n\t* object, not just refuse to emit the drop.\n\t*/\n\tcollectSchemaIssues(options, schema) {\n\t\tconst allowed = options.policy.allowedOperationClasses;\n\t\tconst strict = allowed.includes(\"widening\") || allowed.includes(\"destructive\");\n\t\tconst { expected, actual, issues: rawIssues } = buildSqlitePlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(rawIssues), options.ownership);\n\t\treturn {\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tissues: strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\")\n\t\t};\n\t}\n};\n/**\n* Drops a `not-expected` issue when it is a whole extra TABLE that some\n* contract space owns, asking the ownership oracle per node.\n*\n* The consultation applies ONLY to table-level extras — a live table this\n* space's contract lacks — identified by asking the issue's own node\n* (`nodeKind === table`), never by counting path segments. SQLite is a\n* single-namespace target, so every coordinate is qualified with the shared\n* `UNBOUND_NAMESPACE_ID` sentinel (the same one the aggregate's declared\n* entities carry for this target). `entityKind` is the literal `'table'`:\n* this function only ever asks about a node already confirmed to be\n* `RelationalSchemaNodeKind.table` (checked just above), and that's a\n* diff-tree `nodeKind` spelling (`'sql-table'`) distinct from the storage\n* `entries` vocabulary `elementCoordinates` walks (`'table'`) — the literal\n* is that storage-entries spelling. `declaresEntity` answers over the whole\n* composition (self included), so a positive answer on such a table means\n* another space owns it (a table this space owned would be in its expected\n* tree, never an extra): leave it. A negative answer means no space owns\n* it — a genuine orphan to drop.\n*\n* A DEEPER extra (an extra column/constraint on a table this space DOES own —\n* only the child drifted, so the table is in the expected tree) is this\n* space's own drift and is always kept for dropping; asking the oracle there\n* would wrongly suppress it, because the owned table answers `true`. No oracle\n* ⇒ every extra is kept (single-space plan).\n*/\nfunction retainUnownedExtras(issues, ownership) {\n\tif (ownership === void 0) return issues;\n\treturn issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.table) return true;\n\t\tconst tableName = issue.path[1];\n\t\treturn tableName === void 0 || !ownership.declaresEntity({\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t});\n}\n//#endregion\nexport { createSqliteMigrationPlanner as n, SqliteMigrationPlanner as t };\n\n//# sourceMappingURL=planner-BENMBCnG.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,KAAK,QAAQ,OAAO,QAAQ;CACpC,OAAO;EACN,GAAG;EACH;CACD;AACD;AACA,SAAS,YAAY,OAAO;CAC3B,OAAO;EACN,aAAa;EACb,OAAO;GACN,aAAa;GACb;GACA,QAAQ,KAAK;EACd;CACD;AACD;AACA,SAAS,aAAa,OAAO,QAAQ;CACpC,OAAO;EACN,aAAa,GAAG,MAAM,GAAG;EACzB,OAAO;GACN,aAAa;GACb;GACA;EACD;CACD;AACD;AACA,SAAS,iBAAiB,MAAM;CAC/B,OAAO,gBAAgB,QAAQ,MAAM,QAAQ,KAAK,UAAU,IAAI,IAAI,KAAK,WAA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ACnE,UAAU,QAAQ;GAClB,cAAc;GACd,qBAAqB,QAAQ;EAC9B,CAAC;EACD,MAAM,QAAQ,oBAAoB,sBAAsB,SAAS,GAAG,QAAQ,SAAS;EACrF,OAAO;GACN;GACA;GACA,QAAQ,SAAS,QAAQ,MAAM,QAAQ,UAAU,aAAa,KAAK,MAAM,cAAc;EACxF;CACD;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,oBAAoB,QAAQ,WAAW;CAC/C,IAAI,cAAc,KAAK,GAAG,OAAO;CACjC,OAAO,OAAO,QAAQ,UAAU;EAC/B,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;EACnD,MAAM,OAAO,UAAU,KAAK;EAC5B,IAAI,SAAS,KAAK,KAAK,KAAK,aAAa,yBAAyB,OAAO,OAAO;EAChF,MAAM,YAAY,MAAM,KAAK;EAC7B,OAAO,cAAc,KAAK,KAAK,CAAC,UAAU,eAAe;GACxD,aAAa;GACb,YAAY;GACZ,YAAY;EACb,CAAC;CACF,CAAC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.mjs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-BqbQmUY1-CTmurARU.mjs";
|
|
3
3
|
import { MigrationPlanWithAuthoringSurface, OpFactoryCall } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
5
5
|
import { MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
6
6
|
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
7
7
|
import { ExecuteRequestLowerer } from "@prisma/orm-family-sql/family/control-adapter";
|
|
8
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-
|
|
8
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-CkHb8T4n.d.mts
|
|
9
9
|
//#region src/core/migrations/planner-produced-sqlite-migration.d.ts
|
|
10
10
|
type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
|
|
11
11
|
interface SqliteMigrationDestinationInfo {
|
|
@@ -28,4 +28,4 @@ declare class TypeScriptRenderableSqliteMigration extends SqliteMigration implem
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
export { TypeScriptRenderableSqliteMigration as n, SqliteMigrationDestinationInfo as t };
|
|
31
|
-
//# sourceMappingURL=planner-produced-sqlite-migration-
|
|
31
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-CkHb8T4n.d.mts"],"mappings":";;;;;;;;;KAQK,KAAK,0BAA0B;UAC1B;WACC;WACA;;cAEG,4CAA4C,2BAA2B;;EAEnF,YAAY,gBAAgB,iBAAiB,MAAM,eAAe,iBAAiB,6BAA6B,cAAc,gCAAgC,UAAU;MACpK,wBAAwB,KAAK,QAAQ;EACzC,YAAY;MACR,eAAe;;;;;;MAMf;EACJ,iBAAiB,wBAAwB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
2
|
-
import { t as renderOps } from "./render-ops-
|
|
1
|
+
import { t as SqliteMigration } from "./sqlite-migration-CTNkjYJ1-eRdmsbpK.mjs";
|
|
2
|
+
import { t as renderOps } from "./render-ops-B889CY71-JvEeW9B4.mjs";
|
|
3
3
|
import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { renderImports } from "@prisma/orm-framework/ts-render";
|
|
5
5
|
import { resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
6
6
|
import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
|
|
7
|
-
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-
|
|
7
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-DjEZTiif.mjs
|
|
8
8
|
/**
|
|
9
9
|
* Polymorphic TypeScript emitter for the SQLite migration IR. Mirrors the
|
|
10
10
|
* Postgres `render-typescript.ts` — different base-class + factory module
|
|
@@ -147,4 +147,4 @@ var TypeScriptRenderableSqliteMigration = class extends SqliteMigration {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
export { TypeScriptRenderableSqliteMigration as t };
|
|
149
149
|
|
|
150
|
-
//# sourceMappingURL=planner-produced-sqlite-migration-
|
|
150
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-produced-sqlite-migration-
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-DjEZTiif-DpC6rk_q.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#destination","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-DjEZTiif.mjs"],"sourcesContent":["import { t as SqliteMigration } from \"./sqlite-migration-CTNkjYJ1.mjs\";\nimport { t as renderOps } from \"./render-ops-B889CY71.mjs\";\nimport { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from \"@internal/framework-components/control\";\nimport { renderImports } from \"@internal/ts-render\";\nimport { resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\n//#region src/core/migrations/render-typescript.ts\n/**\n* Polymorphic TypeScript emitter for the SQLite migration IR. Mirrors the\n* Postgres `render-typescript.ts` — different base-class + factory module\n* specifier, same overall shape.\n*/\n/**\n* Always-present base imports for the rendered scaffold. Both come from\n* `@internal/sqlite/migration` so an authored SQLite\n* `migration.ts` only needs a single dependency for its base class and\n* its CLI entrypoint. Mirrors Postgres's `BASE_IMPORTS`.\n*\n* - `Migration` — the facade re-export fixes the `SqlMigration`\n* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to\n* `'sqlite'`.\n* - `MigrationCLI` — the migration-file CLI entrypoint, re-exported from\n* `@internal/cli/migration-cli`. Loads `prisma.config.ts`,\n* assembles a `ControlStack`, and instantiates the migration class.\n*/\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: \"@internal/sqlite/migration\",\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: \"@internal/sqlite/migration\",\n\tsymbol: \"MigrationCLI\"\n}];\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => c.renderTypeScript()).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`export default class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\treturn renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));\n}\n/**\n* The committed contract-JSON imports the scaffold reads its from/to identity\n* from, resolved to the deduplicated snapshot store under\n* `meta.snapshotsImportPath`. The end snapshot is always present; the start\n* snapshot is added only for a non-baseline migration (`meta.from !== null`).\n* The matching `Contract` type imports (aliased `Start`/`End`) feed the\n* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with\n* no start imports — `never` is the honest \"no prior contract\" Start.\n*/\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\n//#region src/core/migrations/planner-produced-sqlite-migration.ts\nvar TypeScriptRenderableSqliteMigration = class extends SqliteMigration {\n\t#calls;\n\t#meta;\n\t#destination;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, destination, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#destination = destination ?? { storageHash: meta.to };\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\tget destination() {\n\t\treturn this.#destination;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from {@link SqlMigrationPlannerPlanOptions.spaceId} so the runner\n\t* keys the marker row by the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderableSqliteMigration as t };\n\n//# sourceMappingURL=planner-produced-sqlite-migration-DjEZTiif.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,eAAe,CAAC;CACrB,iBAAiB;CACjB,QAAQ;AACT,GAAG;CACF,iBAAiB;CACjB,QAAQ;AACT,CAAC;AACD,SAAS,wBAAwB,OAAO,MAAM;CAC7C,MAAM,UAAU,aAAa,OAAO,IAAI;CACxC,MAAM,iBAAiB,MAAM,KAAK,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,KAAK;CACxE,MAAM,WAAW,KAAK,SAAS;CAC/B,MAAM,aAAa,WAAW,CAAC,wDAAwD,IAAI,CAAC;CAC5F,OAAO;EACN,eAAe,sBAAsB,CAAC;EACtC;EACA;EACA,4CAA4C,WAAW,UAAU,QAAQ;EACzE,GAAG;EACH;EACA;EACA;EACA;EACA,OAAO,g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,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,eAAe,eAAe,EAAE,aAAa,KAAK,GAAG;EAC1D,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKN,QAAQ,KAAKK,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKL;CACb;CACA,IAAI,cAAc;EACjB,OAAO,KAAKG;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKF;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
-
import { n as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-
|
|
3
|
-
import { AppliedMigrationStatement, MigrationAccessChange,
|
|
2
|
+
import { n as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-CkHb8T4n-SM_tztzo.mjs";
|
|
3
|
+
import { AppliedMigrationStatement, MigrationAccessChange, MigrationDataLoss, MigrationPlanner, MigrationScaffoldContext, MigrationTemporaryValue, PlanOrigin, ResolvedMigrationStatement, SchemaOwnership } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { MigrationOperationPolicy, SqlMigrationPlanner, SqlPlannerFailureResult } from "@prisma/orm-family-sql/family/control";
|
|
5
5
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
6
6
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
@@ -12,8 +12,9 @@ type SqlitePlanResult = {
|
|
|
12
12
|
readonly kind: 'success';
|
|
13
13
|
readonly plan: TypeScriptRenderableSqliteMigration;
|
|
14
14
|
readonly appliedStatements: readonly AppliedMigrationStatement[];
|
|
15
|
-
readonly dataLoss: readonly
|
|
15
|
+
readonly dataLoss: readonly MigrationDataLoss[];
|
|
16
16
|
readonly accessWidening: readonly MigrationAccessChange[];
|
|
17
|
+
readonly temporaryValues: readonly MigrationTemporaryValue[];
|
|
17
18
|
} | SqlPlannerFailureResult;
|
|
18
19
|
/**
|
|
19
20
|
* SQLite migration planner — a thin wrapper over `planIssues`.
|
|
@@ -111,4 +112,4 @@ declare class SqliteMigrationPlanner implements SqlMigrationPlanner<SqlitePlanTa
|
|
|
111
112
|
}
|
|
112
113
|
//#endregion
|
|
113
114
|
export { SqlitePlanResult as n, createSqliteMigrationPlanner as r, SqliteMigrationPlanner as t };
|
|
114
|
-
//# sourceMappingURL=planner-
|
|
115
|
+
//# sourceMappingURL=planner-tv5z1cn8.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-tv5z1cn8.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner.d.mts"],"mappings":";;;;;;;;;iBAQiB,6BAA6B,SAAS,wBAAwB;KAC1E;WACM;WACA,MAAM;WACN,4BAA4B;WAC5B,mBAAmB;WACnB,yBAAyB;WACzB,0BAA0B;IACjC;;;;;;;;;;;;;;;;;cAiBU,kCAAkC,oBAAoB,0BAA0B;;EAE5F,YAAY,SAAS;EACrB,KAAK;aACM;aACA;aACA,QAAQ;;;;;;;;;aASR,cAAc;;aAEd,QAAQ;aACR,qBAAqB;aACrB,qBAAqB,cAAc;;;;;;aAMnC;;;;;aAKA,YAAY;;;;;;aAMZ;MACP;EACJ,eAAe,SAAS,0BAA0B,kBAAkB;UAC5D;;;;;;UAMA;UACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BA"}
|