@prisma-next/target-sqlite 0.11.0 → 0.12.0-dev.10
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-CYwMu3-4.d.mts → codec-ids-C4UfWqAE.d.mts} +1 -1
- package/dist/{codec-ids-CYwMu3-4.d.mts.map → codec-ids-C4UfWqAE.d.mts.map} +1 -1
- package/dist/codec-ids.d.mts +1 -1
- package/dist/{codec-types-DNauB5UT.d.mts → codec-types-B2ci-b_W.d.mts} +2 -2
- package/dist/{codec-types-DNauB5UT.d.mts.map → codec-types-B2ci-b_W.d.mts.map} +1 -1
- package/dist/codec-types.d.mts +2 -2
- package/dist/codecs-DVnHtVWW.mjs.map +1 -1
- package/dist/{codecs-BAlEiSeP.d.mts → codecs-DqDWNIKq.d.mts} +2 -2
- package/dist/{codecs-BAlEiSeP.d.mts.map → codecs-DqDWNIKq.d.mts.map} +1 -1
- package/dist/codecs.d.mts +1 -1
- package/dist/codecs.mjs.map +1 -1
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +38 -51
- package/dist/control.mjs.map +1 -1
- package/dist/{default-normalizer-3Fccw7yw.mjs → default-normalizer-CWKVYSxS.mjs} +1 -1
- package/dist/{default-normalizer-3Fccw7yw.mjs.map → default-normalizer-CWKVYSxS.mjs.map} +1 -1
- package/dist/default-normalizer.d.mts.map +1 -1
- package/dist/default-normalizer.mjs +1 -1
- package/dist/descriptor-meta-DIbCXU65.mjs +15 -0
- package/dist/descriptor-meta-DIbCXU65.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-DOcnLfOX.mjs +12 -0
- package/dist/descriptor-meta-runtime-DOcnLfOX.mjs.map +1 -0
- package/dist/migration.d.mts +2 -2
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +3 -3
- package/dist/migration.mjs.map +1 -1
- package/dist/{native-type-normalizer-BlN5XfD-.mjs → native-type-normalizer-HvkimyB8.mjs} +1 -1
- package/dist/{native-type-normalizer-BlN5XfD-.mjs.map → native-type-normalizer-HvkimyB8.mjs.map} +1 -1
- package/dist/native-type-normalizer.d.mts.map +1 -1
- package/dist/native-type-normalizer.mjs +1 -1
- package/dist/{op-factory-call-BnPhI25-.mjs → op-factory-call-VBm-wu5R.mjs} +2 -2
- package/dist/{op-factory-call-BnPhI25-.mjs.map → op-factory-call-VBm-wu5R.mjs.map} +1 -1
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.d.mts.map +1 -1
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.d.mts +8 -7
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-B9-16QqD.mjs → planner-BDZolRbq.mjs} +7 -7
- package/dist/{planner-B9-16QqD.mjs.map → planner-BDZolRbq.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-CI9LdXPr.d.mts → planner-produced-sqlite-migration-D4FSvPE4.d.mts} +3 -3
- package/dist/planner-produced-sqlite-migration-D4FSvPE4.d.mts.map +1 -0
- package/dist/{planner-produced-sqlite-migration-BqzfeOFu.mjs → planner-produced-sqlite-migration-DF8pnKfG.mjs} +5 -8
- package/dist/planner-produced-sqlite-migration-DF8pnKfG.mjs.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-target-details-vhvZDWK1.d.mts → planner-target-details-B-VJkUsu.d.mts} +1 -1
- package/dist/planner-target-details-B-VJkUsu.d.mts.map +1 -0
- package/dist/{planner-target-details-Bm71XPKb.mjs → planner-target-details-BRS591Zt.mjs} +1 -1
- package/dist/{planner-target-details-Bm71XPKb.mjs.map → planner-target-details-BRS591Zt.mjs.map} +1 -1
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner-target-details.mjs +1 -1
- package/dist/planner.d.mts +2 -2
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/{render-ops-CSRDT4YL.mjs → render-ops-ByOBLKVj.mjs} +1 -1
- package/dist/{render-ops-CSRDT4YL.mjs.map → render-ops-ByOBLKVj.mjs.map} +1 -1
- package/dist/render-ops.d.mts +1 -1
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/render-ops.mjs +1 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -2
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-qLsgTOZs.d.mts → shared-DDOJntxk.d.mts} +2 -2
- package/dist/shared-DDOJntxk.d.mts.map +1 -0
- package/dist/{sql-utils-DhevMgef.mjs → sql-utils-D0gQAMLB.mjs} +1 -1
- package/dist/{sql-utils-DhevMgef.mjs.map → sql-utils-D0gQAMLB.mjs.map} +1 -1
- package/dist/sql-utils.d.mts.map +1 -1
- package/dist/sql-utils.mjs +1 -1
- package/dist/{sqlite-migration-DAb2NEX6.d.mts → sqlite-migration-Feio34n3.d.mts} +2 -2
- package/dist/sqlite-migration-Feio34n3.d.mts.map +1 -0
- package/dist/{sqlite-migration-BBJktVVw.mjs → sqlite-migration-Lvmtu9IE.mjs} +1 -1
- package/dist/{sqlite-migration-BBJktVVw.mjs.map → sqlite-migration-Lvmtu9IE.mjs.map} +1 -1
- package/dist/{statement-builders-Dne-LkAV.mjs → statement-builders-D1Q_i4sb.mjs} +14 -2
- package/dist/statement-builders-D1Q_i4sb.mjs.map +1 -0
- package/dist/statement-builders.d.mts +4 -1
- package/dist/statement-builders.d.mts.map +1 -1
- package/dist/statement-builders.mjs +1 -1
- package/dist/{tables-DGRRJasz.mjs → tables-gB0XiFu8.mjs} +4 -4
- package/dist/{tables-DGRRJasz.mjs.map → tables-gB0XiFu8.mjs.map} +1 -1
- package/package.json +29 -18
- package/src/core/authoring.ts +1 -1
- package/src/core/descriptor-meta-runtime.ts +28 -0
- package/src/core/descriptor-meta.ts +2 -6
- package/src/core/migrations/planner-produced-sqlite-migration.ts +0 -2
- package/src/core/migrations/render-typescript.ts +1 -5
- package/src/core/migrations/runner.ts +56 -75
- package/src/core/migrations/statement-builders.ts +17 -2
- package/src/core/runtime-target.ts +2 -2
- package/dist/descriptor-meta-CE2Kbn9b.mjs +0 -17
- package/dist/descriptor-meta-CE2Kbn9b.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-BqzfeOFu.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-CI9LdXPr.d.mts.map +0 -1
- package/dist/planner-target-details-vhvZDWK1.d.mts.map +0 -1
- package/dist/shared-qLsgTOZs.d.mts.map +0 -1
- package/dist/sqlite-migration-DAb2NEX6.d.mts.map +0 -1
- package/dist/statement-builders-Dne-LkAV.mjs.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as renderOps } from "./render-ops-
|
|
2
|
-
import { t as SqliteMigration } from "./sqlite-migration-
|
|
3
|
-
import {
|
|
4
|
-
import { ifDefined } from "@prisma-next/utils/defined";
|
|
1
|
+
import { t as renderOps } from "./render-ops-ByOBLKVj.mjs";
|
|
2
|
+
import { t as SqliteMigration } from "./sqlite-migration-Lvmtu9IE.mjs";
|
|
3
|
+
import { renderImports } from "@prisma-next/ts-render";
|
|
5
4
|
import { detectScaffoldRuntime, shebangLineFor } from "@prisma-next/migration-tools/migration-ts";
|
|
6
5
|
//#region src/core/migrations/render-typescript.ts
|
|
7
6
|
/**
|
|
@@ -55,7 +54,6 @@ function buildDescribeMethod(meta) {
|
|
|
55
54
|
lines.push(" return {");
|
|
56
55
|
lines.push(` from: ${JSON.stringify(meta.from)},`);
|
|
57
56
|
lines.push(` to: ${JSON.stringify(meta.to)},`);
|
|
58
|
-
if (meta.labels && meta.labels.length > 0) lines.push(` labels: ${jsonToTsSource(meta.labels)},`);
|
|
59
57
|
lines.push(" };");
|
|
60
58
|
lines.push(" }");
|
|
61
59
|
lines.push("");
|
|
@@ -99,12 +97,11 @@ var TypeScriptRenderableSqliteMigration = class extends SqliteMigration {
|
|
|
99
97
|
renderTypeScript() {
|
|
100
98
|
return renderCallsToTypeScript(this.#calls, {
|
|
101
99
|
from: this.#meta.from,
|
|
102
|
-
to: this.#meta.to
|
|
103
|
-
...ifDefined("labels", this.#meta.labels)
|
|
100
|
+
to: this.#meta.to
|
|
104
101
|
});
|
|
105
102
|
}
|
|
106
103
|
};
|
|
107
104
|
//#endregion
|
|
108
105
|
export { TypeScriptRenderableSqliteMigration as t };
|
|
109
106
|
|
|
110
|
-
//# sourceMappingURL=planner-produced-sqlite-migration-
|
|
107
|
+
//# sourceMappingURL=planner-produced-sqlite-migration-DF8pnKfG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-produced-sqlite-migration-DF8pnKfG.mjs","names":["#calls","#meta","#destination","#spaceId"],"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 type { OpFactoryCall } from '@prisma-next/framework-components/control';\nimport { detectScaffoldRuntime, shebangLineFor } from '@prisma-next/migration-tools/migration-ts';\nimport { type ImportRequirement, renderImports } from '@prisma-next/ts-render';\n\nexport interface RenderMigrationMeta {\n readonly from: string | null;\n readonly to: string;\n}\n\n/**\n * Always-present base imports for the rendered scaffold. Both come from\n * `@prisma-next/sqlite/migration` so an authored SQLite\n * `migration.ts` only needs a single dependency for its base class and\n * its CLI entrypoint. Mirrors Postgres's `BASE_IMPORTS`.\n *\n * - `Migration` — the facade re-export fixes the `SqlMigration`\n * generic to `SqlitePlanTargetDetails` and the abstract `targetId` to\n * `'sqlite'`.\n * - `MigrationCLI` — the migration-file CLI entrypoint, re-exported from\n * `@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/sqlite/migration', symbol: 'Migration' },\n { moduleSpecifier: '@prisma-next/sqlite/migration', symbol: 'MigrationCLI' },\n];\n\nexport function renderCallsToTypeScript(\n calls: ReadonlyArray<OpFactoryCall>,\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<OpFactoryCall>): 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 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 {\n MigrationPlanWithAuthoringSurface,\n OpFactoryCall,\n} from '@prisma-next/framework-components/control';\nimport type { MigrationMeta } from '@prisma-next/migration-tools/migration';\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 OpFactoryCall[];\n readonly #meta: MigrationMeta;\n readonly #destination: SqliteMigrationDestinationInfo;\n readonly #spaceId: string;\n\n constructor(\n calls: readonly OpFactoryCall[],\n meta: MigrationMeta,\n spaceId: string,\n destination?: SqliteMigrationDestinationInfo,\n ) {\n super();\n this.#calls = calls;\n this.#meta = meta;\n this.#spaceId = spaceId;\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 /**\n * Contract space this planner-produced plan applies to. Threaded\n * from {@link SqlMigrationPlannerPlanOptions.spaceId} so the runner\n * keys the marker row by the right space when executing the plan.\n */\n get spaceId(): string {\n return this.#spaceId;\n }\n\n renderTypeScript(): string {\n return renderCallsToTypeScript(this.#calls, {\n from: this.#meta.from,\n to: this.#meta.to,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,eAA6C,CACjD;CAAE,iBAAiB;CAAiC,QAAQ;AAAY,GACxE;CAAE,iBAAiB;CAAiC,QAAQ;AAAe,CAC7E;AAEA,SAAgB,wBACd,OACA,MACQ;CACR,MAAM,UAAU,aAAa,KAAK;CAClC,MAAM,iBAAiB,MAAM,KAAK,MAAM,EAAE,iBAAiB,CAAC,EAAE,KAAK,KAAK;CAExE,OAAO;EACL,eAAe,sBAAsB,CAAC;EACtC;EACA;EACA;EACA,oBAAoB,IAAI;EACxB;EACA;EACA,OAAO,gBAAgB,CAAC;EACxB;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAS,aAAa,OAA6C;CACjE,MAAM,eAAoC,CAAC,GAAG,YAAY;CAC1D,KAAK,MAAM,QAAQ,OACjB,KAAK,MAAM,OAAO,KAAK,mBAAmB,GACxC,aAAa,KAAK,GAAG;CAGzB,OAAO,cAAc,YAAY;AACnC;AAEA,SAAS,oBAAoB,MAAmC;CAC9D,MAAM,QAAkB,CAAC;CACzB,MAAM,KAAK,yBAAyB;CACpC,MAAM,KAAK,cAAc;CACzB,MAAM,KAAK,eAAe,KAAK,UAAU,KAAK,IAAI,EAAE,EAAE;CACtD,MAAM,KAAK,aAAa,KAAK,UAAU,KAAK,EAAE,EAAE,EAAE;CAClD,MAAM,KAAK,QAAQ;CACnB,MAAM,KAAK,KAAK;CAChB,MAAM,KAAK,EAAE;CACb,OAAO,MAAM,KAAK,IAAI;AACxB;AAEA,SAAS,OAAO,MAAc,QAAwB;CACpD,MAAM,MAAM,IAAI,OAAO,MAAM;CAC7B,OAAO,KACJ,MAAM,IAAI,EACV,KAAK,SAAU,KAAK,KAAK,IAAI,GAAG,MAAM,SAAS,IAAK,EACpD,KAAK,IAAI;AACd;;;ACpEA,IAAa,sCAAb,cACU,gBAEV;CACE;CACA;CACA;CACA;CAEA,YACE,OACA,MACA,SACA,aACA;EACA,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKE,WAAW;EAChB,KAAKD,eAAe,eAAe,EAAE,aAAa,KAAK,GAAG;CAC5D;CAEA,IAAa,aAA4B;EACvC,OAAO,UAAU,KAAKF,MAAM;CAC9B;CAEA,WAAmC;EACjC,OAAO,KAAKC;CACd;CAEA,IAAa,cAA8C;EACzD,OAAO,KAAKC;CACd;;;;;;CAOA,IAAI,UAAkB;EACpB,OAAO,KAAKC;CACd;CAEA,mBAA2B;EACzB,OAAO,wBAAwB,KAAKH,QAAQ;GAC1C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;EACjB,CAAC;CACH;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TypeScriptRenderableSqliteMigration, t as SqliteMigrationDestinationInfo } from "./planner-produced-sqlite-migration-
|
|
1
|
+
import { n as TypeScriptRenderableSqliteMigration, t as SqliteMigrationDestinationInfo } from "./planner-produced-sqlite-migration-D4FSvPE4.mjs";
|
|
2
2
|
export { type SqliteMigrationDestinationInfo, TypeScriptRenderableSqliteMigration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-
|
|
1
|
+
import { t as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-DF8pnKfG.mjs";
|
|
2
2
|
export { TypeScriptRenderableSqliteMigration };
|
package/dist/{planner-target-details-vhvZDWK1.d.mts → planner-target-details-B-VJkUsu.d.mts}
RENAMED
|
@@ -9,4 +9,4 @@ interface SqlitePlanTargetDetails {
|
|
|
9
9
|
declare function buildTargetDetails(objectType: OperationClass, name: string, table?: string): SqlitePlanTargetDetails;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { buildTargetDetails as n, SqlitePlanTargetDetails as t };
|
|
12
|
-
//# sourceMappingURL=planner-target-details-
|
|
12
|
+
//# sourceMappingURL=planner-target-details-B-VJkUsu.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-target-details-B-VJkUsu.d.mts","names":[],"sources":["../src/core/migrations/planner-target-details.ts"],"mappings":";KAEY,cAAA;AAAA,UAMK,uBAAA;EAAA,SACN,MAAA;EAAA,SACA,UAAA,EAAY,cAAc;EAAA,SAC1B,IAAA;EAAA,SACA,KAAA;AAAA;AAAA,iBASK,kBAAA,CACd,UAAA,EAAY,cAAA,EACZ,IAAA,UACA,KAAA,YACC,uBAAuB"}
|
package/dist/{planner-target-details-Bm71XPKb.mjs.map → planner-target-details-BRS591Zt.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-target-details-
|
|
1
|
+
{"version":3,"file":"planner-target-details-BRS591Zt.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;CACzB,OAAO;EACL,QAAQ;EACR;EACA;EACA,GAAG,UAAU,SAAS,KAAK;CAC7B;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildTargetDetails, t as SqlitePlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { n as buildTargetDetails, t as SqlitePlanTargetDetails } from "./planner-target-details-B-VJkUsu.mjs";
|
|
2
2
|
export { type SqlitePlanTargetDetails, buildTargetDetails };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as buildTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as buildTargetDetails } from "./planner-target-details-BRS591Zt.mjs";
|
|
2
2
|
export { buildTargetDetails };
|
package/dist/planner.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as SqlitePlanTargetDetails } from "./planner-target-details-
|
|
2
|
-
import { n as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-B-VJkUsu.mjs";
|
|
2
|
+
import { n as TypeScriptRenderableSqliteMigration } from "./planner-produced-sqlite-migration-D4FSvPE4.mjs";
|
|
3
3
|
import { MigrationOperationPolicy, SqlMigrationPlanner, SqlPlannerFailureResult } from "@prisma-next/family-sql/control";
|
|
4
4
|
import { MigrationPlanner, MigrationScaffoldContext } from "@prisma-next/framework-components/control";
|
|
5
5
|
import { Contract } from "@prisma-next/contract/types";
|
package/dist/planner.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner.d.mts","names":[],"sources":["../src/core/migrations/planner.ts"],"mappings":";;;;;;;;iBA6BgB,4BAAA,CAAA,GAAgC,
|
|
1
|
+
{"version":3,"file":"planner.d.mts","names":[],"sources":["../src/core/migrations/planner.ts"],"mappings":";;;;;;;;iBA6BgB,4BAAA,CAAA,GAAgC,sBAAsB;AAAA,KAI1D,gBAAA;EAAA,SACG,IAAA;EAAA,SAA0B,IAAA,EAAM,mCAAA;AAAA,IAC3C,uBAAuB;;AAN2C;AAItE;;;;;;;;;AAE2B;AAgB3B;;cAAa,sBAAA,YACA,mBAAA,CAAoB,uBAAA,GAA0B,gBAAA;EAEzD,IAAA,CAAK,OAAA;IAAA,SACM,QAAA;IAAA,SACA,MAAA;IAAA,SACA,MAAA,EAAQ,wBAAA;IAYa;;;;;;;;;;IAAA,SADrB,YAAA,EAAc,QAAA;IAAA,SACd,mBAAA,EAAqB,aAAA,CAAc,8BAAA;IAdnC;;;;;IAAA,SAoBA,OAAA;EAAA,IACP,gBAAA;EAIJ,cAAA,CACE,OAAA,EAAS,wBAAA,EACT,OAAA,WACC,mCAAA;EAAA,QAWK,OAAA;EAAA,QA6DA,oBAAA;EAAA,QAaA,mBAAA;AAAA"}
|
package/dist/planner.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-
|
|
1
|
+
import { n as createSqliteMigrationPlanner, t as SqliteMigrationPlanner } from "./planner-BDZolRbq.mjs";
|
|
2
2
|
export { SqliteMigrationPlanner, createSqliteMigrationPlanner };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-ops-
|
|
1
|
+
{"version":3,"file":"render-ops-ByOBLKVj.mjs","names":[],"sources":["../src/core/migrations/render-ops.ts"],"sourcesContent":["import type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { OpFactoryCall } from '@prisma-next/framework-components/control';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\n\ntype Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;\n\nexport function renderOps(calls: readonly OpFactoryCall[]): Op[] {\n // Each call's `toOp()` is typed as the framework `MigrationPlanOperation`;\n // every concrete Call class on the sqlite planner path produces an op\n // whose `target.details` is `SqlitePlanTargetDetails`-shaped (or whose\n // `target.details` is absent, which is structurally compatible). The\n // narrowing cast happens at this single integration boundary instead of\n // poisoning every caller's type.\n return calls.map((c) => c.toOp() as Op);\n}\n"],"mappings":";AAMA,SAAgB,UAAU,OAAuC;CAO/D,OAAO,MAAM,KAAK,MAAM,EAAE,KAAK,CAAO;AACxC"}
|
package/dist/render-ops.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SqlitePlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-B-VJkUsu.mjs";
|
|
2
2
|
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
3
3
|
import { OpFactoryCall } from "@prisma-next/framework-components/control";
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-ops.d.mts","names":[],"sources":["../src/core/migrations/render-ops.ts"],"mappings":";;;;;KAIK,EAAA,GAAK,
|
|
1
|
+
{"version":3,"file":"render-ops.d.mts","names":[],"sources":["../src/core/migrations/render-ops.ts"],"mappings":";;;;;KAIK,EAAA,GAAK,yBAAyB,CAAC,uBAAA;AAAA,iBAEpB,SAAA,CAAU,KAAA,WAAgB,aAAA,KAAkB,EAAE"}
|
package/dist/render-ops.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as renderOps } from "./render-ops-
|
|
1
|
+
import { t as renderOps } from "./render-ops-ByOBLKVj.mjs";
|
|
2
2
|
export { renderOps };
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-target.ts"],"mappings":";;;;UAIiB,2BAAA,SAAoC,
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-target.ts"],"mappings":";;;;UAIiB,2BAAA,SAAoC,qBAAqB;AAAA,cAEpE,6BAAA,EAA+B,0BAA0B,WAE7D,2BAAA"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as sqliteTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-DOcnLfOX.mjs";
|
|
2
2
|
//#region src/core/runtime-target.ts
|
|
3
3
|
const sqliteRuntimeTargetDescriptor = {
|
|
4
|
-
...
|
|
4
|
+
...sqliteTargetDescriptorMetaRuntime,
|
|
5
5
|
codecs: () => [],
|
|
6
6
|
create() {
|
|
7
7
|
return {
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/core/runtime-target.ts"],"sourcesContent":["import type { RuntimeTargetInstance } from '@prisma-next/framework-components/execution';\nimport type { SqlRuntimeTargetDescriptor } from '@prisma-next/sql-runtime';\nimport {
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/core/runtime-target.ts"],"sourcesContent":["import type { RuntimeTargetInstance } from '@prisma-next/framework-components/execution';\nimport type { SqlRuntimeTargetDescriptor } from '@prisma-next/sql-runtime';\nimport { sqliteTargetDescriptorMetaRuntime } from './descriptor-meta-runtime';\n\nexport interface SqliteRuntimeTargetInstance extends RuntimeTargetInstance<'sql', 'sqlite'> {}\n\nconst sqliteRuntimeTargetDescriptor: SqlRuntimeTargetDescriptor<\n 'sqlite',\n SqliteRuntimeTargetInstance\n> = {\n ...sqliteTargetDescriptorMetaRuntime,\n codecs: () => [],\n create(): SqliteRuntimeTargetInstance {\n return {\n familyId: 'sql',\n targetId: 'sqlite',\n };\n },\n};\n\nexport default sqliteRuntimeTargetDescriptor;\n"],"mappings":";;AAMA,MAAM,gCAGF;CACF,GAAG;CACH,cAAc,CAAC;CACf,SAAsC;EACpC,OAAO;GACL,UAAU;GACV,UAAU;EACZ;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SqlitePlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-B-VJkUsu.mjs";
|
|
2
2
|
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
3
3
|
import { ReferentialAction } from "@prisma-next/sql-contract/types";
|
|
4
4
|
|
|
@@ -66,4 +66,4 @@ interface SqliteIndexSpec {
|
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
68
|
export { SqliteTableSpec as i, SqliteColumnSpec as n, SqliteIndexSpec as r, Op as t };
|
|
69
|
-
//# sourceMappingURL=shared-
|
|
69
|
+
//# sourceMappingURL=shared-DDOJntxk.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-DDOJntxk.d.mts","names":[],"sources":["../src/core/migrations/operations/shared.ts"],"mappings":";;;;;KAKY,EAAA,GAAK,yBAAyB,CAAC,uBAAA;;AAAuB;AAsBlE;;;;;;;;;;AAKwC;AAGxC;;;UARiB,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA;EAAA,SACA,QAAA;EAAA,SACA,6BAAA;AAAA;AAAA,UAGM,oBAAA;EAAA,SACN,OAAO;AAAA;AAAA,UAGD,gBAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAI;AAAA;AAAA,UAGE,oBAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA;IAAA,SACE,KAAA;IAAA,SACA,OAAA;EAAA;EAAA,SAEF,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAiB;EAAA,SAC5B,UAAA;AAAA;;;;;UAOM,eAAA;EAAA,SACN,OAAA,WAAkB,gBAAA;EAAA,SAClB,UAAA,GAAa,oBAAA;EAAA,SACb,OAAA,YAAmB,gBAAA;EAAA,SACnB,WAAA,YAAuB,oBAAA;AAAA;;;;;;UAQjB,eAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAO;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-utils-
|
|
1
|
+
{"version":3,"file":"sql-utils-D0gQAMLB.mjs","names":[],"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;CAGtB;CACA;CAHlB,YACE,SACA,OACA,MACA;EACA,MAAM,OAAO;EAHG,KAAA,QAAA;EACA,KAAA,OAAA;EAGhB,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,gBAAgB,YAA4B;CAC1D,IAAI,WAAW,WAAW,GACxB,MAAM,IAAI,eAAe,8BAA8B,YAAY,YAAY;CAEjF,IAAI,WAAW,SAAS,IAAI,GAC1B,MAAM,IAAI,eACR,wCACA,WAAW,QAAQ,OAAO,KAAK,GAC/B,YACF;CAEF,OAAO,IAAI,WAAW,QAAQ,MAAM,MAAI,EAAE;AAC5C;AAEA,SAAgB,cAAc,OAAuB;CACnD,IAAI,MAAM,SAAS,IAAI,GACrB,MAAM,IAAI,eACR,2CACA,MAAM,QAAQ,OAAO,KAAK,GAC1B,SACF;CAEF,OAAO,MAAM,QAAQ,MAAM,IAAI;AACjC"}
|
package/dist/sql-utils.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-utils.d.mts","names":[],"sources":["../src/core/sql-utils.ts"],"mappings":";;AAYA;;;;;;;;;;cAAa,cAAA,SAAuB,
|
|
1
|
+
{"version":3,"file":"sql-utils.d.mts","names":[],"sources":["../src/core/sql-utils.ts"],"mappings":";;AAYA;;;;;;;;;;cAAa,cAAA,SAAuB,KAAK;EAAA,SAGrB,KAAA;EAAA,SACA,IAAA;cAFhB,OAAA,UACgB,KAAA,UACA,IAAA;AAAA;AAAA,iBAOJ,eAAA,CAAgB,UAAkB;AAAA,iBAclC,aAAA,CAAc,KAAa"}
|
package/dist/sql-utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as escapeLiteral, r as quoteIdentifier, t as SqlEscapeError } from "./sql-utils-
|
|
1
|
+
import { n as escapeLiteral, r as quoteIdentifier, t as SqlEscapeError } from "./sql-utils-D0gQAMLB.mjs";
|
|
2
2
|
export { SqlEscapeError, escapeLiteral, quoteIdentifier };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SqlitePlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as SqlitePlanTargetDetails } from "./planner-target-details-B-VJkUsu.mjs";
|
|
2
2
|
import { Migration } from "@prisma-next/family-sql/migration";
|
|
3
3
|
|
|
4
4
|
//#region src/core/migrations/sqlite-migration.d.ts
|
|
@@ -14,4 +14,4 @@ declare abstract class SqliteMigration extends Migration<SqlitePlanTargetDetails
|
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
export { SqliteMigration as t };
|
|
17
|
-
//# sourceMappingURL=sqlite-migration-
|
|
17
|
+
//# sourceMappingURL=sqlite-migration-Feio34n3.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-migration-Feio34n3.d.mts","names":[],"sources":["../src/core/migrations/sqlite-migration.ts"],"mappings":";;;;;;AAUA;;;;;uBAAsB,eAAA,SAAwB,SAAY,CAAC,uBAAA;EAAA,SAChD,QAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-migration-
|
|
1
|
+
{"version":3,"file":"sqlite-migration-Lvmtu9IE.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,WAAoB;AACtB"}
|
|
@@ -33,7 +33,10 @@ const ensureMarkerTableStatement = {
|
|
|
33
33
|
const ensureLedgerTableStatement = {
|
|
34
34
|
sql: `CREATE TABLE IF NOT EXISTS _prisma_ledger (
|
|
35
35
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
36
|
-
created_at TEXT NOT NULL DEFAULT (
|
|
36
|
+
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
|
|
37
|
+
space TEXT NOT NULL,
|
|
38
|
+
migration_name TEXT NOT NULL,
|
|
39
|
+
migration_hash TEXT NOT NULL,
|
|
37
40
|
origin_core_hash TEXT,
|
|
38
41
|
origin_profile_hash TEXT,
|
|
39
42
|
destination_core_hash TEXT NOT NULL,
|
|
@@ -122,6 +125,9 @@ function buildWriteMarkerStatements(input) {
|
|
|
122
125
|
function buildLedgerInsertStatement(input) {
|
|
123
126
|
return {
|
|
124
127
|
sql: `INSERT INTO _prisma_ledger (
|
|
128
|
+
space,
|
|
129
|
+
migration_name,
|
|
130
|
+
migration_hash,
|
|
125
131
|
origin_core_hash,
|
|
126
132
|
origin_profile_hash,
|
|
127
133
|
destination_core_hash,
|
|
@@ -136,9 +142,15 @@ function buildLedgerInsertStatement(input) {
|
|
|
136
142
|
?,
|
|
137
143
|
?,
|
|
138
144
|
?,
|
|
145
|
+
?,
|
|
146
|
+
?,
|
|
147
|
+
?,
|
|
139
148
|
?
|
|
140
149
|
)`,
|
|
141
150
|
params: [
|
|
151
|
+
input.space,
|
|
152
|
+
input.migrationName,
|
|
153
|
+
input.migrationHash,
|
|
142
154
|
input.originStorageHash ?? null,
|
|
143
155
|
input.originProfileHash ?? null,
|
|
144
156
|
input.destinationStorageHash,
|
|
@@ -155,4 +167,4 @@ function jsonParam(value) {
|
|
|
155
167
|
//#endregion
|
|
156
168
|
export { buildLedgerInsertStatement as a, ensureMarkerTableStatement as c, MARKER_TABLE_NAME as i, readMarkerStatement as l, CONTROL_TABLE_NAMES as n, buildWriteMarkerStatements as o, LEDGER_TABLE_NAME as r, ensureLedgerTableStatement as s, APP_SPACE_ID$1 as t };
|
|
157
169
|
|
|
158
|
-
//# sourceMappingURL=statement-builders-
|
|
170
|
+
//# sourceMappingURL=statement-builders-D1Q_i4sb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement-builders-D1Q_i4sb.mjs","names":["APP_SPACE_ID"],"sources":["../src/core/migrations/statement-builders.ts"],"sourcesContent":["import { APP_SPACE_ID } from '@prisma-next/framework-components/control';\n\nexport { APP_SPACE_ID };\n\nexport interface SqlStatement {\n readonly sql: string;\n readonly params: readonly unknown[];\n}\n\nexport const MARKER_TABLE_NAME = '_prisma_marker';\nexport const LEDGER_TABLE_NAME = '_prisma_ledger';\n\n/**\n * Control tables the runner creates/manages. The planner must not drop these\n * when reconciling \"extra\" tables against the contract.\n */\nexport const CONTROL_TABLE_NAMES: ReadonlySet<string> = new Set([\n MARKER_TABLE_NAME,\n LEDGER_TABLE_NAME,\n]);\n\n/**\n * Schema for `_prisma_marker`. The `space TEXT PRIMARY KEY` shape\n * supports one row per loaded contract space (`'app'`,\n * `'<extension-id>'`, …); brand-new databases create this shape\n * directly. The migration runner detects pre-1.0 single-row markers\n * (no `space` column) at boot and fails with a structured\n * `LEGACY_MARKER_SHAPE` error rather than auto-rebuilding the table —\n * see `specs/framework-mechanism.spec.md § 2`.\n */\nexport const ensureMarkerTableStatement: SqlStatement = {\n sql: `CREATE TABLE IF NOT EXISTS _prisma_marker (\n space TEXT NOT NULL PRIMARY KEY DEFAULT '${APP_SPACE_ID}',\n core_hash TEXT NOT NULL,\n profile_hash TEXT NOT NULL,\n contract_json TEXT,\n canonical_version INTEGER,\n updated_at TEXT NOT NULL DEFAULT (datetime('now')),\n app_tag TEXT,\n meta TEXT NOT NULL DEFAULT '{}',\n invariants TEXT NOT NULL DEFAULT '[]'\n )`,\n params: [],\n};\n\nexport const ensureLedgerTableStatement: SqlStatement = {\n sql: `CREATE TABLE IF NOT EXISTS _prisma_ledger (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),\n space TEXT NOT NULL,\n migration_name TEXT NOT NULL,\n migration_hash TEXT NOT NULL,\n origin_core_hash TEXT,\n origin_profile_hash TEXT,\n destination_core_hash TEXT NOT NULL,\n destination_profile_hash TEXT,\n contract_json_before TEXT,\n contract_json_after TEXT,\n operations TEXT NOT NULL\n )`,\n params: [],\n};\n\nexport function readMarkerStatement(space: string): SqlStatement {\n return {\n sql: `SELECT\n core_hash,\n profile_hash,\n contract_json,\n canonical_version,\n updated_at,\n app_tag,\n meta,\n invariants\n FROM _prisma_marker\n WHERE space = ?`,\n params: [space],\n };\n}\n\nexport interface WriteMarkerInput {\n /**\n * Logical space identifier for this marker row. Required at every\n * call site so the type system surfaces every place that needs to\n * thread the value (rather than letting an `?? APP_SPACE_ID`\n * fall-through silently collapse per-space markers onto the\n * `'app'` row). App-plan callers pass {@link APP_SPACE_ID}\n * (`'app'`); per-extension callers pass the extension's space id.\n */\n readonly space: string;\n readonly storageHash: string;\n readonly profileHash: string;\n readonly contractJson?: unknown;\n readonly canonicalVersion?: number | null;\n readonly appTag?: string | null;\n readonly meta?: Record<string, unknown>;\n /**\n * Invariants to write into `marker.invariants`. Stored as a JSON-encoded\n * TEXT array — SQLite has no native array type. The runner is responsible\n * for merging with the existing column (no SQL-side merge here, unlike\n * Postgres) before passing them in: BEGIN EXCLUSIVE on the migration\n * transaction makes the read-then-merge-then-write sequence safe.\n */\n readonly invariants: readonly string[];\n}\n\nexport function buildWriteMarkerStatements(input: WriteMarkerInput): {\n readonly insert: SqlStatement;\n readonly update: SqlStatement;\n} {\n const params: readonly unknown[] = [\n input.space,\n input.storageHash,\n input.profileHash,\n jsonParam(input.contractJson),\n input.canonicalVersion ?? null,\n input.appTag ?? null,\n jsonParam(input.meta ?? {}),\n jsonParam(input.invariants),\n ];\n\n return {\n insert: {\n sql: `INSERT INTO _prisma_marker (\n space,\n core_hash,\n profile_hash,\n contract_json,\n canonical_version,\n updated_at,\n app_tag,\n meta,\n invariants\n ) VALUES (\n ?,\n ?,\n ?,\n ?,\n ?,\n datetime('now'),\n ?,\n ?,\n ?\n )`,\n params,\n },\n update: {\n sql: `UPDATE _prisma_marker SET\n core_hash = ?,\n profile_hash = ?,\n contract_json = ?,\n canonical_version = ?,\n updated_at = datetime('now'),\n app_tag = ?,\n meta = ?,\n invariants = ?\n WHERE space = ?`,\n params: [\n input.storageHash,\n input.profileHash,\n jsonParam(input.contractJson),\n input.canonicalVersion ?? null,\n input.appTag ?? null,\n jsonParam(input.meta ?? {}),\n jsonParam(input.invariants),\n input.space,\n ],\n },\n };\n}\n\nexport interface LedgerInsertInput {\n readonly space: string;\n readonly migrationName: string;\n readonly migrationHash: string;\n readonly originStorageHash?: string | null;\n readonly originProfileHash?: string | null;\n readonly destinationStorageHash: string;\n readonly destinationProfileHash?: string | null;\n readonly contractJsonBefore?: unknown;\n readonly contractJsonAfter?: unknown;\n readonly operations: unknown;\n}\n\nexport function buildLedgerInsertStatement(input: LedgerInsertInput): SqlStatement {\n return {\n sql: `INSERT INTO _prisma_ledger (\n space,\n migration_name,\n migration_hash,\n origin_core_hash,\n origin_profile_hash,\n destination_core_hash,\n destination_profile_hash,\n contract_json_before,\n contract_json_after,\n operations\n ) VALUES (\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?,\n ?\n )`,\n params: [\n input.space,\n input.migrationName,\n input.migrationHash,\n input.originStorageHash ?? null,\n input.originProfileHash ?? null,\n input.destinationStorageHash,\n input.destinationProfileHash ?? null,\n jsonParam(input.contractJsonBefore),\n jsonParam(input.contractJsonAfter),\n jsonParam(input.operations),\n ],\n };\n}\n\nfunction jsonParam(value: unknown): string {\n return JSON.stringify(value ?? null);\n}\n"],"mappings":";;AASA,MAAa,oBAAoB;AACjC,MAAa,oBAAoB;;;;;AAMjC,MAAa,sBAA2C,IAAI,IAAI,CAC9D,mBACA,iBACF,CAAC;;;;;;;;;;AAWD,MAAa,6BAA2C;CACtD,KAAK;+CACwCA,eAAa;;;;;;;;;;CAU1D,QAAQ,CAAC;AACX;AAEA,MAAa,6BAA2C;CACtD,KAAK;;;;;;;;;;;;;;CAcL,QAAQ,CAAC;AACX;AAEA,SAAgB,oBAAoB,OAA6B;CAC/D,OAAO;EACL,KAAK;;;;;;;;;;;EAWL,QAAQ,CAAC,KAAK;CAChB;AACF;AA4BA,SAAgB,2BAA2B,OAGzC;CAYA,OAAO;EACL,QAAQ;GACN,KAAK;;;;;;;;;;;;;;;;;;;;;GAqBL,QAAA;IAjCF,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU,MAAM,YAAY;IAC5B,MAAM,oBAAoB;IAC1B,MAAM,UAAU;IAChB,UAAU,MAAM,QAAQ,CAAC,CAAC;IAC1B,UAAU,MAAM,UAAU;GA0BnB;EACP;EACA,QAAQ;GACN,KAAK;;;;;;;;;;GAUL,QAAQ;IACN,MAAM;IACN,MAAM;IACN,UAAU,MAAM,YAAY;IAC5B,MAAM,oBAAoB;IAC1B,MAAM,UAAU;IAChB,UAAU,MAAM,QAAQ,CAAC,CAAC;IAC1B,UAAU,MAAM,UAAU;IAC1B,MAAM;GACR;EACF;CACF;AACF;AAeA,SAAgB,2BAA2B,OAAwC;CACjF,OAAO;EACL,KAAK;;;;;;;;;;;;;;;;;;;;;;;EAuBL,QAAQ;GACN,MAAM;GACN,MAAM;GACN,MAAM;GACN,MAAM,qBAAqB;GAC3B,MAAM,qBAAqB;GAC3B,MAAM;GACN,MAAM,0BAA0B;GAChC,UAAU,MAAM,kBAAkB;GAClC,UAAU,MAAM,iBAAiB;GACjC,UAAU,MAAM,UAAU;EAC5B;CACF;AACF;AAEA,SAAS,UAAU,OAAwB;CACzC,OAAO,KAAK,UAAU,SAAS,IAAI;AACrC"}
|
|
@@ -29,7 +29,7 @@ interface WriteMarkerInput {
|
|
|
29
29
|
* Logical space identifier for this marker row. Required at every
|
|
30
30
|
* call site so the type system surfaces every place that needs to
|
|
31
31
|
* thread the value (rather than letting an `?? APP_SPACE_ID`
|
|
32
|
-
* fall-through silently collapse
|
|
32
|
+
* fall-through silently collapse per-space markers onto the
|
|
33
33
|
* `'app'` row). App-plan callers pass {@link APP_SPACE_ID}
|
|
34
34
|
* (`'app'`); per-extension callers pass the extension's space id.
|
|
35
35
|
*/
|
|
@@ -54,6 +54,9 @@ declare function buildWriteMarkerStatements(input: WriteMarkerInput): {
|
|
|
54
54
|
readonly update: SqlStatement;
|
|
55
55
|
};
|
|
56
56
|
interface LedgerInsertInput {
|
|
57
|
+
readonly space: string;
|
|
58
|
+
readonly migrationName: string;
|
|
59
|
+
readonly migrationHash: string;
|
|
57
60
|
readonly originStorageHash?: string | null;
|
|
58
61
|
readonly originProfileHash?: string | null;
|
|
59
62
|
readonly destinationStorageHash: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-builders.d.mts","names":[],"sources":["../src/core/migrations/statement-builders.ts"],"mappings":";;;UAIiB,YAAA;EAAA,SACN,GAAA;EAAA,SACA,
|
|
1
|
+
{"version":3,"file":"statement-builders.d.mts","names":[],"sources":["../src/core/migrations/statement-builders.ts"],"mappings":";;;UAIiB,YAAA;EAAA,SACN,GAAA;EAAA,SACA,MAAM;AAAA;AAAA,cAGJ,iBAAA;AAAA,cACA,iBAAA;AADb;;;;AAAA,cAOa,mBAAA,EAAqB,WAAW;AAN7C;;;;AAA8B;AAM9B;;;;AANA,cAoBa,0BAAA,EAA4B,YAaxC;AAAA,cAEY,0BAAA,EAA4B,YAgBxC;AAAA,iBAEe,mBAAA,CAAoB,KAAA,WAAgB,YAAY;AAAA,UAiB/C,gBAAA;EArChB;AAAA;AAED;;;;AAgBC;AAED;EApBC,SA8CU,KAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA;EAAA,SACA,gBAAA;EAAA,SACA,MAAA;EAAA,SACA,IAAA,GAAO,MAAM;EAAA;;;;;;;EAAA,SAQb,UAAA;AAAA;AAAA,iBAGK,0BAAA,CAA2B,KAAA,EAAO,gBAAA;EAAA,SACvC,MAAA,EAAQ,YAAA;EAAA,SACR,MAAA,EAAQ,YAAA;AAAA;AAAA,UA+DF,iBAAA;EAAA,SACN,KAAA;EAAA,SACA,aAAA;EAAA,SACA,aAAA;EAAA,SACA,iBAAA;EAAA,SACA,iBAAA;EAAA,SACA,sBAAA;EAAA,SACA,sBAAA;EAAA,SACA,kBAAA;EAAA,SACA,iBAAA;EAAA,SACA,UAAA;AAAA;AAAA,iBAGK,0BAAA,CAA2B,KAAA,EAAO,iBAAA,GAAoB,YAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildLedgerInsertStatement, c as ensureMarkerTableStatement, i as MARKER_TABLE_NAME, l as readMarkerStatement, n as CONTROL_TABLE_NAMES, o as buildWriteMarkerStatements, r as LEDGER_TABLE_NAME, s as ensureLedgerTableStatement, t as APP_SPACE_ID } from "./statement-builders-
|
|
1
|
+
import { a as buildLedgerInsertStatement, c as ensureMarkerTableStatement, i as MARKER_TABLE_NAME, l as readMarkerStatement, n as CONTROL_TABLE_NAMES, o as buildWriteMarkerStatements, r as LEDGER_TABLE_NAME, s as ensureLedgerTableStatement, t as APP_SPACE_ID } from "./statement-builders-D1Q_i4sb.mjs";
|
|
2
2
|
export { APP_SPACE_ID, CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME, buildLedgerInsertStatement, buildWriteMarkerStatements, ensureLedgerTableStatement, ensureMarkerTableStatement, readMarkerStatement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as stripOuterParens } from "./default-normalizer-
|
|
2
|
-
import { n as escapeLiteral, r as quoteIdentifier } from "./sql-utils-
|
|
3
|
-
import { t as buildTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { n as stripOuterParens } from "./default-normalizer-CWKVYSxS.mjs";
|
|
2
|
+
import { n as escapeLiteral, r as quoteIdentifier } from "./sql-utils-D0gQAMLB.mjs";
|
|
3
|
+
import { t as buildTargetDetails } from "./planner-target-details-BRS591Zt.mjs";
|
|
4
4
|
import { isPostgresEnumStorageEntry } from "@prisma-next/sql-contract/types";
|
|
5
5
|
//#region src/core/migrations/operations/shared.ts
|
|
6
6
|
function step(description, sql) {
|
|
@@ -415,4 +415,4 @@ function buildRecreatePostchecks(tableName, issues, spec) {
|
|
|
415
415
|
//#endregion
|
|
416
416
|
export { recreateTable as a, buildColumnDefaultSql as c, renderDefaultLiteral as d, addColumn as f, dropTable as i, buildColumnTypeSql as l, step as m, buildRecreateSummary as n, createIndex as o, dropColumn as p, createTable as r, dropIndex as s, buildRecreatePostchecks as t, isInlineAutoincrementPrimaryKey as u };
|
|
417
417
|
|
|
418
|
-
//# sourceMappingURL=tables-
|
|
418
|
+
//# sourceMappingURL=tables-gB0XiFu8.mjs.map
|