@prisma/orm-target-sqlite 0.16.0-dev.36
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/LICENSE +201 -0
- package/README.md +23 -0
- package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts +22 -0
- package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts.map +1 -0
- package/dist/adapter-m_BtnNSn.d.mts +2 -0
- package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs +997 -0
- package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs.map +1 -0
- package/dist/adapter.d.mts +14 -0
- package/dist/adapter.mjs +6 -0
- package/dist/adapter__adapter.d.mts +4 -0
- package/dist/adapter__adapter.mjs +2 -0
- package/dist/adapter__codec-types.d.mts +4 -0
- package/dist/adapter__codec-types.mjs +1 -0
- package/dist/adapter__column-types.d.mts +2 -0
- package/dist/adapter__column-types.mjs +2 -0
- package/dist/adapter__control.d.mts +5 -0
- package/dist/adapter__control.mjs +261 -0
- package/dist/adapter__control.mjs.map +1 -0
- package/dist/adapter__runtime.d.mts +2 -0
- package/dist/adapter__runtime.mjs +32 -0
- package/dist/adapter__runtime.mjs.map +1 -0
- package/dist/adapter__types.d.mts +3 -0
- package/dist/adapter__types.mjs +1 -0
- package/dist/codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts +31 -0
- package/dist/codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts.map +1 -0
- package/dist/codec-descriptor-CyCQXvSl.d.mts +2 -0
- package/dist/codec-descriptor-kVCSW1OR-CPatZUPM.mjs +104 -0
- package/dist/codec-descriptor-kVCSW1OR-CPatZUPM.mjs.map +1 -0
- package/dist/codec-descriptor-rFuZ9DzY-DO0k8l6N.d.mts +1 -0
- package/dist/codec-ids-ChRBs2aB.d.mts +1 -0
- package/dist/codec-ids-DocGjhs--CHhP1jNZ.d.mts +13 -0
- package/dist/codec-ids-DocGjhs--CHhP1jNZ.d.mts.map +1 -0
- package/dist/codec-ids-xicqpuAa-DHnKqnIs.mjs +13 -0
- package/dist/codec-ids-xicqpuAa-DHnKqnIs.mjs.map +1 -0
- package/dist/codec-types-DKB--ltR-CIuvX0zx.d.mts +24 -0
- package/dist/codec-types-DKB--ltR-CIuvX0zx.d.mts.map +1 -0
- package/dist/codec-types-Tw3EFTjf.d.mts +1 -0
- package/dist/codec-types-wPDlPoD7.d.mts +2 -0
- package/dist/codecs-1-oOsTPG-Bv518Lbm.d.mts +155 -0
- package/dist/codecs-1-oOsTPG-Bv518Lbm.d.mts.map +1 -0
- package/dist/codecs-CM_2W3uA.mjs +345 -0
- package/dist/codecs-CM_2W3uA.mjs.map +1 -0
- package/dist/codecs-j-8RDkOt.d.mts +1 -0
- package/dist/column-types-StKUDF6A.mjs +34 -0
- package/dist/column-types-StKUDF6A.mjs.map +1 -0
- package/dist/column-types-iWGuW-0W.d.mts +33 -0
- package/dist/column-types-iWGuW-0W.d.mts.map +1 -0
- package/dist/contract-free-CCLAXZV2.d.mts +88 -0
- package/dist/contract-free-CCLAXZV2.d.mts.map +1 -0
- package/dist/contract-free-DElSXD0q.mjs +90 -0
- package/dist/contract-free-DElSXD0q.mjs.map +1 -0
- package/dist/control--wMueaTg.d.mts +61 -0
- package/dist/control--wMueaTg.d.mts.map +1 -0
- package/dist/control-8G9x72lw.mjs +42 -0
- package/dist/control-8G9x72lw.mjs.map +1 -0
- package/dist/control-DLO163u8.d.mts +19 -0
- package/dist/control-DLO163u8.d.mts.map +1 -0
- package/dist/control-cahq7u71.d.mts +117 -0
- package/dist/control-cahq7u71.d.mts.map +1 -0
- package/dist/control-tables-D_o8dKRB-BXi43noL.mjs +12 -0
- package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +1 -0
- package/dist/control-tables-Dua-YcJL.d.mts +12 -0
- package/dist/control-tables-Dua-YcJL.d.mts.map +1 -0
- package/dist/ddl-CW34JvfE-rd1ZIxOn.mjs +66 -0
- package/dist/ddl-CW34JvfE-rd1ZIxOn.mjs.map +1 -0
- package/dist/ddl-CfSqNT0M.d.mts +1 -0
- package/dist/default-normalizer-B9V7TY5u.d.mts +7 -0
- package/dist/default-normalizer-B9V7TY5u.d.mts.map +1 -0
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +69 -0
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +1 -0
- package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs +30 -0
- package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs.map +1 -0
- package/dist/descriptor-meta-DnwDwnGg-D3f936hn.mjs +23 -0
- package/dist/descriptor-meta-DnwDwnGg-D3f936hn.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +13 -0
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +1 -0
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs +70 -0
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +1 -0
- package/dist/driver.d.mts +3 -0
- package/dist/driver.mjs +2 -0
- package/dist/driver__control.d.mts +2 -0
- package/dist/driver__control.mjs +2 -0
- package/dist/driver__runtime.d.mts +2 -0
- package/dist/driver__runtime.mjs +197 -0
- package/dist/driver__runtime.mjs.map +1 -0
- package/dist/errors-CKsaaSnD-BeB4JS8h.mjs +38 -0
- package/dist/errors-CKsaaSnD-BeB4JS8h.mjs.map +1 -0
- package/dist/migration-jsmNRI_8.mjs +47 -0
- package/dist/migration-jsmNRI_8.mjs.map +1 -0
- package/dist/migration-uylRe5MP.d.mts +43 -0
- package/dist/migration-uylRe5MP.d.mts.map +1 -0
- package/dist/native-type-normalizer-CO2wKGL6.d.mts +12 -0
- package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +1 -0
- package/dist/native-type-normalizer-GpQMEyN5.mjs +14 -0
- package/dist/native-type-normalizer-GpQMEyN5.mjs.map +1 -0
- package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts +29 -0
- package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +1 -0
- package/dist/nodes-DUZSdX86-BBEEaxXY.mjs +33 -0
- package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +1 -0
- package/dist/op-factory-call-C_or6163-B_LDzC37.mjs +829 -0
- package/dist/op-factory-call-C_or6163-B_LDzC37.mjs.map +1 -0
- package/dist/op-factory-call-DoHN7Q7L.d.mts +161 -0
- package/dist/op-factory-call-DoHN7Q7L.d.mts.map +1 -0
- package/dist/pack-BfwyQ0b3.d.mts +93 -0
- package/dist/pack-BfwyQ0b3.d.mts.map +1 -0
- package/dist/planner-Bxdi7jZF.d.mts +104 -0
- package/dist/planner-Bxdi7jZF.d.mts.map +1 -0
- package/dist/planner-DiGcIjl1-QnNAhVmX.mjs +811 -0
- package/dist/planner-DiGcIjl1-QnNAhVmX.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts +31 -0
- package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +1 -0
- package/dist/planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs +150 -0
- package/dist/planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +1 -0
- package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs +15 -0
- package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +1 -0
- package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts +13 -0
- package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +1 -0
- package/dist/render-ops-B10yqmdG.d.mts +11 -0
- package/dist/render-ops-B10yqmdG.d.mts.map +1 -0
- package/dist/render-ops-DIOn_wOx-D33LOy3b.mjs +27 -0
- package/dist/render-ops-DIOn_wOx-D33LOy3b.mjs.map +1 -0
- package/dist/runtime-B1coahKC.d.mts +15 -0
- package/dist/runtime-B1coahKC.d.mts.map +1 -0
- package/dist/runtime-B99c4n56.d.mts +28 -0
- package/dist/runtime-B99c4n56.d.mts.map +1 -0
- package/dist/runtime-tbBYTw7Z.d.mts +10 -0
- package/dist/runtime-tbBYTw7Z.d.mts.map +1 -0
- package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts +68 -0
- package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +1 -0
- package/dist/sql-utils-0SJZOd7Q.d.mts +18 -0
- package/dist/sql-utils-0SJZOd7Q.d.mts.map +1 -0
- package/dist/sql-utils-DqPXZBMA-Mm27NNjs.mjs +35 -0
- package/dist/sql-utils-DqPXZBMA-Mm27NNjs.mjs.map +1 -0
- package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts +31 -0
- package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +1 -0
- package/dist/sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs +151 -0
- package/dist/sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs.map +1 -0
- package/dist/sqlite-migration-CV6LIqhx-D5eMTAbH.mjs +94 -0
- package/dist/sqlite-migration-CV6LIqhx-D5eMTAbH.mjs.map +1 -0
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts +105 -0
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +1 -0
- package/dist/target.d.mts +28 -0
- package/dist/target.mjs +19 -0
- package/dist/target__codec-descriptor.d.mts +3 -0
- package/dist/target__codec-descriptor.mjs +2 -0
- package/dist/target__codec-ids.d.mts +3 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +4 -0
- package/dist/target__codec-types.mjs +1 -0
- package/dist/target__codecs.d.mts +3 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__contract-free.d.mts +2 -0
- package/dist/target__contract-free.mjs +3 -0
- package/dist/target__control-tables.d.mts +2 -0
- package/dist/target__control-tables.mjs +2 -0
- package/dist/target__control.d.mts +3 -0
- package/dist/target__control.mjs +432 -0
- package/dist/target__control.mjs.map +1 -0
- package/dist/target__ddl.d.mts +3 -0
- package/dist/target__ddl.mjs +2 -0
- package/dist/target__default-normalizer.d.mts +2 -0
- package/dist/target__default-normalizer.mjs +2 -0
- package/dist/target__migration.d.mts +3 -0
- package/dist/target__migration.mjs +3 -0
- package/dist/target__native-type-normalizer.d.mts +2 -0
- package/dist/target__native-type-normalizer.mjs +2 -0
- package/dist/target__op-factory-call.d.mts +2 -0
- package/dist/target__op-factory-call.mjs +2 -0
- package/dist/target__pack.d.mts +2 -0
- package/dist/target__pack.mjs +2 -0
- package/dist/target__planner-produced-sqlite-migration.d.mts +3 -0
- package/dist/target__planner-produced-sqlite-migration.mjs +2 -0
- package/dist/target__planner-target-details.d.mts +2 -0
- package/dist/target__planner-target-details.mjs +2 -0
- package/dist/target__planner.d.mts +2 -0
- package/dist/target__planner.mjs +2 -0
- package/dist/target__render-ops.d.mts +2 -0
- package/dist/target__render-ops.mjs +2 -0
- package/dist/target__runtime.d.mts +3 -0
- package/dist/target__runtime.mjs +17 -0
- package/dist/target__runtime.mjs.map +1 -0
- package/dist/target__sql-utils.d.mts +2 -0
- package/dist/target__sql-utils.mjs +2 -0
- package/dist/types-C5FSREvo-Bm6N5Kog.d.mts +25 -0
- package/dist/types-C5FSREvo-Bm6N5Kog.d.mts.map +1 -0
- package/dist/types-DiH2oWUJ.d.mts +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-DiGcIjl1-QnNAhVmX.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-DiGcIjl1.mjs"],"sourcesContent":["import { a as DropColumnCall, d as buildRecreateSummary, h as renderDefaultLiteral, i as DataTransformCall, l as RecreateTableCall, m as buildColumnTypeSql, n as CreateIndexCall, o as DropIndexCall, p as buildColumnDefaultSql, r as CreateTableCall, s as DropTableCall, t as AddColumnCall, u as buildRecreatePostchecks } from \"./op-factory-call-C_or6163.mjs\";\nimport { t as CONTROL_TABLE_NAMES } from \"./control-tables-D_o8dKRB.mjs\";\nimport { t as TypeScriptRenderableSqliteMigration } from \"./planner-produced-sqlite-migration-C8nxPT0P.mjs\";\nimport { DdlColumn, ForeignKeyConstraint, FunctionColumnDefault, LiteralColumnDefault, PrimaryKeyConstraint, UniqueConstraint } from \"@internal/sql-relational-core/ast\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { buildNativeTypeExpander, contractToSchemaIR, extractCodecControlHooks, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { verifySqlSchemaByDiff } from \"@internal/family-sql/diff\";\nimport { diffSchemas, issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError, assertNever } from \"@internal/utils/internal-error\";\n//#region src/core/migrations/diff-database-schema.ts\n/** Renders a column default for the SQLite dialect. */\nfunction sqliteRenderDefault(def, _column) {\n\tif (def.kind === \"function\") {\n\t\tif (def.expression === \"now()\") return \"datetime('now')\";\n\t\treturn def.expression;\n\t}\n\treturn renderDefaultLiteral(def.value);\n}\n/**\n* The SQLite expected-side projection: contract → flat relational schema IR.\n*\n* `extras` thread the plan-time derivation input: the native-type expander,\n* so the expected side carries resolved native types (like the verify\n* side). Every expected column also carries its `codecRef` unconditionally\n* (Decision 5) — the planner's op-builders resolve DDL rendering from it at\n* plan time, so no separate render stamper is threaded here.\n*/\nfunction sqliteContractToSchema(contract, extras) {\n\treturn contractToSchemaIR(contract, {\n\t\tannotationNamespace: \"sqlite\",\n\t\trenderDefault: sqliteRenderDefault,\n\t\t...ifDefined(\"expandNativeType\", extras?.expandNativeType)\n\t});\n}\n/**\n* The SQLite schema verify: the full-tree node-diff verdict wrapped in the\n* issue-based result envelope. Used by the runner's post-apply check; the\n* family `verifySchema` runs the same composition via the descriptor hook.\n*/\nfunction verifySqliteDatabaseSchema(input) {\n\treturn verifySqlSchemaByDiff({\n\t\tcontract: input.contract,\n\t\tschema: input.actualSchema,\n\t\tstrict: input.strict,\n\t\tframeworkComponents: input.frameworkComponents,\n\t\tdiffSchema: diffSqliteSchema,\n\t\tgranularityOf: relationalNodeGranularity\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject table's declared control policy\n* directly from the contract. SQLite's expected tree is flat, so the issue\n* path carries no namespace segment — `path[1]` is the table name (`path[0]`\n* is the tree root's own id); every contract namespace is searched for that\n* table name (table names are globally unique in the flat tree — duplicates\n* across namespaces are rejected earlier, at `contractToSchemaIR`).\n*/\nfunction resolveControlPolicy(issue, contract) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return void 0;\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst table = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t\tif (table !== void 0) return table.control;\n\t}\n}\n/**\n* The SQLite full-tree node diff for the family verify verdict: derive the\n* expected flat tree with resolved leaf values (expander threaded so\n* parameterized types compare expanded; FK nodes born with the flat empty\n* `resolvedReferencedNamespace`), and run the generic differ over the trees\n* as derived. Flat targets need no ownership scoping. The codec `verifyType`\n* hooks run once per contract namespace with tables, each against the sole\n* flat actual root — exactly the legacy per-namespace pairing.\n*/\nfunction diffSqliteSchema(input) {\n\tconst expandNativeType = buildNativeTypeExpander(input.frameworkComponents);\n\tconst expected = sqliteContractToSchema(input.contract, { ...ifDefined(\"expandNativeType\", expandNativeType) });\n\tconst actual = input.schema instanceof SqlSchemaIR ? input.schema : blindCast(input.schema);\n\treturn {\n\t\tissues: diffSchemas(expected, actual),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, input.contract),\n\t\tnamespacePairs: Object.values(input.contract.storage.namespaces).filter((ns) => Object.keys(ns.entries.table ?? {}).length > 0).map(() => ({ actual }))\n\t};\n}\n/**\n* The SQLite planner's diff input: the same tree-building\n* `diffSqliteSchema` uses (expander threaded, FK nodes born flat). One differ\n* drives both verify and plan over the trees as derived; this is the plan-side\n* derivation — column DDL resolves from each expected column's `codecRef` at\n* plan time (`column-ddl-rendering.ts`), so no separate render stamping happens here.\n*/\nfunction buildSqlitePlanDiff(input) {\n\tconst expandNativeType = buildNativeTypeExpander(input.frameworkComponents);\n\tconst expected = sqliteContractToSchema(input.contract, { ...ifDefined(\"expandNativeType\", expandNativeType) });\n\tconst actual = new SqlSchemaIR(withRecordKeyNames(input.actualSchema));\n\treturn {\n\t\texpected,\n\t\tactual,\n\t\tissues: diffSchemas(expected, actual)\n\t};\n}\n/**\n* Every schema-tree builder in this codebase derives a table's / column's\n* `name` from the record key it's stored under (`contractToSchemaIR`,\n* the SQLite introspection adapter) rather than trusting a redundant\n* embedded field — the record key IS the identity. Mirrors that discipline\n* for the actual/live tree before construction, so `SqlTableIR.id` /\n* `SqlColumnIR.id` (both derived from `.name`) are always correct without\n* requiring every caller to duplicate the key onto the value. A no-op for a\n* tree that already carries matching names (the real introspection adapter\n* always does).\n*/\nfunction withRecordKeyNames(actualSchema) {\n\tconst raw = blindCast(actualSchema);\n\tconst tables = {};\n\tfor (const [tableName, table] of Object.entries(raw.tables ?? {})) {\n\t\tconst rawTable = blindCast(table);\n\t\tconst columns = {};\n\t\tfor (const [columnName, column] of Object.entries(blindCast(table).columns ?? {})) columns[columnName] = {\n\t\t\t...blindCast(column),\n\t\t\tname: columnName\n\t\t};\n\t\ttables[tableName] = {\n\t\t\t...rawTable,\n\t\t\tname: tableName,\n\t\t\tcolumns,\n\t\t\tforeignKeys: rawTable.foreignKeys ?? [],\n\t\t\tuniques: rawTable.uniques ?? [],\n\t\t\tindexes: rawTable.indexes ?? []\n\t\t};\n\t}\n\treturn { tables };\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\n/**\n* Reconstructs the `StorageColumn`-shaped fields `buildColumnTypeSql` /\n* `buildColumnDefaultSql` expect, from a column node's own stamped codec\n* identity (`codecRef` / `codecBaseNativeType`, Decision 5) — never the\n* contract. SQLite's type renderer only uppercases the resolved base type\n* (no parameterized expansion, no named-type quoting), so `typeRef` is\n* deliberately left unset here: setting it would send `buildColumnTypeSql`\n* back through a live `storageTypes` lookup the node's fields have already\n* resolved past, which throws for an unrecognized reference (unlike\n* Postgres's lenient fallback).\n*/\nfunction columnLike(column) {\n\tif (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new InternalError(`columnLike: expected column \"${column.name}\" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tnativeType: column.codecBaseNativeType,\n\t\tcodecId: column.codecRef.codecId,\n\t\tnullable: column.nullable,\n\t\t...(column.many ?? column.codecRef.many) !== void 0 ? { many: column.many ?? column.codecRef.many } : {},\n\t\t...column.codecRef.typeParams !== void 0 ? { typeParams: blindCast(column.codecRef.typeParams) } : {},\n\t\t...column.resolvedDefault !== void 0 ? { default: column.resolvedDefault } : {}\n\t};\n}\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(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* True when the column is rendered inline as `INTEGER PRIMARY KEY\n* AUTOINCREMENT` — the sole member of the table's primary key with an\n* `autoincrement()` default. Node-based sibling of the retired\n* `isInlineAutoincrementPrimaryKey` (which read the raw `StorageTable`);\n* reads the table/column nodes instead.\n*/\nfunction isInlineAutoincrementPrimaryKeyNode(table, column) {\n\tif (table.primaryKey?.columns.length !== 1) return false;\n\tif (table.primaryKey.columns[0] !== column.name) return false;\n\treturn column.resolvedDefault?.kind === \"function\" && column.resolvedDefault.expression === \"autoincrement()\";\n}\n/**\n* Builds the flat `SqliteColumnSpec` `AddColumnCall` / `RecreateTableCall`\n* need, resolved from the column node's codec identity — the same builders\n* the pre-`plan(start, end)` op-path called, so the output is\n* byte-identical.\n*/\nfunction columnSpecFromNode(column, inline) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, {});\n\tconst defaultSql = buildColumnDefaultSql(like.default);\n\treturn {\n\t\tname: column.name,\n\t\ttypeSql,\n\t\tdefaultSql,\n\t\tnullable: column.nullable,\n\t\t...inline ? { inlineAutoincrementPrimaryKey: true } : {}\n\t};\n}\n/**\n* Builds the `DdlColumn` the `CreateTableCall` path needs, resolved from the\n* column node's codec identity.\n*/\nfunction ddlColumnFromNode(column, inline) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, {});\n\tif (inline) return new DdlColumn({\n\t\tname: column.name,\n\t\ttype: `${typeSql} PRIMARY KEY AUTOINCREMENT`\n\t});\n\tconst colDefault = sqliteDefaultToDdlColumnDefault(like.default);\n\treturn new DdlColumn({\n\t\tname: column.name,\n\t\ttype: typeSql,\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...colDefault !== void 0 ? { default: colDefault } : {},\n\t\t...column.codecRef !== void 0 ? { codecRef: column.codecRef } : {}\n\t});\n}\n/**\n* Builds the table-level constraints (PK / unique / FK) for a `CreateTable`\n* path from the table node — the node-sourced sibling of the retired\n* contract-based `tableToDdlParts`'s constraint half.\n*/\nfunction tableConstraintsFromNode(table, hasInlinePk) {\n\tconst constraints = [];\n\tif (table.primaryKey && !hasInlinePk) constraints.push(new PrimaryKeyConstraint({ columns: table.primaryKey.columns }));\n\tfor (const u of table.uniques) constraints.push(new UniqueConstraint({\n\t\tcolumns: u.columns,\n\t\t...u.name !== void 0 ? { name: u.name } : {}\n\t}));\n\tfor (const fk of table.foreignKeys) constraints.push(new ForeignKeyConstraint({\n\t\tcolumns: fk.columns,\n\t\trefTable: fk.referencedTable,\n\t\trefColumns: fk.referencedColumns,\n\t\t...fk.name !== void 0 ? { name: fk.name } : {},\n\t\t...fk.onDelete !== void 0 ? { onDelete: fk.onDelete } : {},\n\t\t...fk.onUpdate !== void 0 ? { onUpdate: fk.onUpdate } : {}\n\t}));\n\treturn constraints;\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Classifies a node issue into the operation class a recreate absorbing it\n* would need, or `null` when the strategy doesn't handle this node/reason at\n* all (table/column not-found-or-not-expected, and index issues — those are\n* standalone ops, never folded into a recreate).\n*\n* Column drift is a single `not-equal` issue now (type AND nullability\n* compared together by `SqlColumnIR.isEqualTo`), so this reads both fields\n* off the node pair directly rather than trusting a separate issue kind per\n* attribute: a type change is always destructive; a pure nullability change\n* is destructive when tightening (NOT NULL required) and widening when\n* relaxing.\n*/\nfunction classifyNodeIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return null;\n\tswitch (blindCast(node).nodeKind) {\n\t\tcase RelationalSchemaNodeKind.column: {\n\t\t\tif (issueOutcome(issue) !== \"not-equal\") return null;\n\t\t\tconst expected = blindCast(issue.expected);\n\t\t\tif (columnTypeChanged(expected, blindCast(issue.actual))) return \"destructive\";\n\t\t\treturn expected.nullable ? \"widening\" : \"destructive\";\n\t\t}\n\t\tcase RelationalSchemaNodeKind.columnDefault: return issueOutcome(issue) === \"not-expected\" ? \"destructive\" : \"widening\";\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.foreignKey:\n\t\tcase RelationalSchemaNodeKind.unique: return \"destructive\";\n\t\tdefault: return null;\n\t}\n}\n/**\n* Groups recreate-eligible issues by table, decides per-table operation class\n* (destructive wins over widening), and emits one `RecreateTableCall` per\n* table. Returns unchanged-or-smaller issue list — issues the strategy\n* consumed are removed so `mapNodeIssueToCall` doesn't double-handle them.\n*\n* The full desired/live table shapes come from `ctx.expected`/`ctx.actual`\n* directly (keyed by table name — SQLite is a flat, single-namespace target)\n* rather than from any individual issue, since a single drifted attribute's\n* issue only carries that attribute's own node, never the whole table.\n*/\nconst recreateTableStrategy = (issues, ctx) => {\n\tconst byTable = /* @__PURE__ */ new Map();\n\tconst consumed = /* @__PURE__ */ new Set();\n\tfor (const issue of issues) {\n\t\tconst cls = classifyNodeIssue(issue);\n\t\tif (!cls) continue;\n\t\tconst tableName = issue.path[1];\n\t\tif (tableName === void 0) continue;\n\t\tconst entry = byTable.get(tableName);\n\t\tif (entry) {\n\t\t\tentry.issues.push(issue);\n\t\t\tif (cls === \"destructive\") entry.hasDestructive = true;\n\t\t} else byTable.set(tableName, {\n\t\t\tissues: [issue],\n\t\t\thasDestructive: cls === \"destructive\"\n\t\t});\n\t\tconsumed.add(issue);\n\t}\n\tif (byTable.size === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [tableName, entry] of byTable) {\n\t\tconst expectedTable = ctx.expected.tables[tableName];\n\t\tconst actualTable = ctx.actual.tables[tableName];\n\t\tif (!expectedTable || !actualTable) continue;\n\t\tconst operationClass = entry.hasDestructive ? \"destructive\" : \"widening\";\n\t\tconst tableSpec = tableSpecFromNode(expectedTable);\n\t\tconst indexes = expectedTable.indexes.map((idx) => ({\n\t\t\tname: idx.name,\n\t\t\tcolumns: idx.columns ?? []\n\t\t}));\n\t\tcalls.push(new RecreateTableCall({\n\t\t\ttableName,\n\t\t\tcontractTable: tableSpec,\n\t\t\tschemaColumnNames: Object.keys(actualTable.columns),\n\t\t\tindexes,\n\t\t\tsummary: buildRecreateSummary(tableName, entry.issues),\n\t\t\tpostchecks: buildRecreatePostchecks(tableName, entry.issues, tableSpec),\n\t\t\toperationClass\n\t\t}));\n\t}\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !consumed.has(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* When the policy allows `'data'` and the expected tree tightens one or more\n* columns from nullable to NOT NULL, emit a `DataTransformCall` stub per\n* tightened column. The user fills the backfill `UPDATE` in the rendered\n* `migration.ts` before the subsequent `RecreateTableCall` copies data into\n* the tightened schema (whose `INSERT INTO temp SELECT … FROM old` would\n* otherwise fail at runtime if any `NULL`s remain).\n*\n* Does NOT consume the tightening issue — `recreateTableStrategy` still\n* needs it to produce the actual recreate that enforces the NOT NULL at\n* the schema level. The backfill op and the recreate op end up in the\n* recipe slot in strategy order (backfill first, recreate second), which\n* matches the required execution order.\n*\n* Mirrors Postgres's `nullableTighteningCallStrategy` / `'data'`-class\n* gating. When `'data'` is not in the policy (the default `db update` /\n* `db init` path), the strategy short-circuits and the recreate alone\n* runs with its current destructive-class gating — preserving today's\n* behavior where a tightening blows up at runtime if NULLs are present.\n*/\nconst nullabilityTighteningBackfillStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\" || issue.expected === void 0 || issue.actual === void 0) continue;\n\t\tif (blindCast(issue.expected).nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expectedColumn = blindCast(issue.expected);\n\t\tconst actualColumn = blindCast(issue.actual);\n\t\tif (expectedColumn.nullable === actualColumn.nullable) continue;\n\t\tif (expectedColumn.nullable) continue;\n\t\tconst tableName = issue.path[1];\n\t\tif (tableName === void 0) continue;\n\t\tcalls.push(new DataTransformCall(`data_migration.backfill-${tableName}-${expectedColumn.name}`, `Backfill NULLs in \"${tableName}\".\"${expectedColumn.name}\" before NOT NULL tightening`, tableName, expectedColumn.name));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\nconst sqlitePlannerStrategies = [nullabilityTighteningBackfillStrategy, recreateTableStrategy];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree (columns, defaults,\n* constraints, indexes). `CreateTableCall`/`DropTableCall` and\n* `AddColumnCall`/`DropColumnCall` already account for the whole subtree\n* (reading it directly off the table/column node), so the nested issues are\n* redundant — coalescing them is \"the planner's responsibility\" the differ's\n* own contract assigns (`schema-diff.ts`). Drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path.\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) === \"not-found\" || issueOutcome(issue) === \"not-expected\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\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* Builds the flat `SqliteTableSpec` `RecreateTableCall` needs from the\n* expected table node — the node-sourced equivalent of the retired\n* `toTableSpec` (which read a raw contract `StorageTable`). Every column's\n* spec is resolved from its `codecRef` via `columnSpecFromNode`.\n*/\nfunction tableSpecFromNode(table) {\n\tconst columns = Object.values(table.columns).map((c) => columnSpecFromNode(c, isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst uniques = table.uniques.map((u) => ({\n\t\tcolumns: u.columns,\n\t\t...u.name !== void 0 ? { name: u.name } : {}\n\t}));\n\tconst foreignKeys = table.foreignKeys.map((fk) => ({\n\t\tcolumns: fk.columns,\n\t\treferences: {\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: fk.referencedColumns\n\t\t},\n\t\t...fk.name !== void 0 ? { name: fk.name } : {},\n\t\t...fk.onDelete !== void 0 ? { onDelete: fk.onDelete } : {},\n\t\t...fk.onUpdate !== void 0 ? { onUpdate: fk.onUpdate } : {}\n\t}));\n\treturn {\n\t\tcolumns,\n\t\t...table.primaryKey ? { primaryKey: { columns: table.primaryKey.columns } } : {},\n\t\tuniques,\n\t\tforeignKeys\n\t};\n}\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\nfunction issueLocation(tableName, columnName) {\n\treturn columnName !== void 0 ? {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\tcolumn: columnName\n\t} : {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t};\n}\n/**\n* Conflict kind for a node kind that `recreateTableStrategy` absorbs for\n* every reachable production issue. Reaching `mapNodeIssueToCall` for one of\n* these means the recreate strategy didn't run — mirrors the legacy\n* `conflictKindForIssue` per-kind categorization.\n*/\nfunction absorbedConflictKind(nodeKind) {\n\tswitch (nodeKind) {\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.unique: return \"indexIncompatible\";\n\t\tcase RelationalSchemaNodeKind.foreignKey: return \"foreignKeyConflict\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\n/**\n* Builds the `CreateTableCall` + per-index `CreateIndexCall`s for a\n* newly-expected table. Reads only the table node's own children — indexes\n* (declared + FK-backing, deduped) are already merged and ordered at\n* derivation (`contractToSchemaIR`'s `convertTable`).\n*/\nfunction buildCreateTableCalls(table) {\n\tconst columns = Object.values(table.columns).map((c) => ddlColumnFromNode(c, isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst constraints = tableConstraintsFromNode(table, Object.values(table.columns).some((c) => isInlineAutoincrementPrimaryKeyNode(table, c)));\n\tconst calls = [new CreateTableCall(table.name, columns, constraints.length > 0 ? constraints : void 0)];\n\tfor (const index of table.indexes) {\n\t\tconst indexName = index.name;\n\t\tcalls.push(new CreateIndexCall(table.name, indexName, index.columns ?? []));\n\t}\n\treturn calls;\n}\nfunction mapTableIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCalls(blindCast(issue.expected)));\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst table = blindCast(issue.actual);\n\t\tif (CONTROL_TABLE_NAMES.has(table.name)) return ok([]);\n\t\treturn ok([new DropTableCall(table.name)]);\n\t}\n\treturn notOk(issueConflict(\"unsupportedOperation\", `Unexpected table drift: ${issue.path.join(\"/\")}`));\n}\nfunction mapColumnIssue(issue, ctx) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Column issue has no table in its path: ${issue.path.join(\"/\")}`));\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\tconst table = ctx.expected.tables[tableName];\n\t\treturn ok([new AddColumnCall(tableName, columnSpecFromNode(column, table !== void 0 && isInlineAutoincrementPrimaryKeyNode(table, column)))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\treturn notOk(issueConflict(columnTypeChanged(expected, blindCast(issue.actual)) ? \"typeMismatch\" : \"nullabilityConflict\", issue.path.join(\"/\"), issueLocation(tableName, expected.name)));\n}\nfunction mapIndexIssue(issue) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Index issue has no table in its path: ${issue.path.join(\"/\")}`));\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst index = blindCast(issue.expected);\n\t\tconst indexName = index.name;\n\t\treturn ok([new CreateIndexCall(tableName, indexName, index.columns ?? [])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst indexName = blindCast(issue.actual).name;\n\t\treturn ok([new DropIndexCall(tableName, indexName)]);\n\t}\n\treturn notOk(issueConflict(\"indexIncompatible\", issue.path.join(\"/\"), issueLocation(tableName)));\n}\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(issueConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tswitch (node.nodeKind) {\n\t\tcase RelationalSchemaNodeKind.table: return mapTableIssue(issue);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnIssue(issue, ctx);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexIssue(issue);\n\t\tcase RelationalSchemaNodeKind.columnDefault:\n\t\tcase RelationalSchemaNodeKind.primaryKey:\n\t\tcase RelationalSchemaNodeKind.foreignKey:\n\t\tcase RelationalSchemaNodeKind.unique: return notOk(issueConflict(absorbedConflictKind(node.nodeKind), issue.path.join(\"/\")));\n\t\tcase RelationalSchemaNodeKind.check: return notOk(issueConflict(\"unsupportedOperation\", `SQLite does not support CHECK constraint DDL: ${issue.path.join(\"/\")}`));\n\t\tdefault: return notOk(issueConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createTable\": return \"create-table\";\n\t\tcase \"addColumn\": return \"add-column\";\n\t\tcase \"createIndex\": return \"create-index\";\n\t\tcase \"dropColumn\": return \"drop-column\";\n\t\tcase \"dropIndex\": return \"drop-index\";\n\t\tcase \"dropTable\": return \"drop-table\";\n\t\tcase \"recreateTable\": return null;\n\t\tdefault: return null;\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\texpected: options.expected ?? emptySchemaIR(),\n\t\tactual: options.actual ?? emptySchemaIR(),\n\t\tpolicy,\n\t\tframeworkComponents\n\t};\n\tconst strategies = options.strategies ?? sqlitePlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketableCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketableCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketableCalls;\n\tlet gatedDefault = defaultCalls;\n\tif (policyProvided) {\n\t\tconst sink = (acc) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tacc.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tconst gatedDefaultBucket = [];\n\t\trecipeCalls.forEach(sink(gatedRecipeBucket));\n\t\tbucketableCalls.forEach(sink(gatedBucketableBucket));\n\t\tdefaultCalls.forEach(sink(gatedDefaultBucket));\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t\tgatedDefault = gatedDefaultBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combined = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combined.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"create-table\"),\n\t\t...byCategory(\"add-column\"),\n\t\t...byCategory(\"create-index\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"drop-column\"),\n\t\t...byCategory(\"drop-index\"),\n\t\t...byCategory(\"drop-table\")\n\t] });\n}\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst location = {};\n\tif (\"tableName\" in call) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = call.tableName;\n\t}\n\tif (\"columnName\" in call) location.column = call.columnName;\n\tif (\"indexName\" in call) location.index = call.indexName;\n\treturn Object.keys(location).length > 0 ? location : void 0;\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 { expected, actual, issues } = this.collectSchemaIssues(options);\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\tstrategies: sqlitePlannerStrategies\n\t\t});\n\t\tif (!result.ok) return plannerFailure(result.failure);\n\t\tconst fieldEventOps = planFieldEventOperations({\n\t\t\tpriorContract: options.fromContract,\n\t\t\tnewContract: options.contract,\n\t\t\tcodecHooks\n\t\t});\n\t\tconst calls = [...result.value.calls, ...fieldEventOps];\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.fromContract?.storage.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};\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) {\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: options.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 { verifySqliteDatabaseSchema as a, sqliteContractToSchema as i, createSqliteMigrationPlanner as n, diffSqliteSchema as r, SqliteMigrationPlanner as t };\n\n//# sourceMappingURL=planner-DiGcIjl1.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,oBAAoB,KAAK,SAAS;CAC1C,IAAI,IAAI,SAAS,YAAY;EAC5B,IAAI,IAAI,eAAe,SAAS,OAAO;EACvC,OAAO,IAAI;CACZ;CACA,OAAO,qBAAqB,IAAI,KAAK;AACtC;;;;;;;;;;AAUA,SAAS,uBAAuB,UAAU,QAAQ;CACjD,OAAO,mBAAmB,UAAU;EACnC,qBAAqB;EACrB,eAAe;EACf,GAAG,UAAU,oBAAoB,QAAQ,gBAAgB;CAC1D,CAAC;AACF;;;;;;AAMA,SAAS,2BAA2B,OAAO;CAC1C,OAAO,sBAAsB;EAC5B,UAAU,MAAM;EAChB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,qBAAqB,MAAM;EAC3B,YAAY;EACZ,eAAe;CAChB,CAAC;AACF;;;;;;;;;AASA,SAAS,qBAAqB,OAAO,UAAU;CAC9C,MAAM,YAAY,MAAM,KAAK;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO,KAAK;CACtC,KAAK,MAAM,eAAe,OAAO,KAAK,SAAS,QAAQ,UAAU,GAAG;EACnE,MAAM,QAAQ,SAAS,SAAS,SAAS;GACxC;GACA,YAAY;GACZ,YAAY;EACb,CAAC;EACD,IAAI,UAAU,KAAK,GAAG,OAAO,MAAM;CACpC;AACD;;;;;;;;;;AAUA,SAAS,iBAAiB,OAAO;CAChC,MAAM,mBAAmB,wBAAwB,MAAM,mBAAmB;CAC1E,MAAM,WAAW,uBAAuB,M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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,31 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-o23JHwzY-CwNJcqwl.mjs";
|
|
3
|
+
import { MigrationPlanWithAuthoringSurface, OpFactoryCall } from "@prisma/orm-framework/components/control";
|
|
4
|
+
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
5
|
+
import { MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
6
|
+
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
7
|
+
import { ExecuteRequestLowerer } from "@prisma/orm-family-sql/family/control-adapter";
|
|
8
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-BuJysRxx.d.mts
|
|
9
|
+
//#region src/core/migrations/planner-produced-sqlite-migration.d.ts
|
|
10
|
+
type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
|
|
11
|
+
interface SqliteMigrationDestinationInfo {
|
|
12
|
+
readonly storageHash: string;
|
|
13
|
+
readonly profileHash?: string;
|
|
14
|
+
}
|
|
15
|
+
declare class TypeScriptRenderableSqliteMigration extends SqliteMigration implements MigrationPlanWithAuthoringSurface {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(calls: readonly OpFactoryCall[], meta: MigrationMeta, spaceId: string, snapshotsImportPath: string, destination?: SqliteMigrationDestinationInfo, lowerer?: ExecuteRequestLowerer);
|
|
18
|
+
get operations(): readonly (Op | Promise<Op>)[];
|
|
19
|
+
describe(): MigrationMeta;
|
|
20
|
+
get destination(): SqliteMigrationDestinationInfo;
|
|
21
|
+
/**
|
|
22
|
+
* Contract space this planner-produced plan applies to. Threaded
|
|
23
|
+
* from {@link SqlMigrationPlannerPlanOptions.spaceId} so the runner
|
|
24
|
+
* keys the marker row by the right space when executing the plan.
|
|
25
|
+
*/
|
|
26
|
+
get spaceId(): string;
|
|
27
|
+
renderTypeScript(resolveImportSpecifier: ImportSpecifierResolver): string;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { TypeScriptRenderableSqliteMigration as n, SqliteMigrationDestinationInfo as t };
|
|
31
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-BuJysRxx.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"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { t as renderOps } from "./render-ops-DIOn_wOx-D33LOy3b.mjs";
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-CV6LIqhx-D5eMTAbH.mjs";
|
|
3
|
+
import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from "@prisma/orm-framework/components/control";
|
|
4
|
+
import { renderImports } from "@prisma/orm-framework/ts-render";
|
|
5
|
+
import { resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
6
|
+
import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
|
|
7
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-C8nxPT0P.mjs
|
|
8
|
+
/**
|
|
9
|
+
* Polymorphic TypeScript emitter for the SQLite migration IR. Mirrors the
|
|
10
|
+
* Postgres `render-typescript.ts` — different base-class + factory module
|
|
11
|
+
* specifier, same overall shape.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Always-present base imports for the rendered scaffold. Both come from
|
|
15
|
+
* `@internal/sqlite/migration` so an authored SQLite
|
|
16
|
+
* `migration.ts` only needs a single dependency for its base class and
|
|
17
|
+
* its CLI entrypoint. Mirrors Postgres's `BASE_IMPORTS`.
|
|
18
|
+
*
|
|
19
|
+
* - `Migration` — the facade re-export fixes the `SqlMigration`
|
|
20
|
+
* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to
|
|
21
|
+
* `'sqlite'`.
|
|
22
|
+
* - `MigrationCLI` — the migration-file CLI entrypoint, re-exported from
|
|
23
|
+
* `@internal/cli/migration-cli`. Loads `prisma-next.config.ts`,
|
|
24
|
+
* assembles a `ControlStack`, and instantiates the migration class.
|
|
25
|
+
*/
|
|
26
|
+
const BASE_IMPORTS = [{
|
|
27
|
+
moduleSpecifier: "@internal/sqlite/migration",
|
|
28
|
+
symbol: "Migration"
|
|
29
|
+
}, {
|
|
30
|
+
moduleSpecifier: "@internal/sqlite/migration",
|
|
31
|
+
symbol: "MigrationCLI"
|
|
32
|
+
}];
|
|
33
|
+
function renderCallsToTypeScript(calls, meta) {
|
|
34
|
+
const imports = buildImports(calls, meta);
|
|
35
|
+
const operationsBody = calls.map((c) => c.renderTypeScript()).join(",\n");
|
|
36
|
+
const hasStart = meta.from !== null;
|
|
37
|
+
const startField = hasStart ? [" override readonly startContractJson = startContract;"] : [];
|
|
38
|
+
return [
|
|
39
|
+
shebangLineFor(detectScaffoldRuntime()),
|
|
40
|
+
imports,
|
|
41
|
+
"",
|
|
42
|
+
`export default class M extends Migration<${hasStart ? "Start" : "never"}, End> {`,
|
|
43
|
+
...startField,
|
|
44
|
+
" override readonly endContractJson = endContract;",
|
|
45
|
+
"",
|
|
46
|
+
" override get operations() {",
|
|
47
|
+
" return [",
|
|
48
|
+
indent(operationsBody, 6),
|
|
49
|
+
" ];",
|
|
50
|
+
" }",
|
|
51
|
+
"}",
|
|
52
|
+
"",
|
|
53
|
+
"MigrationCLI.run(import.meta.url, M);",
|
|
54
|
+
""
|
|
55
|
+
].join("\n");
|
|
56
|
+
}
|
|
57
|
+
function buildImports(calls, meta) {
|
|
58
|
+
const requirements = [...BASE_IMPORTS, ...contractImports(meta)];
|
|
59
|
+
for (const call of calls) for (const req of call.importRequirements()) requirements.push(req);
|
|
60
|
+
return renderImports(resolveRequirementSpecifiers(requirements, meta.resolveImportSpecifier));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The committed contract-JSON imports the scaffold reads its from/to identity
|
|
64
|
+
* from, resolved to the deduplicated snapshot store under
|
|
65
|
+
* `meta.snapshotsImportPath`. The end snapshot is always present; the start
|
|
66
|
+
* snapshot is added only for a non-baseline migration (`meta.from !== null`).
|
|
67
|
+
* The matching `Contract` type imports (aliased `Start`/`End`) feed the
|
|
68
|
+
* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with
|
|
69
|
+
* no start imports — `never` is the honest "no prior contract" Start.
|
|
70
|
+
*/
|
|
71
|
+
function contractImports(meta) {
|
|
72
|
+
const reqs = [{
|
|
73
|
+
moduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),
|
|
74
|
+
symbol: "endContract",
|
|
75
|
+
kind: "default",
|
|
76
|
+
attributes: { type: "json" }
|
|
77
|
+
}, {
|
|
78
|
+
moduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),
|
|
79
|
+
symbol: "Contract",
|
|
80
|
+
alias: "End",
|
|
81
|
+
typeOnly: true
|
|
82
|
+
}];
|
|
83
|
+
if (meta.from !== null) {
|
|
84
|
+
reqs.push({
|
|
85
|
+
moduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),
|
|
86
|
+
symbol: "startContract",
|
|
87
|
+
kind: "default",
|
|
88
|
+
attributes: { type: "json" }
|
|
89
|
+
});
|
|
90
|
+
reqs.push({
|
|
91
|
+
moduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),
|
|
92
|
+
symbol: "Contract",
|
|
93
|
+
alias: "Start",
|
|
94
|
+
typeOnly: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return reqs;
|
|
98
|
+
}
|
|
99
|
+
function indent(text, spaces) {
|
|
100
|
+
const pad = " ".repeat(spaces);
|
|
101
|
+
return text.split("\n").map((line) => line.trim() ? `${pad}${line}` : line).join("\n");
|
|
102
|
+
}
|
|
103
|
+
var TypeScriptRenderableSqliteMigration = class extends SqliteMigration {
|
|
104
|
+
#calls;
|
|
105
|
+
#meta;
|
|
106
|
+
#destination;
|
|
107
|
+
#spaceId;
|
|
108
|
+
#snapshotsImportPath;
|
|
109
|
+
#lowerer;
|
|
110
|
+
#operationsCache;
|
|
111
|
+
constructor(calls, meta, spaceId, snapshotsImportPath, destination, lowerer) {
|
|
112
|
+
super();
|
|
113
|
+
this.#calls = calls;
|
|
114
|
+
this.#meta = meta;
|
|
115
|
+
this.#spaceId = spaceId;
|
|
116
|
+
this.#snapshotsImportPath = snapshotsImportPath;
|
|
117
|
+
this.#destination = destination ?? { storageHash: meta.to };
|
|
118
|
+
this.#lowerer = lowerer;
|
|
119
|
+
}
|
|
120
|
+
get operations() {
|
|
121
|
+
this.#operationsCache ??= renderOps(this.#calls, this.#lowerer);
|
|
122
|
+
return this.#operationsCache;
|
|
123
|
+
}
|
|
124
|
+
describe() {
|
|
125
|
+
return this.#meta;
|
|
126
|
+
}
|
|
127
|
+
get destination() {
|
|
128
|
+
return this.#destination;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Contract space this planner-produced plan applies to. Threaded
|
|
132
|
+
* from {@link SqlMigrationPlannerPlanOptions.spaceId} so the runner
|
|
133
|
+
* keys the marker row by the right space when executing the plan.
|
|
134
|
+
*/
|
|
135
|
+
get spaceId() {
|
|
136
|
+
return this.#spaceId;
|
|
137
|
+
}
|
|
138
|
+
renderTypeScript(resolveImportSpecifier) {
|
|
139
|
+
return renderCallsToTypeScript(this.#calls, {
|
|
140
|
+
from: this.#meta.from,
|
|
141
|
+
to: this.#meta.to,
|
|
142
|
+
snapshotsImportPath: this.#snapshotsImportPath,
|
|
143
|
+
resolveImportSpecifier
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
//#endregion
|
|
148
|
+
export { TypeScriptRenderableSqliteMigration as t };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#destination","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-produced-sqlite-migration-C8nxPT0P.mjs"],"sourcesContent":["import { t as renderOps } from \"./render-ops-DIOn_wOx.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-CV6LIqhx.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-next.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-C8nxPT0P.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,gBAAgB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C,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.mjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
2
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-target-details-CIQ789Gc.mjs
|
|
3
|
+
const DEFAULT_SCHEMA = "main";
|
|
4
|
+
function buildTargetDetails(objectType, name, table) {
|
|
5
|
+
return {
|
|
6
|
+
schema: DEFAULT_SCHEMA,
|
|
7
|
+
objectType,
|
|
8
|
+
name,
|
|
9
|
+
...ifDefined("table", table)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { buildTargetDetails as t };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-target-details-CIQ789Gc-C5U4yVY9.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-target-details-CIQ789Gc.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/migrations/planner-target-details.ts\nconst DEFAULT_SCHEMA = \"main\";\nfunction buildTargetDetails(objectType, name, table) {\n\treturn {\n\t\tschema: DEFAULT_SCHEMA,\n\t\tobjectType,\n\t\tname,\n\t\t...ifDefined(\"table\", table)\n\t};\n}\n//#endregion\nexport { buildTargetDetails as t };\n\n//# sourceMappingURL=planner-target-details-CIQ789Gc.mjs.map"],"mappings":";;AAEA,MAAM,iBAAiB;AACvB,SAAS,mBAAmB,YAAY,MAAM,OAAO;CACpD,OAAO;EACN,QAAQ;EACR;EACA;EACA,GAAG,UAAU,SAAS,KAAK;CAC5B;AACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/planner-target-details-xR6UfIcz.d.mts
|
|
2
|
+
//#region src/core/migrations/planner-target-details.d.ts
|
|
3
|
+
type OperationClass = 'table' | 'column' | 'primaryKey' | 'unique' | 'index' | 'foreignKey';
|
|
4
|
+
interface SqlitePlanTargetDetails {
|
|
5
|
+
readonly schema: string;
|
|
6
|
+
readonly objectType: OperationClass;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly table?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function buildTargetDetails(objectType: OperationClass, name: string, table?: string): SqlitePlanTargetDetails;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { buildTargetDetails as n, SqlitePlanTargetDetails as t };
|
|
13
|
+
//# sourceMappingURL=planner-target-details-xR6UfIcz-CMahymzq.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-target-details-xR6UfIcz-CMahymzq.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/planner-target-details-xR6UfIcz.d.mts"],"mappings":";;KACK;UACK;WACC;WACA,YAAY;WACZ;WACA;;iBAEM,mBAAmB,YAAY,gBAAgB,cAAc,iBAAiB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
+
import { OpFactoryCall } from "@prisma/orm-framework/components/control";
|
|
3
|
+
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
4
|
+
import { ExecuteRequestLowerer } from "@prisma/orm-family-sql/family/control-adapter";
|
|
5
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/render-ops.d.mts
|
|
6
|
+
//#region src/core/migrations/render-ops.d.ts
|
|
7
|
+
type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
|
|
8
|
+
declare function renderOps(calls: readonly OpFactoryCall[], lowerer?: ExecuteRequestLowerer): (Op | Promise<Op>)[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { renderOps as t };
|
|
11
|
+
//# sourceMappingURL=render-ops-B10yqmdG.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-ops-B10yqmdG.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/render-ops.d.mts"],"mappings":";;;;;;KAKK,KAAK,0BAA0B;iBACnB,UAAU,gBAAgB,iBAAiB,UAAU,yBAAyB,KAAK,QAAQ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { n as sqliteError } from "./errors-CKsaaSnD-BeB4JS8h.mjs";
|
|
2
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
|
+
import { isThenable } from "@prisma/orm-framework/utils/promise";
|
|
4
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/render-ops-DIOn_wOx.mjs
|
|
5
|
+
function assertSqliteOp(op, callFactoryName) {
|
|
6
|
+
const targetId = blindCast(op).target?.id;
|
|
7
|
+
if (targetId !== "sqlite") throw sqliteError("MIGRATION.TARGET_MISMATCH", `renderOps: expected sqlite op but got target.id="${String(targetId)}" for op.id="${op.id}" (factoryName="${callFactoryName}"). An OpFactoryCall produced an op for a different target on the sqlite planner path; check the call's target binding.`, { meta: {
|
|
8
|
+
opId: op.id,
|
|
9
|
+
targetId: String(targetId),
|
|
10
|
+
factoryName: callFactoryName
|
|
11
|
+
} });
|
|
12
|
+
}
|
|
13
|
+
function renderOps(calls, lowerer) {
|
|
14
|
+
return calls.map((c) => {
|
|
15
|
+
const opOrPromise = blindCast(c).toOp(lowerer);
|
|
16
|
+
if (isThenable(opOrPromise)) return opOrPromise.then((op) => {
|
|
17
|
+
assertSqliteOp(op, c.factoryName);
|
|
18
|
+
return op;
|
|
19
|
+
});
|
|
20
|
+
assertSqliteOp(opOrPromise, c.factoryName);
|
|
21
|
+
return opOrPromise;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { renderOps as t };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=render-ops-DIOn_wOx-D33LOy3b.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-ops-DIOn_wOx-D33LOy3b.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/render-ops-DIOn_wOx.mjs"],"sourcesContent":["import { n as sqliteError } from \"./errors-CKsaaSnD.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { isThenable } from \"@internal/utils/promise\";\n//#region src/core/migrations/render-ops.ts\nfunction assertSqliteOp(op, callFactoryName) {\n\tconst targetId = blindCast(op).target?.id;\n\tif (targetId !== \"sqlite\") throw sqliteError(\"MIGRATION.TARGET_MISMATCH\", `renderOps: expected sqlite op but got target.id=\"${String(targetId)}\" for op.id=\"${op.id}\" (factoryName=\"${callFactoryName}\"). An OpFactoryCall produced an op for a different target on the sqlite planner path; check the call's target binding.`, { meta: {\n\t\topId: op.id,\n\t\ttargetId: String(targetId),\n\t\tfactoryName: callFactoryName\n\t} });\n}\nfunction renderOps(calls, lowerer) {\n\treturn calls.map((c) => {\n\t\tconst opOrPromise = blindCast(c).toOp(lowerer);\n\t\tif (isThenable(opOrPromise)) return opOrPromise.then((op) => {\n\t\t\tassertSqliteOp(op, c.factoryName);\n\t\t\treturn op;\n\t\t});\n\t\tassertSqliteOp(opOrPromise, c.factoryName);\n\t\treturn opOrPromise;\n\t});\n}\n//#endregion\nexport { renderOps as t };\n\n//# sourceMappingURL=render-ops-DIOn_wOx.mjs.map"],"mappings":";;;;AAIA,SAAS,eAAe,IAAI,iBAAiB;CAC5C,MAAM,WAAW,UAAU,EAAE,CAAC,CAAC,QAAQ;CACvC,IAAI,aAAa,UAAU,MAAM,YAAY,6BAA6B,oDAAoD,OAAO,QAAQ,EAAE,eAAe,GAAG,GAAG,kBAAkB,gBAAgB,0HAA0H,EAAE,MAAM;EACvU,MAAM,GAAG;EACT,UAAU,OAAO,QAAQ;EACzB,aAAa;CACd,EAAE,CAAC;AACJ;AACA,SAAS,UAAU,OAAO,SAAS;CAClC,OAAO,MAAM,KAAK,MAAM;EACvB,MAAM,cAAc,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO;EAC7C,IAAI,WAAW,WAAW,GAAG,OAAO,YAAY,MAAM,OAAO;GAC5D,eAAe,IAAI,EAAE,WAAW;GAChC,OAAO;EACR,CAAC;EACD,eAAe,aAAa,EAAE,WAAW;EACzC,OAAO;CACR,CAAC;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SqlDriver } from "@prisma/orm-family-sql/relational-core/ast";
|
|
2
|
+
import { RuntimeDriverDescriptor, RuntimeDriverInstance } from "@prisma/orm-framework/components/execution";
|
|
3
|
+
//#region ../../../3-targets/7-drivers/sqlite/dist/runtime.d.mts
|
|
4
|
+
//#region src/sqlite-driver.d.ts
|
|
5
|
+
type SqliteBinding = {
|
|
6
|
+
readonly kind: 'path';
|
|
7
|
+
readonly path: string;
|
|
8
|
+
};
|
|
9
|
+
type SqliteRuntimeDriver = RuntimeDriverInstance<'sql', 'sqlite'> & SqlDriver<SqliteBinding>;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/core/runtime-driver.d.ts
|
|
12
|
+
declare const sqliteRuntimeDriverDescriptor: RuntimeDriverDescriptor<'sql', 'sqlite', void, SqliteRuntimeDriver>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SqliteRuntimeDriver as n, sqliteRuntimeDriverDescriptor as r, SqliteBinding as t };
|
|
15
|
+
//# sourceMappingURL=runtime-B1coahKC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-B1coahKC.d.mts","names":[],"sources":["../../../../3-targets/7-drivers/sqlite/dist/runtime.d.mts"],"mappings":";;;;KAIK;WACM;WACA;;KAEN,sBAAsB,yCAAyC,UAAU;;;cAGhE,+BAA+B,+CAA+C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "./sqlite-contract-view-BpNMaU2m-COMDaGaq.mjs";
|
|
2
|
+
import { Namespace } from "@prisma/orm-framework/components/ir";
|
|
3
|
+
import { SqlNamespaceInput, SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
4
|
+
import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
|
|
5
|
+
import { SqlRuntimeTargetDescriptor } from "@prisma/orm-family-sql/runtime";
|
|
6
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
7
|
+
import { RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
|
|
8
|
+
import { JsonObject } from "@prisma/orm-framework/utils/json";
|
|
9
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/runtime.d.mts
|
|
10
|
+
//#region src/core/runtime-target.d.ts
|
|
11
|
+
interface SqliteRuntimeTargetInstance extends RuntimeTargetInstance<'sql', 'sqlite'> {}
|
|
12
|
+
declare const sqliteRuntimeTargetDescriptor: SqlRuntimeTargetDescriptor<'sqlite', SqliteRuntimeTargetInstance>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/core/sqlite-contract-serializer.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* SQLite target `ContractSerializer` concretion. Mirrors the Postgres
|
|
17
|
+
* shape: inherits the full SQL-family deserialization pipeline and
|
|
18
|
+
* materialises namespace entries as SQLite database concretions that
|
|
19
|
+
* expose `qualifyTable()` for runtime SQL rendering.
|
|
20
|
+
*/
|
|
21
|
+
declare class SqliteContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {
|
|
22
|
+
constructor();
|
|
23
|
+
protected hydrateSqlNamespaceEntry(nsId: string, raw: Record<string, unknown>): Namespace | SqlNamespaceInput;
|
|
24
|
+
serializeContract(contract: Contract<SqlStorage>): JsonObject;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SqliteRuntimeTargetInstance as n, sqliteRuntimeTargetDescriptor as r, SqliteContractSerializer as t };
|
|
28
|
+
//# sourceMappingURL=runtime-B99c4n56.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-B99c4n56.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/runtime.d.mts"],"mappings":";;;;;;;;;;UASU,oCAAoC;cAChC,+BAA+B,qCAAqC;;;;;;;;;cASpE,iCAAiC,0BAA0B,SAAS;EAChF;YACU,yBAAyB,cAAc,KAAK,0BAA0B,YAAY;EAC5F,kBAAkB,UAAU,SAAS,cAAc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { n as createSqliteAdapterWithCodecRegistry } from "./adapter-DizMsGCb-n4h4w8ms.mjs";
|
|
2
|
+
import { SqlRuntimeAdapterDescriptor } from "@prisma/orm-family-sql/runtime";
|
|
3
|
+
import { RuntimeAdapterInstance } from "@prisma/orm-framework/components/execution";
|
|
4
|
+
//#region ../../../3-targets/6-adapters/sqlite/dist/runtime.d.mts
|
|
5
|
+
//#region src/core/runtime-adapter.d.ts
|
|
6
|
+
type SqliteRuntimeAdapterInstance = RuntimeAdapterInstance<'sql', 'sqlite'> & ReturnType<typeof createSqliteAdapterWithCodecRegistry>;
|
|
7
|
+
declare const sqliteRuntimeAdapterDescriptor: SqlRuntimeAdapterDescriptor<'sqlite', SqliteRuntimeAdapterInstance>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { sqliteRuntimeAdapterDescriptor as n, SqliteRuntimeAdapterInstance as t };
|
|
10
|
+
//# sourceMappingURL=runtime-tbBYTw7Z.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-tbBYTw7Z.d.mts","names":[],"sources":["../../../../3-targets/6-adapters/sqlite/dist/runtime.d.mts"],"mappings":";;;;;KAIK,+BAA+B,0CAA0C,kBAAkB;cAClF,gCAAgC,sCAAsC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz-CMahymzq.mjs";
|
|
2
|
+
import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
3
|
+
import { ReferentialAction } from "@prisma/orm-family-sql/contract/types";
|
|
4
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/shared-BYAX0FaQ.d.mts
|
|
5
|
+
//#region src/core/migrations/operations/shared.d.ts
|
|
6
|
+
type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
|
|
7
|
+
/**
|
|
8
|
+
* Flat, fully-resolved column shape consumed by `createTable`, `addColumn`,
|
|
9
|
+
* and `recreateTable`. Codec / `typeRef` / default expansion happens at the
|
|
10
|
+
* call-construction site (in the issue-planner / strategies) so the
|
|
11
|
+
* operation factories deal only in pre-rendered SQL fragments — mirrors the
|
|
12
|
+
* Postgres `ColumnSpec` pattern.
|
|
13
|
+
*
|
|
14
|
+
* - `typeSql` is the column's DDL type token (e.g. `"INTEGER"`, `"TEXT"`).
|
|
15
|
+
* - `defaultSql` is the full `DEFAULT …` clause (or empty when there is no
|
|
16
|
+
* default and when the column is rendered as `INTEGER PRIMARY KEY
|
|
17
|
+
* AUTOINCREMENT`, since SQLite forbids a default on an autoincrement PK).
|
|
18
|
+
* - `inlineAutoincrementPrimaryKey` directs the renderer to emit
|
|
19
|
+
* `INTEGER PRIMARY KEY AUTOINCREMENT` inline and to skip the table-level
|
|
20
|
+
* primary-key constraint for this column. SQLite-specific: the column
|
|
21
|
+
* becomes an alias for `rowid` only when this exact form is used.
|
|
22
|
+
*/
|
|
23
|
+
interface SqliteColumnSpec {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly typeSql: string;
|
|
26
|
+
readonly defaultSql: string;
|
|
27
|
+
readonly nullable: boolean;
|
|
28
|
+
readonly inlineAutoincrementPrimaryKey?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface SqlitePrimaryKeySpec {
|
|
31
|
+
readonly columns: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
interface SqliteUniqueSpec {
|
|
34
|
+
readonly columns: readonly string[];
|
|
35
|
+
readonly name?: string;
|
|
36
|
+
}
|
|
37
|
+
interface SqliteForeignKeySpec {
|
|
38
|
+
readonly columns: readonly string[];
|
|
39
|
+
readonly references: {
|
|
40
|
+
readonly table: string;
|
|
41
|
+
readonly columns: readonly string[];
|
|
42
|
+
};
|
|
43
|
+
readonly name?: string;
|
|
44
|
+
readonly onDelete?: ReferentialAction;
|
|
45
|
+
readonly onUpdate?: ReferentialAction;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Flat shape of a contract table for DDL emission. Used by both
|
|
49
|
+
* `createTable` (additive) and `recreateTable` (widening/destructive).
|
|
50
|
+
*/
|
|
51
|
+
interface SqliteTableSpec {
|
|
52
|
+
readonly columns: readonly SqliteColumnSpec[];
|
|
53
|
+
readonly primaryKey?: SqlitePrimaryKeySpec;
|
|
54
|
+
readonly uniques?: readonly SqliteUniqueSpec[];
|
|
55
|
+
readonly foreignKeys?: readonly SqliteForeignKeySpec[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Index recreation spec for `recreateTable`. Both declared indexes and
|
|
59
|
+
* FK-backing indexes flatten to the same shape; the planner dedupes by
|
|
60
|
+
* column-set before constructing the call.
|
|
61
|
+
*/
|
|
62
|
+
interface SqliteIndexSpec {
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly columns: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { SqliteTableSpec as i, SqliteColumnSpec as n, SqliteIndexSpec as r, Op as t };
|
|
68
|
+
//# sourceMappingURL=shared-BYAX0FaQ--VvRXVRC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-BYAX0FaQ--VvRXVRC.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/shared-BYAX0FaQ.d.mts"],"mappings":";;;;;KAIK,KAAK,0BAA0B;;;;;;;;;;;;;;;;;UAiB1B;WACC;WACA;WACA;WACA;WACA;;UAED;WACC;;UAED;WACC;WACA;;UAED;WACC;WACA;aACE;aACA;;WAEF;WACA,WAAW;WACX,WAAW;;;;;;UAMZ;WACC,kBAAkB;WAClB,aAAa;WACb,mBAAmB;WACnB,uBAAuB;;;;;;;UAOxB;WACC;WACA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region ../../../3-targets/3-targets/sqlite/dist/sql-utils.d.mts
|
|
2
|
+
//#region src/core/sql-utils.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Shared SQL utility functions for the SQLite target.
|
|
5
|
+
*
|
|
6
|
+
* These functions handle safe SQL identifier and literal escaping. They
|
|
7
|
+
* live in `target-sqlite` (mirroring `target-postgres/src/core/sql-utils.ts`)
|
|
8
|
+
* so both the control adapter (used at emit time) and the runtime adapter
|
|
9
|
+
* (used at execute time) can depend on them through a single one-way edge:
|
|
10
|
+
* `adapter-sqlite → target-sqlite`. Hosting them target-side avoids the
|
|
11
|
+
* cyclic workspace dependency that would arise if `target-sqlite` reached
|
|
12
|
+
* back into `adapter-sqlite` for these primitives.
|
|
13
|
+
*/
|
|
14
|
+
declare function quoteIdentifier(identifier: string): string;
|
|
15
|
+
declare function escapeLiteral(value: string): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { quoteIdentifier as n, escapeLiteral as t };
|
|
18
|
+
//# sourceMappingURL=sql-utils-0SJZOd7Q.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-utils-0SJZOd7Q.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/sql-utils.d.mts"],"mappings":";;;;;;;;;;;;;iBAYiB,gBAAgB;iBAChB,cAAc"}
|