@prisma-next/target-sqlite 0.13.0-dev.35 → 0.13.0-dev.37
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 -3
- package/dist/control.mjs +2 -2
- package/dist/ddl-DrtjQMFK.mjs +68 -0
- package/dist/ddl-DrtjQMFK.mjs.map +1 -0
- package/dist/migration.d.mts +3 -45
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +3 -3
- package/dist/{op-factory-call-z4TT72k3.mjs → op-factory-call-DmdfD1yd.mjs} +143 -104
- package/dist/op-factory-call-DmdfD1yd.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +12 -6
- package/dist/op-factory-call.d.mts.map +1 -1
- package/dist/op-factory-call.mjs +1 -1
- package/dist/{planner-jMHqfl1A.mjs → planner-Ciq8p_dL.mjs} +3 -3
- package/dist/{planner-jMHqfl1A.mjs.map → planner-Ciq8p_dL.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-CyyvoPmm.mjs → planner-produced-sqlite-migration-0xPEm3R1.mjs} +2 -2
- package/dist/{planner-produced-sqlite-migration-CyyvoPmm.mjs.map → planner-produced-sqlite-migration-0xPEm3R1.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-BWpnDmhM.d.mts → planner-produced-sqlite-migration-CpgsY-M9.d.mts} +2 -2
- package/dist/{planner-produced-sqlite-migration-BWpnDmhM.d.mts.map → planner-produced-sqlite-migration-CpgsY-M9.d.mts.map} +1 -1
- package/dist/planner-produced-sqlite-migration.d.mts +1 -1
- package/dist/planner-produced-sqlite-migration.mjs +1 -1
- package/dist/planner.d.mts +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/shared-Dhc8mLK1.d.mts.map +1 -1
- package/dist/{sqlite-migration-DhW4ycZV.mjs → sqlite-migration-A0rwqPOG.mjs} +32 -13
- 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/migrations/op-factory-call.ts +191 -43
- 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/sqlite-migration.ts +82 -14
- package/src/exports/contract-free.ts +8 -0
- package/src/exports/migration.ts +0 -3
- package/dist/ddl-CH8V_qcd.mjs +0 -23
- package/dist/ddl-CH8V_qcd.mjs.map +0 -1
- package/dist/op-factory-call-z4TT72k3.mjs.map +0 -1
- package/dist/sqlite-migration-CJrASAxf.d.mts +0 -46
- package/dist/sqlite-migration-CJrASAxf.d.mts.map +0 -1
- package/dist/sqlite-migration-DhW4ycZV.mjs.map +0 -1
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz.mjs";
|
|
2
|
-
import { DdlColumn, DdlTableConstraint } from "@prisma-next/sql-relational-core/ast";
|
|
3
|
-
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
4
|
-
import { Migration } from "@prisma-next/family-sql/migration";
|
|
5
|
-
import { ControlStack } from "@prisma-next/framework-components/control";
|
|
6
|
-
import { SqlControlAdapter } from "@prisma-next/family-sql/control-adapter";
|
|
7
|
-
|
|
8
|
-
//#region src/core/migrations/sqlite-migration.d.ts
|
|
9
|
-
/**
|
|
10
|
-
* Target-owned base class for SQLite migrations. Fixes the `SqlMigration`
|
|
11
|
-
* generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the
|
|
12
|
-
* SQLite literal, so both user-authored migrations and renderer-generated
|
|
13
|
-
* scaffolds can extend `SqliteMigration` directly without redeclaring
|
|
14
|
-
* target-local identity.
|
|
15
|
-
*
|
|
16
|
-
* The constructor materializes a single SQLite `SqlControlAdapter` from
|
|
17
|
-
* `stack.adapter.create(stack)` and stores it; the protected `createTable`
|
|
18
|
-
* instance method forwards to `CreateTableCall` with that stored adapter,
|
|
19
|
-
* so user migrations can write `this.createTable({...})` without threading
|
|
20
|
-
* the adapter through every call.
|
|
21
|
-
*/
|
|
22
|
-
declare abstract class SqliteMigration extends Migration<SqlitePlanTargetDetails, 'sqlite'> {
|
|
23
|
-
readonly targetId: "sqlite";
|
|
24
|
-
/**
|
|
25
|
-
* Materialized SQLite control adapter, created once per migration
|
|
26
|
-
* instance from the injected stack. `undefined` only when the migration
|
|
27
|
-
* was instantiated without a stack (test fixtures); `createTable`
|
|
28
|
-
* throws in that case to surface the misuse.
|
|
29
|
-
*/
|
|
30
|
-
protected readonly controlAdapter: SqlControlAdapter<'sqlite'> | undefined;
|
|
31
|
-
constructor(stack?: ControlStack<'sql', 'sqlite'>);
|
|
32
|
-
/**
|
|
33
|
-
* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from
|
|
34
|
-
* the supplied options and lowers it through the stored control adapter.
|
|
35
|
-
* Throws if no adapter is present (i.e. migration instantiated without a stack).
|
|
36
|
-
*/
|
|
37
|
-
protected createTable(options: {
|
|
38
|
-
readonly table: string;
|
|
39
|
-
readonly ifNotExists?: boolean;
|
|
40
|
-
readonly columns: readonly DdlColumn[];
|
|
41
|
-
readonly constraints?: readonly DdlTableConstraint[];
|
|
42
|
-
}): Promise<SqlMigrationPlanOperation<SqlitePlanTargetDetails>>;
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { SqliteMigration as t };
|
|
46
|
-
//# sourceMappingURL=sqlite-migration-CJrASAxf.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-migration-CJrASAxf.d.mts","names":[],"sources":["../src/core/migrations/sqlite-migration.ts"],"mappings":";;;;;;;;;;AAuBA;;;;;;;;;;;uBAAsB,eAAA,SAAwB,SAAA,CAAa,uBAAA;EAAA,SAChD,QAAA;EAD+C;;;;;;EAAA,mBASrC,cAAA,EAAgB,iBAAA;cAEvB,KAAA,GAAQ,YAAA;EAAR;;;;;EAAA,UAeF,WAAA,CAAY,OAAA;IAAA,SACX,KAAA;IAAA,SACA,WAAA;IAAA,SACA,OAAA,WAAkB,SAAA;IAAA,SAClB,WAAA,YAAuB,kBAAA;EAAA,IAC9B,OAAA,CAAQ,yBAAA,CAA0B,uBAAA;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-migration-DhW4ycZV.mjs","names":["SqlMigration"],"sources":["../src/core/errors.ts","../src/core/migrations/sqlite-migration.ts"],"sourcesContent":["import { CliStructuredError } from '@prisma-next/errors/control';\n\n/**\n * A `SqliteMigration` instance method that needs the materialized control\n * adapter (currently only `this.createTable(...)`) was invoked, but the\n * migration was constructed without a `ControlStack`. Concrete authoring\n * usage always goes through the migration CLI entrypoint, which assembles\n * a stack from the loaded `prisma-next.config.ts`; reaching this error\n * means a test fixture or ad-hoc consumer instantiated `SqliteMigration`\n * with the no-arg form (legal for `operations` / `describe` introspection\n * only).\n *\n * Distinct from `PN-MIG-2001` (placeholder not filled) because the missing\n * input is the stack itself, not the per-operation contract.\n *\n * Lives in `@prisma-next/target-sqlite/errors` rather than the shared\n * framework migration errors module because the failure is target-specific:\n * the contract it talks about (`SqliteMigration`, the SQLite control\n * adapter, the SQLite-target stack) only exists in this package.\n */\nexport function errorSqliteMigrationStackMissing(): CliStructuredError {\n return new CliStructuredError('2008', 'SqliteMigration.createTable requires a control adapter', {\n domain: 'MIG',\n why: 'SqliteMigration.createTable was invoked on an instance constructed without a ControlStack. The stored controlAdapter is undefined, so createTable cannot lower its DDL node.',\n fix: 'Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.',\n meta: {},\n });\n}\n","import type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport { Migration as SqlMigration } from '@prisma-next/family-sql/migration';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-core/ast';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { errorSqliteMigrationStackMissing } from '../errors';\nimport { CreateTableCall } from './op-factory-call';\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 *\n * The constructor materializes a single SQLite `SqlControlAdapter` from\n * `stack.adapter.create(stack)` and stores it; the protected `createTable`\n * instance method forwards to `CreateTableCall` with that stored adapter,\n * so user migrations can write `this.createTable({...})` without threading\n * the adapter through every call.\n */\nexport abstract class SqliteMigration extends SqlMigration<SqlitePlanTargetDetails, 'sqlite'> {\n readonly targetId = 'sqlite' as const;\n\n /**\n * Materialized SQLite control adapter, created once per migration\n * instance from the injected stack. `undefined` only when the migration\n * was instantiated without a stack (test fixtures); `createTable`\n * throws in that case to surface the misuse.\n */\n protected readonly controlAdapter: SqlControlAdapter<'sqlite'> | undefined;\n\n constructor(stack?: ControlStack<'sql', 'sqlite'>) {\n super(stack);\n this.controlAdapter = stack?.adapter\n ? blindCast<\n SqlControlAdapter<'sqlite'>,\n 'The SQLite descriptor create() returns SqlControlAdapter<sqlite>; typed as wider ControlAdapterInstance at the framework boundary'\n >(stack.adapter.create(stack))\n : undefined;\n }\n\n /**\n * Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n * the supplied options and lowers it through the stored control adapter.\n * Throws if no adapter is present (i.e. migration instantiated without a stack).\n */\n protected createTable(options: {\n readonly table: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n readonly constraints?: readonly DdlTableConstraint[];\n }): Promise<SqlMigrationPlanOperation<SqlitePlanTargetDetails>> {\n if (!this.controlAdapter) {\n throw errorSqliteMigrationStackMissing();\n }\n return new CreateTableCall(options.table, options.columns, options.constraints).toOp(\n this.controlAdapter,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,mCAAuD;CACrE,OAAO,IAAI,mBAAmB,QAAQ,0DAA0D;EAC9F,QAAQ;EACR,KAAK;EACL,KAAK;EACL,MAAM,CAAC;CACT,CAAC;AACH;;;;;;;;;;;;;;;;ACJA,IAAsB,kBAAtB,cAA8CA,UAAgD;CAC5F,WAAoB;;;;;;;CAQpB;CAEA,YAAY,OAAuC;EACjD,MAAM,KAAK;EACX,KAAK,iBAAiB,OAAO,UACzB,UAGE,MAAM,QAAQ,OAAO,KAAK,CAAC,IAC7B,KAAA;CACN;;;;;;CAOA,YAAsB,SAK0C;EAC9D,IAAI,CAAC,KAAK,gBACR,MAAM,iCAAiC;EAEzC,OAAO,IAAI,gBAAgB,QAAQ,OAAO,QAAQ,SAAS,QAAQ,WAAW,CAAC,CAAC,KAC9E,KAAK,cACP;CACF;AACF"}
|