@prisma-next/target-sqlite 0.5.0-dev.6 → 0.5.0-dev.60
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/codec-ids-B1-OiN8Q.mjs +14 -0
- package/dist/codec-ids-B1-OiN8Q.mjs.map +1 -0
- package/dist/codec-ids.d.mts +13 -0
- package/dist/codec-ids.d.mts.map +1 -0
- package/dist/codec-ids.mjs +3 -0
- package/dist/codec-types.d.mts +7 -0
- package/dist/codec-types.d.mts.map +1 -0
- package/dist/codec-types.mjs +3 -0
- package/dist/codecs-5GJysiEg.mjs +95 -0
- package/dist/codecs-5GJysiEg.mjs.map +1 -0
- package/dist/codecs-D4jgBM6T.d.mts +139 -0
- package/dist/codecs-D4jgBM6T.d.mts.map +1 -0
- package/dist/codecs.d.mts +2 -0
- package/dist/codecs.mjs +3 -0
- package/dist/control.d.mts +4 -3
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +343 -1
- package/dist/control.mjs.map +1 -1
- package/dist/default-normalizer-R-sQXAYt.mjs +69 -0
- package/dist/default-normalizer-R-sQXAYt.mjs.map +1 -0
- package/dist/default-normalizer.d.mts +8 -0
- package/dist/default-normalizer.d.mts.map +1 -0
- package/dist/default-normalizer.mjs +3 -0
- package/dist/descriptor-meta-BA2YAFQq.mjs +24 -0
- package/dist/descriptor-meta-BA2YAFQq.mjs.map +1 -0
- package/dist/migration.d.mts +76 -0
- package/dist/migration.d.mts.map +1 -0
- package/dist/migration.mjs +38 -0
- package/dist/migration.mjs.map +1 -0
- package/dist/native-type-normalizer-BMovohPm.mjs +14 -0
- package/dist/native-type-normalizer-BMovohPm.mjs.map +1 -0
- package/dist/native-type-normalizer.d.mts +11 -0
- package/dist/native-type-normalizer.d.mts.map +1 -0
- package/dist/native-type-normalizer.mjs +3 -0
- package/dist/op-factory-call-BPPSCdTB.d.mts +134 -0
- package/dist/op-factory-call-BPPSCdTB.d.mts.map +1 -0
- package/dist/op-factory-call-BUVV-W9F.mjs +252 -0
- package/dist/op-factory-call-BUVV-W9F.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +3 -0
- package/dist/op-factory-call.mjs +3 -0
- package/dist/pack.d.mts +35 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/planner-CuchCrpN.mjs +522 -0
- package/dist/planner-CuchCrpN.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-C3AAaQoW.mjs +107 -0
- package/dist/planner-produced-sqlite-migration-C3AAaQoW.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-RVneETNy.d.mts +24 -0
- package/dist/planner-produced-sqlite-migration-RVneETNy.d.mts.map +1 -0
- package/dist/planner-produced-sqlite-migration.d.mts +5 -0
- package/dist/planner-produced-sqlite-migration.mjs +3 -0
- package/dist/planner-target-details-BQIWQlBu.mjs +16 -0
- package/dist/planner-target-details-BQIWQlBu.mjs.map +1 -0
- package/dist/planner-target-details-DTIFFx4L.d.mts +12 -0
- package/dist/planner-target-details-DTIFFx4L.d.mts.map +1 -0
- package/dist/planner-target-details.d.mts +2 -0
- package/dist/planner-target-details.mjs +3 -0
- package/dist/planner.d.mts +56 -0
- package/dist/planner.d.mts.map +1 -0
- package/dist/planner.mjs +3 -0
- package/dist/render-ops-CXOv7SRC.mjs +8 -0
- package/dist/render-ops-CXOv7SRC.mjs.map +1 -0
- package/dist/render-ops.d.mts +11 -0
- package/dist/render-ops.d.mts.map +1 -0
- package/dist/render-ops.mjs +3 -0
- package/dist/runtime.mjs +1 -1
- package/dist/shared-BNtoZqdo.d.mts +69 -0
- package/dist/shared-BNtoZqdo.d.mts.map +1 -0
- package/dist/sql-utils-D3SMPFDD.mjs +33 -0
- package/dist/sql-utils-D3SMPFDD.mjs.map +1 -0
- package/dist/sql-utils.d.mts +22 -0
- package/dist/sql-utils.d.mts.map +1 -0
- package/dist/sql-utils.mjs +3 -0
- package/dist/sqlite-migration-BYgrMZdR.d.mts +18 -0
- package/dist/sqlite-migration-BYgrMZdR.d.mts.map +1 -0
- package/dist/sqlite-migration-CnLhIrJF.mjs +17 -0
- package/dist/sqlite-migration-CnLhIrJF.mjs.map +1 -0
- package/dist/statement-builders-B3OGOp7n.mjs +148 -0
- package/dist/statement-builders-B3OGOp7n.mjs.map +1 -0
- package/dist/statement-builders.d.mts +48 -0
- package/dist/statement-builders.d.mts.map +1 -0
- package/dist/statement-builders.mjs +3 -0
- package/dist/tables-sKIg_lWE.mjs +408 -0
- package/dist/tables-sKIg_lWE.mjs.map +1 -0
- package/package.json +29 -7
- package/src/core/authoring.ts +9 -0
- package/src/core/codec-ids.ts +13 -0
- package/src/core/codecs.ts +119 -0
- package/src/core/control-target.ts +54 -11
- package/src/core/default-normalizer.ts +92 -0
- package/src/core/descriptor-meta.ts +5 -1
- package/src/core/migrations/issue-planner.ts +586 -0
- package/src/core/migrations/op-factory-call.ts +332 -0
- package/src/core/migrations/operations/columns.ts +62 -0
- package/src/core/migrations/operations/data-transform.ts +51 -0
- package/src/core/migrations/operations/indexes.ts +52 -0
- package/src/core/migrations/operations/shared.ts +120 -0
- package/src/core/migrations/operations/tables.ts +388 -0
- package/src/core/migrations/planner-ddl-builders.ts +142 -0
- package/src/core/migrations/planner-produced-sqlite-migration.ts +56 -0
- package/src/core/migrations/planner-strategies.ts +231 -0
- package/src/core/migrations/planner-target-details.ts +33 -0
- package/src/core/migrations/planner.ts +149 -0
- package/src/core/migrations/render-ops.ts +9 -0
- package/src/core/migrations/render-typescript.ts +91 -0
- package/src/core/migrations/runner.ts +593 -0
- package/src/core/migrations/sqlite-migration.ts +13 -0
- package/src/core/migrations/statement-builders.ts +190 -0
- package/src/core/native-type-normalizer.ts +9 -0
- package/src/core/sql-utils.ts +47 -0
- package/src/exports/codec-ids.ts +13 -0
- package/src/exports/codec-types.ts +6 -0
- package/src/exports/codecs.ts +1 -0
- package/src/exports/control.ts +1 -0
- package/src/exports/default-normalizer.ts +1 -0
- package/src/exports/migration.ts +23 -0
- package/src/exports/native-type-normalizer.ts +1 -0
- package/src/exports/op-factory-call.ts +11 -0
- package/src/exports/planner-produced-sqlite-migration.ts +4 -0
- package/src/exports/planner-target-details.ts +2 -0
- package/src/exports/planner.ts +2 -0
- package/src/exports/render-ops.ts +1 -0
- package/src/exports/sql-utils.ts +1 -0
- package/src/exports/statement-builders.ts +11 -0
- package/dist/descriptor-meta-DbuuziYA.mjs +0 -14
- package/dist/descriptor-meta-DbuuziYA.mjs.map +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { t as renderOps } from "./render-ops-CXOv7SRC.mjs";
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-CnLhIrJF.mjs";
|
|
3
|
+
import { jsonToTsSource, renderImports } from "@prisma-next/ts-render";
|
|
4
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
5
|
+
import { detectScaffoldRuntime, shebangLineFor } from "@prisma-next/migration-tools/migration-ts";
|
|
6
|
+
|
|
7
|
+
//#region src/core/migrations/render-typescript.ts
|
|
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
|
+
* `@prisma-next/target-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 target-owned 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
|
+
* `@prisma-next/cli/migration-cli`. Loads `prisma-next.config.ts`,
|
|
24
|
+
* assembles a `ControlStack`, and instantiates the migration class.
|
|
25
|
+
*/
|
|
26
|
+
const BASE_IMPORTS = [{
|
|
27
|
+
moduleSpecifier: "@prisma-next/target-sqlite/migration",
|
|
28
|
+
symbol: "Migration"
|
|
29
|
+
}, {
|
|
30
|
+
moduleSpecifier: "@prisma-next/target-sqlite/migration",
|
|
31
|
+
symbol: "MigrationCLI"
|
|
32
|
+
}];
|
|
33
|
+
function renderCallsToTypeScript(calls, meta) {
|
|
34
|
+
const imports = buildImports(calls);
|
|
35
|
+
const operationsBody = calls.map((c) => c.renderTypeScript()).join(",\n");
|
|
36
|
+
return [
|
|
37
|
+
shebangLineFor(detectScaffoldRuntime()),
|
|
38
|
+
imports,
|
|
39
|
+
"",
|
|
40
|
+
"export default class M extends Migration {",
|
|
41
|
+
buildDescribeMethod(meta),
|
|
42
|
+
" override get operations() {",
|
|
43
|
+
" return [",
|
|
44
|
+
indent(operationsBody, 6),
|
|
45
|
+
" ];",
|
|
46
|
+
" }",
|
|
47
|
+
"}",
|
|
48
|
+
"",
|
|
49
|
+
"MigrationCLI.run(import.meta.url, M);",
|
|
50
|
+
""
|
|
51
|
+
].join("\n");
|
|
52
|
+
}
|
|
53
|
+
function buildImports(calls) {
|
|
54
|
+
const requirements = [...BASE_IMPORTS];
|
|
55
|
+
for (const call of calls) for (const req of call.importRequirements()) requirements.push(req);
|
|
56
|
+
return renderImports(requirements);
|
|
57
|
+
}
|
|
58
|
+
function buildDescribeMethod(meta) {
|
|
59
|
+
const lines = [];
|
|
60
|
+
lines.push(" override describe() {");
|
|
61
|
+
lines.push(" return {");
|
|
62
|
+
lines.push(` from: ${JSON.stringify(meta.from)},`);
|
|
63
|
+
lines.push(` to: ${JSON.stringify(meta.to)},`);
|
|
64
|
+
if (meta.labels && meta.labels.length > 0) lines.push(` labels: ${jsonToTsSource(meta.labels)},`);
|
|
65
|
+
lines.push(" };");
|
|
66
|
+
lines.push(" }");
|
|
67
|
+
lines.push("");
|
|
68
|
+
return lines.join("\n");
|
|
69
|
+
}
|
|
70
|
+
function indent(text, spaces) {
|
|
71
|
+
const pad = " ".repeat(spaces);
|
|
72
|
+
return text.split("\n").map((line) => line.trim() ? `${pad}${line}` : line).join("\n");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/core/migrations/planner-produced-sqlite-migration.ts
|
|
77
|
+
var TypeScriptRenderableSqliteMigration = class extends SqliteMigration {
|
|
78
|
+
#calls;
|
|
79
|
+
#meta;
|
|
80
|
+
#destination;
|
|
81
|
+
constructor(calls, meta, destination) {
|
|
82
|
+
super();
|
|
83
|
+
this.#calls = calls;
|
|
84
|
+
this.#meta = meta;
|
|
85
|
+
this.#destination = destination ?? { storageHash: meta.to };
|
|
86
|
+
}
|
|
87
|
+
get operations() {
|
|
88
|
+
return renderOps(this.#calls);
|
|
89
|
+
}
|
|
90
|
+
describe() {
|
|
91
|
+
return this.#meta;
|
|
92
|
+
}
|
|
93
|
+
get destination() {
|
|
94
|
+
return this.#destination;
|
|
95
|
+
}
|
|
96
|
+
renderTypeScript() {
|
|
97
|
+
return renderCallsToTypeScript(this.#calls, {
|
|
98
|
+
from: this.#meta.from,
|
|
99
|
+
to: this.#meta.to,
|
|
100
|
+
...ifDefined("labels", this.#meta.labels)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { TypeScriptRenderableSqliteMigration as t };
|
|
107
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-C3AAaQoW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-C3AAaQoW.mjs","names":["BASE_IMPORTS: readonly ImportRequirement[]","requirements: ImportRequirement[]","lines: string[]","#calls","#meta","#destination"],"sources":["../src/core/migrations/render-typescript.ts","../src/core/migrations/planner-produced-sqlite-migration.ts"],"sourcesContent":["/**\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\nimport { detectScaffoldRuntime, shebangLineFor } from '@prisma-next/migration-tools/migration-ts';\nimport { type ImportRequirement, jsonToTsSource, renderImports } from '@prisma-next/ts-render';\nimport type { SqliteOpFactoryCall } from './op-factory-call';\n\nexport interface RenderMigrationMeta {\n readonly from: string | null;\n readonly to: string;\n readonly labels?: readonly string[];\n}\n\n/**\n * Always-present base imports for the rendered scaffold. Both come from\n * `@prisma-next/target-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 target-owned 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 * `@prisma-next/cli/migration-cli`. Loads `prisma-next.config.ts`,\n * assembles a `ControlStack`, and instantiates the migration class.\n */\nconst BASE_IMPORTS: readonly ImportRequirement[] = [\n { moduleSpecifier: '@prisma-next/target-sqlite/migration', symbol: 'Migration' },\n { moduleSpecifier: '@prisma-next/target-sqlite/migration', symbol: 'MigrationCLI' },\n];\n\nexport function renderCallsToTypeScript(\n calls: ReadonlyArray<SqliteOpFactoryCall>,\n meta: RenderMigrationMeta,\n): string {\n const imports = buildImports(calls);\n const operationsBody = calls.map((c) => c.renderTypeScript()).join(',\\n');\n\n return [\n shebangLineFor(detectScaffoldRuntime()),\n imports,\n '',\n 'export default class M extends Migration {',\n buildDescribeMethod(meta),\n ' override get operations() {',\n ' return [',\n indent(operationsBody, 6),\n ' ];',\n ' }',\n '}',\n '',\n 'MigrationCLI.run(import.meta.url, M);',\n '',\n ].join('\\n');\n}\n\nfunction buildImports(calls: ReadonlyArray<SqliteOpFactoryCall>): string {\n const requirements: ImportRequirement[] = [...BASE_IMPORTS];\n for (const call of calls) {\n for (const req of call.importRequirements()) {\n requirements.push(req);\n }\n }\n return renderImports(requirements);\n}\n\nfunction buildDescribeMethod(meta: RenderMigrationMeta): string {\n const lines: string[] = [];\n lines.push(' override describe() {');\n lines.push(' return {');\n lines.push(` from: ${JSON.stringify(meta.from)},`);\n lines.push(` to: ${JSON.stringify(meta.to)},`);\n if (meta.labels && meta.labels.length > 0) {\n lines.push(` labels: ${jsonToTsSource(meta.labels)},`);\n }\n lines.push(' };');\n lines.push(' }');\n lines.push('');\n return lines.join('\\n');\n}\n\nfunction indent(text: string, spaces: number): string {\n const pad = ' '.repeat(spaces);\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${pad}${line}` : line))\n .join('\\n');\n}\n","import type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { MigrationPlanWithAuthoringSurface } from '@prisma-next/framework-components/control';\nimport type { MigrationMeta } from '@prisma-next/migration-tools/migration';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { SqliteOpFactoryCall } from './op-factory-call';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\nimport { renderOps } from './render-ops';\nimport { renderCallsToTypeScript } from './render-typescript';\nimport { SqliteMigration } from './sqlite-migration';\n\ntype Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;\n\nexport interface SqliteMigrationDestinationInfo {\n readonly storageHash: string;\n readonly profileHash?: string;\n}\n\nexport class TypeScriptRenderableSqliteMigration\n extends SqliteMigration\n implements MigrationPlanWithAuthoringSurface\n{\n readonly #calls: readonly SqliteOpFactoryCall[];\n readonly #meta: MigrationMeta;\n readonly #destination: SqliteMigrationDestinationInfo;\n\n constructor(\n calls: readonly SqliteOpFactoryCall[],\n meta: MigrationMeta,\n destination?: SqliteMigrationDestinationInfo,\n ) {\n super();\n this.#calls = calls;\n this.#meta = meta;\n this.#destination = destination ?? { storageHash: meta.to };\n }\n\n override get operations(): readonly Op[] {\n return renderOps(this.#calls);\n }\n\n override describe(): MigrationMeta {\n return this.#meta;\n }\n\n override get destination(): SqliteMigrationDestinationInfo {\n return this.#destination;\n }\n\n renderTypeScript(): string {\n return renderCallsToTypeScript(this.#calls, {\n from: this.#meta.from,\n to: this.#meta.to,\n ...ifDefined('labels', this.#meta.labels),\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAMA,eAA6C,CACjD;CAAE,iBAAiB;CAAwC,QAAQ;CAAa,EAChF;CAAE,iBAAiB;CAAwC,QAAQ;CAAgB,CACpF;AAED,SAAgB,wBACd,OACA,MACQ;CACR,MAAM,UAAU,aAAa,MAAM;CACnC,MAAM,iBAAiB,MAAM,KAAK,MAAM,EAAE,kBAAkB,CAAC,CAAC,KAAK,MAAM;AAEzE,QAAO;EACL,eAAe,uBAAuB,CAAC;EACvC;EACA;EACA;EACA,oBAAoB,KAAK;EACzB;EACA;EACA,OAAO,gBAAgB,EAAE;EACzB;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK;;AAGd,SAAS,aAAa,OAAmD;CACvE,MAAMC,eAAoC,CAAC,GAAG,aAAa;AAC3D,MAAK,MAAM,QAAQ,MACjB,MAAK,MAAM,OAAO,KAAK,oBAAoB,CACzC,cAAa,KAAK,IAAI;AAG1B,QAAO,cAAc,aAAa;;AAGpC,SAAS,oBAAoB,MAAmC;CAC9D,MAAMC,QAAkB,EAAE;AAC1B,OAAM,KAAK,0BAA0B;AACrC,OAAM,KAAK,eAAe;AAC1B,OAAM,KAAK,eAAe,KAAK,UAAU,KAAK,KAAK,CAAC,GAAG;AACvD,OAAM,KAAK,aAAa,KAAK,UAAU,KAAK,GAAG,CAAC,GAAG;AACnD,KAAI,KAAK,UAAU,KAAK,OAAO,SAAS,EACtC,OAAM,KAAK,iBAAiB,eAAe,KAAK,OAAO,CAAC,GAAG;AAE7D,OAAM,KAAK,SAAS;AACpB,OAAM,KAAK,MAAM;AACjB,OAAM,KAAK,GAAG;AACd,QAAO,MAAM,KAAK,KAAK;;AAGzB,SAAS,OAAO,MAAc,QAAwB;CACpD,MAAM,MAAM,IAAI,OAAO,OAAO;AAC9B,QAAO,KACJ,MAAM,KAAK,CACX,KAAK,SAAU,KAAK,MAAM,GAAG,GAAG,MAAM,SAAS,KAAM,CACrD,KAAK,KAAK;;;;;ACxEf,IAAa,sCAAb,cACU,gBAEV;CACE,CAASC;CACT,CAASC;CACT,CAASC;CAET,YACE,OACA,MACA,aACA;AACA,SAAO;AACP,QAAKF,QAAS;AACd,QAAKC,OAAQ;AACb,QAAKC,cAAe,eAAe,EAAE,aAAa,KAAK,IAAI;;CAG7D,IAAa,aAA4B;AACvC,SAAO,UAAU,MAAKF,MAAO;;CAG/B,AAAS,WAA0B;AACjC,SAAO,MAAKC;;CAGd,IAAa,cAA8C;AACzD,SAAO,MAAKC;;CAGd,mBAA2B;AACzB,SAAO,wBAAwB,MAAKF,OAAQ;GAC1C,MAAM,MAAKC,KAAM;GACjB,IAAI,MAAKA,KAAM;GACf,GAAG,UAAU,UAAU,MAAKA,KAAM,OAAO;GAC1C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-DTIFFx4L.mjs";
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-BYgrMZdR.mjs";
|
|
3
|
+
import { l as SqliteOpFactoryCall } from "./op-factory-call-BPPSCdTB.mjs";
|
|
4
|
+
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
5
|
+
import { MigrationPlanWithAuthoringSurface } from "@prisma-next/framework-components/control";
|
|
6
|
+
import { MigrationMeta } from "@prisma-next/migration-tools/migration";
|
|
7
|
+
|
|
8
|
+
//#region src/core/migrations/planner-produced-sqlite-migration.d.ts
|
|
9
|
+
type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
|
|
10
|
+
interface SqliteMigrationDestinationInfo {
|
|
11
|
+
readonly storageHash: string;
|
|
12
|
+
readonly profileHash?: string;
|
|
13
|
+
}
|
|
14
|
+
declare class TypeScriptRenderableSqliteMigration extends SqliteMigration implements MigrationPlanWithAuthoringSurface {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(calls: readonly SqliteOpFactoryCall[], meta: MigrationMeta, destination?: SqliteMigrationDestinationInfo);
|
|
17
|
+
get operations(): readonly Op[];
|
|
18
|
+
describe(): MigrationMeta;
|
|
19
|
+
get destination(): SqliteMigrationDestinationInfo;
|
|
20
|
+
renderTypeScript(): string;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { TypeScriptRenderableSqliteMigration as n, SqliteMigrationDestinationInfo as t };
|
|
24
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-RVneETNy.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-RVneETNy.d.mts","names":[],"sources":["../src/core/migrations/planner-produced-sqlite-migration.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAUK,EAAA,GAAK,0BAA0B;UAEnB,8BAAA;EAFZ,SAAE,WAA6B,EAAA,MAAA;EAEnB,SAAA,WAAA,CAAA,EAAA,MAAA;AAKjB;AASoB,cATP,mCAAA,SACH,eAAA,YACG,iCAOO,CAAA;EACV,CAAA,OAAA;EACQ,WAAA,CAAA,KAAA,EAAA,SAFE,mBAEF,EAAA,EAAA,IAAA,EADR,aACQ,EAAA,WAAA,CAAA,EAAA,8BAAA;EAQoB,IAAA,UAAA,CAAA,CAAA,EAAA,SAAA,EAAA,EAAA;EAIf,QAAA,CAAA,CAAA,EAAA,aAAA;EAIO,IAAA,WAAA,CAAA,CAAA,EAAA,8BAAA;EA1BpB,gBAAA,CAAA,CAAA,EAAA,MAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./shared-BNtoZqdo.mjs";
|
|
2
|
+
import "./sqlite-migration-BYgrMZdR.mjs";
|
|
3
|
+
import "./op-factory-call-BPPSCdTB.mjs";
|
|
4
|
+
import { n as TypeScriptRenderableSqliteMigration, t as SqliteMigrationDestinationInfo } from "./planner-produced-sqlite-migration-RVneETNy.mjs";
|
|
5
|
+
export { type SqliteMigrationDestinationInfo, TypeScriptRenderableSqliteMigration };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
2
|
+
|
|
3
|
+
//#region src/core/migrations/planner-target-details.ts
|
|
4
|
+
const DEFAULT_SCHEMA = "main";
|
|
5
|
+
function buildTargetDetails(objectType, name, table) {
|
|
6
|
+
return {
|
|
7
|
+
schema: DEFAULT_SCHEMA,
|
|
8
|
+
objectType,
|
|
9
|
+
name,
|
|
10
|
+
...ifDefined("table", table)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { buildTargetDetails as t };
|
|
16
|
+
//# sourceMappingURL=planner-target-details-BQIWQlBu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-target-details-BQIWQlBu.mjs","names":[],"sources":["../src/core/migrations/planner-target-details.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\n\nexport type OperationClass = 'table' | 'column' | 'primaryKey' | 'unique' | 'index' | 'foreignKey';\n\n// SQLite's default (and only) schema name; keeps `SqlitePlanTargetDetails`\n// conformant with `SqlPlanTargetDetails`, which mandates a `schema` field.\nconst DEFAULT_SCHEMA = 'main';\n\nexport interface SqlitePlanTargetDetails {\n readonly schema: string;\n readonly objectType: OperationClass;\n readonly name: string;\n readonly table?: string;\n}\n\nexport interface PlanningMode {\n readonly includeExtraObjects: boolean;\n readonly allowWidening: boolean;\n readonly allowDestructive: boolean;\n}\n\nexport function buildTargetDetails(\n objectType: OperationClass,\n name: string,\n table?: string,\n): SqlitePlanTargetDetails {\n return {\n schema: DEFAULT_SCHEMA,\n objectType,\n name,\n ...ifDefined('table', table),\n };\n}\n"],"mappings":";;;AAMA,MAAM,iBAAiB;AAevB,SAAgB,mBACd,YACA,MACA,OACyB;AACzB,QAAO;EACL,QAAQ;EACR;EACA;EACA,GAAG,UAAU,SAAS,MAAM;EAC7B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/core/migrations/planner-target-details.d.ts
|
|
2
|
+
type OperationClass = 'table' | 'column' | 'primaryKey' | 'unique' | 'index' | 'foreignKey';
|
|
3
|
+
interface SqlitePlanTargetDetails {
|
|
4
|
+
readonly schema: string;
|
|
5
|
+
readonly objectType: OperationClass;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly table?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function buildTargetDetails(objectType: OperationClass, name: string, table?: string): SqlitePlanTargetDetails;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { buildTargetDetails as n, SqlitePlanTargetDetails as t };
|
|
12
|
+
//# sourceMappingURL=planner-target-details-DTIFFx4L.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-target-details-DTIFFx4L.d.mts","names":[],"sources":["../src/core/migrations/planner-target-details.ts"],"sourcesContent":[],"mappings":";KAEY,cAAA;AAAA,UAMK,uBAAA,CANS;EAMT,SAAA,MAAA,EAAA,MAAA;EAaD,SAAA,UAAA,EAXO,cAYT;;;;iBADE,kBAAA,aACF,+CAGX"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-DTIFFx4L.mjs";
|
|
2
|
+
import "./shared-BNtoZqdo.mjs";
|
|
3
|
+
import "./sqlite-migration-BYgrMZdR.mjs";
|
|
4
|
+
import "./op-factory-call-BPPSCdTB.mjs";
|
|
5
|
+
import { n as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-RVneETNy.mjs";
|
|
6
|
+
import { MigrationOperationPolicy, SqlMigrationPlanner, SqlPlannerFailureResult } from "@prisma-next/family-sql/control";
|
|
7
|
+
import { Contract } from "@prisma-next/contract/types";
|
|
8
|
+
import { MigrationPlanner, MigrationScaffoldContext } from "@prisma-next/framework-components/control";
|
|
9
|
+
import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
|
|
10
|
+
|
|
11
|
+
//#region src/core/migrations/planner.d.ts
|
|
12
|
+
declare function createSqliteMigrationPlanner(): SqliteMigrationPlanner;
|
|
13
|
+
type SqlitePlanResult = {
|
|
14
|
+
readonly kind: 'success';
|
|
15
|
+
readonly plan: TypeScriptRenderableSqliteMigration;
|
|
16
|
+
} | SqlPlannerFailureResult;
|
|
17
|
+
/**
|
|
18
|
+
* SQLite migration planner — a thin wrapper over `planIssues`.
|
|
19
|
+
*
|
|
20
|
+
* `plan()` verifies the live schema against the target contract (producing
|
|
21
|
+
* `SchemaIssue[]`) and delegates to `planIssues` with the registered
|
|
22
|
+
* strategies. Strategies absorb groups of related issues into composite
|
|
23
|
+
* recipes (e.g. recreating a table to apply type/nullability/default/
|
|
24
|
+
* constraint changes at once); anything not absorbed by a strategy flows
|
|
25
|
+
* through `mapIssueToCall` in the issue planner as a one-off call.
|
|
26
|
+
*
|
|
27
|
+
* FK-backing indexes are surfaced by `verifySqlSchema`'s index expansion
|
|
28
|
+
* (see `verify-sql-schema.ts:459-469`), so `mapIssueToCall` handles them
|
|
29
|
+
* uniformly alongside user-declared indexes.
|
|
30
|
+
*/
|
|
31
|
+
declare class SqliteMigrationPlanner implements SqlMigrationPlanner<SqlitePlanTargetDetails>, MigrationPlanner<'sql', 'sqlite'> {
|
|
32
|
+
plan(options: {
|
|
33
|
+
readonly contract: unknown;
|
|
34
|
+
readonly schema: unknown;
|
|
35
|
+
readonly policy: MigrationOperationPolicy;
|
|
36
|
+
/**
|
|
37
|
+
* The "from" contract (state the planner assumes the database starts at),
|
|
38
|
+
* or `null` for reconciliation flows.
|
|
39
|
+
*
|
|
40
|
+
* Typed as the framework `Contract | null` to satisfy the
|
|
41
|
+
* `MigrationPlanner` interface contract; `planSql` narrows to the SQL
|
|
42
|
+
* shape via `SqlMigrationPlannerPlanOptions`. Used to populate
|
|
43
|
+
* `describe().from` on the produced plan as
|
|
44
|
+
* `fromContract?.storage.storageHash ?? null`.
|
|
45
|
+
*/
|
|
46
|
+
readonly fromContract: Contract | null;
|
|
47
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
|
|
48
|
+
}): SqlitePlanResult;
|
|
49
|
+
emptyMigration(context: MigrationScaffoldContext): TypeScriptRenderableSqliteMigration;
|
|
50
|
+
private planSql;
|
|
51
|
+
private ensureAdditivePolicy;
|
|
52
|
+
private collectSchemaIssues;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { SqliteMigrationPlanner, type SqlitePlanResult, createSqliteMigrationPlanner };
|
|
56
|
+
//# sourceMappingURL=planner.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.d.mts","names":[],"sources":["../src/core/migrations/planner.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;iBAyBgB,4BAAA,CAAA,GAAgC;KAIpC,gBAAA;;iBACmC;IAC3C;AANJ;AAIA;AAkBA;;;;;;;;;;;;cAAa,sBAAA,YACA,oBAAoB,0BAA0B;;;;qBAKtC;;;;;;;;;;;2BAWM;kCACO,cAAc;MAC1C;0BAIoB,2BAA2B"}
|
package/dist/planner.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-ops-CXOv7SRC.mjs","names":[],"sources":["../src/core/migrations/render-ops.ts"],"sourcesContent":["import type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { SqliteOpFactoryCall } from './op-factory-call';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\n\ntype Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;\n\nexport function renderOps(calls: readonly SqliteOpFactoryCall[]): Op[] {\n return calls.map((c) => c.toOp());\n}\n"],"mappings":";AAMA,SAAgB,UAAU,OAA6C;AACrE,QAAO,MAAM,KAAK,MAAM,EAAE,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-DTIFFx4L.mjs";
|
|
2
|
+
import "./shared-BNtoZqdo.mjs";
|
|
3
|
+
import { l as SqliteOpFactoryCall } from "./op-factory-call-BPPSCdTB.mjs";
|
|
4
|
+
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
5
|
+
|
|
6
|
+
//#region src/core/migrations/render-ops.d.ts
|
|
7
|
+
type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
|
|
8
|
+
declare function renderOps(calls: readonly SqliteOpFactoryCall[]): Op[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { renderOps };
|
|
11
|
+
//# sourceMappingURL=render-ops.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-ops.d.mts","names":[],"sources":["../src/core/migrations/render-ops.ts"],"sourcesContent":[],"mappings":";;;;;;KAIK,EAAA,GAAK,0BAA0B;iBAEpB,SAAA,iBAA0B,wBAAwB"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-BA2YAFQq.mjs";
|
|
2
2
|
import { createCodecRegistry } from "@prisma-next/sql-relational-core/ast";
|
|
3
3
|
|
|
4
4
|
//#region src/core/runtime-target.ts
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-DTIFFx4L.mjs";
|
|
2
|
+
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
3
|
+
import { ReferentialAction } from "@prisma-next/sql-contract/types";
|
|
4
|
+
|
|
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
|
+
readonly constraint: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Flat shape of a contract table for DDL emission. Used by both
|
|
50
|
+
* `createTable` (additive) and `recreateTable` (widening/destructive).
|
|
51
|
+
*/
|
|
52
|
+
interface SqliteTableSpec {
|
|
53
|
+
readonly columns: readonly SqliteColumnSpec[];
|
|
54
|
+
readonly primaryKey?: SqlitePrimaryKeySpec;
|
|
55
|
+
readonly uniques?: readonly SqliteUniqueSpec[];
|
|
56
|
+
readonly foreignKeys?: readonly SqliteForeignKeySpec[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Index recreation spec for `recreateTable`. Both declared indexes and
|
|
60
|
+
* FK-backing indexes flatten to the same shape; the planner dedupes by
|
|
61
|
+
* column-set before constructing the call.
|
|
62
|
+
*/
|
|
63
|
+
interface SqliteIndexSpec {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly columns: readonly string[];
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { SqliteTableSpec as i, SqliteColumnSpec as n, SqliteIndexSpec as r, Op as t };
|
|
69
|
+
//# sourceMappingURL=shared-BNtoZqdo.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-BNtoZqdo.d.mts","names":[],"sources":["../src/core/migrations/operations/shared.ts"],"sourcesContent":[],"mappings":";;;;;KAKY,EAAA,GAAK,0BAA0B;AAkC3C;AAKA;AAgBA;;;;;;AAYA;;;;;;;;UA7CiB,gBAAA;;;;;;;UAQA,oBAAA;;;UAIA,gBAAA;;;;UAKA,oBAAA;;;;;;;sBAOK;sBACA;;;;;;;UAQL,eAAA;6BACY;wBACL;8BACM;kCACI;;;;;;;UAQjB,eAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/core/sql-utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Shared SQL utility functions for the SQLite target.
|
|
4
|
+
*
|
|
5
|
+
* These functions handle safe SQL identifier and literal escaping. They
|
|
6
|
+
* live in `target-sqlite` (mirroring `target-postgres/src/core/sql-utils.ts`)
|
|
7
|
+
* so both the control adapter (used at emit time) and the runtime adapter
|
|
8
|
+
* (used at execute time) can depend on them through a single one-way edge:
|
|
9
|
+
* `adapter-sqlite → target-sqlite`. Hosting them target-side avoids the
|
|
10
|
+
* cyclic workspace dependency that would arise if `target-sqlite` reached
|
|
11
|
+
* back into `adapter-sqlite` for these primitives.
|
|
12
|
+
*/
|
|
13
|
+
var SqlEscapeError = class extends Error {
|
|
14
|
+
constructor(message, value, kind) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.value = value;
|
|
17
|
+
this.kind = kind;
|
|
18
|
+
this.name = "SqlEscapeError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function quoteIdentifier(identifier) {
|
|
22
|
+
if (identifier.length === 0) throw new SqlEscapeError("Identifier cannot be empty", identifier, "identifier");
|
|
23
|
+
if (identifier.includes("\0")) throw new SqlEscapeError("Identifier cannot contain null bytes", identifier.replace(/\0/g, "\\0"), "identifier");
|
|
24
|
+
return `"${identifier.replace(/"/g, "\"\"")}"`;
|
|
25
|
+
}
|
|
26
|
+
function escapeLiteral(value) {
|
|
27
|
+
if (value.includes("\0")) throw new SqlEscapeError("Literal value cannot contain null bytes", value.replace(/\0/g, "\\0"), "literal");
|
|
28
|
+
return value.replace(/'/g, "''");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { escapeLiteral as n, quoteIdentifier as r, SqlEscapeError as t };
|
|
33
|
+
//# sourceMappingURL=sql-utils-D3SMPFDD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-utils-D3SMPFDD.mjs","names":["value: string","kind: 'identifier' | 'literal'"],"sources":["../src/core/sql-utils.ts"],"sourcesContent":["/**\n * Shared SQL utility functions for the SQLite target.\n *\n * These functions handle safe SQL identifier and literal escaping. They\n * live in `target-sqlite` (mirroring `target-postgres/src/core/sql-utils.ts`)\n * so both the control adapter (used at emit time) and the runtime adapter\n * (used at execute time) can depend on them through a single one-way edge:\n * `adapter-sqlite → target-sqlite`. Hosting them target-side avoids the\n * cyclic workspace dependency that would arise if `target-sqlite` reached\n * back into `adapter-sqlite` for these primitives.\n */\n\nexport class SqlEscapeError extends Error {\n constructor(\n message: string,\n public readonly value: string,\n public readonly kind: 'identifier' | 'literal',\n ) {\n super(message);\n this.name = 'SqlEscapeError';\n }\n}\n\nexport function quoteIdentifier(identifier: string): string {\n if (identifier.length === 0) {\n throw new SqlEscapeError('Identifier cannot be empty', identifier, 'identifier');\n }\n if (identifier.includes('\\0')) {\n throw new SqlEscapeError(\n 'Identifier cannot contain null bytes',\n identifier.replace(/\\0/g, '\\\\0'),\n 'identifier',\n );\n }\n return `\"${identifier.replace(/\"/g, '\"\"')}\"`;\n}\n\nexport function escapeLiteral(value: string): string {\n if (value.includes('\\0')) {\n throw new SqlEscapeError(\n 'Literal value cannot contain null bytes',\n value.replace(/\\0/g, '\\\\0'),\n 'literal',\n );\n }\n return value.replace(/'/g, \"''\");\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,iBAAb,cAAoC,MAAM;CACxC,YACE,SACA,AAAgBA,OAChB,AAAgBC,MAChB;AACA,QAAM,QAAQ;EAHE;EACA;AAGhB,OAAK,OAAO;;;AAIhB,SAAgB,gBAAgB,YAA4B;AAC1D,KAAI,WAAW,WAAW,EACxB,OAAM,IAAI,eAAe,8BAA8B,YAAY,aAAa;AAElF,KAAI,WAAW,SAAS,KAAK,CAC3B,OAAM,IAAI,eACR,wCACA,WAAW,QAAQ,OAAO,MAAM,EAChC,aACD;AAEH,QAAO,IAAI,WAAW,QAAQ,MAAM,OAAK,CAAC;;AAG5C,SAAgB,cAAc,OAAuB;AACnD,KAAI,MAAM,SAAS,KAAK,CACtB,OAAM,IAAI,eACR,2CACA,MAAM,QAAQ,OAAO,MAAM,EAC3B,UACD;AAEH,QAAO,MAAM,QAAQ,MAAM,KAAK"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/core/sql-utils.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Shared SQL utility functions for the SQLite target.
|
|
4
|
+
*
|
|
5
|
+
* These functions handle safe SQL identifier and literal escaping. They
|
|
6
|
+
* live in `target-sqlite` (mirroring `target-postgres/src/core/sql-utils.ts`)
|
|
7
|
+
* so both the control adapter (used at emit time) and the runtime adapter
|
|
8
|
+
* (used at execute time) can depend on them through a single one-way edge:
|
|
9
|
+
* `adapter-sqlite → target-sqlite`. Hosting them target-side avoids the
|
|
10
|
+
* cyclic workspace dependency that would arise if `target-sqlite` reached
|
|
11
|
+
* back into `adapter-sqlite` for these primitives.
|
|
12
|
+
*/
|
|
13
|
+
declare class SqlEscapeError extends Error {
|
|
14
|
+
readonly value: string;
|
|
15
|
+
readonly kind: 'identifier' | 'literal';
|
|
16
|
+
constructor(message: string, value: string, kind: 'identifier' | 'literal');
|
|
17
|
+
}
|
|
18
|
+
declare function quoteIdentifier(identifier: string): string;
|
|
19
|
+
declare function escapeLiteral(value: string): string;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { SqlEscapeError, escapeLiteral, quoteIdentifier };
|
|
22
|
+
//# sourceMappingURL=sql-utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-utils.d.mts","names":[],"sources":["../src/core/sql-utils.ts"],"sourcesContent":[],"mappings":";;AAYA;AAWA;AAcA;;;;;;;;cAzBa,cAAA,SAAuB,KAAA;;;;;iBAWpB,eAAA;iBAcA,aAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-DTIFFx4L.mjs";
|
|
2
|
+
import { Migration } from "@prisma-next/family-sql/migration";
|
|
3
|
+
|
|
4
|
+
//#region src/core/migrations/sqlite-migration.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Target-owned base class for SQLite migrations. Fixes the `SqlMigration`
|
|
8
|
+
* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the
|
|
9
|
+
* SQLite literal, so both user-authored migrations and renderer-generated
|
|
10
|
+
* scaffolds can extend `SqliteMigration` directly without redeclaring
|
|
11
|
+
* target-local identity.
|
|
12
|
+
*/
|
|
13
|
+
declare abstract class SqliteMigration extends Migration<SqlitePlanTargetDetails> {
|
|
14
|
+
readonly targetId: "sqlite";
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SqliteMigration as t };
|
|
18
|
+
//# sourceMappingURL=sqlite-migration-BYgrMZdR.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-migration-BYgrMZdR.d.mts","names":[],"sources":["../src/core/migrations/sqlite-migration.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;;;;;uBAAsB,eAAA,SAAwB,UAAa"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Migration } from "@prisma-next/family-sql/migration";
|
|
2
|
+
|
|
3
|
+
//#region src/core/migrations/sqlite-migration.ts
|
|
4
|
+
/**
|
|
5
|
+
* Target-owned base class for SQLite migrations. Fixes the `SqlMigration`
|
|
6
|
+
* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the
|
|
7
|
+
* SQLite literal, so both user-authored migrations and renderer-generated
|
|
8
|
+
* scaffolds can extend `SqliteMigration` directly without redeclaring
|
|
9
|
+
* target-local identity.
|
|
10
|
+
*/
|
|
11
|
+
var SqliteMigration = class extends Migration {
|
|
12
|
+
targetId = "sqlite";
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { SqliteMigration as t };
|
|
17
|
+
//# sourceMappingURL=sqlite-migration-CnLhIrJF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-migration-CnLhIrJF.mjs","names":["SqlMigration"],"sources":["../src/core/migrations/sqlite-migration.ts"],"sourcesContent":["import { Migration as SqlMigration } from '@prisma-next/family-sql/migration';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\n\n/**\n * Target-owned base class for SQLite migrations. Fixes the `SqlMigration`\n * generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the\n * SQLite literal, so both user-authored migrations and renderer-generated\n * scaffolds can extend `SqliteMigration` directly without redeclaring\n * target-local identity.\n */\nexport abstract class SqliteMigration extends SqlMigration<SqlitePlanTargetDetails> {\n readonly targetId = 'sqlite' as const;\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAsB,kBAAtB,cAA8CA,UAAsC;CAClF,AAAS,WAAW"}
|