@prisma-next/target-postgres 0.7.0 → 0.8.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{codec-ids-CplrEfmx.d.mts → codec-ids-RvYfmUmi.d.mts} +1 -1
- package/dist/{codec-ids-CplrEfmx.d.mts.map → codec-ids-RvYfmUmi.d.mts.map} +1 -1
- package/dist/codec-ids.d.mts +1 -1
- package/dist/{codec-types-lrsb3N07.d.mts → codec-types-667FxIW8.d.mts} +2 -2
- package/dist/{codec-types-lrsb3N07.d.mts.map → codec-types-667FxIW8.d.mts.map} +1 -1
- package/dist/codec-types.d.mts +1 -1
- package/dist/{codecs-Cue97Xqf.d.mts → codecs-DXeDABSO.d.mts} +2 -2
- package/dist/{codecs-Cue97Xqf.d.mts.map → codecs-DXeDABSO.d.mts.map} +1 -1
- package/dist/codecs.d.mts +1 -1
- package/dist/control.d.mts +2 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +38 -7
- package/dist/control.mjs.map +1 -1
- package/dist/{data-transform-bIeAcZIJ.d.mts → data-transform-B6p02mFJ.d.mts} +3 -3
- package/dist/{data-transform-bIeAcZIJ.d.mts.map → data-transform-B6p02mFJ.d.mts.map} +1 -1
- package/dist/{data-transform-DKWXdHuZ.mjs → data-transform-aF9az88u.mjs} +1 -1
- package/dist/{data-transform-DKWXdHuZ.mjs.map → data-transform-aF9az88u.mjs.map} +1 -1
- package/dist/data-transform.d.mts +1 -1
- package/dist/data-transform.mjs +1 -1
- package/dist/{default-normalizer-C8XyZj85.mjs → default-normalizer-DHCsbfjc.mjs} +1 -1
- package/dist/{default-normalizer-C8XyZj85.mjs.map → default-normalizer-DHCsbfjc.mjs.map} +1 -1
- package/dist/default-normalizer.mjs +1 -1
- package/dist/descriptor-meta-DFUCClk_.mjs +124 -0
- package/dist/descriptor-meta-DFUCClk_.mjs.map +1 -0
- package/dist/enum-planning-Bqp96iIw.mjs +63 -0
- package/dist/enum-planning-Bqp96iIw.mjs.map +1 -0
- package/dist/enum-planning.d.mts +48 -0
- package/dist/enum-planning.d.mts.map +1 -0
- package/dist/enum-planning.mjs +2 -0
- package/dist/{errors-Chm2bKcS.mjs → errors-BiOloWUh.mjs} +1 -1
- package/dist/{errors-Chm2bKcS.mjs.map → errors-BiOloWUh.mjs.map} +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/{issue-planner-DQ6WJkad.mjs → issue-planner-BhWVYyE1.mjs} +114 -49
- package/dist/issue-planner-BhWVYyE1.mjs.map +1 -0
- package/dist/issue-planner.d.mts +11 -9
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +4 -4
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +3 -3
- package/dist/{native-type-normalizer-Cry4QoLf.mjs → native-type-normalizer-DMikJJ1V.mjs} +1 -1
- package/dist/{native-type-normalizer-Cry4QoLf.mjs.map → native-type-normalizer-DMikJJ1V.mjs.map} +1 -1
- package/dist/native-type-normalizer.mjs +1 -1
- package/dist/{op-factory-call-DeaFxa8_.mjs → op-factory-call-DerP9BoT.mjs} +8 -5
- package/dist/{op-factory-call-DeaFxa8_.mjs.map → op-factory-call-DerP9BoT.mjs.map} +1 -1
- package/dist/{op-factory-call-UFpUPJL6.d.mts → op-factory-call-c1zELk3U.d.mts} +5 -4
- package/dist/{op-factory-call-UFpUPJL6.d.mts.map → op-factory-call-c1zELk3U.d.mts.map} +1 -1
- package/dist/op-factory-call.d.mts +1 -1
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.d.mts +13 -24
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-CYtKhLYa.mjs → planner-DSDXUbQ4.mjs} +8 -6
- package/dist/planner-DSDXUbQ4.mjs.map +1 -0
- package/dist/{planner-ddl-builders-CLB7Umhh.mjs → planner-ddl-builders-5QIyhBUF.mjs} +3 -3
- package/dist/planner-ddl-builders-5QIyhBUF.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +5 -5
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-ddl-builders.mjs +1 -1
- package/dist/{planner-identity-values-DTx0gePL.mjs → planner-identity-values-BUYNOCwb.mjs} +9 -3
- package/dist/planner-identity-values-BUYNOCwb.mjs.map +1 -0
- package/dist/planner-identity-values.d.mts +1 -1
- package/dist/planner-identity-values.d.mts.map +1 -1
- package/dist/planner-identity-values.mjs +1 -1
- package/dist/{planner-produced-postgres-migration-CjxWIVgh.d.mts → planner-produced-postgres-migration-D34ftfEK.d.mts} +3 -3
- package/dist/{planner-produced-postgres-migration-CjxWIVgh.d.mts.map → planner-produced-postgres-migration-D34ftfEK.d.mts.map} +1 -1
- package/dist/{planner-produced-postgres-migration-DphktB2N.mjs → planner-produced-postgres-migration-D8OCSSLM.mjs} +4 -4
- package/dist/{planner-produced-postgres-migration-DphktB2N.mjs.map → planner-produced-postgres-migration-D8OCSSLM.mjs.map} +1 -1
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/{planner-schema-lookup-B1ags8ys.mjs → planner-schema-lookup--u9whY_Y.mjs} +1 -1
- package/dist/{planner-schema-lookup-B1ags8ys.mjs.map → planner-schema-lookup--u9whY_Y.mjs.map} +1 -1
- package/dist/planner-schema-lookup.mjs +1 -1
- package/dist/{planner-sql-checks-DwZvGlV4.mjs → planner-sql-checks-Cd016Ycs.mjs} +7 -2
- package/dist/planner-sql-checks-Cd016Ycs.mjs.map +1 -0
- package/dist/planner-sql-checks.d.mts +2 -2
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/{planner-target-details-bVVcanWh.d.mts → planner-target-details-iYJwzFHP.d.mts} +1 -1
- package/dist/{planner-target-details-bVVcanWh.d.mts.map → planner-target-details-iYJwzFHP.d.mts.map} +1 -1
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner.d.mts +1 -1
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/postgres-contract-serializer-D5VJk6lo.mjs +61 -0
- package/dist/postgres-contract-serializer-D5VJk6lo.mjs.map +1 -0
- package/dist/postgres-enum-type-CrKq8au9.d.mts +69 -0
- package/dist/postgres-enum-type-CrKq8au9.d.mts.map +1 -0
- package/dist/postgres-enum-type-DS-KLVRH.mjs +61 -0
- package/dist/postgres-enum-type-DS-KLVRH.mjs.map +1 -0
- package/dist/{postgres-migration-UkcHfZAA.d.mts → postgres-migration-CiQzhcMe.d.mts} +4 -4
- package/dist/{postgres-migration-UkcHfZAA.d.mts.map → postgres-migration-CiQzhcMe.d.mts.map} +1 -1
- package/dist/{postgres-migration-Bkv140RW.mjs → postgres-migration-Fdxzo6l2.mjs} +3 -3
- package/dist/{postgres-migration-Bkv140RW.mjs.map → postgres-migration-Fdxzo6l2.mjs.map} +1 -1
- package/dist/{render-ops--1nnfNus.mjs → render-ops-CkiuHSNj.mjs} +1 -1
- package/dist/{render-ops--1nnfNus.mjs.map → render-ops-CkiuHSNj.mjs.map} +1 -1
- package/dist/render-ops.d.mts +1 -1
- package/dist/render-ops.mjs +1 -1
- package/dist/{render-typescript-D3doH-vX.mjs → render-typescript-C9XWI8Ld.mjs} +1 -1
- package/dist/{render-typescript-D3doH-vX.mjs.map → render-typescript-C9XWI8Ld.mjs.map} +1 -1
- package/dist/render-typescript.mjs +1 -1
- package/dist/runtime.d.mts +25 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +3 -2
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-MpwjwAjM.d.mts → shared-DLYdmYo-.d.mts} +2 -2
- package/dist/{shared-MpwjwAjM.d.mts.map → shared-DLYdmYo-.d.mts.map} +1 -1
- package/dist/{sql-utils-CggjWNij.mjs → sql-utils-BewXAnsG.mjs} +1 -1
- package/dist/{sql-utils-CggjWNij.mjs.map → sql-utils-BewXAnsG.mjs.map} +1 -1
- package/dist/sql-utils.mjs +1 -1
- package/dist/{statement-builders-BT889jV0.mjs → statement-builders-BSIQMClE.mjs} +1 -1
- package/dist/{statement-builders-BT889jV0.mjs.map → statement-builders-BSIQMClE.mjs.map} +1 -1
- package/dist/statement-builders.mjs +1 -1
- package/dist/{tables-DgYIXjUt.mjs → tables-Ce_Q0I8B.mjs} +7 -7
- package/dist/{tables-DgYIXjUt.mjs.map → tables-Ce_Q0I8B.mjs.map} +1 -1
- package/dist/{types-CTqpysRY.d.mts → types-Dq74Z3eu.d.mts} +1 -1
- package/dist/types-Dq74Z3eu.d.mts.map +1 -0
- package/dist/types.d.mts +3 -2
- package/dist/types.mjs +2 -1
- package/package.json +20 -19
- package/src/core/authoring.ts +41 -9
- package/src/core/descriptor-meta.ts +6 -1
- package/src/core/migrations/enum-planning.ts +93 -0
- package/src/core/migrations/issue-planner.ts +25 -13
- package/src/core/migrations/op-factory-call.ts +12 -3
- package/src/core/migrations/operations/enums.ts +5 -4
- package/src/core/migrations/planner-ddl-builders.ts +4 -3
- package/src/core/migrations/planner-identity-values.ts +28 -4
- package/src/core/migrations/planner-recipes.ts +6 -2
- package/src/core/migrations/planner-sql-checks.ts +6 -2
- package/src/core/migrations/planner-strategies.ts +187 -74
- package/src/core/migrations/planner-type-resolution.ts +20 -2
- package/src/core/migrations/planner.ts +3 -0
- package/src/core/migrations/runner.ts +3 -0
- package/src/core/postgres-contract-serializer.ts +70 -0
- package/src/core/postgres-enum-type.ts +85 -0
- package/src/core/postgres-schema-verifier.ts +37 -0
- package/src/exports/control.ts +4 -0
- package/src/exports/enum-planning.ts +6 -0
- package/src/exports/runtime.ts +2 -0
- package/src/exports/types.ts +1 -0
- package/dist/descriptor-meta-Dde_BS3K.mjs +0 -99
- package/dist/descriptor-meta-Dde_BS3K.mjs.map +0 -1
- package/dist/issue-planner-DQ6WJkad.mjs.map +0 -1
- package/dist/planner-CYtKhLYa.mjs.map +0 -1
- package/dist/planner-ddl-builders-CLB7Umhh.mjs.map +0 -1
- package/dist/planner-identity-values-DTx0gePL.mjs.map +0 -1
- package/dist/planner-sql-checks-DwZvGlV4.mjs.map +0 -1
- package/dist/types-CTqpysRY.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as PostgresPlanTargetDetails } from "./planner-target-details-
|
|
2
|
-
import { n as ForeignKeySpec, t as ColumnSpec } from "./shared-
|
|
1
|
+
import { t as PostgresPlanTargetDetails } from "./planner-target-details-iYJwzFHP.mjs";
|
|
2
|
+
import { n as ForeignKeySpec, t as ColumnSpec } from "./shared-DLYdmYo-.mjs";
|
|
3
3
|
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
4
4
|
import { ImportRequirement, TsExpression } from "@prisma-next/ts-render";
|
|
5
5
|
import { MigrationOperationClass, OpFactoryCall } from "@prisma-next/framework-components/control";
|
|
@@ -204,9 +204,10 @@ declare class CreateEnumTypeCall extends PostgresOpFactoryCallNode {
|
|
|
204
204
|
readonly operationClass: "additive";
|
|
205
205
|
readonly schemaName: string;
|
|
206
206
|
readonly typeName: string;
|
|
207
|
+
readonly nativeType: string;
|
|
207
208
|
readonly values: readonly string[];
|
|
208
209
|
readonly label: string;
|
|
209
|
-
constructor(schemaName: string, typeName: string, values: readonly string[]);
|
|
210
|
+
constructor(schemaName: string, typeName: string, values: readonly string[], nativeType?: string);
|
|
210
211
|
toOp(): Op;
|
|
211
212
|
renderTypeScript(): string;
|
|
212
213
|
}
|
|
@@ -304,4 +305,4 @@ declare class DataTransformCall extends PostgresOpFactoryCallNode {
|
|
|
304
305
|
type PostgresOpFactoryCall = CreateTableCall | DropTableCall | AddColumnCall | DropColumnCall | AlterColumnTypeCall | SetNotNullCall | DropNotNullCall | SetDefaultCall | DropDefaultCall | AddPrimaryKeyCall | AddForeignKeyCall | AddUniqueCall | CreateIndexCall | DropIndexCall | DropConstraintCall | CreateEnumTypeCall | AddEnumValuesCall | DropEnumTypeCall | RenameTypeCall | RawSqlCall | CreateExtensionCall | CreateSchemaCall | DataTransformCall;
|
|
305
306
|
//#endregion
|
|
306
307
|
export { SetDefaultCall as C, RenameTypeCall as S, DropIndexCall as _, AddUniqueCall as a, PostgresOpFactoryCall as b, CreateExtensionCall as c, CreateTableCall as d, DataTransformCall as f, DropEnumTypeCall as g, DropDefaultCall as h, AddPrimaryKeyCall as i, CreateIndexCall as l, DropConstraintCall as m, AddEnumValuesCall as n, AlterColumnTypeCall as o, DropColumnCall as p, AddForeignKeyCall as r, CreateEnumTypeCall as s, AddColumnCall as t, CreateSchemaCall as u, DropNotNullCall as v, SetNotNullCall as w, RawSqlCall as x, DropTableCall as y };
|
|
307
|
-
//# sourceMappingURL=op-factory-call-
|
|
308
|
+
//# sourceMappingURL=op-factory-call-c1zELk3U.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-factory-call-
|
|
1
|
+
{"version":3,"file":"op-factory-call-c1zELk3U.d.mts","names":[],"sources":["../src/core/migrations/op-factory-call.ts"],"mappings":";;;;;;;KA8CK,EAAA,GAAK,yBAAA,CAA0B,yBAAA;AAAA,uBAIrB,yBAAA,SAAkC,YAAA,YAAwB,aAAA;EAAA,kBACrD,WAAA;EAAA,kBACA,cAAA,EAAgB,uBAAA;EAAA,kBAChB,KAAA;EAAA,SACT,IAAA,CAAA,GAAQ,EAAA;EAEjB,kBAAA,CAAA,YAA+B,iBAAA;EAAA,UAIrB,MAAA,CAAA;AAAA;AAAA,UASK,qBAAA;EAAA,SACN,OAAA;AAAA;AAAA,cAGE,eAAA,SAAwB,yBAAA;EAAA,SAC1B,WAAA;EAAA,SACA,cAAA;EAAA,SACA,UAAA;EAAA,SACA,SAAA;EAAA,SACA,OAAA,WAAkB,UAAA;EAAA,SAClB,UAAA,EAAY,qBAAA;EAAA,SACZ,KAAA;cAGP,UAAA,UACA,SAAA,UACA,OAAA,WAAkB,UAAA,IAClB,UAAA,GAAa,qBAAA;EAWf,IAAA,CAA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,SACA,aAAA;EAAA,SACA,KAAA;cAEG,aAAA;EAOZ,IAAA,CAAA,GAAQ,EAAA;EAIR,gBAAA,CAAA;AAAA;AAAA,cAKW,gBAAA,SAAyB,yBAAA;EAAA,SAC3B,WAAA;EAAA,SACA,cAAA;EAAA,SACA,UAAA;EAAA,SACA,KAAA;cAEG,UAAA;EAOZ,IAAA,CAAA,GAAQ,EAAA;EAIR,gBAAA,CAAA;AAAA;;;;;;;;cAgBW,iBAAA,SAA0B,yBAAA;EAAA,SAC5B,WAAA;EAAA,SACA,cAAA,EAAgB,uBAAA;EAAA,SAChB,KAAA;EAAA,SACA,SAAA;EAAA,SACA,OAAA;cAGP,KAAA,UACA,SAAA,UACA,OAAA,UACA,cAAA,GAAgB,uBAAA;EAUlB,IAAA,CAAA,GAAQ,EAAA;EAIR,gBAAA,CAAA;EASS,kBAAA,CAAA,YAA+B,iBAAA;AAAA;AAAA,KAa9B,qBAAA,GACR,eAAA,GACA,aAAA,GACA,aAAA,GACA,cAAA,GACA,mBAAA,GACA,cAAA,GACA,eAAA,GACA,cAAA,GACA,eAAA,GACA,iBAAA,GACA,iBAAA,GACA,aAAA,GACA,eAAA,GACA,aAAA,GACA,kBAAA,GACA,kBAAA,GACA,iBAAA,GACA,gBAAA,GACA,cAAA,GACA,UAAA,GACA,mBAAA,GACA,gBAAA,GACA,iBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as SetDefaultCall, S as RenameTypeCall, _ as DropIndexCall, a as AddUniqueCall, c as CreateExtensionCall, d as CreateTableCall, f as DataTransformCall, g as DropEnumTypeCall, h as DropDefaultCall, i as AddPrimaryKeyCall, l as CreateIndexCall, m as DropConstraintCall, n as AddEnumValuesCall, o as AlterColumnTypeCall, p as DropColumnCall, r as AddForeignKeyCall, s as CreateEnumTypeCall, t as AddColumnCall, u as CreateSchemaCall, v as DropNotNullCall, w as SetNotNullCall, x as RawSqlCall, y as DropTableCall } from "./op-factory-call-
|
|
1
|
+
import { C as SetDefaultCall, S as RenameTypeCall, _ as DropIndexCall, a as AddUniqueCall, c as CreateExtensionCall, d as CreateTableCall, f as DataTransformCall, g as DropEnumTypeCall, h as DropDefaultCall, i as AddPrimaryKeyCall, l as CreateIndexCall, m as DropConstraintCall, n as AddEnumValuesCall, o as AlterColumnTypeCall, p as DropColumnCall, r as AddForeignKeyCall, s as CreateEnumTypeCall, t as AddColumnCall, u as CreateSchemaCall, v as DropNotNullCall, w as SetNotNullCall, x as RawSqlCall, y as DropTableCall } from "./op-factory-call-c1zELk3U.mjs";
|
|
2
2
|
export { AddColumnCall, AddEnumValuesCall, AddForeignKeyCall, AddPrimaryKeyCall, AddUniqueCall, AlterColumnTypeCall, CreateEnumTypeCall, CreateExtensionCall, CreateIndexCall, CreateSchemaCall, CreateTableCall, DataTransformCall, DropColumnCall, DropConstraintCall, DropDefaultCall, DropEnumTypeCall, DropIndexCall, DropNotNullCall, DropTableCall, RawSqlCall, RenameTypeCall, SetDefaultCall, SetNotNullCall };
|
package/dist/op-factory-call.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as SetNotNullCall, S as SetDefaultCall, _ as DropIndexCall, a as AddUniqueCall, b as RawSqlCall, c as CreateExtensionCall, d as CreateTableCall, f as DataTransformCall, g as DropEnumTypeCall, h as DropDefaultCall, i as AddPrimaryKeyCall, l as CreateIndexCall, m as DropConstraintCall, n as AddEnumValuesCall, o as AlterColumnTypeCall, p as DropColumnCall, r as AddForeignKeyCall, s as CreateEnumTypeCall, t as AddColumnCall, u as CreateSchemaCall, v as DropNotNullCall, x as RenameTypeCall, y as DropTableCall } from "./op-factory-call-
|
|
1
|
+
import { C as SetNotNullCall, S as SetDefaultCall, _ as DropIndexCall, a as AddUniqueCall, b as RawSqlCall, c as CreateExtensionCall, d as CreateTableCall, f as DataTransformCall, g as DropEnumTypeCall, h as DropDefaultCall, i as AddPrimaryKeyCall, l as CreateIndexCall, m as DropConstraintCall, n as AddEnumValuesCall, o as AlterColumnTypeCall, p as DropColumnCall, r as AddForeignKeyCall, s as CreateEnumTypeCall, t as AddColumnCall, u as CreateSchemaCall, v as DropNotNullCall, x as RenameTypeCall, y as DropTableCall } from "./op-factory-call-DerP9BoT.mjs";
|
|
2
2
|
export { AddColumnCall, AddEnumValuesCall, AddForeignKeyCall, AddPrimaryKeyCall, AddUniqueCall, AlterColumnTypeCall, CreateEnumTypeCall, CreateExtensionCall, CreateIndexCall, CreateSchemaCall, CreateTableCall, DataTransformCall, DropColumnCall, DropConstraintCall, DropDefaultCall, DropEnumTypeCall, DropIndexCall, DropNotNullCall, DropTableCall, RawSqlCall, RenameTypeCall, SetDefaultCall, SetNotNullCall };
|
package/dist/pack.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { r as CodecTypes } from "./codec-types-
|
|
1
|
+
import { r as CodecTypes } from "./codec-types-667FxIW8.mjs";
|
|
2
|
+
import { n as PostgresEnumTypeInput } from "./postgres-enum-type-CrKq8au9.mjs";
|
|
3
|
+
import * as _$_prisma_next_sql_contract_types0 from "@prisma-next/sql-contract/types";
|
|
2
4
|
|
|
3
5
|
//#region src/core/descriptor-meta.d.ts
|
|
4
6
|
declare const postgresTargetDescriptorMetaBase: {
|
|
@@ -9,29 +11,7 @@ declare const postgresTargetDescriptorMetaBase: {
|
|
|
9
11
|
readonly version: "0.0.1";
|
|
10
12
|
readonly capabilities: {};
|
|
11
13
|
readonly authoring: {
|
|
12
|
-
readonly type: {
|
|
13
|
-
readonly enum: {
|
|
14
|
-
readonly kind: "typeConstructor";
|
|
15
|
-
readonly args: readonly [{
|
|
16
|
-
readonly kind: "string";
|
|
17
|
-
}, {
|
|
18
|
-
readonly kind: "stringArray";
|
|
19
|
-
}];
|
|
20
|
-
readonly output: {
|
|
21
|
-
readonly codecId: "pg/enum@1";
|
|
22
|
-
readonly nativeType: {
|
|
23
|
-
readonly kind: "arg";
|
|
24
|
-
readonly index: 0;
|
|
25
|
-
};
|
|
26
|
-
readonly typeParams: {
|
|
27
|
-
readonly values: {
|
|
28
|
-
readonly kind: "arg";
|
|
29
|
-
readonly index: 1;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
14
|
+
readonly type: {};
|
|
35
15
|
readonly field: {
|
|
36
16
|
readonly text: {
|
|
37
17
|
readonly kind: "fieldPreset";
|
|
@@ -127,6 +107,15 @@ declare const postgresTargetDescriptorMetaBase: {
|
|
|
127
107
|
};
|
|
128
108
|
};
|
|
129
109
|
};
|
|
110
|
+
readonly entityTypes: {
|
|
111
|
+
readonly enum: {
|
|
112
|
+
readonly kind: "entity";
|
|
113
|
+
readonly discriminator: "postgres-enum";
|
|
114
|
+
readonly output: {
|
|
115
|
+
readonly factory: (input: PostgresEnumTypeInput) => _$_prisma_next_sql_contract_types0.PostgresEnumStorageEntry;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
130
119
|
};
|
|
131
120
|
};
|
|
132
121
|
declare const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {
|
package/dist/pack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"mappings":";;;;;cAOM,gCAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAYI,qBAAA,KAAA,kCAAA,CAAA,wBAAA;QAAA;MAAA;IAAA;EAAA;AAAA;AAAA,cAEG,4BAAA,SAAqC,gCAAA;EAAA,SACvC,YAAA,GAAe,UAAA;AAAA"}
|
package/dist/pack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DFUCClk_.mjs";
|
|
2
2
|
export { postgresTargetDescriptorMeta as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { t as parsePostgresDefault } from "./default-normalizer-
|
|
2
|
-
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { t as parsePostgresDefault } from "./default-normalizer-DHCsbfjc.mjs";
|
|
2
|
+
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-DMikJJ1V.mjs";
|
|
3
|
+
import { r as readExistingEnumValues } from "./enum-planning-Bqp96iIw.mjs";
|
|
4
|
+
import { n as postgresPlannerStrategies, t as planIssues } from "./issue-planner-BhWVYyE1.mjs";
|
|
5
|
+
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-D8OCSSLM.mjs";
|
|
5
6
|
import { extractCodecControlHooks, planFieldEventOperations, plannerFailure } from "@prisma-next/family-sql/control";
|
|
6
7
|
import { verifySqlSchema } from "@prisma-next/family-sql/schema-verify";
|
|
7
8
|
//#region src/core/migrations/planner.ts
|
|
@@ -94,11 +95,12 @@ var PostgresMigrationPlanner = class {
|
|
|
94
95
|
typeMetadataRegistry: /* @__PURE__ */ new Map(),
|
|
95
96
|
frameworkComponents: options.frameworkComponents,
|
|
96
97
|
normalizeDefault: parsePostgresDefault,
|
|
97
|
-
normalizeNativeType: normalizeSchemaNativeType
|
|
98
|
+
normalizeNativeType: normalizeSchemaNativeType,
|
|
99
|
+
resolveExistingEnumValues: (schema, enumType) => readExistingEnumValues(schema, enumType.nativeType)
|
|
98
100
|
}).schema.issues;
|
|
99
101
|
}
|
|
100
102
|
};
|
|
101
103
|
//#endregion
|
|
102
104
|
export { createPostgresMigrationPlanner as t };
|
|
103
105
|
|
|
104
|
-
//# sourceMappingURL=planner-
|
|
106
|
+
//# sourceMappingURL=planner-DSDXUbQ4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-DSDXUbQ4.mjs","names":[],"sources":["../src/core/migrations/planner.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport type {\n MigrationOperationPolicy,\n SqlMigrationPlannerPlanOptions,\n SqlPlannerFailureResult,\n} from '@prisma-next/family-sql/control';\nimport {\n extractCodecControlHooks,\n planFieldEventOperations,\n plannerFailure,\n} from '@prisma-next/family-sql/control';\nimport { verifySqlSchema } from '@prisma-next/family-sql/schema-verify';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type {\n MigrationPlanner,\n MigrationPlanWithAuthoringSurface,\n MigrationScaffoldContext,\n SchemaIssue,\n} from '@prisma-next/framework-components/control';\nimport { parsePostgresDefault } from '../default-normalizer';\nimport { normalizeSchemaNativeType } from '../native-type-normalizer';\nimport { readExistingEnumValues } from './enum-planning';\nimport { planIssues } from './issue-planner';\nimport { TypeScriptRenderablePostgresMigration } from './planner-produced-postgres-migration';\nimport { postgresPlannerStrategies } from './planner-strategies';\n\ntype PlannerFrameworkComponents = SqlMigrationPlannerPlanOptions extends {\n readonly frameworkComponents: infer T;\n}\n ? T\n : ReadonlyArray<unknown>;\n\ntype PlannerOptionsWithComponents = SqlMigrationPlannerPlanOptions & {\n readonly frameworkComponents: PlannerFrameworkComponents;\n};\n\ntype VerifySqlSchemaOptionsWithComponents = Parameters<typeof verifySqlSchema>[0] & {\n readonly frameworkComponents: PlannerFrameworkComponents;\n};\n\ninterface PlannerConfig {\n readonly defaultSchema: string;\n}\n\nconst DEFAULT_PLANNER_CONFIG: PlannerConfig = {\n defaultSchema: 'public',\n};\n\nexport function createPostgresMigrationPlanner(\n config: Partial<PlannerConfig> = {},\n): PostgresMigrationPlanner {\n return new PostgresMigrationPlanner({\n ...DEFAULT_PLANNER_CONFIG,\n ...config,\n });\n}\n\n/**\n * Result of `PostgresMigrationPlanner.plan()`. A discriminated union whose\n * success variant carries a `TypeScriptRenderablePostgresMigration` — a\n * migration object that both the CLI (via `renderTypeScript()`) and the\n * SQL-typed callers (via `operations`, `describe()`, etc.) consume\n * uniformly.\n */\nexport type PostgresPlanResult =\n | { readonly kind: 'success'; readonly plan: TypeScriptRenderablePostgresMigration }\n | SqlPlannerFailureResult;\n\n/**\n * Postgres migration planner — a thin wrapper over `planIssues`.\n *\n * `plan()` verifies the live schema against the target contract (producing\n * `SchemaIssue[]`) and delegates to `planIssues` with the unified\n * `postgresPlannerStrategies` list: enum-change, NOT-NULL backfill,\n * type-change, nullable-tightening, codec-hook storage types,\n * component-declared dependency installs, and shared-temp-default /\n * empty-table-guarded NOT-NULL add-column. The same strategy list runs for\n * `migration plan`, `db update`, and `db init`; behavior diverges purely on\n * `policy.allowedOperationClasses` (the data-safe strategies short-circuit\n * when `'data'` is excluded). The issue planner applies operation-class\n * policy gates and emits a single `PostgresOpFactoryCall[]` that drives both\n * the runtime-ops view (via `renderOps`) and the `renderTypeScript()`\n * authoring surface.\n */\nexport class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgres'> {\n constructor(private readonly config: PlannerConfig) {}\n\n plan(options: {\n readonly contract: unknown;\n readonly schema: unknown;\n readonly policy: MigrationOperationPolicy;\n /**\n * The \"from\" contract (state the planner assumes the database starts\n * at), or `null` for reconciliation flows. Only `migration plan` ever\n * supplies a non-null value; `db update` / `db init` reconcile against\n * the live schema and pass `null`. When present alongside the\n * `'data'` operation class, strategies that need from/to column-shape\n * comparisons (unsafe type change, nullability tightening) activate.\n *\n * Typed as the framework `Contract | null` to satisfy the\n * `MigrationPlanner` interface contract; `planSql` narrows to the SQL\n * shape via `SqlMigrationPlannerPlanOptions`. Used to populate\n * `describe().from` on the produced plan as\n * `fromContract?.storage.storageHash ?? null`.\n */\n readonly fromContract: Contract | null;\n readonly schemaName?: string;\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n /**\n * Contract space this plan applies to. Stamped onto the produced\n * {@link TypeScriptRenderablePostgresMigration.spaceId} so the runner keys\n * the marker row by the right space.\n */\n readonly spaceId: string;\n }): PostgresPlanResult {\n return this.planSql(options as SqlMigrationPlannerPlanOptions);\n }\n\n emptyMigration(\n context: MigrationScaffoldContext,\n spaceId: string,\n ): MigrationPlanWithAuthoringSurface {\n return new TypeScriptRenderablePostgresMigration(\n [],\n {\n from: context.fromHash,\n to: context.toHash,\n },\n spaceId,\n );\n }\n\n private planSql(options: SqlMigrationPlannerPlanOptions): PostgresPlanResult {\n const schemaName = options.schemaName ?? this.config.defaultSchema;\n const policyResult = this.ensureAdditivePolicy(options.policy);\n if (policyResult) {\n return policyResult;\n }\n\n const schemaIssues = this.collectSchemaIssues(options);\n const codecHooks = extractCodecControlHooks(options.frameworkComponents);\n const storageTypes = options.contract.storage.types ?? {};\n\n const result = planIssues({\n issues: schemaIssues,\n toContract: options.contract,\n // `fromContract` is only supplied by `migration plan`. It is `null` for\n // `db update` / `db init`, which means data-safety strategies needing\n // from/to comparisons (unsafe type change, nullable tightening) are\n // inapplicable there — reconciliation falls through to\n // `mapIssueToCall`'s direct destructive handlers.\n fromContract: options.fromContract,\n schemaName,\n codecHooks,\n storageTypes,\n schema: options.schema,\n policy: options.policy,\n frameworkComponents: options.frameworkComponents,\n strategies: postgresPlannerStrategies,\n });\n\n if (!result.ok) {\n return plannerFailure(result.failure);\n }\n\n // Inline `onFieldEvent`-emitted ops after structural DDL. The fixed\n // ordering is `structural → added → dropped → altered`, with\n // within-group sorting by `(tableName, fieldName)` so re-emits are\n // byte-stable. The hook fires only at the application emitter —\n // extension-space planning never reaches this helper.\n const fieldEventOps = planFieldEventOperations({\n priorContract: options.fromContract,\n newContract: options.contract,\n codecHooks,\n });\n // Codec-emitted calls already conform to `OpFactoryCall` — render +\n // toOp + importRequirements ride directly through the same emit path\n // as structural ops, no `RawSqlCall` wrap.\n const calls = [...result.value.calls, ...fieldEventOps];\n\n return Object.freeze({\n kind: 'success' as const,\n plan: new TypeScriptRenderablePostgresMigration(\n calls,\n {\n from: options.fromContract?.storage.storageHash ?? null,\n to: options.contract.storage.storageHash,\n },\n options.spaceId,\n ),\n });\n }\n\n private ensureAdditivePolicy(policy: MigrationOperationPolicy) {\n if (!policy.allowedOperationClasses.includes('additive')) {\n return plannerFailure([\n {\n kind: 'unsupportedOperation',\n summary: 'Migration planner requires additive operations be allowed',\n why: 'The planner requires the \"additive\" operation class to be allowed in the policy.',\n },\n ]);\n }\n return null;\n }\n\n private collectSchemaIssues(options: PlannerOptionsWithComponents): readonly SchemaIssue[] {\n // `db init` uses additive-only policy and intentionally ignores extra\n // schema objects. Any reconciliation-capable policy (widening or\n // destructive) must inspect extras to reconcile strict equality.\n const allowed = options.policy.allowedOperationClasses;\n const strict = allowed.includes('widening') || allowed.includes('destructive');\n const verifyOptions: VerifySqlSchemaOptionsWithComponents = {\n contract: options.contract,\n schema: options.schema,\n strict,\n typeMetadataRegistry: new Map(),\n frameworkComponents: options.frameworkComponents,\n normalizeDefault: parsePostgresDefault,\n normalizeNativeType: normalizeSchemaNativeType,\n resolveExistingEnumValues: (schema, enumType) =>\n readExistingEnumValues(schema, enumType.nativeType),\n };\n const verifyResult = verifySqlSchema(verifyOptions);\n return verifyResult.schema.issues;\n }\n}\n"],"mappings":";;;;;;;;AA4CA,MAAM,yBAAwC,EAC5C,eAAe,UAChB;AAED,SAAgB,+BACd,SAAiC,EAAE,EACT;CAC1B,OAAO,IAAI,yBAAyB;EAClC,GAAG;EACH,GAAG;EACJ,CAAC;;;;;;;;;;;;;;;;;;AA8BJ,IAAa,2BAAb,MAAqF;CACtD;CAA7B,YAAY,QAAwC;EAAvB,KAAA,SAAA;;CAE7B,KAAK,SA2BkB;EACrB,OAAO,KAAK,QAAQ,QAA0C;;CAGhE,eACE,SACA,SACmC;EACnC,OAAO,IAAI,sCACT,EAAE,EACF;GACE,MAAM,QAAQ;GACd,IAAI,QAAQ;GACb,EACD,QACD;;CAGH,QAAgB,SAA6D;EAC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Q,aAClC,uBAAuB,QAAQ,SAAS,WAAW;GAEL,CAC/B,CAAC,OAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as quoteIdentifier, n as escapeLiteral } from "./sql-utils-
|
|
2
|
-
import { c as qualifyTableName, f as resolveColumnTypeMetadata } from "./planner-sql-checks-
|
|
1
|
+
import { i as quoteIdentifier, n as escapeLiteral } from "./sql-utils-BewXAnsG.mjs";
|
|
2
|
+
import { c as qualifyTableName, f as resolveColumnTypeMetadata } from "./planner-sql-checks-Cd016Ycs.mjs";
|
|
3
3
|
//#region src/core/migrations/planner-ddl-builders.ts
|
|
4
4
|
function buildCreateTableSql(qualifiedTableName, table, codecHooks, storageTypes = {}) {
|
|
5
5
|
const columnDefinitions = Object.entries(table.columns).map(([columnName, column]) => {
|
|
@@ -128,4 +128,4 @@ REFERENCES ${qualifyTableName(schemaName, foreignKey.references.table)} (${forei
|
|
|
128
128
|
//#endregion
|
|
129
129
|
export { buildForeignKeySql as a, buildCreateTableSql as i, buildColumnDefaultSql as n, renderDefaultLiteral as o, buildColumnTypeSql as r, buildAddColumnSql as t };
|
|
130
130
|
|
|
131
|
-
//# sourceMappingURL=planner-ddl-builders-
|
|
131
|
+
//# sourceMappingURL=planner-ddl-builders-5QIyhBUF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-ddl-builders-5QIyhBUF.mjs","names":[],"sources":["../src/core/migrations/planner-ddl-builders.ts"],"sourcesContent":["import type { CodecControlHooks } from '@prisma-next/family-sql/control';\nimport type {\n ForeignKey,\n PostgresEnumStorageEntry,\n ReferentialAction,\n StorageColumn,\n StorageTable,\n StorageTypeInstance,\n} from '@prisma-next/sql-contract/types';\nimport { escapeLiteral, quoteIdentifier } from '../sql-utils';\nimport type { PostgresColumnDefault } from '../types';\nimport { qualifyTableName } from './planner-sql-checks';\nimport { resolveColumnTypeMetadata } from './planner-type-resolution';\n\nexport function buildCreateTableSql(\n qualifiedTableName: string,\n table: StorageTable,\n codecHooks: Map<string, CodecControlHooks>,\n storageTypes: Record<string, StorageTypeInstance | PostgresEnumStorageEntry> = {},\n): string {\n const columnDefinitions = Object.entries(table.columns).map(\n ([columnName, column]: [string, StorageColumn]) => {\n const parts = [\n quoteIdentifier(columnName),\n buildColumnTypeSql(column, codecHooks, storageTypes),\n buildColumnDefaultSql(column.default, column),\n column.nullable ? '' : 'NOT NULL',\n ].filter(Boolean);\n return parts.join(' ');\n },\n );\n\n const constraintDefinitions: string[] = [];\n if (table.primaryKey) {\n constraintDefinitions.push(\n `PRIMARY KEY (${table.primaryKey.columns.map(quoteIdentifier).join(', ')})`,\n );\n }\n\n const allDefinitions = [...columnDefinitions, ...constraintDefinitions];\n return `CREATE TABLE ${qualifiedTableName} (\\n ${allDefinitions.join(',\\n ')}\\n)`;\n}\n\n/**\n * Pattern for safe PostgreSQL type names.\n * Allows letters, digits, underscores, spaces (for \"double precision\", \"character varying\"),\n * and trailing [] for array types.\n */\nconst SAFE_NATIVE_TYPE_PATTERN = /^[a-zA-Z][a-zA-Z0-9_ ]*(\\[\\])?$/;\n\nfunction assertSafeNativeType(nativeType: string): void {\n if (!SAFE_NATIVE_TYPE_PATTERN.test(nativeType)) {\n throw new Error(\n `Unsafe native type name in contract: \"${nativeType}\". ` +\n 'Native type names must match /^[a-zA-Z][a-zA-Z0-9_ ]*(\\\\[\\\\])?$/',\n );\n }\n}\n\n/**\n * Sanity check against accidental SQL injection from malformed contract files.\n * Rejects semicolons, SQL comment tokens, and dollar-quoting.\n * Not a comprehensive security boundary — the contract is developer-authored.\n */\nfunction assertSafeDefaultExpression(expression: string): void {\n if (expression.includes(';') || /--|\\/\\*|\\$\\$|\\bSELECT\\b/i.test(expression)) {\n throw new Error(\n `Unsafe default expression in contract: \"${expression}\". ` +\n 'Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.',\n );\n }\n}\n\n/**\n * Renders the SQL type for a column in DDL context.\n *\n * @param allowPseudoTypes - When true (default), autoincrement integer columns\n * produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts\n * like ALTER COLUMN TYPE where pseudo-types are invalid.\n */\nexport function buildColumnTypeSql(\n column: StorageColumn,\n codecHooks: Map<string, CodecControlHooks>,\n storageTypes: Record<string, StorageTypeInstance | PostgresEnumStorageEntry> = {},\n allowPseudoTypes = true,\n): string {\n const resolved = resolveColumnTypeMetadata(column, storageTypes);\n\n if (allowPseudoTypes) {\n const columnDefault = column.default;\n if (columnDefault?.kind === 'function' && columnDefault.expression === 'autoincrement()') {\n if (resolved.nativeType === 'int4' || resolved.nativeType === 'integer') {\n return 'SERIAL';\n }\n if (resolved.nativeType === 'int8' || resolved.nativeType === 'bigint') {\n return 'BIGSERIAL';\n }\n if (resolved.nativeType === 'int2' || resolved.nativeType === 'smallint') {\n return 'SMALLSERIAL';\n }\n }\n }\n\n const expanded = expandParameterizedTypeSql(resolved, codecHooks);\n if (expanded !== null) {\n return expanded;\n }\n\n if (column.typeRef) {\n return quoteIdentifier(resolved.nativeType);\n }\n\n assertSafeNativeType(resolved.nativeType);\n return resolved.nativeType;\n}\n\nfunction expandParameterizedTypeSql(\n column: Pick<StorageColumn, 'nativeType' | 'codecId' | 'typeParams'>,\n codecHooks: Map<string, CodecControlHooks>,\n): string | null {\n if (!column.typeParams) {\n return null;\n }\n\n if (!column.codecId) {\n throw new Error(\n `Column declares typeParams for nativeType \"${column.nativeType}\" but has no codecId. ` +\n 'Ensure the column is associated with a codec.',\n );\n }\n\n const hooks = codecHooks.get(column.codecId);\n if (!hooks?.expandNativeType) {\n if (hooks?.planTypeOperations) {\n return null;\n }\n throw new Error(\n `Column declares typeParams for nativeType \"${column.nativeType}\" ` +\n `but no expandNativeType hook is registered for codecId \"${column.codecId}\". ` +\n 'Ensure the extension providing this codec is included in extensionPacks.',\n );\n }\n\n const expanded = hooks.expandNativeType({\n nativeType: column.nativeType,\n codecId: column.codecId,\n typeParams: column.typeParams,\n });\n\n return expanded !== column.nativeType ? expanded : null;\n}\n\n/** Autoincrement columns use SERIAL types, so this returns empty for them. */\nexport function buildColumnDefaultSql(\n columnDefault: PostgresColumnDefault | undefined,\n column?: StorageColumn,\n): string {\n if (!columnDefault) {\n return '';\n }\n\n switch (columnDefault.kind) {\n case 'literal':\n return `DEFAULT ${renderDefaultLiteral(columnDefault.value, column)}`;\n case 'function': {\n if (columnDefault.expression === 'autoincrement()') {\n return '';\n }\n assertSafeDefaultExpression(columnDefault.expression);\n return `DEFAULT (${columnDefault.expression})`;\n }\n case 'sequence':\n return `DEFAULT nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`;\n }\n}\n\nexport function renderDefaultLiteral(value: unknown, column?: StorageColumn): string {\n const isJsonColumn = column?.nativeType === 'json' || column?.nativeType === 'jsonb';\n\n if (value instanceof Date) {\n return `'${escapeLiteral(value.toISOString())}'`;\n }\n if (typeof value === 'string') {\n return `'${escapeLiteral(value)}'`;\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (value === null) {\n return 'NULL';\n }\n const json = JSON.stringify(value);\n if (isJsonColumn) {\n return `'${escapeLiteral(json)}'::${column.nativeType}`;\n }\n return `'${escapeLiteral(json)}'`;\n}\n\nexport function buildAddColumnSql(\n qualifiedTableName: string,\n columnName: string,\n column: StorageColumn,\n codecHooks: Map<string, CodecControlHooks>,\n temporaryDefault?: string | null,\n storageTypes: Record<string, StorageTypeInstance | PostgresEnumStorageEntry> = {},\n): string {\n const typeSql = buildColumnTypeSql(column, codecHooks, storageTypes);\n const defaultSql =\n buildColumnDefaultSql(column.default, column) ||\n (temporaryDefault ? `DEFAULT ${temporaryDefault}` : '');\n const parts = [\n `ALTER TABLE ${qualifiedTableName}`,\n `ADD COLUMN ${quoteIdentifier(columnName)} ${typeSql}`,\n defaultSql,\n column.nullable ? '' : 'NOT NULL',\n ].filter(Boolean);\n return parts.join(' ');\n}\n\nconst REFERENTIAL_ACTION_SQL: Record<ReferentialAction, string> = {\n noAction: 'NO ACTION',\n restrict: 'RESTRICT',\n cascade: 'CASCADE',\n setNull: 'SET NULL',\n setDefault: 'SET DEFAULT',\n};\n\nexport function buildForeignKeySql(\n schemaName: string,\n tableName: string,\n fkName: string,\n foreignKey: ForeignKey,\n): string {\n let sql = `ALTER TABLE ${qualifyTableName(schemaName, tableName)}\nADD CONSTRAINT ${quoteIdentifier(fkName)}\nFOREIGN KEY (${foreignKey.columns.map(quoteIdentifier).join(', ')})\nREFERENCES ${qualifyTableName(schemaName, foreignKey.references.table)} (${foreignKey.references.columns\n .map(quoteIdentifier)\n .join(', ')})`;\n\n if (foreignKey.onDelete !== undefined) {\n const action = REFERENTIAL_ACTION_SQL[foreignKey.onDelete];\n if (!action) {\n throw new Error(`Unknown referential action for onDelete: ${String(foreignKey.onDelete)}`);\n }\n sql += `\\nON DELETE ${action}`;\n }\n if (foreignKey.onUpdate !== undefined) {\n const action = REFERENTIAL_ACTION_SQL[foreignKey.onUpdate];\n if (!action) {\n throw new Error(`Unknown referential action for onUpdate: ${String(foreignKey.onUpdate)}`);\n }\n sql += `\\nON UPDATE ${action}`;\n }\n\n return sql;\n}\n"],"mappings":";;;AAcA,SAAgB,oBACd,oBACA,OACA,YACA,eAA+E,EAAE,EACzE;CACR,MAAM,oBAAoB,OAAO,QAAQ,MAAM,QAAQ,CAAC,KACrD,CAAC,YAAY,YAAqC;EAOjD,OANc;GACZ,gBAAgB,WAAW;GAC3B,mBAAmB,QAAQ,YAAY,aAAa;GACpD,sBAAsB,OAAO,SAAS,OAAO;GAC7C,OAAO,WAAW,KAAK;GACxB,CAAC,OAAO,QACG,CAAC,KAAK,IAAI;GAEzB;CAED,MAAM,wBAAkC,EAAE;CAC1C,IAAI,MAAM,YACR,sBAAsB,KACpB,gBAAgB,MAAM,WAAW,QAAQ,IAAI,gBAAgB,CAAC,KAAK,KAAK,CAAC,GAC1E;CAIH,OAAO,gBAAgB,mBAAmB,QAAQ,CAD1B,GAAG,mBAAmB,GAAG,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Y;CACb;AAED,SAAgB,mBACd,YACA,WACA,QACA,YACQ;CACR,IAAI,MAAM,eAAe,iBAAiB,YAAY,UAAU,CAAC;iBAClD,gBAAgB,OAAO,CAAC;eAC1B,WAAW,QAAQ,IAAI,gBAAgB,CAAC,KAAK,KAAK,CAAC;aACrD,iBAAiB,YAAY,WAAW,WAAW,MAAM,CAAC,IAAI,WAAW,WAAW,QAC5F,IAAI,gBAAgB,CACpB,KAAK,KAAK,CAAC;CAEd,IAAI,WAAW,aAAa,KAAA,GAAW;EACrC,MAAM,SAAS,uBAAuB,WAAW;EACjD,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,4CAA4C,OAAO,WAAW,SAAS,GAAG;EAE5F,OAAO,eAAe;;CAExB,IAAI,WAAW,aAAa,KAAA,GAAW;EACrC,MAAM,SAAS,uBAAuB,WAAW;EACjD,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,4CAA4C,OAAO,WAAW,SAAS,GAAG;EAE5F,OAAO,eAAe;;CAGxB,OAAO"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as PostgresColumnDefault } from "./types-
|
|
1
|
+
import { t as PostgresColumnDefault } from "./types-Dq74Z3eu.mjs";
|
|
2
2
|
import { CodecControlHooks } from "@prisma-next/family-sql/control";
|
|
3
|
-
import { ForeignKey, StorageColumn, StorageTable, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
3
|
+
import { ForeignKey, PostgresEnumStorageEntry, StorageColumn, StorageTable, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
4
4
|
|
|
5
5
|
//#region src/core/migrations/planner-ddl-builders.d.ts
|
|
6
|
-
declare function buildCreateTableSql(qualifiedTableName: string, table: StorageTable, codecHooks: Map<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance>): string;
|
|
6
|
+
declare function buildCreateTableSql(qualifiedTableName: string, table: StorageTable, codecHooks: Map<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance | PostgresEnumStorageEntry>): string;
|
|
7
7
|
/**
|
|
8
8
|
* Renders the SQL type for a column in DDL context.
|
|
9
9
|
*
|
|
@@ -11,11 +11,11 @@ declare function buildCreateTableSql(qualifiedTableName: string, table: StorageT
|
|
|
11
11
|
* produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts
|
|
12
12
|
* like ALTER COLUMN TYPE where pseudo-types are invalid.
|
|
13
13
|
*/
|
|
14
|
-
declare function buildColumnTypeSql(column: StorageColumn, codecHooks: Map<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance>, allowPseudoTypes?: boolean): string;
|
|
14
|
+
declare function buildColumnTypeSql(column: StorageColumn, codecHooks: Map<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance | PostgresEnumStorageEntry>, allowPseudoTypes?: boolean): string;
|
|
15
15
|
/** Autoincrement columns use SERIAL types, so this returns empty for them. */
|
|
16
16
|
declare function buildColumnDefaultSql(columnDefault: PostgresColumnDefault | undefined, column?: StorageColumn): string;
|
|
17
17
|
declare function renderDefaultLiteral(value: unknown, column?: StorageColumn): string;
|
|
18
|
-
declare function buildAddColumnSql(qualifiedTableName: string, columnName: string, column: StorageColumn, codecHooks: Map<string, CodecControlHooks>, temporaryDefault?: string | null, storageTypes?: Record<string, StorageTypeInstance>): string;
|
|
18
|
+
declare function buildAddColumnSql(qualifiedTableName: string, columnName: string, column: StorageColumn, codecHooks: Map<string, CodecControlHooks>, temporaryDefault?: string | null, storageTypes?: Record<string, StorageTypeInstance | PostgresEnumStorageEntry>): string;
|
|
19
19
|
declare function buildForeignKeySql(schemaName: string, tableName: string, fkName: string, foreignKey: ForeignKey): string;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { buildAddColumnSql, buildColumnDefaultSql, buildColumnTypeSql, buildCreateTableSql, buildForeignKeySql, renderDefaultLiteral };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-ddl-builders.d.mts","names":[],"sources":["../src/core/migrations/planner-ddl-builders.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"planner-ddl-builders.d.mts","names":[],"sources":["../src/core/migrations/planner-ddl-builders.ts"],"mappings":";;;;;iBAcgB,mBAAA,CACd,kBAAA,UACA,KAAA,EAAO,YAAA,EACP,UAAA,EAAY,GAAA,SAAY,iBAAA,GACxB,YAAA,GAAc,MAAA,SAAe,mBAAA,GAAsB,wBAAA;;AAJrD;;;;;;iBAkEgB,kBAAA,CACd,MAAA,EAAQ,aAAA,EACR,UAAA,EAAY,GAAA,SAAY,iBAAA,GACxB,YAAA,GAAc,MAAA,SAAe,mBAAA,GAAsB,wBAAA,GACnD,gBAAA;;iBAqEc,qBAAA,CACd,aAAA,EAAe,qBAAA,cACf,MAAA,GAAS,aAAA;AAAA,iBAqBK,oBAAA,CAAqB,KAAA,WAAgB,MAAA,GAAS,aAAA;AAAA,iBAsB9C,iBAAA,CACd,kBAAA,UACA,UAAA,UACA,MAAA,EAAQ,aAAA,EACR,UAAA,EAAY,GAAA,SAAY,iBAAA,GACxB,gBAAA,kBACA,YAAA,GAAc,MAAA,SAAe,mBAAA,GAAsB,wBAAA;AAAA,iBAuBrC,kBAAA,CACd,UAAA,UACA,SAAA,UACA,MAAA,UACA,UAAA,EAAY,UAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildForeignKeySql, i as buildCreateTableSql, n as buildColumnDefaultSql, o as renderDefaultLiteral, r as buildColumnTypeSql, t as buildAddColumnSql } from "./planner-ddl-builders-
|
|
1
|
+
import { a as buildForeignKeySql, i as buildCreateTableSql, n as buildColumnDefaultSql, o as renderDefaultLiteral, r as buildColumnTypeSql, t as buildAddColumnSql } from "./planner-ddl-builders-5QIyhBUF.mjs";
|
|
2
2
|
export { buildAddColumnSql, buildColumnDefaultSql, buildColumnTypeSql, buildCreateTableSql, buildForeignKeySql, renderDefaultLiteral };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
2
|
+
import { isPostgresEnumStorageEntry } from "@prisma-next/sql-contract/types";
|
|
2
3
|
//#region src/core/migrations/planner-identity-values.ts
|
|
3
4
|
/**
|
|
4
5
|
* Resolves the identity value (monoid neutral element) as a SQL literal for a column's type.
|
|
@@ -7,9 +8,14 @@ import { ifDefined } from "@prisma-next/utils/defined";
|
|
|
7
8
|
*/
|
|
8
9
|
function resolveIdentityValue(column, codecHooks, storageTypes = {}) {
|
|
9
10
|
const referencedType = column.typeRef ? storageTypes[column.typeRef] : void 0;
|
|
10
|
-
const
|
|
11
|
+
const referencedIsEnum = referencedType !== void 0 && isPostgresEnumStorageEntry(referencedType);
|
|
12
|
+
const referencedBinding = referencedIsEnum ? referencedType.codecBinding ?? {
|
|
13
|
+
codecId: referencedType.codecId,
|
|
14
|
+
typeParams: { values: referencedType.values }
|
|
15
|
+
} : void 0;
|
|
16
|
+
const codecId = referencedBinding?.codecId ?? (referencedType && !referencedIsEnum ? referencedType.codecId : void 0) ?? column.codecId;
|
|
11
17
|
const nativeType = referencedType?.nativeType ?? column.nativeType;
|
|
12
|
-
const typeParams =
|
|
18
|
+
const typeParams = referencedBinding?.typeParams ?? (referencedType && !referencedIsEnum ? referencedType.typeParams : void 0) ?? column.typeParams;
|
|
13
19
|
if (codecId) {
|
|
14
20
|
const hookDefault = codecHooks.get(codecId)?.resolveIdentityValue?.({
|
|
15
21
|
nativeType,
|
|
@@ -87,4 +93,4 @@ function buildBitIdentityValue(typeParams) {
|
|
|
87
93
|
//#endregion
|
|
88
94
|
export { resolveIdentityValue as n, buildBuiltinIdentityValue as t };
|
|
89
95
|
|
|
90
|
-
//# sourceMappingURL=planner-identity-values-
|
|
96
|
+
//# sourceMappingURL=planner-identity-values-BUYNOCwb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-identity-values-BUYNOCwb.mjs","names":[],"sources":["../src/core/migrations/planner-identity-values.ts"],"sourcesContent":["import type { CodecControlHooks } from '@prisma-next/family-sql/control';\nimport {\n isPostgresEnumStorageEntry,\n type PostgresEnumStorageEntry,\n type StorageColumn,\n type StorageTypeInstance,\n} from '@prisma-next/sql-contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { PostgresEnumType } from '../postgres-enum-type';\n\n/**\n * Resolves the identity value (monoid neutral element) as a SQL literal for a column's type.\n * Checks codec hooks first (extensions can provide type-specific identity values),\n * then falls back to the built-in map.\n */\nexport function resolveIdentityValue(\n column: StorageColumn,\n codecHooks: Map<string, CodecControlHooks>,\n storageTypes: Record<string, StorageTypeInstance | PostgresEnumStorageEntry> = {},\n): string | null {\n const referencedType = column.typeRef ? storageTypes[column.typeRef] : undefined;\n const referencedIsEnum =\n referencedType !== undefined && isPostgresEnumStorageEntry(referencedType);\n const referencedBinding = referencedIsEnum\n ? ((referencedType as PostgresEnumType).codecBinding ?? {\n codecId: (referencedType as PostgresEnumStorageEntry).codecId,\n typeParams: { values: (referencedType as PostgresEnumStorageEntry).values },\n })\n : undefined;\n const codecId =\n referencedBinding?.codecId ??\n (referencedType && !referencedIsEnum\n ? (referencedType as StorageTypeInstance).codecId\n : undefined) ??\n column.codecId;\n const nativeType = referencedType?.nativeType ?? column.nativeType;\n const typeParams =\n (referencedBinding?.typeParams as Record<string, unknown> | undefined) ??\n (referencedType && !referencedIsEnum\n ? (referencedType as StorageTypeInstance).typeParams\n : undefined) ??\n column.typeParams;\n\n if (codecId) {\n const hookDefault = codecHooks.get(codecId)?.resolveIdentityValue?.({\n nativeType,\n codecId,\n ...ifDefined('typeParams', typeParams),\n });\n if (hookDefault !== undefined) {\n return hookDefault;\n }\n }\n\n return buildBuiltinIdentityValue(nativeType, typeParams);\n}\n\n/**\n * Returns the built-in identity value (monoid neutral element) as a SQL literal for the given\n * PostgreSQL native type — e.g. 0 for integers, '' for text, false for booleans.\n *\n * This is the planner's fallback when no codec hook provides a type-specific identity value.\n *\n * Returns null for unrecognized types (for example enums and extension-owned types without a\n * hook), which causes the planner to fall back to the empty-table precheck.\n *\n * @internal Exported for testing only.\n */\nexport function buildBuiltinIdentityValue(\n nativeType: string,\n typeParams?: Record<string, unknown>,\n): string | null {\n const normalizedNativeType = normalizeIdentityValueNativeType(nativeType);\n\n if (normalizedNativeType.endsWith('[]')) {\n return \"'{}'\";\n }\n\n switch (normalizedNativeType) {\n case 'text':\n case 'character':\n case 'bpchar':\n case 'character varying':\n case 'varchar':\n return \"''\";\n\n case 'int2':\n case 'int4':\n case 'int8':\n case 'integer':\n case 'bigint':\n case 'smallint':\n case 'float4':\n case 'float8':\n case 'real':\n case 'double precision':\n case 'numeric':\n case 'decimal':\n return '0';\n\n case 'bool':\n case 'boolean':\n return 'false';\n\n case 'uuid':\n return \"'00000000-0000-0000-0000-000000000000'\";\n\n case 'json':\n return \"'{}'::json\";\n case 'jsonb':\n return \"'{}'::jsonb\";\n\n case 'date':\n case 'timestamp':\n case 'timestamptz':\n case 'timestamp with time zone':\n case 'timestamp without time zone':\n return \"'epoch'\";\n\n case 'time':\n case 'time without time zone':\n return \"'00:00:00'\";\n case 'timetz':\n case 'time with time zone':\n return \"'00:00:00+00'\";\n\n case 'interval':\n return \"'0'\";\n\n case 'bytea':\n return \"''::bytea\";\n case 'tsvector':\n return \"''::tsvector\";\n\n case 'bit':\n return buildBitIdentityValue(typeParams);\n case 'bit varying':\n case 'varbit':\n return \"B''\";\n\n default:\n return null;\n }\n}\n\nfunction normalizeIdentityValueNativeType(nativeType: string): string {\n return nativeType.trim().toLowerCase().replace(/\\s+/g, ' ');\n}\n\nfunction buildBitIdentityValue(typeParams?: Record<string, unknown>): string | null {\n const length = typeParams?.['length'];\n if (length === undefined) {\n return \"B'0'\";\n }\n if (typeof length !== 'number' || !Number.isInteger(length) || length <= 0) {\n return null;\n }\n return `B'${'0'.repeat(length)}'`;\n}\n"],"mappings":";;;;;;;;AAeA,SAAgB,qBACd,QACA,YACA,eAA+E,EAAE,EAClE;CACf,MAAM,iBAAiB,OAAO,UAAU,aAAa,OAAO,W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AAK,OACH,OAAO,sBAAsB,WAAW;EAC1C,KAAK;EACL,KAAK,UACH,OAAO;EAET,SACE,OAAO;;;AAIb,SAAS,iCAAiC,YAA4B;CACpE,OAAO,WAAW,MAAM,CAAC,aAAa,CAAC,QAAQ,QAAQ,IAAI;;AAG7D,SAAS,sBAAsB,YAAqD;CAClF,MAAM,SAAS,aAAa;CAC5B,IAAI,WAAW,KAAA,GACb,OAAO;CAET,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,UAAU,OAAO,IAAI,UAAU,GACvE,OAAO;CAET,OAAO,KAAK,IAAI,OAAO,OAAO,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodecControlHooks } from "@prisma-next/family-sql/control";
|
|
2
|
-
import { StorageColumn, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
2
|
+
import { PostgresEnumStorageEntry, StorageColumn, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
3
3
|
|
|
4
4
|
//#region src/core/migrations/planner-identity-values.d.ts
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-identity-values.d.mts","names":[],"sources":["../src/core/migrations/planner-identity-values.ts"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"planner-identity-values.d.mts","names":[],"sources":["../src/core/migrations/planner-identity-values.ts"],"mappings":";;;;;;;;;;;;;;;iBAoEgB,yBAAA,CACd,UAAA,UACA,UAAA,GAAa,MAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as buildBuiltinIdentityValue } from "./planner-identity-values-
|
|
1
|
+
import { t as buildBuiltinIdentityValue } from "./planner-identity-values-BUYNOCwb.mjs";
|
|
2
2
|
export { buildBuiltinIdentityValue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as PostgresPlanTargetDetails } from "./planner-target-details-
|
|
2
|
-
import { t as PostgresMigration } from "./postgres-migration-
|
|
1
|
+
import { t as PostgresPlanTargetDetails } from "./planner-target-details-iYJwzFHP.mjs";
|
|
2
|
+
import { t as PostgresMigration } from "./postgres-migration-CiQzhcMe.mjs";
|
|
3
3
|
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
4
4
|
import { MigrationPlanWithAuthoringSurface, OpFactoryCall } from "@prisma-next/framework-components/control";
|
|
5
5
|
import { MigrationMeta } from "@prisma-next/migration-tools/migration";
|
|
@@ -21,4 +21,4 @@ declare class TypeScriptRenderablePostgresMigration extends PostgresMigration im
|
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { TypeScriptRenderablePostgresMigration as t };
|
|
24
|
-
//# sourceMappingURL=planner-produced-postgres-migration-
|
|
24
|
+
//# sourceMappingURL=planner-produced-postgres-migration-D34ftfEK.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-produced-postgres-migration-
|
|
1
|
+
{"version":3,"file":"planner-produced-postgres-migration-D34ftfEK.d.mts","names":[],"sources":["../src/core/migrations/planner-produced-postgres-migration.ts"],"mappings":";;;;;;;KAqCK,EAAA,GAAK,yBAAA,CAA0B,yBAAA;AAAA,cAEvB,qCAAA,SACH,iBAAA,YACG,iCAAA;EAAA;cAMC,KAAA,WAAgB,aAAA,IAAiB,IAAA,EAAM,aAAA,EAAe,OAAA;EAAA,IAOrD,UAAA,CAAA,YAAuB,EAAA;EAI3B,QAAA,CAAA,GAAY,aAAA;EAAA;;;;;EAAA,IASjB,OAAA,CAAA;EAIJ,gBAAA,CAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as PostgresMigration } from "./postgres-migration-
|
|
2
|
-
import { t as renderOps } from "./render-ops
|
|
3
|
-
import { t as renderCallsToTypeScript } from "./render-typescript-
|
|
1
|
+
import { t as PostgresMigration } from "./postgres-migration-Fdxzo6l2.mjs";
|
|
2
|
+
import { t as renderOps } from "./render-ops-CkiuHSNj.mjs";
|
|
3
|
+
import { t as renderCallsToTypeScript } from "./render-typescript-C9XWI8Ld.mjs";
|
|
4
4
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
5
5
|
//#region src/core/migrations/planner-produced-postgres-migration.ts
|
|
6
6
|
var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
|
|
@@ -38,4 +38,4 @@ var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
|
|
|
38
38
|
//#endregion
|
|
39
39
|
export { TypeScriptRenderablePostgresMigration as t };
|
|
40
40
|
|
|
41
|
-
//# sourceMappingURL=planner-produced-postgres-migration-
|
|
41
|
+
//# sourceMappingURL=planner-produced-postgres-migration-D8OCSSLM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-produced-postgres-migration-
|
|
1
|
+
{"version":3,"file":"planner-produced-postgres-migration-D8OCSSLM.mjs","names":["#calls","#meta","#spaceId"],"sources":["../src/core/migrations/planner-produced-postgres-migration.ts"],"sourcesContent":["/**\n * Planner-produced Postgres migration.\n *\n * Returned by `PostgresMigrationPlanner.plan(...)` and `emptyMigration(...)`.\n * Holds the migration IR (`PostgresOpFactoryCall[]`) alongside\n * `MigrationMeta` and exposes both the runtime-ops view (`get operations`)\n * and the TypeScript authoring view (`renderTypeScript()`). Satisfies\n * `MigrationPlanWithAuthoringSurface` so the CLI can uniformly serialize any\n * planner result back to `migration.ts`.\n *\n * Extends the family-level `SqlMigration` alias rather than the target-local\n * migration base directly — mirrors Mongo's `PlannerProducedMongoMigration`\n * shape and keeps CLI wiring one step removed from target internals.\n *\n * Placeholder-bearing plans: `renderTypeScript()` always succeeds and embeds\n * `() => placeholder(\"slot\")` at each stub. `operations`, in contrast, is\n * _not safe to enumerate_ on a stub-bearing plan — `DataTransformCall.toOp()`\n * throws `PN-MIG-2001` because a planner-stubbed closure cannot be lowered\n * to a runtime op. Callers that know a plan may carry stubs must render to\n * `migration.ts`, let the user fill the slots, and re-load the edited\n * migration before enumerating ops. The walk-schema planner does not emit\n * `DataTransformCall`s today, so this asymmetry is invisible until the\n * issue-planner integration lands in Phase 2.\n */\n\nimport 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 { ifDefined } from '@prisma-next/utils/defined';\nimport type { PostgresPlanTargetDetails } from './planner-target-details';\nimport { PostgresMigration } from './postgres-migration';\nimport { renderOps } from './render-ops';\nimport { renderCallsToTypeScript } from './render-typescript';\n\ntype Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;\n\nexport class TypeScriptRenderablePostgresMigration\n extends PostgresMigration\n implements MigrationPlanWithAuthoringSurface\n{\n readonly #calls: readonly OpFactoryCall[];\n readonly #meta: MigrationMeta;\n readonly #spaceId: string;\n\n constructor(calls: readonly OpFactoryCall[], meta: MigrationMeta, spaceId: string) {\n super();\n this.#calls = calls;\n this.#meta = meta;\n this.#spaceId = spaceId;\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 /**\n * Contract space this planner-produced plan applies to. Threaded\n * from the planner options so the runner keys the marker row by\n * 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 ...ifDefined('labels', this.#meta.labels),\n });\n }\n}\n"],"mappings":";;;;;AAuCA,IAAa,wCAAb,cACU,kBAEV;CACE;CACA;CACA;CAEA,YAAY,OAAiC,MAAqB,SAAiB;EACjF,OAAO;EACP,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;;CAGlB,IAAa,aAA4B;EACvC,OAAO,UAAU,KAAKF,OAAO;;CAG/B,WAAmC;EACjC,OAAO,KAAKC;;;;;;;CAQd,IAAI,UAAkB;EACpB,OAAO,KAAKC;;CAGd,mBAA2B;EACzB,OAAO,wBAAwB,KAAKF,QAAQ;GAC1C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,GAAG,UAAU,UAAU,KAAKA,MAAM,OAAO;GAC1C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-
|
|
1
|
+
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-D34ftfEK.mjs";
|
|
2
2
|
export { TypeScriptRenderablePostgresMigration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-
|
|
1
|
+
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-D8OCSSLM.mjs";
|
|
2
2
|
export { TypeScriptRenderablePostgresMigration };
|
|
@@ -26,4 +26,4 @@ function hasForeignKey(lookup, fk) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { hasUniqueConstraint as i, hasForeignKey as n, hasIndex as r, buildSchemaLookupMap as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=planner-schema-lookup
|
|
29
|
+
//# sourceMappingURL=planner-schema-lookup--u9whY_Y.mjs.map
|
package/dist/{planner-schema-lookup-B1ags8ys.mjs.map → planner-schema-lookup--u9whY_Y.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-schema-lookup
|
|
1
|
+
{"version":3,"file":"planner-schema-lookup--u9whY_Y.mjs","names":[],"sources":["../src/core/migrations/planner-schema-lookup.ts"],"sourcesContent":["import type { ForeignKey } from '@prisma-next/sql-contract/types';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\n\n/**\n * Pre-computed lookup sets for a schema table's constraints.\n * Converts O(n*m) linear scans to O(1) Set lookups per constraint check.\n */\nexport interface SchemaTableLookup {\n readonly uniqueKeys: Set<string>;\n readonly indexKeys: Set<string>;\n readonly uniqueIndexKeys: Set<string>;\n readonly fkKeys: Set<string>;\n}\n\nexport function buildSchemaLookupMap(schema: SqlSchemaIR): ReadonlyMap<string, SchemaTableLookup> {\n const map = new Map<string, SchemaTableLookup>();\n for (const [tableName, table] of Object.entries(schema.tables)) {\n map.set(tableName, buildSchemaTableLookup(table));\n }\n return map;\n}\n\nfunction buildSchemaTableLookup(table: SqlSchemaIR['tables'][string]): SchemaTableLookup {\n const uniqueKeys = new Set(table.uniques.map((u) => u.columns.join(',')));\n const indexKeys = new Set(table.indexes.map((i) => i.columns.join(',')));\n const uniqueIndexKeys = new Set(\n table.indexes.filter((i) => i.unique).map((i) => i.columns.join(',')),\n );\n const fkKeys = new Set(\n table.foreignKeys.map(\n (fk) => `${fk.columns.join(',')}|${fk.referencedTable}|${fk.referencedColumns.join(',')}`,\n ),\n );\n return { uniqueKeys, indexKeys, uniqueIndexKeys, fkKeys };\n}\n\nexport function hasUniqueConstraint(\n lookup: SchemaTableLookup,\n columns: readonly string[],\n): boolean {\n const key = columns.join(',');\n return lookup.uniqueKeys.has(key) || lookup.uniqueIndexKeys.has(key);\n}\n\nexport function hasIndex(lookup: SchemaTableLookup, columns: readonly string[]): boolean {\n const key = columns.join(',');\n return lookup.indexKeys.has(key) || lookup.uniqueKeys.has(key);\n}\n\nexport function hasForeignKey(lookup: SchemaTableLookup, fk: ForeignKey): boolean {\n return lookup.fkKeys.has(\n `${fk.columns.join(',')}|${fk.references.table}|${fk.references.columns.join(',')}`,\n );\n}\n"],"mappings":";AAcA,SAAgB,qBAAqB,QAA6D;CAChG,MAAM,sBAAM,IAAI,KAAgC;CAChD,KAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,OAAO,OAAO,EAC5D,IAAI,IAAI,WAAW,uBAAuB,MAAM,CAAC;CAEnD,OAAO;;AAGT,SAAS,uBAAuB,OAAyD;CAWvF,OAAO;EAAE,YAAA,IAVc,IAAI,MAAM,QAAQ,KAAK,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAUrD;EAAE,WAAA,IATC,IAAI,MAAM,QAAQ,KAAK,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CASzC;EAAE,iBAAA,IARJ,IAC1B,MAAM,QAAQ,QAAQ,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAOxB;EAAE,QAAA,IAL9B,IACjB,MAAM,YAAY,KACf,OAAO,GAAG,GAAG,QAAQ,KAAK,IAAI,CAAC,GAAG,GAAG,gBAAgB,GAAG,GAAG,kBAAkB,KAAK,IAAI,GACxF,CAEoD;EAAE;;AAG3D,SAAgB,oBACd,QACA,SACS;CACT,MAAM,MAAM,QAAQ,KAAK,IAAI;CAC7B,OAAO,OAAO,WAAW,IAAI,IAAI,IAAI,OAAO,gBAAgB,IAAI,IAAI;;AAGtE,SAAgB,SAAS,QAA2B,SAAqC;CACvF,MAAM,MAAM,QAAQ,KAAK,IAAI;CAC7B,OAAO,OAAO,UAAU,IAAI,IAAI,IAAI,OAAO,WAAW,IAAI,IAAI;;AAGhE,SAAgB,cAAc,QAA2B,IAAyB;CAChF,OAAO,OAAO,OAAO,IACnB,GAAG,GAAG,QAAQ,KAAK,IAAI,CAAC,GAAG,GAAG,WAAW,MAAM,GAAG,GAAG,WAAW,QAAQ,KAAK,IAAI,GAClF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as hasUniqueConstraint, n as hasForeignKey, r as hasIndex, t as buildSchemaLookupMap } from "./planner-schema-lookup
|
|
1
|
+
import { i as hasUniqueConstraint, n as hasForeignKey, r as hasIndex, t as buildSchemaLookupMap } from "./planner-schema-lookup--u9whY_Y.mjs";
|
|
2
2
|
export { buildSchemaLookupMap, hasForeignKey, hasIndex, hasUniqueConstraint };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { i as quoteIdentifier, n as escapeLiteral } from "./sql-utils-
|
|
1
|
+
import { i as quoteIdentifier, n as escapeLiteral } from "./sql-utils-BewXAnsG.mjs";
|
|
2
|
+
import { isPostgresEnumStorageEntry } from "@prisma-next/sql-contract/types";
|
|
2
3
|
//#region src/core/migrations/planner-type-resolution.ts
|
|
3
4
|
function resolveColumnTypeMetadata(column, storageTypes) {
|
|
4
5
|
if (!column.typeRef) return column;
|
|
5
6
|
const referencedType = storageTypes[column.typeRef];
|
|
6
7
|
if (!referencedType) return column;
|
|
8
|
+
if (isPostgresEnumStorageEntry(referencedType)) return {
|
|
9
|
+
codecId: referencedType.codecId,
|
|
10
|
+
nativeType: referencedType.nativeType
|
|
11
|
+
};
|
|
7
12
|
return {
|
|
8
13
|
codecId: referencedType.codecId,
|
|
9
14
|
nativeType: referencedType.nativeType,
|
|
@@ -236,4 +241,4 @@ function tableHasPrimaryKeyCheck(schema, table, exists, constraintName) {
|
|
|
236
241
|
//#endregion
|
|
237
242
|
export { columnNullabilityCheck as a, qualifyTableName as c, toRegclassLiteral as d, resolveColumnTypeMetadata as f, columnHasNoDefaultCheck as i, tableHasPrimaryKeyCheck as l, columnDefaultExistsCheck as n, columnTypeCheck as o, columnExistsCheck as r, constraintExistsCheck as s, buildExpectedFormatType as t, tableIsEmptyCheck as u };
|
|
238
243
|
|
|
239
|
-
//# sourceMappingURL=planner-sql-checks-
|
|
244
|
+
//# sourceMappingURL=planner-sql-checks-Cd016Ycs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner-sql-checks-Cd016Ycs.mjs","names":[],"sources":["../src/core/migrations/planner-type-resolution.ts","../src/core/migrations/planner-sql-checks.ts"],"sourcesContent":["import {\n isPostgresEnumStorageEntry,\n type PostgresEnumStorageEntry,\n type StorageColumn,\n type StorageTypeInstance,\n} from '@prisma-next/sql-contract/types';\n\nexport type ResolvedColumnTypeMetadata = Pick<\n StorageColumn,\n 'nativeType' | 'codecId' | 'typeParams'\n>;\n\nexport function resolveColumnTypeMetadata(\n column: StorageColumn,\n storageTypes: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>,\n): ResolvedColumnTypeMetadata {\n if (!column.typeRef) {\n return column;\n }\n\n const referencedType = storageTypes[column.typeRef];\n if (!referencedType) {\n return column;\n }\n\n if (isPostgresEnumStorageEntry(referencedType)) {\n // Enum types are referenced by name (`quoteIdentifier(nativeType)`),\n // not via parameterised codec expansion. The structural shape\n // carries `codecId` as an enumerable property (mirroring the\n // codec-typed view); `typeParams` is intentionally omitted here so\n // `expandParameterizedTypeSql` does not try to look up a\n // (deliberately absent) `expandNativeType` hook for `pg/enum@*`.\n return {\n codecId: referencedType.codecId,\n nativeType: referencedType.nativeType,\n };\n }\n\n return {\n codecId: referencedType.codecId,\n nativeType: referencedType.nativeType,\n typeParams: referencedType.typeParams,\n };\n}\n","import type { CodecControlHooks } from '@prisma-next/family-sql/control';\nimport type {\n PostgresEnumStorageEntry,\n StorageColumn,\n StorageTypeInstance,\n} from '@prisma-next/sql-contract/types';\nimport { escapeLiteral, quoteIdentifier } from '../sql-utils';\nimport { resolveColumnTypeMetadata } from './planner-type-resolution';\n\nexport function qualifyTableName(schema: string, table: string): string {\n return `${quoteIdentifier(schema)}.${quoteIdentifier(table)}`;\n}\n\nexport function toRegclassLiteral(schema: string, name: string): string {\n const regclass = `${quoteIdentifier(schema)}.${quoteIdentifier(name)}`;\n return `'${escapeLiteral(regclass)}'`;\n}\n\n/**\n * When `table` is omitted the check matches by name + schema across all tables.\n * Pass `table` to scope the check to a single table (prevents false matches on\n * identically-named constraints in different tables).\n */\nexport function constraintExistsCheck({\n constraintName,\n schema,\n table,\n exists = true,\n}: {\n constraintName: string;\n schema: string;\n table?: string;\n exists?: boolean;\n}): string {\n const existsClause = exists ? 'EXISTS' : 'NOT EXISTS';\n const tableFilter = table\n ? `AND c.conrelid = to_regclass(${toRegclassLiteral(schema, table)})`\n : '';\n return `SELECT ${existsClause} (\n SELECT 1 FROM pg_constraint c\n JOIN pg_namespace n ON c.connamespace = n.oid\n WHERE c.conname = '${escapeLiteral(constraintName)}'\n AND n.nspname = '${escapeLiteral(schema)}'\n ${tableFilter}\n)`;\n}\n\nexport function columnExistsCheck({\n schema,\n table,\n column,\n exists = true,\n}: {\n schema: string;\n table: string;\n column: string;\n exists?: boolean;\n}): string {\n const existsClause = exists ? '' : 'NOT ';\n return `SELECT ${existsClause}EXISTS (\n SELECT 1\n FROM information_schema.columns\n WHERE table_schema = '${escapeLiteral(schema)}'\n AND table_name = '${escapeLiteral(table)}'\n AND column_name = '${escapeLiteral(column)}'\n)`;\n}\n\nexport function columnNullabilityCheck({\n schema,\n table,\n column,\n nullable,\n}: {\n schema: string;\n table: string;\n column: string;\n nullable: boolean;\n}): string {\n const expected = nullable ? 'YES' : 'NO';\n return `SELECT EXISTS (\n SELECT 1\n FROM information_schema.columns\n WHERE table_schema = '${escapeLiteral(schema)}'\n AND table_name = '${escapeLiteral(table)}'\n AND column_name = '${escapeLiteral(column)}'\n AND is_nullable = '${expected}'\n)`;\n}\n\nexport function tableIsEmptyCheck(qualifiedTableName: string): string {\n return `SELECT NOT EXISTS (SELECT 1 FROM ${qualifiedTableName} LIMIT 1)`;\n}\n\nexport function columnHasNoDefaultCheck(opts: {\n schema: string;\n table: string;\n column: string;\n}): string {\n return `SELECT NOT EXISTS (\n SELECT 1\n FROM information_schema.columns\n WHERE table_schema = '${escapeLiteral(opts.schema)}'\n AND table_name = '${escapeLiteral(opts.table)}'\n AND column_name = '${escapeLiteral(opts.column)}'\n AND column_default IS NOT NULL\n)`;\n}\n\nconst FORMAT_TYPE_DISPLAY: ReadonlyMap<string, string> = new Map([\n ['int2', 'smallint'],\n ['int4', 'integer'],\n ['int8', 'bigint'],\n ['float4', 'real'],\n ['float8', 'double precision'],\n ['bool', 'boolean'],\n ['timestamp', 'timestamp without time zone'],\n ['timestamptz', 'timestamp with time zone'],\n ['time', 'time without time zone'],\n ['timetz', 'time with time zone'],\n]);\n\nconst UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;\n\nconst POSTGRES_RESERVED_IDENTIFIER_WORDS = new Set([\n 'all',\n 'analyse',\n 'analyze',\n 'and',\n 'any',\n 'array',\n 'as',\n 'asc',\n 'asymmetric',\n 'authorization',\n 'between',\n 'binary',\n 'both',\n 'case',\n 'cast',\n 'check',\n 'collate',\n 'column',\n 'constraint',\n 'create',\n 'current_catalog',\n 'current_date',\n 'current_role',\n 'current_time',\n 'current_timestamp',\n 'current_user',\n 'default',\n 'deferrable',\n 'desc',\n 'distinct',\n 'do',\n 'else',\n 'end',\n 'except',\n 'false',\n 'fetch',\n 'for',\n 'foreign',\n 'freeze',\n 'from',\n 'full',\n 'grant',\n 'group',\n 'having',\n 'ilike',\n 'in',\n 'initially',\n 'inner',\n 'intersect',\n 'into',\n 'is',\n 'isnull',\n 'join',\n 'lateral',\n 'leading',\n 'left',\n 'like',\n 'limit',\n 'localtime',\n 'localtimestamp',\n 'natural',\n 'not',\n 'notnull',\n 'null',\n 'offset',\n 'on',\n 'only',\n 'or',\n 'order',\n 'outer',\n 'overlaps',\n 'placing',\n 'primary',\n 'references',\n 'right',\n 'select',\n 'session_user',\n 'similar',\n 'some',\n 'symmetric',\n 'table',\n 'then',\n 'to',\n 'trailing',\n 'true',\n 'union',\n 'unique',\n 'user',\n 'using',\n 'variadic',\n 'verbose',\n 'when',\n 'where',\n 'window',\n 'with',\n]);\n\nfunction formatUserDefinedTypeName(identifier: string): string {\n if (\n UNQUOTED_POSTGRES_IDENTIFIER_PATTERN.test(identifier) &&\n !POSTGRES_RESERVED_IDENTIFIER_WORDS.has(identifier)\n ) {\n return identifier;\n }\n\n return quoteIdentifier(identifier);\n}\n\nexport function buildExpectedFormatType(\n column: StorageColumn,\n codecHooks: Map<string, CodecControlHooks>,\n storageTypes: Record<string, StorageTypeInstance | PostgresEnumStorageEntry> = {},\n): string {\n const resolved = resolveColumnTypeMetadata(column, storageTypes);\n\n if (resolved.typeParams && resolved.codecId) {\n const hooks = codecHooks.get(resolved.codecId);\n if (hooks?.expandNativeType) {\n return hooks.expandNativeType({\n nativeType: resolved.nativeType,\n codecId: resolved.codecId,\n typeParams: resolved.typeParams,\n });\n }\n }\n\n if (column.typeRef) {\n return formatUserDefinedTypeName(resolved.nativeType);\n }\n\n return FORMAT_TYPE_DISPLAY.get(resolved.nativeType) ?? resolved.nativeType;\n}\n\nexport function columnTypeCheck({\n schema,\n table,\n column,\n expectedType,\n}: {\n schema: string;\n table: string;\n column: string;\n expectedType: string;\n}): string {\n return `SELECT EXISTS (\n SELECT 1\n FROM pg_attribute a\n JOIN pg_class c ON c.oid = a.attrelid\n JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE n.nspname = '${escapeLiteral(schema)}'\n AND c.relname = '${escapeLiteral(table)}'\n AND a.attname = '${escapeLiteral(column)}'\n AND format_type(a.atttypid, a.atttypmod) = '${escapeLiteral(expectedType)}'\n AND NOT a.attisdropped\n)`;\n}\n\nexport function columnDefaultExistsCheck({\n schema,\n table,\n column,\n exists = true,\n}: {\n schema: string;\n table: string;\n column: string;\n exists?: boolean;\n}): string {\n const nullCheck = exists ? 'IS NOT NULL' : 'IS NULL';\n return `SELECT EXISTS (\n SELECT 1\n FROM information_schema.columns\n WHERE table_schema = '${escapeLiteral(schema)}'\n AND table_name = '${escapeLiteral(table)}'\n AND column_name = '${escapeLiteral(column)}'\n AND column_default ${nullCheck}\n)`;\n}\n\nexport function tableHasPrimaryKeyCheck(\n schema: string,\n table: string,\n exists: boolean,\n constraintName?: string,\n): string {\n const comparison = exists ? '' : 'NOT ';\n const constraintFilter = constraintName\n ? `AND c2.relname = '${escapeLiteral(constraintName)}'`\n : '';\n return `SELECT ${comparison}EXISTS (\n SELECT 1\n FROM pg_index i\n JOIN pg_class c ON c.oid = i.indrelid\n JOIN pg_namespace n ON n.oid = c.relnamespace\n LEFT JOIN pg_class c2 ON c2.oid = i.indexrelid\n WHERE n.nspname = '${escapeLiteral(schema)}'\n AND c.relname = '${escapeLiteral(table)}'\n AND i.indisprimary\n ${constraintFilter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T,OAAO;;;0BAGiB,cAAc,KAAK,OAAO,CAAC;wBAC7B,cAAc,KAAK,MAAM,CAAC;yBACzB,cAAc,KAAK,OAAO,CAAC;;;;AAKpD,MAAM,sBAAmD,IAAI,IAAI;CAC/D,CAAC,QAAQ,WAAW;CACpB,CAAC,QAAQ,UAAU;CACnB,CAAC,QAAQ,SAAS;CAClB,CAAC,UAAU,OAAO;CAClB,CAAC,UAAU,mBAAmB;CAC9B,CAAC,QAAQ,UAAU;CACnB,CAAC,aAAa,8BAA8B;CAC5C,CAAC,eAAe,2BAA2B;CAC3C,CAAC,QAAQ,yBAAyB;CAClC,CAAC,UAAU,sBAAsB;CAClC,CAAC;AAEF,MAAM,uCAAuC;AAE7C,MAAM,qCAAqC,IAAI,IAAI;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAS,0BAA0B,YAA4B;CAC7D,IACE,qCAAqC,KAAK,WAAW,IACrD,CAAC,mCAAmC,IAAI,WAAW,EAEnD,OAAO;CAGT,OAAO,gBAAgB,WAAW;;AAGpC,SAAgB,wBACd,QACA,YACA,eAA+E,EAAE,EACzE;CACR,MAAM,WAAW,0BAA0B,QAAQ,aAAa;CAEhE,IAAI,SAAS,cAAc,SAAS,SAAS;EAC3C,MAAM,QAAQ,WAAW,IAAI,SAAS,QAAQ;EAC9C,IAAI,OAAO,kBACT,OAAO,MAAM,iBAAiB;GAC5B,YAAY,SAAS;GACrB,SAAS,SAAS;GAClB,YAAY,SAAS;GACtB,CAAC;;CAIN,IAAI,OAAO,SACT,OAAO,0BAA0B,SAAS,WAAW;CAGvD,OAAO,oBAAoB,IAAI,SAAS,WAAW,IAAI,SAAS;;AAGlE,SAAgB,gBAAgB,EAC9B,QACA,OACA,QACA,gBAMS;CACT,OAAO;;;;;uBAKc,cAAc,OAAO,CAAC;uBACtB,cAAc,MAAM,CAAC;uBACrB,cAAc,OAAO,CAAC;kDACK,cAAc,aAAa,CAAC;;;;AAK9E,SAAgB,yBAAyB,EACvC,QACA,OACA,QACA,SAAS,QAMA;CACT,MAAM,YAAY,SAAS,gBAAgB;CAC3C,OAAO;;;0BAGiB,cAAc,OAAO,CAAC;wBACxB,cAAc,MAAM,CAAC;yBACpB,cAAc,OAAO,CAAC;yBACtB,UAAU;;;AAInC,SAAgB,wBACd,QACA,OACA,QACA,gBACQ;CACR,MAAM,aAAa,SAAS,KAAK;CACjC,MAAM,mBAAmB,iBACrB,qBAAqB,cAAc,eAAe,CAAC,KACnD;CACJ,OAAO,UAAU,WAAW;;;;;;uBAMP,cAAc,OAAO,CAAC;uBACtB,cAAc,MAAM,CAAC;;MAEtC,iBAAiB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodecControlHooks } from "@prisma-next/family-sql/control";
|
|
2
|
-
import { StorageColumn, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
2
|
+
import { PostgresEnumStorageEntry, StorageColumn, StorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
3
3
|
|
|
4
4
|
//#region src/core/migrations/planner-sql-checks.d.ts
|
|
5
5
|
declare function qualifyTableName(schema: string, table: string): string;
|
|
@@ -48,7 +48,7 @@ declare function columnHasNoDefaultCheck(opts: {
|
|
|
48
48
|
table: string;
|
|
49
49
|
column: string;
|
|
50
50
|
}): string;
|
|
51
|
-
declare function buildExpectedFormatType(column: StorageColumn, codecHooks: Map<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance>): string;
|
|
51
|
+
declare function buildExpectedFormatType(column: StorageColumn, codecHooks: Map<string, CodecControlHooks>, storageTypes?: Record<string, StorageTypeInstance | PostgresEnumStorageEntry>): string;
|
|
52
52
|
declare function tableHasPrimaryKeyCheck(schema: string, table: string, exists: boolean, constraintName?: string): string;
|
|
53
53
|
//#endregion
|
|
54
54
|
export { buildExpectedFormatType, columnExistsCheck, columnHasNoDefaultCheck, columnNullabilityCheck, constraintExistsCheck, qualifyTableName, tableHasPrimaryKeyCheck, tableIsEmptyCheck, toRegclassLiteral };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-sql-checks.d.mts","names":[],"sources":["../src/core/migrations/planner-sql-checks.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"planner-sql-checks.d.mts","names":[],"sources":["../src/core/migrations/planner-sql-checks.ts"],"mappings":";;;;iBASgB,gBAAA,CAAiB,MAAA,UAAgB,KAAA;AAAA,iBAIjC,iBAAA,CAAkB,MAAA,UAAgB,IAAA;AAJlD;;;;;AAAA,iBAcgB,qBAAA,CAAA;EACd,cAAA;EACA,MAAA;EACA,KAAA;EACA;AAAA;EAEA,cAAA;EACA,MAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,iBAec,iBAAA,CAAA;EACd,MAAA;EACA,KAAA;EACA,MAAA;EACA;AAAA;EAEA,MAAA;EACA,KAAA;EACA,MAAA;EACA,MAAA;AAAA;AAAA,iBAYc,sBAAA,CAAA;EACd,MAAA;EACA,KAAA;EACA,MAAA;EACA;AAAA;EAEA,MAAA;EACA,KAAA;EACA,MAAA;EACA,QAAA;AAAA;AAAA,iBAac,iBAAA,CAAkB,kBAAA;AAAA,iBAIlB,uBAAA,CAAwB,IAAA;EACtC,MAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,iBAwIc,uBAAA,CACd,MAAA,EAAQ,aAAA,EACR,UAAA,EAAY,GAAA,SAAY,iBAAA,GACxB,YAAA,GAAc,MAAA,SAAe,mBAAA,GAAsB,wBAAA;AAAA,iBAoErC,uBAAA,CACd,MAAA,UACA,KAAA,UACA,MAAA,WACA,cAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as columnNullabilityCheck, c as qualifyTableName, d as toRegclassLiteral, i as columnHasNoDefaultCheck, l as tableHasPrimaryKeyCheck, r as columnExistsCheck, s as constraintExistsCheck, t as buildExpectedFormatType, u as tableIsEmptyCheck } from "./planner-sql-checks-
|
|
1
|
+
import { a as columnNullabilityCheck, c as qualifyTableName, d as toRegclassLiteral, i as columnHasNoDefaultCheck, l as tableHasPrimaryKeyCheck, r as columnExistsCheck, s as constraintExistsCheck, t as buildExpectedFormatType, u as tableIsEmptyCheck } from "./planner-sql-checks-Cd016Ycs.mjs";
|
|
2
2
|
export { buildExpectedFormatType, columnExistsCheck, columnHasNoDefaultCheck, columnNullabilityCheck, constraintExistsCheck, qualifyTableName, tableHasPrimaryKeyCheck, tableIsEmptyCheck, toRegclassLiteral };
|
package/dist/{planner-target-details-bVVcanWh.d.mts.map → planner-target-details-iYJwzFHP.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner-target-details-
|
|
1
|
+
{"version":3,"file":"planner-target-details-iYJwzFHP.d.mts","names":[],"sources":["../src/core/migrations/planner-target-details.ts"],"mappings":";KAEY,cAAA;AAAA,UAUK,yBAAA;EAAA,SACN,MAAA;EAAA,SACA,UAAA,EAAY,cAAA;EAAA,SACZ,IAAA;EAAA,SACA,KAAA;AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PostgresPlanTargetDetails } from "./planner-target-details-
|
|
1
|
+
import { t as PostgresPlanTargetDetails } from "./planner-target-details-iYJwzFHP.mjs";
|
|
2
2
|
export { type PostgresPlanTargetDetails };
|
package/dist/planner.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-
|
|
1
|
+
import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-D34ftfEK.mjs";
|
|
2
2
|
import { MigrationOperationPolicy, SqlPlannerFailureResult } from "@prisma-next/family-sql/control";
|
|
3
3
|
import { MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationScaffoldContext } from "@prisma-next/framework-components/control";
|
|
4
4
|
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":";;;;;;;
|
|
1
|
+
{"version":3,"file":"planner.d.mts","names":[],"sources":["../src/core/migrations/planner.ts"],"mappings":";;;;;;;UAwCU,aAAA;EAAA,SACC,aAAA;AAAA;AAAA,iBAOK,8BAAA,CACd,MAAA,GAAQ,OAAA,CAAQ,aAAA,IACf,wBAAA;;;;AAFH;;;;KAgBY,kBAAA;EAAA,SACG,IAAA;EAAA,SAA0B,IAAA,EAAM,qCAAA;AAAA,IAC3C,uBAAA;;;;;;;AAFJ;;;;;;;;;;cAoBa,wBAAA,YAAoC,gBAAA;EAAA,iBAClB,MAAA;cAAA,MAAA,EAAQ,aAAA;EAErC,IAAA,CAAK,OAAA;IAAA,SACM,QAAA;IAAA,SACA,MAAA;IAAA,SACA,MAAA,EAAQ,wBAAA;IAiBa;;;;;;;;;;;;;;IAAA,SAFrB,YAAA,EAAc,QAAA;IAAA,SACd,UAAA;IAAA,SACA,mBAAA,EAAqB,aAAA,CAAc,8BAAA;IAFnC;;;;;IAAA,SAQA,OAAA;EAAA,IACP,kBAAA;EAIJ,cAAA,CACE,OAAA,EAAS,wBAAA,EACT,OAAA,WACC,iCAAA;EAAA,QAWK,OAAA;EAAA,QA6DA,oBAAA;EAAA,QAaA,mBAAA;AAAA"}
|
package/dist/planner.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPostgresMigrationPlanner } from "./planner-
|
|
1
|
+
import { t as createPostgresMigrationPlanner } from "./planner-DSDXUbQ4.mjs";
|
|
2
2
|
export { createPostgresMigrationPlanner };
|