@prisma-next/target-sqlite 0.13.0-dev.34 → 0.13.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.
Files changed (51) hide show
  1. package/dist/contract-free.d.mts +35 -2
  2. package/dist/contract-free.d.mts.map +1 -1
  3. package/dist/contract-free.mjs +3 -3
  4. package/dist/control.d.mts.map +1 -1
  5. package/dist/control.mjs +3 -3
  6. package/dist/ddl-DrtjQMFK.mjs +68 -0
  7. package/dist/ddl-DrtjQMFK.mjs.map +1 -0
  8. package/dist/migration.d.mts +3 -45
  9. package/dist/migration.d.mts.map +1 -1
  10. package/dist/migration.mjs +3 -3
  11. package/dist/{op-factory-call-z4TT72k3.mjs → op-factory-call-DmdfD1yd.mjs} +143 -104
  12. package/dist/op-factory-call-DmdfD1yd.mjs.map +1 -0
  13. package/dist/op-factory-call.d.mts +12 -6
  14. package/dist/op-factory-call.d.mts.map +1 -1
  15. package/dist/op-factory-call.mjs +1 -1
  16. package/dist/{planner-jMHqfl1A.mjs → planner-Ciq8p_dL.mjs} +3 -3
  17. package/dist/{planner-jMHqfl1A.mjs.map → planner-Ciq8p_dL.mjs.map} +1 -1
  18. package/dist/{planner-produced-sqlite-migration-CyyvoPmm.mjs → planner-produced-sqlite-migration-0xPEm3R1.mjs} +2 -2
  19. package/dist/{planner-produced-sqlite-migration-CyyvoPmm.mjs.map → planner-produced-sqlite-migration-0xPEm3R1.mjs.map} +1 -1
  20. package/dist/{planner-produced-sqlite-migration-BWpnDmhM.d.mts → planner-produced-sqlite-migration-CpgsY-M9.d.mts} +2 -2
  21. package/dist/{planner-produced-sqlite-migration-BWpnDmhM.d.mts.map → planner-produced-sqlite-migration-CpgsY-M9.d.mts.map} +1 -1
  22. package/dist/planner-produced-sqlite-migration.d.mts +1 -1
  23. package/dist/planner-produced-sqlite-migration.mjs +1 -1
  24. package/dist/planner.d.mts +1 -1
  25. package/dist/planner.mjs +1 -1
  26. package/dist/runtime.mjs +1 -1
  27. package/dist/shared-Dhc8mLK1.d.mts.map +1 -1
  28. package/dist/{sqlite-contract-serializer-B_Cu0o3G.mjs → sqlite-contract-serializer-Cq9mXdXi.mjs} +5 -14
  29. package/dist/sqlite-contract-serializer-Cq9mXdXi.mjs.map +1 -0
  30. package/dist/{sqlite-migration-DhW4ycZV.mjs → sqlite-migration-A0rwqPOG.mjs} +32 -13
  31. package/dist/sqlite-migration-A0rwqPOG.mjs.map +1 -0
  32. package/dist/sqlite-migration-DVfhQwN_.d.mts +75 -0
  33. package/dist/sqlite-migration-DVfhQwN_.d.mts.map +1 -0
  34. package/package.json +18 -18
  35. package/src/contract-free/checks.ts +75 -0
  36. package/src/core/migrations/op-factory-call.ts +191 -43
  37. package/src/core/migrations/operations/columns.ts +32 -26
  38. package/src/core/migrations/operations/indexes.ts +31 -27
  39. package/src/core/migrations/operations/shared.ts +11 -3
  40. package/src/core/migrations/operations/tables.ts +39 -37
  41. package/src/core/migrations/sqlite-migration.ts +82 -14
  42. package/src/core/sqlite-unbound-database.ts +16 -23
  43. package/src/exports/contract-free.ts +8 -0
  44. package/src/exports/migration.ts +0 -3
  45. package/dist/ddl-CH8V_qcd.mjs +0 -23
  46. package/dist/ddl-CH8V_qcd.mjs.map +0 -1
  47. package/dist/op-factory-call-z4TT72k3.mjs.map +0 -1
  48. package/dist/sqlite-contract-serializer-B_Cu0o3G.mjs.map +0 -1
  49. package/dist/sqlite-migration-CJrASAxf.d.mts +0 -46
  50. package/dist/sqlite-migration-CJrASAxf.d.mts.map +0 -1
  51. package/dist/sqlite-migration-DhW4ycZV.mjs.map +0 -1
@@ -1,7 +1,40 @@
1
1
  import { n as SqliteCreateTable } from "./nodes-VzaaeUTb.mjs";
2
- import { DdlColumn, DdlNode, DdlTableConstraint } from "@prisma-next/sql-relational-core/ast";
2
+ import { DdlColumn, DdlNode, DdlTableConstraint, SelectAst } from "@prisma-next/sql-relational-core/ast";
3
3
  import { ColumnDescriptor, ColumnSchema, TableHandle } from "@prisma-next/sql-relational-core/contract-free";
4
4
 
5
+ //#region src/contract-free/checks.d.ts
6
+ interface ColumnExistsCheckBuilder {
7
+ columnAbsent(): SelectAst;
8
+ columnPresent(): SelectAst;
9
+ }
10
+ /**
11
+ * Typed builder for the migration planner's column-existence checks. Produces
12
+ * `SELECT COUNT(*) {=|>} 0 AS "result" FROM pragma_table_info(?) WHERE "name" = ?`
13
+ * ASTs with the table and column names bound as text parameters — never
14
+ * inlined into the SQL.
15
+ */
16
+ declare function columnExistsAst(table: string, column: string): ColumnExistsCheckBuilder;
17
+ interface TableExistsCheckBuilder {
18
+ tableAbsent(): SelectAst;
19
+ tablePresent(): SelectAst;
20
+ }
21
+ /**
22
+ * Typed builder for table-existence checks over `sqlite_master`.
23
+ * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
24
+ * with the table name and the literal `'table'` bound as text parameters.
25
+ */
26
+ declare function tableExistsAst(tableName: string): TableExistsCheckBuilder;
27
+ interface IndexExistsCheckBuilder {
28
+ indexAbsent(): SelectAst;
29
+ indexPresent(): SelectAst;
30
+ }
31
+ /**
32
+ * Typed builder for index-existence checks over `sqlite_master`.
33
+ * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
34
+ * with the index name and the literal `'index'` bound as text parameters.
35
+ */
36
+ declare function indexExistsAst(indexName: string): IndexExistsCheckBuilder;
37
+ //#endregion
5
38
  //#region src/contract-free/columns.d.ts
6
39
  type ColOpts = {
7
40
  readonly nullable?: boolean;
@@ -51,5 +84,5 @@ declare function createTable(options: {
51
84
  readonly constraints?: readonly DdlTableConstraint[];
52
85
  }): SqliteCreateTable;
53
86
  //#endregion
54
- export { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createTable, datetime, integer, jsonText, sqliteTable, text };
87
+ export { type ColumnExistsCheckBuilder, type IndexExistsCheckBuilder, type TableExistsCheckBuilder, buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, columnExistsAst, createTable, datetime, indexExistsAst, integer, jsonText, sqliteTable, tableExistsAst, text };
55
88
  //# sourceMappingURL=contract-free.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts"],"mappings":";;;;;KAcK,OAAA;EAAA,SAAqB,QAAQ;AAAA;AAAA,cAOrB,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAoD;AAAA,cAC7E,OAAA,GAAW,IAAA,GAAO,OAAA,KAAU,gBAAuD;AAAA,cACnF,QAAA,GAAY,IAAA,GAAO,OAAA,KAAU,gBAAoD;AAAA,cACjF,QAAA,GAAY,IAAA,GAAO,OAAA,KAAU,gBAAwD;;AAVhE;AAOlC;;;;;;;;AAA0F;AAC1F;iBAgBgB,WAAA,gBAA2B,YAAA,EACzC,IAAA,UACA,OAAA,EAAS,MAAA,GACR,WAAA,CAAY,MAAA;;;iBCMC,+BAAA,aAA4C,OAAO;AAAA,iBAInD,iCAAA,aAA8C,OAAO;;;;;;AD7Cb;;;;AAQtB;AAOlC;;;;;;iBEJgB,WAAA,CAAY,OAAA;EAAA,SACjB,KAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA,WAAkB,SAAA;EAAA,SAClB,WAAA,YAAuB,kBAAA;AAAA,IAC9B,iBAAA"}
1
+ {"version":3,"file":"contract-free.d.mts","names":[],"sources":["../src/contract-free/checks.ts","../src/contract-free/columns.ts","../src/contract-free/control-bootstrap.ts","../src/contract-free/ddl.ts"],"mappings":";;;;;UAIiB,wBAAA;EACf,YAAA,IAAgB,SAAA;EAChB,aAAA,IAAiB,SAAS;AAAA;AAF5B;;;;;;AAAA,iBAWgB,eAAA,CAAgB,KAAA,UAAe,MAAA,WAAiB,wBAAwB;AAAA,UAavE,uBAAA;EACf,WAAA,IAAe,SAAA;EACf,YAAA,IAAgB,SAAS;AAAA;;;;;;iBAQX,cAAA,CAAe,SAAA,WAAoB,uBAAuB;AAAA,UAczD,uBAAA;EACf,WAAA,IAAe,SAAA;EACf,YAAA,IAAgB,SAAS;AAAA;;;;;;iBAQX,cAAA,CAAe,SAAA,WAAoB,uBAAuB;;;KChDrE,OAAA;EAAA,SAAqB,QAAQ;AAAA;AAAA,cAOrB,IAAA,GAAQ,IAAA,GAAO,OAAA,KAAU,gBAAoD;AAAA,cAC7E,OAAA,GAAW,IAAA,GAAO,OAAA,KAAU,gBAAuD;AAAA,cACnF,QAAA,GAAY,IAAA,GAAO,OAAA,KAAU,gBAAoD;AAAA,cACjF,QAAA,GAAY,IAAA,GAAO,OAAA,KAAU,gBAAwD;;;;;;;ADlBtE;AAS5B;;;;;iBCuBgB,WAAA,gBAA2B,YAAA,EACzC,IAAA,UACA,OAAA,EAAS,MAAA,GACR,WAAA,CAAY,MAAA;;;iBCMC,+BAAA,aAA4C,OAAO;AAAA,iBAInD,iCAAA,aAA8C,OAAO;;;;;;AF/CrE;;;;;;;;;AAE4B;AAS5B;iBGEgB,WAAA,CAAY,OAAA;EAAA,SACjB,KAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA,WAAkB,SAAA;EAAA,SAClB,WAAA,YAAuB,kBAAA;AAAA,IAC9B,iBAAA"}
@@ -1,8 +1,8 @@
1
1
  import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID } from "./codec-ids-DSU7S2Li.mjs";
2
- import { t as createTable } from "./ddl-CH8V_qcd.mjs";
2
+ import { i as tableExistsAst, n as columnExistsAst, r as indexExistsAst, t as createTable } from "./ddl-DrtjQMFK.mjs";
3
3
  import { TableSource } from "@prisma-next/sql-relational-core/ast";
4
- import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
5
4
  import { col, fn, lit, table } from "@prisma-next/sql-relational-core/contract-free";
5
+ import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
6
6
  //#region src/contract-free/columns.ts
7
7
  const desc = (codecId, opts) => ({
8
8
  codecId,
@@ -87,6 +87,6 @@ function buildControlTableBootstrapQueries() {
87
87
  return [markerTable, ledgerTable];
88
88
  }
89
89
  //#endregion
90
- export { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, createTable, datetime, integer, jsonText, sqliteTable, text };
90
+ export { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, columnExistsAst, createTable, datetime, indexExistsAst, integer, jsonText, sqliteTable, tableExistsAst, text };
91
91
 
92
92
  //# sourceMappingURL=contract-free.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-target.ts","../src/core/sqlite-unbound-database.ts"],"mappings":";;;;;;cAgCM,6BAAA,EAA+B,0BAA0B,WAAW,uBAAA;;;KCnB9D,mBAAA;EAAA,SACD,EAAA;EAAA,SACA,OAAA,EAAS,mBAAmB;AAAA;ADF4C;;;;AAmBc;AAnBd,cCYtE,cAAA,SAAuB,aAAA;EAAA,SACjB,IAAA;EAAA,SAER,EAAA;EAAA,SACA,OAAA,EAAS,mBAAA;cAEN,KAAA,EAAO,mBAAA;EAAA,IAiCf,KAAA,IAAS,QAAA,CAAS,MAAA,SAAe,YAAA;EAIrC,SAAA;EAIA,YAAA,CAAa,SAAA;AAAA;;;AAzDwB;AAUvC;;;;;;;;;;;;;;cAqEa,qBAAA,SAA8B,cAAc;EAAA,gBACvC,QAAA,EAAU,qBAAA;EAAA,QAEnB,WAAA;AAAA;;;;;;;;;AAzBuB;AAsBhC;iBAmCgB,qBAAA,CACd,KAAA,EAAO,uBAAA,GACN,cAAA,GAAiB,qBAAA"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-target.ts","../src/core/sqlite-unbound-database.ts"],"mappings":";;;;;;cAgCM,6BAAA,EAA+B,0BAA0B,WAAW,uBAAA;;;KClB9D,mBAAA;EAAA,SACD,EAAA;EAAA,SACA,OAAA,EAAS,mBAAmB;AAAA;ADH4C;;;;AAmBc;AAnBd,cCatE,cAAA,SAAuB,aAAA;EAAA,SACjB,IAAA;EAAA,SAER,EAAA;EAAA,SACA,OAAA,EAAS,mBAAA;cAEN,KAAA,EAAO,mBAAA;EAAA,IAyBf,KAAA,IAAS,QAAA,CAAS,MAAA,SAAe,YAAA;EAIrC,SAAA;EAIA,YAAA,CAAa,SAAA;AAAA;;;AAjDwB;AAUvC;;;;;;;;;;;;;;cA6Da,qBAAA,SAA8B,cAAc;EAAA,gBACvC,QAAA,EAAU,qBAAA;EAAA,QAEnB,WAAA;AAAA;;;;;;;;;AAzBuB;AAsBhC;iBAmCgB,qBAAA,CACd,KAAA,EAAO,uBAAA,GACN,cAAA,GAAiB,qBAAA"}
package/dist/control.mjs CHANGED
@@ -2,9 +2,9 @@ import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-Dxx2A6PT.mjs"
2
2
  import { t as parseSqliteDefault } from "./default-normalizer-DuoHj9-O.mjs";
3
3
  import { t as normalizeSqliteNativeType } from "./native-type-normalizer-CiSyVmMP.mjs";
4
4
  import { r as MARKER_TABLE_NAME } from "./control-tables-7KwMyJ6i.mjs";
5
- import { y as renderDefaultLiteral } from "./op-factory-call-z4TT72k3.mjs";
6
- import { n as createSqliteMigrationPlanner } from "./planner-jMHqfl1A.mjs";
7
- import { n as SqliteUnboundDatabase, r as sqliteCreateNamespace, t as SqliteContractSerializer } from "./sqlite-contract-serializer-B_Cu0o3G.mjs";
5
+ import { h as renderDefaultLiteral } from "./op-factory-call-DmdfD1yd.mjs";
6
+ import { n as createSqliteMigrationPlanner } from "./planner-Ciq8p_dL.mjs";
7
+ import { n as SqliteUnboundDatabase, r as sqliteCreateNamespace, t as SqliteContractSerializer } from "./sqlite-contract-serializer-Cq9mXdXi.mjs";
8
8
  import { contractToSchemaIR, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
9
9
  import { SqlStorage } from "@prisma-next/sql-contract/types";
10
10
  import { verifySqlSchema } from "@prisma-next/family-sql/schema-verify";
@@ -0,0 +1,68 @@
1
+ import { s as SQLITE_TEXT_CODEC_ID } from "./codec-ids-DSU7S2Li.mjs";
2
+ import { t as SqliteCreateTable } from "./nodes-D0k4z7NL.mjs";
3
+ import { FunctionSource } from "@prisma-next/sql-relational-core/ast";
4
+ import { cfExpr, cfTable, exprSelect } from "@prisma-next/sql-relational-core/contract-free";
5
+ //#region src/contract-free/checks.ts
6
+ /**
7
+ * Typed builder for the migration planner's column-existence checks. Produces
8
+ * `SELECT COUNT(*) {=|>} 0 AS "result" FROM pragma_table_info(?) WHERE "name" = ?`
9
+ * ASTs with the table and column names bound as text parameters — never
10
+ * inlined into the SQL.
11
+ */
12
+ function columnExistsAst(table, column) {
13
+ const source = FunctionSource.of("pragma_table_info", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);
14
+ const where = cfExpr.identifierRef("name").eqParam(column, SQLITE_TEXT_CODEC_ID);
15
+ return {
16
+ columnAbsent: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build(),
17
+ columnPresent: () => exprSelect().from(source).project("result", cfExpr.countStar().gtLit(0)).where(where).build()
18
+ };
19
+ }
20
+ /**
21
+ * Typed builder for table-existence checks over `sqlite_master`.
22
+ * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
23
+ * with the table name and the literal `'table'` bound as text parameters.
24
+ */
25
+ function tableExistsAst(tableName) {
26
+ const source = cfTable("sqlite_master");
27
+ const where = cfExpr.allOf([cfExpr.identifierRef("type").eqParam("table", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef("name").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);
28
+ return {
29
+ tableAbsent: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build(),
30
+ tablePresent: () => exprSelect().from(source).project("result", cfExpr.countStar().gtLit(0)).where(where).build()
31
+ };
32
+ }
33
+ /**
34
+ * Typed builder for index-existence checks over `sqlite_master`.
35
+ * Produces `SELECT COUNT(*) {=|>} 0 AS "result" FROM "sqlite_master" WHERE "type" = ? AND "name" = ?`
36
+ * with the index name and the literal `'index'` bound as text parameters.
37
+ */
38
+ function indexExistsAst(indexName) {
39
+ const source = cfTable("sqlite_master");
40
+ const where = cfExpr.allOf([cfExpr.identifierRef("type").eqParam("index", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef("name").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);
41
+ return {
42
+ indexAbsent: () => exprSelect().from(source).project("result", cfExpr.countStar().eqLit(0)).where(where).build(),
43
+ indexPresent: () => exprSelect().from(source).project("result", cfExpr.countStar().gtLit(0)).where(where).build()
44
+ };
45
+ }
46
+ //#endregion
47
+ //#region src/contract-free/ddl.ts
48
+ /**
49
+ * Build a SQLite `CREATE TABLE` query node.
50
+ *
51
+ * Pass `constraints` for table-level composite primary keys, foreign keys, and
52
+ * unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},
53
+ * and {@link UniqueConstraint} classes from `@prisma-next/sql-relational-core/ast`.
54
+ *
55
+ * Precondition: identifiers (`table`, column names/types) are emitted to SQL
56
+ * verbatim — they are not quoted or escaped, so callers must pass pre-trusted
57
+ * values (e.g. fixed control-plane identifiers). String-literal default values,
58
+ * by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.
59
+ * Identifier quoting for untrusted identifiers is added when the migration
60
+ * planner adopts this lowering path.
61
+ */
62
+ function createTable(options) {
63
+ return new SqliteCreateTable(options);
64
+ }
65
+ //#endregion
66
+ export { tableExistsAst as i, columnExistsAst as n, indexExistsAst as r, createTable as t };
67
+
68
+ //# sourceMappingURL=ddl-DrtjQMFK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ddl-DrtjQMFK.mjs","names":[],"sources":["../src/contract-free/checks.ts","../src/contract-free/ddl.ts"],"sourcesContent":["import { FunctionSource, type SelectAst } from '@prisma-next/sql-relational-core/ast';\nimport { cfExpr, cfTable, exprSelect } from '@prisma-next/sql-relational-core/contract-free';\nimport { SQLITE_TEXT_CODEC_ID } from '../core/codec-ids';\n\nexport interface ColumnExistsCheckBuilder {\n columnAbsent(): SelectAst;\n columnPresent(): SelectAst;\n}\n\n/**\n * Typed builder for the migration planner's column-existence checks. Produces\n * `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM pragma_table_info(?) WHERE \"name\" = ?`\n * ASTs with the table and column names bound as text parameters — never\n * inlined into the SQL.\n */\nexport function columnExistsAst(table: string, column: string): ColumnExistsCheckBuilder {\n const source = FunctionSource.of('pragma_table_info', [\n cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast,\n ]);\n const where = cfExpr.identifierRef('name').eqParam(column, SQLITE_TEXT_CODEC_ID);\n return {\n columnAbsent: () =>\n exprSelect().from(source).project('result', cfExpr.countStar().eqLit(0)).where(where).build(),\n columnPresent: () =>\n exprSelect().from(source).project('result', cfExpr.countStar().gtLit(0)).where(where).build(),\n };\n}\n\nexport interface TableExistsCheckBuilder {\n tableAbsent(): SelectAst;\n tablePresent(): SelectAst;\n}\n\n/**\n * Typed builder for table-existence checks over `sqlite_master`.\n * Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ? AND \"name\" = ?`\n * with the table name and the literal `'table'` bound as text parameters.\n */\nexport function tableExistsAst(tableName: string): TableExistsCheckBuilder {\n const source = cfTable('sqlite_master');\n const where = cfExpr.allOf([\n cfExpr.identifierRef('type').eqParam('table', SQLITE_TEXT_CODEC_ID),\n cfExpr.identifierRef('name').eqParam(tableName, SQLITE_TEXT_CODEC_ID),\n ]);\n return {\n tableAbsent: () =>\n exprSelect().from(source).project('result', cfExpr.countStar().eqLit(0)).where(where).build(),\n tablePresent: () =>\n exprSelect().from(source).project('result', cfExpr.countStar().gtLit(0)).where(where).build(),\n };\n}\n\nexport interface IndexExistsCheckBuilder {\n indexAbsent(): SelectAst;\n indexPresent(): SelectAst;\n}\n\n/**\n * Typed builder for index-existence checks over `sqlite_master`.\n * Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ? AND \"name\" = ?`\n * with the index name and the literal `'index'` bound as text parameters.\n */\nexport function indexExistsAst(indexName: string): IndexExistsCheckBuilder {\n const source = cfTable('sqlite_master');\n const where = cfExpr.allOf([\n cfExpr.identifierRef('type').eqParam('index', SQLITE_TEXT_CODEC_ID),\n cfExpr.identifierRef('name').eqParam(indexName, SQLITE_TEXT_CODEC_ID),\n ]);\n return {\n indexAbsent: () =>\n exprSelect().from(source).project('result', cfExpr.countStar().eqLit(0)).where(where).build(),\n indexPresent: () =>\n exprSelect().from(source).project('result', cfExpr.countStar().gtLit(0)).where(where).build(),\n };\n}\n","import type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-core/ast';\nimport { SqliteCreateTable } from '../core/ddl/nodes';\n\n/**\n * Build a SQLite `CREATE TABLE` query node.\n *\n * Pass `constraints` for table-level composite primary keys, foreign keys, and\n * unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n * and {@link UniqueConstraint} classes from `@prisma-next/sql-relational-core/ast`.\n *\n * Precondition: identifiers (`table`, column names/types) are emitted to SQL\n * verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n * values (e.g. fixed control-plane identifiers). String-literal default values,\n * by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n * Identifier quoting for untrusted identifiers is added when the migration\n * planner adopts this lowering path.\n */\nexport function createTable(options: {\n readonly table: string;\n readonly schema?: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n readonly constraints?: readonly DdlTableConstraint[];\n}): SqliteCreateTable {\n return new SqliteCreateTable(options);\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,gBAAgB,OAAe,QAA0C;CACvF,MAAM,SAAS,eAAe,GAAG,qBAAqB,CACpD,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAC5C,CAAC;CACD,MAAM,QAAQ,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,QAAQ,oBAAoB;CAC/E,OAAO;EACL,oBACE,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC9F,qBACE,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAChG;AACF;;;;;;AAYA,SAAgB,eAAe,WAA4C;CACzE,MAAM,SAAS,QAAQ,eAAe;CACtC,MAAM,QAAQ,OAAO,MAAM,CACzB,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,oBAAoB,GAClE,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CACtE,CAAC;CACD,OAAO;EACL,mBACE,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC9F,oBACE,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAChG;AACF;;;;;;AAYA,SAAgB,eAAe,WAA4C;CACzE,MAAM,SAAS,QAAQ,eAAe;CACtC,MAAM,QAAQ,OAAO,MAAM,CACzB,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,oBAAoB,GAClE,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CACtE,CAAC;CACD,OAAO;EACL,mBACE,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC9F,oBACE,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAChG;AACF;;;;;;;;;;;;;;;;;ACzDA,SAAgB,YAAY,SAMN;CACpB,OAAO,IAAI,kBAAkB,OAAO;AACtC"}
@@ -1,14 +1,9 @@
1
- import { i as SqliteTableSpec, n as SqliteColumnSpec, r as SqliteIndexSpec, t as Op } from "./shared-Dhc8mLK1.mjs";
2
- import { t as SqliteMigration } from "./sqlite-migration-CJrASAxf.mjs";
3
- import { MigrationOperationClass } from "@prisma-next/family-sql/control";
1
+ import { t as Op } from "./shared-Dhc8mLK1.mjs";
2
+ import { t as SqliteMigration } from "./sqlite-migration-DVfhQwN_.mjs";
4
3
  import { placeholder } from "@prisma-next/errors/migration";
5
4
  import { col, fn, foreignKey, lit, primaryKey, unique } from "@prisma-next/sql-relational-core/contract-free";
6
5
  import { MigrationCLI } from "@prisma-next/cli/migration-cli";
7
6
 
8
- //#region src/core/migrations/operations/columns.d.ts
9
- declare function addColumn(tableName: string, column: SqliteColumnSpec): Op;
10
- declare function dropColumn(tableName: string, columnName: string): Op;
11
- //#endregion
12
7
  //#region src/core/migrations/operations/data-transform.d.ts
13
8
  interface DataTransformOptions {
14
9
  /** Stable id used in the ledger / for runner idempotency tracking. */
@@ -34,10 +29,6 @@ interface DataTransformOptions {
34
29
  }
35
30
  declare function dataTransform(opts: DataTransformOptions): Op;
36
31
  //#endregion
37
- //#region src/core/migrations/operations/indexes.d.ts
38
- declare function createIndex(tableName: string, indexName: string, columns: readonly string[]): Op;
39
- declare function dropIndex(tableName: string, indexName: string): Op;
40
- //#endregion
41
32
  //#region src/core/migrations/operations/raw.d.ts
42
33
  /**
43
34
  * Identity factory for an already-materialized
@@ -48,38 +39,5 @@ declare function dropIndex(tableName: string, indexName: string): Op;
48
39
  */
49
40
  declare function rawSql(op: Op): Op;
50
41
  //#endregion
51
- //#region src/core/migrations/operations/tables.d.ts
52
- declare function dropTable(tableName: string): Op;
53
- interface RecreateTableArgs {
54
- readonly tableName: string;
55
- /** New (post-recreate) shape of the table. Same flat spec as `createTable`. */
56
- readonly contractTable: SqliteTableSpec;
57
- /**
58
- * Names of columns that exist in the live (pre-recreate) schema. Used to
59
- * compute the `INSERT INTO temp ... SELECT ... FROM old` column list — only
60
- * shared columns are copied, so dropped columns are left behind and added
61
- * columns come from defaults.
62
- */
63
- readonly schemaColumnNames: readonly string[];
64
- /**
65
- * Indexes (declared + FK-backing, deduped by column-set) to recreate after
66
- * the table has been replaced. The planner pre-merges these.
67
- */
68
- readonly indexes: readonly SqliteIndexSpec[];
69
- /** Human-readable summary of the change, built by the planner from issues. */
70
- readonly summary: string;
71
- /**
72
- * Per-issue postcheck steps appended after the structural postchecks. The
73
- * planner pre-builds these via `buildRecreatePostchecks` so the call IR
74
- * carries flat, serializable data only — no `SchemaIssue` references.
75
- */
76
- readonly postchecks: readonly {
77
- readonly description: string;
78
- readonly sql: string;
79
- }[];
80
- readonly operationClass: MigrationOperationClass;
81
- }
82
- declare function recreateTable(args: RecreateTableArgs): Op;
83
- //#endregion
84
- export { type DataTransformOptions, SqliteMigration as Migration, MigrationCLI, addColumn, col, createIndex, dataTransform, dropColumn, dropIndex, dropTable, fn, foreignKey, lit, placeholder, primaryKey, rawSql, recreateTable, unique };
42
+ export { type DataTransformOptions, SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };
85
43
  //# sourceMappingURL=migration.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration.d.mts","names":[],"sources":["../src/core/migrations/operations/columns.ts","../src/core/migrations/operations/data-transform.ts","../src/core/migrations/operations/indexes.ts","../src/core/migrations/operations/raw.ts","../src/core/migrations/operations/tables.ts"],"mappings":";;;;;;;;iBAIgB,SAAA,CAAU,SAAA,UAAmB,MAAA,EAAQ,gBAAA,GAAmB,EAAE;AAAA,iBA+B1D,UAAA,CAAW,SAAA,UAAmB,UAAA,WAAqB,EAAE;;;UCnBpD,oBAAA;EDZoC;EAAA,SCc1C,EAAA;EDd6D;EAAA,SCgB7D,KAAA;EDhB+D;EAAA,SCkB/D,KAAA;EDae;;;;EAAA,SCRf,WAAA;EDQwD;;AAAE;;;;ACnBrE;;EDmBmE,SCCxD,GAAA;AAAA;AAAA,iBAGK,aAAA,CAAc,IAAA,EAAM,oBAAA,GAAuB,EAAE;;;iBClC7C,WAAA,CAAY,SAAA,UAAmB,SAAA,UAAmB,OAAA,sBAA6B,EAAE;AAAA,iBAyBjF,SAAA,CAAU,SAAA,UAAmB,SAAA,WAAoB,EAAE;;;;;;;;;;iBCrBnD,MAAA,CAAO,EAAA,EAAI,EAAA,GAAK,EAAE;;;iBC0DlB,SAAA,CAAU,SAAA,WAAoB,EAAE;AAAA,UAuB/B,iBAAA;EAAA,SACN,SAAA;;WAEA,aAAA,EAAe,eAAA;EJzFV;;;;;;EAAA,SIgGL,iBAAA;EJhG6D;;AAAE;AA+B1E;EA/BwE,SIqG7D,OAAA,WAAkB,eAAA;;WAElB,OAAA;EJxEgB;;;;AAA0C;EAA1C,SI8EhB,UAAA;IAAA,SAAgC,WAAA;IAAA,SAA8B,GAAA;EAAA;EAAA,SAC9D,cAAA,EAAgB,uBAAA;AAAA;AAAA,iBAGX,aAAA,CAAc,IAAA,EAAM,iBAAA,GAAoB,EAAE"}
1
+ {"version":3,"file":"migration.d.mts","names":[],"sources":["../src/core/migrations/operations/data-transform.ts","../src/core/migrations/operations/raw.ts"],"mappings":";;;;;;;UAgBiB,oBAAA;EAWN;EAAA,SATA,EAAA;EAkBG;EAAA,SAhBH,KAAA;EAmBK;EAAA,SAjBL,KAAA;;;;;WAKA,WAAA;EAYkD;AAAA;;;;AC9B7D;;;ED8B6D,SAHlD,GAAA;AAAA;AAAA,iBAGK,aAAA,CAAc,IAAA,EAAM,oBAAA,GAAuB,EAAE;;;;;;;;;AAvB7D;iBCPgB,MAAA,CAAO,EAAA,EAAI,EAAA,GAAK,EAAE"}
@@ -1,6 +1,6 @@
1
1
  import { t as buildTargetDetails } from "./planner-target-details-H8z9TFDg.mjs";
2
- import { C as step, S as dropColumn, f as dropTable, h as dropIndex, m as createIndex, p as recreateTable, x as addColumn } from "./op-factory-call-z4TT72k3.mjs";
3
- import { t as SqliteMigration } from "./sqlite-migration-DhW4ycZV.mjs";
2
+ import { _ as step } from "./op-factory-call-DmdfD1yd.mjs";
3
+ import { t as SqliteMigration } from "./sqlite-migration-A0rwqPOG.mjs";
4
4
  import { placeholder } from "@prisma-next/errors/migration";
5
5
  import { col, fn, foreignKey, lit, primaryKey, unique } from "@prisma-next/sql-relational-core/contract-free";
6
6
  import { MigrationCLI } from "@prisma-next/cli/migration-cli";
@@ -45,6 +45,6 @@ function rawSql(op) {
45
45
  return op;
46
46
  }
47
47
  //#endregion
48
- export { SqliteMigration as Migration, MigrationCLI, addColumn, col, createIndex, dataTransform, dropColumn, dropIndex, dropTable, fn, foreignKey, lit, placeholder, primaryKey, rawSql, recreateTable, unique };
48
+ export { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };
49
49
 
50
50
  //# sourceMappingURL=migration.mjs.map