@prisma-next/target-sqlite 0.13.0 → 0.14.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract-free.d.mts +35 -2
- package/dist/contract-free.d.mts.map +1 -1
- package/dist/contract-free.mjs +3 -22
- package/dist/contract-free.mjs.map +1 -1
- package/dist/control.d.mts +5 -8
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +18 -20
- package/dist/control.mjs.map +1 -1
- package/dist/ddl-DrtjQMFK.mjs +68 -0
- package/dist/ddl-DrtjQMFK.mjs.map +1 -0
- package/dist/{descriptor-meta-Dxx2A6PT.mjs → descriptor-meta-DxmEeTJ-.mjs} +10 -3
- package/dist/descriptor-meta-DxmEeTJ-.mjs.map +1 -0
- package/dist/migration.d.mts +4 -46
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +4 -3
- package/dist/migration.mjs.map +1 -1
- package/dist/op-factory-call-DmdfD1yd.mjs +794 -0
- package/dist/op-factory-call-DmdfD1yd.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +22 -12
- package/dist/op-factory-call.d.mts.map +1 -1
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-DSNDwQy9.mjs → planner-Ciq8p_dL.mjs} +80 -12
- package/dist/planner-Ciq8p_dL.mjs.map +1 -0
- package/dist/{planner-produced-sqlite-migration-DowV_vHw.mjs → planner-produced-sqlite-migration-0xPEm3R1.mjs} +9 -5
- package/dist/planner-produced-sqlite-migration-0xPEm3R1.mjs.map +1 -0
- package/dist/{planner-produced-sqlite-migration-C1yqJAiM.d.mts → planner-produced-sqlite-migration-CpgsY-M9.d.mts} +5 -4
- package/dist/planner-produced-sqlite-migration-CpgsY-M9.d.mts.map +1 -0
- package/dist/planner-produced-sqlite-migration.d.mts +1 -1
- package/dist/planner-produced-sqlite-migration.mjs +1 -1
- package/dist/planner.d.mts +5 -2
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/render-ops-BDW2tUeR.mjs +22 -0
- package/dist/render-ops-BDW2tUeR.mjs.map +1 -0
- package/dist/render-ops.d.mts +2 -1
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/render-ops.mjs +1 -1
- package/dist/runtime.d.mts +1 -0
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -2
- package/dist/shared-Dhc8mLK1.d.mts.map +1 -1
- package/dist/{sqlite-contract-serializer-jcRu8aHh.mjs → sqlite-contract-serializer--iaDgC8e.mjs} +17 -6
- package/dist/sqlite-contract-serializer--iaDgC8e.mjs.map +1 -0
- package/dist/sqlite-migration-A0rwqPOG.mjs +92 -0
- package/dist/sqlite-migration-A0rwqPOG.mjs.map +1 -0
- package/dist/sqlite-migration-DVfhQwN_.d.mts +75 -0
- package/dist/sqlite-migration-DVfhQwN_.d.mts.map +1 -0
- package/package.json +18 -18
- package/src/contract-free/checks.ts +75 -0
- package/src/core/control-target.ts +4 -4
- package/src/core/errors.ts +28 -0
- package/src/core/migrations/issue-planner.ts +151 -8
- package/src/core/migrations/op-factory-call.ts +332 -45
- package/src/core/migrations/operations/columns.ts +32 -26
- package/src/core/migrations/operations/indexes.ts +31 -27
- package/src/core/migrations/operations/shared.ts +11 -3
- package/src/core/migrations/operations/tables.ts +39 -37
- package/src/core/migrations/planner-ddl-builders.ts +7 -16
- package/src/core/migrations/planner-produced-sqlite-migration.ts +8 -2
- package/src/core/migrations/planner-strategies.ts +3 -3
- package/src/core/migrations/planner.ts +14 -2
- package/src/core/migrations/render-ops.ts +37 -9
- package/src/core/migrations/runner.ts +16 -12
- package/src/core/migrations/sqlite-migration.ts +119 -1
- package/src/core/sqlite-contract-serializer.ts +5 -0
- package/src/core/sqlite-unbound-database.ts +30 -54
- package/src/exports/contract-free.ts +8 -0
- package/src/exports/migration.ts +8 -3
- package/dist/descriptor-meta-Dxx2A6PT.mjs.map +0 -1
- package/dist/descriptor-meta-runtime-BkXK3OjD.mjs +0 -12
- package/dist/descriptor-meta-runtime-BkXK3OjD.mjs.map +0 -1
- package/dist/op-factory-call-DymqdXQW.mjs +0 -279
- package/dist/op-factory-call-DymqdXQW.mjs.map +0 -1
- package/dist/planner-DSNDwQy9.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-C1yqJAiM.d.mts.map +0 -1
- package/dist/planner-produced-sqlite-migration-DowV_vHw.mjs.map +0 -1
- package/dist/render-ops-CFRbJ3Yb.mjs +0 -8
- package/dist/render-ops-CFRbJ3Yb.mjs.map +0 -1
- package/dist/sqlite-contract-serializer-jcRu8aHh.mjs.map +0 -1
- package/dist/sqlite-migration-CUqgmzQH.mjs +0 -16
- package/dist/sqlite-migration-CUqgmzQH.mjs.map +0 -1
- package/dist/sqlite-migration-D4XGYzgQ.d.mts +0 -17
- package/dist/sqlite-migration-D4XGYzgQ.d.mts.map +0 -1
- package/dist/tables-CjB7vXCr.mjs +0 -412
- package/dist/tables-CjB7vXCr.mjs.map +0 -1
package/dist/migration.d.mts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
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
|
-
|
|
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
|
package/dist/migration.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.mts","names":[],"sources":["../src/core/migrations/operations/
|
|
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"}
|
package/dist/migration.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { t as buildTargetDetails } from "./planner-target-details-H8z9TFDg.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
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,
|
|
48
|
+
export { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };
|
|
48
49
|
|
|
49
50
|
//# sourceMappingURL=migration.mjs.map
|
package/dist/migration.mjs.map
CHANGED
|
@@ -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":"
|
|
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"}
|