@prisma-next/target-sqlite 0.13.0-dev.4 → 0.13.0-dev.40

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 (86) 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 -22
  4. package/dist/contract-free.mjs.map +1 -1
  5. package/dist/control.d.mts +5 -8
  6. package/dist/control.d.mts.map +1 -1
  7. package/dist/control.mjs +18 -20
  8. package/dist/control.mjs.map +1 -1
  9. package/dist/ddl-DrtjQMFK.mjs +68 -0
  10. package/dist/ddl-DrtjQMFK.mjs.map +1 -0
  11. package/dist/{descriptor-meta-Dxx2A6PT.mjs → descriptor-meta-DxmEeTJ-.mjs} +10 -3
  12. package/dist/descriptor-meta-DxmEeTJ-.mjs.map +1 -0
  13. package/dist/migration.d.mts +4 -46
  14. package/dist/migration.d.mts.map +1 -1
  15. package/dist/migration.mjs +4 -3
  16. package/dist/migration.mjs.map +1 -1
  17. package/dist/op-factory-call-DmdfD1yd.mjs +794 -0
  18. package/dist/op-factory-call-DmdfD1yd.mjs.map +1 -0
  19. package/dist/op-factory-call.d.mts +22 -12
  20. package/dist/op-factory-call.d.mts.map +1 -1
  21. package/dist/op-factory-call.mjs +1 -1
  22. package/dist/pack.mjs +1 -1
  23. package/dist/{planner-DSNDwQy9.mjs → planner-Ciq8p_dL.mjs} +80 -12
  24. package/dist/planner-Ciq8p_dL.mjs.map +1 -0
  25. package/dist/{planner-produced-sqlite-migration-DowV_vHw.mjs → planner-produced-sqlite-migration-0xPEm3R1.mjs} +9 -5
  26. package/dist/planner-produced-sqlite-migration-0xPEm3R1.mjs.map +1 -0
  27. package/dist/{planner-produced-sqlite-migration-C1yqJAiM.d.mts → planner-produced-sqlite-migration-CpgsY-M9.d.mts} +5 -4
  28. package/dist/planner-produced-sqlite-migration-CpgsY-M9.d.mts.map +1 -0
  29. package/dist/planner-produced-sqlite-migration.d.mts +1 -1
  30. package/dist/planner-produced-sqlite-migration.mjs +1 -1
  31. package/dist/planner.d.mts +5 -2
  32. package/dist/planner.d.mts.map +1 -1
  33. package/dist/planner.mjs +1 -1
  34. package/dist/render-ops-BDW2tUeR.mjs +22 -0
  35. package/dist/render-ops-BDW2tUeR.mjs.map +1 -0
  36. package/dist/render-ops.d.mts +2 -1
  37. package/dist/render-ops.d.mts.map +1 -1
  38. package/dist/render-ops.mjs +1 -1
  39. package/dist/runtime.d.mts +1 -0
  40. package/dist/runtime.d.mts.map +1 -1
  41. package/dist/runtime.mjs +2 -2
  42. package/dist/shared-Dhc8mLK1.d.mts.map +1 -1
  43. package/dist/{sqlite-contract-serializer-jcRu8aHh.mjs → sqlite-contract-serializer--iaDgC8e.mjs} +17 -6
  44. package/dist/sqlite-contract-serializer--iaDgC8e.mjs.map +1 -0
  45. package/dist/sqlite-migration-A0rwqPOG.mjs +92 -0
  46. package/dist/sqlite-migration-A0rwqPOG.mjs.map +1 -0
  47. package/dist/sqlite-migration-DVfhQwN_.d.mts +75 -0
  48. package/dist/sqlite-migration-DVfhQwN_.d.mts.map +1 -0
  49. package/package.json +18 -18
  50. package/src/contract-free/checks.ts +75 -0
  51. package/src/core/control-target.ts +4 -4
  52. package/src/core/errors.ts +28 -0
  53. package/src/core/migrations/issue-planner.ts +151 -8
  54. package/src/core/migrations/op-factory-call.ts +332 -45
  55. package/src/core/migrations/operations/columns.ts +32 -26
  56. package/src/core/migrations/operations/indexes.ts +31 -27
  57. package/src/core/migrations/operations/shared.ts +11 -3
  58. package/src/core/migrations/operations/tables.ts +39 -37
  59. package/src/core/migrations/planner-ddl-builders.ts +7 -16
  60. package/src/core/migrations/planner-produced-sqlite-migration.ts +8 -2
  61. package/src/core/migrations/planner-strategies.ts +3 -3
  62. package/src/core/migrations/planner.ts +14 -2
  63. package/src/core/migrations/render-ops.ts +37 -9
  64. package/src/core/migrations/runner.ts +16 -12
  65. package/src/core/migrations/sqlite-migration.ts +119 -1
  66. package/src/core/sqlite-contract-serializer.ts +5 -0
  67. package/src/core/sqlite-unbound-database.ts +30 -54
  68. package/src/exports/contract-free.ts +8 -0
  69. package/src/exports/migration.ts +8 -3
  70. package/dist/descriptor-meta-Dxx2A6PT.mjs.map +0 -1
  71. package/dist/descriptor-meta-runtime-BkXK3OjD.mjs +0 -12
  72. package/dist/descriptor-meta-runtime-BkXK3OjD.mjs.map +0 -1
  73. package/dist/op-factory-call-DymqdXQW.mjs +0 -279
  74. package/dist/op-factory-call-DymqdXQW.mjs.map +0 -1
  75. package/dist/planner-DSNDwQy9.mjs.map +0 -1
  76. package/dist/planner-produced-sqlite-migration-C1yqJAiM.d.mts.map +0 -1
  77. package/dist/planner-produced-sqlite-migration-DowV_vHw.mjs.map +0 -1
  78. package/dist/render-ops-CFRbJ3Yb.mjs +0 -8
  79. package/dist/render-ops-CFRbJ3Yb.mjs.map +0 -1
  80. package/dist/sqlite-contract-serializer-jcRu8aHh.mjs.map +0 -1
  81. package/dist/sqlite-migration-CUqgmzQH.mjs +0 -16
  82. package/dist/sqlite-migration-CUqgmzQH.mjs.map +0 -1
  83. package/dist/sqlite-migration-D4XGYzgQ.d.mts +0 -17
  84. package/dist/sqlite-migration-D4XGYzgQ.d.mts.map +0 -1
  85. package/dist/tables-CjB7vXCr.mjs +0 -412
  86. package/dist/tables-CjB7vXCr.mjs.map +0 -1
@@ -1,13 +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-D4XGYzgQ.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";
4
+ import { col, fn, foreignKey, lit, primaryKey, unique } from "@prisma-next/sql-relational-core/contract-free";
5
5
  import { MigrationCLI } from "@prisma-next/cli/migration-cli";
6
6
 
7
- //#region src/core/migrations/operations/columns.d.ts
8
- declare function addColumn(tableName: string, column: SqliteColumnSpec): Op;
9
- declare function dropColumn(tableName: string, columnName: string): Op;
10
- //#endregion
11
7
  //#region src/core/migrations/operations/data-transform.d.ts
12
8
  interface DataTransformOptions {
13
9
  /** Stable id used in the ledger / for runner idempotency tracking. */
@@ -33,10 +29,6 @@ interface DataTransformOptions {
33
29
  }
34
30
  declare function dataTransform(opts: DataTransformOptions): Op;
35
31
  //#endregion
36
- //#region src/core/migrations/operations/indexes.d.ts
37
- declare function createIndex(tableName: string, indexName: string, columns: readonly string[]): Op;
38
- declare function dropIndex(tableName: string, indexName: string): Op;
39
- //#endregion
40
32
  //#region src/core/migrations/operations/raw.d.ts
41
33
  /**
42
34
  * Identity factory for an already-materialized
@@ -47,39 +39,5 @@ declare function dropIndex(tableName: string, indexName: string): Op;
47
39
  */
48
40
  declare function rawSql(op: Op): Op;
49
41
  //#endregion
50
- //#region src/core/migrations/operations/tables.d.ts
51
- declare function createTable(tableName: string, spec: SqliteTableSpec): Op;
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, createIndex, createTable, dataTransform, dropColumn, dropIndex, dropTable, placeholder, rawSql, recreateTable };
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;EDZ4B;EAAA,SCclC,EAAA;EDd+D;EAAA,SCgB/D,KAAA;EDeK;EAAA,SCbL,KAAA;;;;;WAKA,WAAA;EDQ0D;AAAA;;;;ACnBrE;;;EDmBqE,SCC1D,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;;;iBCmClB,WAAA,CAAY,SAAA,UAAmB,IAAA,EAAM,eAAA,GAAkB,EAAE;AAAA,iBAuBzD,SAAA,CAAU,SAAA,WAAoB,EAAE;AAAA,UAuB/B,iBAAA;EAAA,SACN,SAAA;;WAEA,aAAA,EAAe,eAAA;EJzFD;;;;;;EAAA,SIgGd,iBAAA;EJhG+D;AAAA;AA+B1E;;EA/B0E,SIqG/D,OAAA,WAAkB,eAAA;EJtEwC;EAAA,SIwE1D,OAAA;EJxEmC;;;AAAuB;;EAAvB,SI8EnC,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,7 +1,8 @@
1
1
  import { t as buildTargetDetails } from "./planner-target-details-H8z9TFDg.mjs";
2
- import { a as recreateTable, f as addColumn, i as dropTable, m as step, o as createIndex, p as dropColumn, r as createTable, s as dropIndex } from "./tables-CjB7vXCr.mjs";
3
- import { t as SqliteMigration } from "./sqlite-migration-CUqgmzQH.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
+ import { col, fn, foreignKey, lit, primaryKey, unique } from "@prisma-next/sql-relational-core/contract-free";
5
6
  import { MigrationCLI } from "@prisma-next/cli/migration-cli";
6
7
  //#region src/core/migrations/operations/data-transform.ts
7
8
  /**
@@ -44,6 +45,6 @@ function rawSql(op) {
44
45
  return op;
45
46
  }
46
47
  //#endregion
47
- export { SqliteMigration as Migration, MigrationCLI, addColumn, createIndex, createTable, dataTransform, dropColumn, dropIndex, dropTable, placeholder, rawSql, recreateTable };
48
+ export { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };
48
49
 
49
50
  //# sourceMappingURL=migration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/migrations/operations/data-transform.ts","../src/core/migrations/operations/raw.ts"],"sourcesContent":["/**\n * User-facing `dataTransform` factory for the SQLite migration authoring\n * surface. Invoked directly inside a `migration.ts` file to supply a\n * user-authored SQL statement that runs with operation class `'data'`.\n *\n * Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL\n * tightening requires a backfill. The rendered `migration.ts` exposes the\n * backfill as a `placeholder(\"…\")` slot the user fills in with an\n * `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`\n * invocation returns a runnable operation the runner executes before the\n * subsequent recreate-table op copies data into the tightened schema.\n */\n\nimport { buildTargetDetails } from '../planner-target-details';\nimport { type Op, step } from './shared';\n\nexport interface DataTransformOptions {\n /** Stable id used in the ledger / for runner idempotency tracking. */\n readonly id: string;\n /** Human-readable label surfaced in CLI output. */\n readonly label: string;\n /** Table the backfill targets; informs `target.details`. */\n readonly table: string;\n /**\n * Short description of the step (shown by the runner on execute). The\n * planner leaves this as `placeholder(...)` for users to replace.\n */\n readonly description: string;\n /**\n * Producer of the SQL string to execute. Invoked eagerly by\n * `dataTransform(...)`, mirroring the Postgres factory — by the time the\n * user calls this factory in `migration.ts`, the SQL is expected to be\n * ready. Planner-emitted stubs that need to defer until the user fills\n * in the SQL go through `DataTransformCall.renderTypeScript()` instead;\n * this factory is only for the post-fill, runnable form.\n */\n readonly run: () => string;\n}\n\nexport function dataTransform(opts: DataTransformOptions): Op {\n return {\n id: opts.id,\n label: opts.label,\n summary: opts.description,\n operationClass: 'data',\n target: { id: 'sqlite', details: buildTargetDetails('table', opts.table) },\n precheck: [],\n execute: [step(opts.description, opts.run())],\n postcheck: [],\n };\n}\n","import type { Op } from './shared';\n\n/**\n * Identity factory for an already-materialized\n * `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres\n * `rawSql` factory: the planner uses this to carry ops produced by SQL-family\n * paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured\n * call IR without reverse-engineering their shape.\n */\nexport function rawSql(op: Op): Op {\n return op;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,SAAgB,cAAc,MAAgC;CAC5D,OAAO;EACL,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GAAE,IAAI;GAAU,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAAE;EACzE,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACd;AACF;;;;;;;;;;ACzCA,SAAgB,OAAO,IAAY;CACjC,OAAO;AACT"}
1
+ {"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/migrations/operations/data-transform.ts","../src/core/migrations/operations/raw.ts"],"sourcesContent":["/**\n * User-facing `dataTransform` factory for the SQLite migration authoring\n * surface. Invoked directly inside a `migration.ts` file to supply a\n * user-authored SQL statement that runs with operation class `'data'`.\n *\n * Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL\n * tightening requires a backfill. The rendered `migration.ts` exposes the\n * backfill as a `placeholder(\"…\")` slot the user fills in with an\n * `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`\n * invocation returns a runnable operation the runner executes before the\n * subsequent recreate-table op copies data into the tightened schema.\n */\n\nimport { buildTargetDetails } from '../planner-target-details';\nimport { type Op, step } from './shared';\n\nexport interface DataTransformOptions {\n /** Stable id used in the ledger / for runner idempotency tracking. */\n readonly id: string;\n /** Human-readable label surfaced in CLI output. */\n readonly label: string;\n /** Table the backfill targets; informs `target.details`. */\n readonly table: string;\n /**\n * Short description of the step (shown by the runner on execute). The\n * planner leaves this as `placeholder(...)` for users to replace.\n */\n readonly description: string;\n /**\n * Producer of the SQL string to execute. Invoked eagerly by\n * `dataTransform(...)`, mirroring the Postgres factory — by the time the\n * user calls this factory in `migration.ts`, the SQL is expected to be\n * ready. Planner-emitted stubs that need to defer until the user fills\n * in the SQL go through `DataTransformCall.renderTypeScript()` instead;\n * this factory is only for the post-fill, runnable form.\n */\n readonly run: () => string;\n}\n\nexport function dataTransform(opts: DataTransformOptions): Op {\n return {\n id: opts.id,\n label: opts.label,\n summary: opts.description,\n operationClass: 'data',\n target: { id: 'sqlite', details: buildTargetDetails('table', opts.table) },\n precheck: [],\n execute: [step(opts.description, opts.run())],\n postcheck: [],\n };\n}\n","import type { Op } from './shared';\n\n/**\n * Identity factory for an already-materialized\n * `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres\n * `rawSql` factory: the planner uses this to carry ops produced by SQL-family\n * paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured\n * call IR without reverse-engineering their shape.\n */\nexport function rawSql(op: Op): Op {\n return op;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,SAAgB,cAAc,MAAgC;CAC5D,OAAO;EACL,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GAAE,IAAI;GAAU,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAAE;EACzE,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACd;AACF;;;;;;;;;;ACzCA,SAAgB,OAAO,IAAY;CACjC,OAAO;AACT"}