@prisma-next/target-postgres 0.12.0-dev.7 → 0.12.0-dev.70
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-DliyCWPY.d.mts → codec-ids-B1vOchLE.d.mts} +3 -2
- package/dist/codec-ids-B1vOchLE.d.mts.map +1 -0
- package/dist/{codec-ids-C5qzBqus.mjs → codec-ids-CTikp1if.mjs} +3 -2
- package/dist/codec-ids-CTikp1if.mjs.map +1 -0
- package/dist/codec-ids.d.mts +2 -2
- package/dist/codec-ids.mjs +2 -2
- package/dist/{codec-types-BF1DXTPs.d.mts → codec-types-CnFiNML4.d.mts} +8 -9
- package/dist/codec-types-CnFiNML4.d.mts.map +1 -0
- package/dist/codec-types.d.mts +2 -2
- package/dist/{codecs-DuP3d9Au.d.mts → codecs-CBpEv4s5.d.mts} +33 -35
- package/dist/codecs-CBpEv4s5.d.mts.map +1 -0
- package/dist/codecs.d.mts +1 -1
- package/dist/codecs.mjs +37 -2
- package/dist/codecs.mjs.map +1 -1
- package/dist/contract-free.d.mts +80 -0
- package/dist/contract-free.d.mts.map +1 -0
- package/dist/contract-free.mjs +117 -0
- package/dist/contract-free.mjs.map +1 -0
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +66 -40
- package/dist/control.mjs.map +1 -1
- package/dist/{data-transform-CRkv2T_U.mjs → data-transform-D25tLeYU.mjs} +1 -1
- package/dist/{data-transform-CRkv2T_U.mjs.map → data-transform-D25tLeYU.mjs.map} +1 -1
- package/dist/{data-transform-CAPmAdxS.d.mts → data-transform-DGOqcLrf.d.mts} +2 -2
- package/dist/{data-transform-CAPmAdxS.d.mts.map → data-transform-DGOqcLrf.d.mts.map} +1 -1
- package/dist/data-transform.d.mts +1 -1
- package/dist/data-transform.mjs +1 -1
- package/dist/ddl-77SyXgFt.mjs +30 -0
- package/dist/ddl-77SyXgFt.mjs.map +1 -0
- package/dist/ddl.d.mts +2 -0
- package/dist/ddl.mjs +2 -0
- package/dist/{default-normalizer-DaAhmzBV.mjs → default-normalizer-DyyCHQWs.mjs} +1 -1
- package/dist/{default-normalizer-DaAhmzBV.mjs.map → default-normalizer-DyyCHQWs.mjs.map} +1 -1
- package/dist/default-normalizer.mjs +1 -1
- package/dist/{descriptor-meta-Uu8QaClr.mjs → descriptor-meta-DKmj-IMN.mjs} +3 -2
- package/dist/descriptor-meta-DKmj-IMN.mjs.map +1 -0
- package/dist/{descriptor-meta-runtime-DMRX39kp.mjs → descriptor-meta-runtime-My8_s4cs.mjs} +2 -2
- package/dist/{descriptor-meta-runtime-DMRX39kp.mjs.map → descriptor-meta-runtime-My8_s4cs.mjs.map} +1 -1
- package/dist/{enum-planning-DRA9LaMU.mjs → enum-planning-BCyvlFHk.mjs} +0 -0
- package/dist/{enum-planning-DRA9LaMU.mjs.map → enum-planning-BCyvlFHk.mjs.map} +1 -1
- package/dist/enum-planning.d.mts +1 -1
- package/dist/enum-planning.mjs +1 -1
- package/dist/{errors-BbnITmAD.mjs → errors-CUk87ByX.mjs} +1 -1
- package/dist/{errors-BbnITmAD.mjs.map → errors-CUk87ByX.mjs.map} +1 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/{issue-planner-BtaL6OfW.mjs → issue-planner-SHnDHfoQ.mjs} +130 -28
- package/dist/issue-planner-SHnDHfoQ.mjs.map +1 -0
- package/dist/issue-planner.d.mts +1 -1
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +7 -8
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +5 -4
- package/dist/migration.mjs.map +1 -1
- package/dist/{native-type-normalizer-BNEQ9VDs.mjs → native-type-normalizer-Bc9XJzWC.mjs} +1 -1
- package/dist/{native-type-normalizer-BNEQ9VDs.mjs.map → native-type-normalizer-Bc9XJzWC.mjs.map} +1 -1
- package/dist/native-type-normalizer.mjs +1 -1
- package/dist/nodes-779hmCfL.d.mts +40 -0
- package/dist/nodes-779hmCfL.d.mts.map +1 -0
- package/dist/nodes-DZk2JZG3.mjs +47 -0
- package/dist/nodes-DZk2JZG3.mjs.map +1 -0
- package/dist/op-factory-call-D2aAUhmS.mjs +1307 -0
- package/dist/op-factory-call-D2aAUhmS.mjs.map +1 -0
- package/dist/{op-factory-call-CDlImOF_.d.mts → op-factory-call-DMA86_2D.d.mts} +39 -14
- package/dist/op-factory-call-DMA86_2D.d.mts.map +1 -0
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +2 -2
- package/dist/pack.d.mts +5 -6
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/planner-Bv5LV2A-.mjs +344 -0
- package/dist/planner-Bv5LV2A-.mjs.map +1 -0
- package/dist/{planner-ddl-builders-BNMfSE9r.mjs → planner-ddl-builders-DDyptTt5.mjs} +4 -28
- package/dist/planner-ddl-builders-DDyptTt5.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +6 -7
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-ddl-builders.mjs +2 -2
- package/dist/{planner-identity-values-nhVj0hp-.mjs → planner-identity-values-BIpa5p2I.mjs} +1 -1
- package/dist/{planner-identity-values-nhVj0hp-.mjs.map → planner-identity-values-BIpa5p2I.mjs.map} +1 -1
- package/dist/planner-identity-values.mjs +1 -1
- package/dist/{planner-produced-postgres-migration-D02NOhVQ.d.mts → planner-produced-postgres-migration-B4EDvLdz.d.mts} +5 -4
- package/dist/planner-produced-postgres-migration-B4EDvLdz.d.mts.map +1 -0
- package/dist/{planner-produced-postgres-migration-D_nsXbhl.mjs → planner-produced-postgres-migration-NSEhWL0L.mjs} +8 -6
- package/dist/planner-produced-postgres-migration-NSEhWL0L.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/{planner-schema-lookup-CGxxYfnD.mjs → planner-schema-lookup-CiVaAQP-.mjs} +1 -1
- package/dist/{planner-schema-lookup-CGxxYfnD.mjs.map → planner-schema-lookup-CiVaAQP-.mjs.map} +1 -1
- package/dist/planner-schema-lookup.mjs +1 -1
- package/dist/{planner-sql-checks-CfEiTXoQ.mjs → planner-sql-checks-DAdhnI2c.mjs} +41 -30
- package/dist/planner-sql-checks-DAdhnI2c.mjs.map +1 -0
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/{planner-target-details-a_wuOiYf.d.mts → planner-target-details-CIY6tLeo.d.mts} +2 -2
- package/dist/planner-target-details-CIY6tLeo.d.mts.map +1 -0
- package/dist/planner-target-details.d.mts +2 -2
- package/dist/planner-type-resolution-836DExFN.mjs +20 -0
- package/dist/planner-type-resolution-836DExFN.mjs.map +1 -0
- package/dist/planner.d.mts +7 -3
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/{postgres-contract-serializer-BnOboPWs.mjs → postgres-contract-serializer-DYTyXjPf.mjs} +33 -24
- package/dist/postgres-contract-serializer-DYTyXjPf.mjs.map +1 -0
- package/dist/{postgres-enum-type-CSzsvXrO.d.mts → postgres-enum-type-BVn63a89.d.mts} +1 -1
- package/dist/{postgres-enum-type-CSzsvXrO.d.mts.map → postgres-enum-type-BVn63a89.d.mts.map} +1 -1
- package/dist/{postgres-enum-type-BMgyxNyy.mjs → postgres-enum-type-DPKqCBem.mjs} +1 -1
- package/dist/{postgres-enum-type-BMgyxNyy.mjs.map → postgres-enum-type-DPKqCBem.mjs.map} +1 -1
- package/dist/{postgres-migration-BatbEvU6.mjs → postgres-migration-COore9Mz.mjs} +23 -3
- package/dist/postgres-migration-COore9Mz.mjs.map +1 -0
- package/dist/{postgres-migration-DRY8V-bQ.d.mts → postgres-migration-DZ_gLUOW.d.mts} +25 -3
- package/dist/postgres-migration-DZ_gLUOW.d.mts.map +1 -0
- package/dist/{postgres-schema-BxAuNFX0.mjs → postgres-schema-BuxCxbvB.mjs} +29 -14
- package/dist/postgres-schema-BuxCxbvB.mjs.map +1 -0
- package/dist/{render-ops-XhICjX_P.mjs → render-ops-BpjstrKQ.mjs} +4 -3
- package/dist/{render-ops-XhICjX_P.mjs.map → render-ops-BpjstrKQ.mjs.map} +1 -1
- package/dist/render-ops.d.mts +3 -2
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/render-ops.mjs +1 -1
- package/dist/{render-typescript-K125n-RZ.mjs → render-typescript-KMgosran.mjs} +5 -2
- package/dist/render-typescript-KMgosran.mjs.map +1 -0
- package/dist/render-typescript.mjs +1 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -2
- package/dist/{shared-Do_a5ymU.d.mts → shared-DarONYBZ.d.mts} +5 -5
- package/dist/{shared-Do_a5ymU.d.mts.map → shared-DarONYBZ.d.mts.map} +1 -1
- package/dist/{sql-utils-CggjWNij.mjs → sql-utils-DcfMz4MQ.mjs} +1 -1
- package/dist/{sql-utils-CggjWNij.mjs.map → sql-utils-DcfMz4MQ.mjs.map} +1 -1
- package/dist/sql-utils.mjs +1 -1
- package/dist/{types-O40IcFV9.d.mts → types-BDKkx8MA.d.mts} +1 -1
- package/dist/types-BDKkx8MA.d.mts.map +1 -0
- package/dist/types.d.mts +16 -11
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +2 -2
- package/package.json +21 -20
- package/src/contract-free/columns.ts +49 -0
- package/src/contract-free/control-bootstrap.ts +55 -0
- package/src/contract-free/ddl.ts +37 -0
- package/src/core/ast/table-source.ts +23 -0
- package/src/core/codec-ids.ts +1 -0
- package/src/core/codecs.ts +44 -0
- package/src/core/ddl/nodes.ts +72 -0
- package/src/core/descriptor-meta.ts +1 -0
- package/src/core/migrations/control-policy.ts +234 -0
- package/src/core/migrations/issue-planner.ts +81 -13
- package/src/core/migrations/op-factory-call.ts +289 -46
- package/src/core/migrations/operations/constraints.ts +79 -10
- package/src/core/migrations/operations/dependencies.ts +0 -17
- package/src/core/migrations/operations/shared.ts +3 -3
- package/src/core/migrations/operations/tables.ts +1 -39
- package/src/core/migrations/planner-ddl-builders.ts +4 -46
- package/src/core/migrations/planner-produced-postgres-migration.ts +11 -6
- package/src/core/migrations/planner-sql-checks.ts +9 -9
- package/src/core/migrations/planner-strategies.ts +149 -11
- package/src/core/migrations/planner-target-details.ts +2 -1
- package/src/core/migrations/planner.ts +66 -8
- package/src/core/migrations/postgres-migration.ts +41 -0
- package/src/core/migrations/render-ops.ts +7 -2
- package/src/core/migrations/render-typescript.ts +5 -1
- package/src/core/migrations/runner.ts +78 -50
- package/src/core/postgres-contract-serializer.ts +52 -46
- package/src/core/postgres-schema.ts +43 -25
- package/src/exports/contract-free.ts +7 -0
- package/src/exports/control.ts +6 -8
- package/src/exports/ddl.ts +7 -0
- package/src/exports/migration.ts +11 -2
- package/src/exports/op-factory-call.ts +2 -0
- package/src/exports/planner-ddl-builders.ts +0 -1
- package/dist/codec-ids-C5qzBqus.mjs.map +0 -1
- package/dist/codec-ids-DliyCWPY.d.mts.map +0 -1
- package/dist/codec-types-BF1DXTPs.d.mts.map +0 -1
- package/dist/codecs-DuP3d9Au.d.mts.map +0 -1
- package/dist/descriptor-meta-Uu8QaClr.mjs.map +0 -1
- package/dist/issue-planner-BtaL6OfW.mjs.map +0 -1
- package/dist/op-factory-call-CDlImOF_.d.mts.map +0 -1
- package/dist/op-factory-call-ewOd5q6L.mjs +0 -625
- package/dist/op-factory-call-ewOd5q6L.mjs.map +0 -1
- package/dist/planner-Bjz5pnLa.mjs +0 -177
- package/dist/planner-Bjz5pnLa.mjs.map +0 -1
- package/dist/planner-ddl-builders-BNMfSE9r.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-D02NOhVQ.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-D_nsXbhl.mjs.map +0 -1
- package/dist/planner-sql-checks-CfEiTXoQ.mjs.map +0 -1
- package/dist/planner-target-details-a_wuOiYf.d.mts.map +0 -1
- package/dist/postgres-contract-serializer-BnOboPWs.mjs.map +0 -1
- package/dist/postgres-migration-BatbEvU6.mjs.map +0 -1
- package/dist/postgres-migration-DRY8V-bQ.d.mts.map +0 -1
- package/dist/postgres-schema-BxAuNFX0.mjs.map +0 -1
- package/dist/render-typescript-K125n-RZ.mjs.map +0 -1
- package/dist/statement-builders-DVI5IVAa.mjs +0 -131
- package/dist/statement-builders-DVI5IVAa.mjs.map +0 -1
- package/dist/statement-builders.d.mts +0 -51
- package/dist/statement-builders.d.mts.map +0 -1
- package/dist/statement-builders.mjs +0 -2
- package/dist/tables-DoA39Yqo.mjs +0 -516
- package/dist/tables-DoA39Yqo.mjs.map +0 -1
- package/dist/types-O40IcFV9.d.mts.map +0 -1
- package/src/core/migrations/statement-builders.ts +0 -183
- package/src/exports/statement-builders.ts +0 -8
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';
|
|
2
|
+
import type { Lowerer } from '@prisma-next/family-sql/control-adapter';
|
|
2
3
|
import type { OpFactoryCall } from '@prisma-next/framework-components/control';
|
|
4
|
+
import { blindCast } from '@prisma-next/utils/casts';
|
|
3
5
|
import type { PostgresPlanTargetDetails } from './planner-target-details';
|
|
4
6
|
|
|
5
7
|
type Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;
|
|
@@ -23,9 +25,12 @@ function assertPostgresOp(
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
export function renderOps(calls: readonly OpFactoryCall[]): Op[] {
|
|
28
|
+
export function renderOps(calls: readonly OpFactoryCall[], lowerer?: Lowerer): Op[] {
|
|
27
29
|
return calls.map((c) => {
|
|
28
|
-
const op =
|
|
30
|
+
const op = blindCast<
|
|
31
|
+
{ toOp(lowerer?: Lowerer): ReturnType<OpFactoryCall['toOp']> },
|
|
32
|
+
'PG OpFactoryCall.toOp accepts an optional Lowerer; the framework interface omits it because not all targets need a lowerer — the PG target overrides with this extended signature'
|
|
33
|
+
>(c).toOp(lowerer);
|
|
29
34
|
assertPostgresOp(op, c.factoryName);
|
|
30
35
|
return op;
|
|
31
36
|
});
|
|
@@ -46,7 +46,7 @@ export function renderCallsToTypeScript(
|
|
|
46
46
|
meta: RenderMigrationMeta,
|
|
47
47
|
): string {
|
|
48
48
|
const imports = buildImports(calls);
|
|
49
|
-
const operationsBody = calls.map((c) => c
|
|
49
|
+
const operationsBody = calls.map((c) => renderCall(c)).join(',\n');
|
|
50
50
|
|
|
51
51
|
return [
|
|
52
52
|
shebangLineFor(detectScaffoldRuntime()),
|
|
@@ -66,6 +66,10 @@ export function renderCallsToTypeScript(
|
|
|
66
66
|
].join('\n');
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
function renderCall(call: OpFactoryCall): string {
|
|
70
|
+
return call.renderTypeScript();
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
function buildImports(calls: ReadonlyArray<OpFactoryCall>): string {
|
|
70
74
|
const requirements: ImportRequirement[] = [...BASE_IMPORTS];
|
|
71
75
|
for (const call of calls) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
1
|
+
import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
2
2
|
import type {
|
|
3
3
|
MigrationOperationPolicy,
|
|
4
4
|
SqlControlFamilyInstance,
|
|
@@ -13,13 +13,12 @@ import type {
|
|
|
13
13
|
} from '@prisma-next/family-sql/control';
|
|
14
14
|
import { runnerFailure, runnerSuccess } from '@prisma-next/family-sql/control';
|
|
15
15
|
import { verifySqlSchema } from '@prisma-next/family-sql/schema-verify';
|
|
16
|
-
import type {
|
|
17
|
-
ControlDriverInstance,
|
|
18
|
-
MigrationRunnerResult,
|
|
19
|
-
} from '@prisma-next/framework-components/control';
|
|
16
|
+
import type { MigrationRunnerResult } from '@prisma-next/framework-components/control';
|
|
20
17
|
import { APP_SPACE_ID } from '@prisma-next/framework-components/control';
|
|
21
18
|
import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';
|
|
19
|
+
import type { SqlControlDriverInstance, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
22
20
|
import { SqlQueryError } from '@prisma-next/sql-errors';
|
|
21
|
+
import type { LoweredStatement } from '@prisma-next/sql-relational-core/ast';
|
|
23
22
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
24
23
|
import type { Result } from '@prisma-next/utils/result';
|
|
25
24
|
import { notOk, ok, okVoid } from '@prisma-next/utils/result';
|
|
@@ -27,14 +26,6 @@ import { parsePostgresDefault } from '../default-normalizer';
|
|
|
27
26
|
import { normalizeSchemaNativeType } from '../native-type-normalizer';
|
|
28
27
|
import { createResolveExistingEnumValues } from './enum-planning';
|
|
29
28
|
import type { PostgresPlanTargetDetails } from './planner-target-details';
|
|
30
|
-
import {
|
|
31
|
-
buildLedgerInsertStatement,
|
|
32
|
-
buildMergeMarkerStatements,
|
|
33
|
-
ensureLedgerTableStatement,
|
|
34
|
-
ensureMarkerTableStatement,
|
|
35
|
-
ensurePrismaContractSchemaStatement,
|
|
36
|
-
type SqlStatement,
|
|
37
|
-
} from './statement-builders';
|
|
38
29
|
|
|
39
30
|
interface ApplyPlanSuccessValue {
|
|
40
31
|
readonly operationsExecuted: number;
|
|
@@ -107,7 +98,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
107
98
|
if (!policyCheck.ok) return policyCheck;
|
|
108
99
|
|
|
109
100
|
await this.acquireLock(driver, lockKey);
|
|
110
|
-
const ensureResult = await this.ensureControlTables(driver);
|
|
101
|
+
const ensureResult = await this.ensureControlTables(driver, options.destinationContract);
|
|
111
102
|
if (!ensureResult.ok) return ensureResult;
|
|
112
103
|
const existingMarker = await this.family.readMarker({ driver, space });
|
|
113
104
|
|
|
@@ -165,8 +156,9 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
165
156
|
isSelfEdge && applyValue.operationsExecuted === 0 && incomingIsSubsetOfExisting;
|
|
166
157
|
|
|
167
158
|
if (!isSelfEdgeNoOp) {
|
|
168
|
-
await this.upsertMarker(driver, options, existingMarker, space);
|
|
169
|
-
|
|
159
|
+
const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
|
|
160
|
+
if (!markerResult.ok) return markerResult;
|
|
161
|
+
await this.recordLedgerEntries(driver, options, applyValue.executedOperations);
|
|
170
162
|
}
|
|
171
163
|
|
|
172
164
|
return runnerSuccess({
|
|
@@ -176,7 +168,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
176
168
|
}
|
|
177
169
|
|
|
178
170
|
async execute(options: {
|
|
179
|
-
readonly driver:
|
|
171
|
+
readonly driver: SqlControlDriverInstance<string>;
|
|
180
172
|
readonly perSpaceOptions: ReadonlyArray<
|
|
181
173
|
SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>
|
|
182
174
|
>;
|
|
@@ -282,18 +274,22 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
282
274
|
|
|
283
275
|
private async ensureControlTables(
|
|
284
276
|
driver: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['driver'],
|
|
277
|
+
contract: Contract<SqlStorage>,
|
|
285
278
|
): Promise<Result<void, SqlMigrationRunnerFailure>> {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
279
|
+
const lowererContext = { contract };
|
|
280
|
+
const bootstrapQueries = this.family.bootstrapControlTableQueries();
|
|
281
|
+
const [schemaQuery, ...tableQueries] = bootstrapQueries;
|
|
282
|
+
if (schemaQuery === undefined) {
|
|
283
|
+
throw new Error('Postgres control-table bootstrap must include CREATE SCHEMA');
|
|
284
|
+
}
|
|
285
|
+
await this.executeStatement(driver, this.family.lowerAst(schemaQuery, lowererContext));
|
|
291
286
|
const legacyDetection = await this.detectLegacyMarkerShape(driver);
|
|
292
287
|
if (!legacyDetection.ok) {
|
|
293
288
|
return legacyDetection;
|
|
294
289
|
}
|
|
295
|
-
|
|
296
|
-
|
|
290
|
+
for (const query of tableQueries) {
|
|
291
|
+
await this.executeStatement(driver, this.family.lowerAst(query, lowererContext));
|
|
292
|
+
}
|
|
297
293
|
return okVoid();
|
|
298
294
|
}
|
|
299
295
|
|
|
@@ -594,43 +590,75 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
594
590
|
options: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>,
|
|
595
591
|
existingMarker: ContractMarkerRecord | null,
|
|
596
592
|
space: string,
|
|
597
|
-
): Promise<void
|
|
598
|
-
const
|
|
599
|
-
const writeStatements = buildMergeMarkerStatements({
|
|
600
|
-
space,
|
|
593
|
+
): Promise<Result<void, SqlMigrationRunnerFailure>> {
|
|
594
|
+
const destination = {
|
|
601
595
|
storageHash: options.plan.destination.storageHash,
|
|
602
596
|
profileHash:
|
|
603
597
|
options.plan.destination.profileHash ??
|
|
604
598
|
options.destinationContract.profileHash ??
|
|
605
599
|
options.plan.destination.storageHash,
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
600
|
+
invariants: options.plan.providedInvariants ?? [],
|
|
601
|
+
};
|
|
602
|
+
if (!existingMarker) {
|
|
603
|
+
await this.family.initMarker({ driver, space, destination });
|
|
604
|
+
return okVoid();
|
|
605
|
+
}
|
|
606
|
+
const updated = await this.family.updateMarker({
|
|
607
|
+
driver,
|
|
608
|
+
space,
|
|
609
|
+
expectedFrom: existingMarker.storageHash,
|
|
610
|
+
destination,
|
|
610
611
|
});
|
|
611
|
-
|
|
612
|
-
|
|
612
|
+
if (!updated) {
|
|
613
|
+
return runnerFailure(
|
|
614
|
+
'MARKER_CAS_FAILURE',
|
|
615
|
+
'Marker was modified by another process during migration execution.',
|
|
616
|
+
{
|
|
617
|
+
meta: {
|
|
618
|
+
space,
|
|
619
|
+
expectedStorageHash: existingMarker.storageHash,
|
|
620
|
+
destinationStorageHash: options.plan.destination.storageHash,
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
return okVoid();
|
|
613
626
|
}
|
|
614
627
|
|
|
615
|
-
private async
|
|
628
|
+
private async recordLedgerEntries(
|
|
616
629
|
driver: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['driver'],
|
|
617
630
|
options: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>,
|
|
618
|
-
existingMarker: ContractMarkerRecord | null,
|
|
619
631
|
executedOperations: readonly SqlMigrationPlanOperation<PostgresPlanTargetDetails>[],
|
|
620
632
|
): Promise<void> {
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
633
|
+
const plan = options.plan;
|
|
634
|
+
const space = plan.spaceId;
|
|
635
|
+
const edges = options.migrationEdges;
|
|
636
|
+
const totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);
|
|
637
|
+
if (totalEdgeOps !== plan.operations.length) {
|
|
638
|
+
throw new Error(
|
|
639
|
+
`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`,
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
// The ledger records the operations as executed — idempotency-skipped ops
|
|
643
|
+
// are substituted with skip records (empty `execute`) by `applyPlan`, so the
|
|
644
|
+
// journal reflects what actually ran rather than the raw plan.
|
|
645
|
+
let offset = 0;
|
|
646
|
+
for (const edge of edges) {
|
|
647
|
+
const edgeOps = executedOperations.slice(offset, offset + edge.operationCount);
|
|
648
|
+
offset += edge.operationCount;
|
|
649
|
+
await this.family.writeLedgerEntry({
|
|
650
|
+
driver,
|
|
651
|
+
space,
|
|
652
|
+
entry: {
|
|
653
|
+
edgeId: `${edge.from}->${edge.to}`,
|
|
654
|
+
from: edge.from,
|
|
655
|
+
to: edge.to,
|
|
656
|
+
migrationName: edge.dirName,
|
|
657
|
+
migrationHash: edge.migrationHash,
|
|
658
|
+
operations: edgeOps,
|
|
659
|
+
},
|
|
660
|
+
});
|
|
661
|
+
}
|
|
634
662
|
}
|
|
635
663
|
|
|
636
664
|
private async acquireLock(
|
|
@@ -660,7 +688,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
660
688
|
|
|
661
689
|
private async executeStatement(
|
|
662
690
|
driver: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['driver'],
|
|
663
|
-
statement:
|
|
691
|
+
statement: LoweredStatement,
|
|
664
692
|
): Promise<void> {
|
|
665
693
|
if (statement.params.length > 0) {
|
|
666
694
|
await driver.query(statement.sql, statement.params);
|
|
@@ -14,12 +14,8 @@ import {
|
|
|
14
14
|
NamespaceBase,
|
|
15
15
|
UNBOUND_NAMESPACE_ID,
|
|
16
16
|
} from '@prisma-next/framework-components/ir';
|
|
17
|
-
import type {
|
|
18
|
-
|
|
19
|
-
SqlStorage,
|
|
20
|
-
SqlStorageTypeEntry,
|
|
21
|
-
StorageTable,
|
|
22
|
-
} from '@prisma-next/sql-contract/types';
|
|
17
|
+
import type { SqlNamespaceTablesInput, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
18
|
+
import { blindCast } from '@prisma-next/utils/casts';
|
|
23
19
|
import type { JsonObject } from '@prisma-next/utils/json';
|
|
24
20
|
import type { Type } from 'arktype';
|
|
25
21
|
import { postgresAuthoringEntityTypes } from './authoring';
|
|
@@ -57,9 +53,8 @@ function collectEntityRegistryContributions(namespace: AuthoringEntityTypeNamesp
|
|
|
57
53
|
if (isAuthoringEntityTypeDescriptor(value)) {
|
|
58
54
|
if (isAuthoringEntityTypeFactoryOutput(value.output)) {
|
|
59
55
|
const { factory } = value.output;
|
|
60
|
-
entityTypeRegistry.set(
|
|
61
|
-
|
|
62
|
-
(raw) => factory(raw, POSTGRES_AUTHORING_CTX) as SqlStorageTypeEntry,
|
|
56
|
+
entityTypeRegistry.set(value.discriminator, (raw) =>
|
|
57
|
+
factory(raw, POSTGRES_AUTHORING_CTX),
|
|
63
58
|
);
|
|
64
59
|
}
|
|
65
60
|
if (value.validatorSchema !== undefined) {
|
|
@@ -91,22 +86,43 @@ export class PostgresContractSerializer extends SqlContractSerializerBase<Contra
|
|
|
91
86
|
if (raw instanceof NamespaceBase) {
|
|
92
87
|
return raw;
|
|
93
88
|
}
|
|
94
|
-
const hydrated =
|
|
95
|
-
|
|
96
|
-
tables
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
|
|
89
|
+
const hydrated = blindCast<
|
|
90
|
+
SqlNamespaceTablesInput,
|
|
91
|
+
'super.hydrateSqlNamespaceEntry returns the tables form when raw is not a NamespaceBase'
|
|
92
|
+
>(super.hydrateSqlNamespaceEntry(nsId, raw));
|
|
93
|
+
const { id, entries } = hydrated;
|
|
94
|
+
|
|
95
|
+
// Extract the postgres-specific `type` slot directly from raw input.
|
|
96
|
+
// The family base handles the `table` slot; the postgres target owns `type`.
|
|
97
|
+
const rawRecord = raw as Record<string, unknown>;
|
|
98
|
+
const rawEntries = rawRecord['entries'];
|
|
99
|
+
let typeSlot: Record<string, PostgresEnumType> | undefined;
|
|
100
|
+
if (rawEntries !== null && typeof rawEntries === 'object' && !Array.isArray(rawEntries)) {
|
|
101
|
+
const rawTypeSlot = (rawEntries as Record<string, unknown>)['type'];
|
|
102
|
+
if (rawTypeSlot !== null && typeof rawTypeSlot === 'object' && !Array.isArray(rawTypeSlot)) {
|
|
103
|
+
const enumFactory = this.entityTypeRegistry.get('postgres-enum');
|
|
104
|
+
typeSlot = Object.fromEntries(
|
|
105
|
+
Object.entries(rawTypeSlot as Record<string, unknown>).map(([name, entry]) => [
|
|
106
|
+
name,
|
|
107
|
+
blindCast<PostgresEnumType, 'postgres-enum factory returns PostgresEnumType'>(
|
|
108
|
+
enumFactory !== undefined ? enumFactory(entry) : entry,
|
|
109
|
+
),
|
|
110
|
+
]),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
100
114
|
|
|
101
|
-
const emptyTables = Object.keys(
|
|
102
|
-
const
|
|
103
|
-
if (id === UNBOUND_NAMESPACE_ID && emptyTables &&
|
|
115
|
+
const emptyTables = Object.keys(entries.table).length === 0;
|
|
116
|
+
const emptyTypes = !typeSlot || Object.keys(typeSlot).length === 0;
|
|
117
|
+
if (id === UNBOUND_NAMESPACE_ID && emptyTables && emptyTypes) {
|
|
104
118
|
return PostgresSchema.unbound;
|
|
105
119
|
}
|
|
106
120
|
return new PostgresSchema({
|
|
107
121
|
id,
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
entries: {
|
|
123
|
+
table: entries.table,
|
|
124
|
+
type: typeSlot ?? {},
|
|
125
|
+
},
|
|
110
126
|
});
|
|
111
127
|
}
|
|
112
128
|
|
|
@@ -117,30 +133,18 @@ export class PostgresContractSerializer extends SqlContractSerializerBase<Contra
|
|
|
117
133
|
if (isPostgresSchema(ns)) {
|
|
118
134
|
namespacesJson[nsId] = this.serializePostgresNamespace(ns, ns.id === UNBOUND_NAMESPACE_ID);
|
|
119
135
|
} else {
|
|
120
|
-
// Family-level SqlUnboundNamespace or other family-built SQL
|
|
121
|
-
// namespaces haven't been promoted to a PostgresSchema instance
|
|
122
|
-
// yet (e.g. they came straight from the TS builder before a target
|
|
123
|
-
// `createNamespace` factory ran). Serialise them as postgres-schema /
|
|
124
|
-
// postgres-unbound-schema so the round-trip through
|
|
125
|
-
// deserializeContract hydrates them back into PostgresSchema
|
|
126
|
-
// instances.
|
|
127
136
|
const isUnboundSlot = nsId === UNBOUND_NAMESPACE_ID;
|
|
128
|
-
const nsEnums = (ns as { readonly enum?: Readonly<Record<string, unknown>> }).enum ?? {};
|
|
129
137
|
namespacesJson[nsId] = {
|
|
130
138
|
id: nsId,
|
|
131
139
|
kind: isUnboundSlot ? 'postgres-unbound-schema' : 'postgres-schema',
|
|
132
|
-
|
|
133
|
-
Object.
|
|
134
|
-
tableName,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
typeName,
|
|
141
|
-
this.serializeJsonValue(entry) as JsonObject,
|
|
142
|
-
]),
|
|
143
|
-
),
|
|
140
|
+
entries: {
|
|
141
|
+
table: Object.fromEntries(
|
|
142
|
+
Object.entries(ns.entries.table).map(([tableName, table]) => [
|
|
143
|
+
tableName,
|
|
144
|
+
this.serializeJsonValue(table) as JsonObject,
|
|
145
|
+
]),
|
|
146
|
+
),
|
|
147
|
+
},
|
|
144
148
|
};
|
|
145
149
|
}
|
|
146
150
|
}
|
|
@@ -163,18 +167,20 @@ export class PostgresContractSerializer extends SqlContractSerializerBase<Contra
|
|
|
163
167
|
|
|
164
168
|
private serializePostgresNamespace(ns: PostgresSchema, isUnboundSlot: boolean): JsonObject {
|
|
165
169
|
const tablesOut: Record<string, JsonObject> = {};
|
|
166
|
-
for (const [tableName, table] of Object.entries(ns.
|
|
170
|
+
for (const [tableName, table] of Object.entries(ns.entries.table)) {
|
|
167
171
|
tablesOut[tableName] = this.serializeJsonValue(table) as JsonObject;
|
|
168
172
|
}
|
|
169
|
-
const
|
|
170
|
-
for (const [typeName, ty] of Object.entries(ns.
|
|
171
|
-
|
|
173
|
+
const typeOut: Record<string, JsonObject> = {};
|
|
174
|
+
for (const [typeName, ty] of Object.entries(ns.entries.type)) {
|
|
175
|
+
typeOut[typeName] = this.serializeJsonValue(ty) as JsonObject;
|
|
172
176
|
}
|
|
173
177
|
return {
|
|
174
178
|
id: ns.id,
|
|
175
179
|
kind: isUnboundSlot ? 'postgres-unbound-schema' : 'postgres-schema',
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
entries: {
|
|
181
|
+
table: tablesOut,
|
|
182
|
+
type: typeOut,
|
|
183
|
+
},
|
|
178
184
|
};
|
|
179
185
|
}
|
|
180
186
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
UNBOUND_NAMESPACE_ID,
|
|
5
5
|
} from '@prisma-next/framework-components/ir';
|
|
6
6
|
import {
|
|
7
|
+
type PostgresEnumStorageEntry,
|
|
7
8
|
type SqlNamespaceTablesInput,
|
|
8
9
|
type SqlStorage,
|
|
9
10
|
StorageTable,
|
|
@@ -14,8 +15,10 @@ import { escapeLiteral } from './sql-utils';
|
|
|
14
15
|
|
|
15
16
|
export interface PostgresSchemaInput {
|
|
16
17
|
readonly id: string;
|
|
17
|
-
readonly
|
|
18
|
-
|
|
18
|
+
readonly entries: {
|
|
19
|
+
readonly table: Record<string, StorageTable | StorageTableInput>;
|
|
20
|
+
readonly type: Record<string, PostgresEnumType | PostgresEnumTypeInput>;
|
|
21
|
+
};
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
/**
|
|
@@ -24,9 +27,10 @@ export interface PostgresSchemaInput {
|
|
|
24
27
|
* `namespaces: Record<NamespaceId, PostgresSchema>` map populated by
|
|
25
28
|
* the Postgres PSL interpreter from `namespace { … }` AST buckets.
|
|
26
29
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
+
* `entries` holds entity-kind slot maps (`table`, `type`). Qualifier
|
|
31
|
+
* emission is the rendering seam: DDL / SQL emission asks the namespace
|
|
32
|
+
* for its qualifier (`"<schema>"`) or for a qualified table name
|
|
33
|
+
* (`"<schema>"."<table>"`) and consumes the result polymorphically.
|
|
30
34
|
* The unbound singleton below overrides these methods to elide the
|
|
31
35
|
* prefix entirely — call sites stay polymorphic and never branch on
|
|
32
36
|
* `id === UNBOUND_NAMESPACE_ID`.
|
|
@@ -43,28 +47,32 @@ export class PostgresSchema extends NamespaceBase {
|
|
|
43
47
|
|
|
44
48
|
declare readonly kind: 'schema';
|
|
45
49
|
readonly id: string;
|
|
46
|
-
readonly
|
|
47
|
-
|
|
50
|
+
readonly entries: Readonly<{
|
|
51
|
+
readonly table: Readonly<Record<string, StorageTable>>;
|
|
52
|
+
readonly type: Readonly<Record<string, PostgresEnumType>>;
|
|
53
|
+
}>;
|
|
48
54
|
|
|
49
55
|
constructor(input: PostgresSchemaInput) {
|
|
50
56
|
super();
|
|
51
57
|
this.id = input.id;
|
|
52
|
-
this.
|
|
53
|
-
Object.
|
|
54
|
-
Object.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
this.entries = Object.freeze({
|
|
59
|
+
table: Object.freeze(
|
|
60
|
+
Object.fromEntries(
|
|
61
|
+
Object.entries(input.entries.table).map(([k, v]) => [
|
|
62
|
+
k,
|
|
63
|
+
v instanceof StorageTable ? v : new StorageTable(v as StorageTableInput),
|
|
64
|
+
]),
|
|
65
|
+
),
|
|
58
66
|
),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
type: Object.freeze(
|
|
68
|
+
Object.fromEntries(
|
|
69
|
+
Object.entries(input.entries.type).map(([k, v]) => [
|
|
70
|
+
k,
|
|
71
|
+
v instanceof PostgresEnumType ? v : new PostgresEnumType(v as PostgresEnumTypeInput),
|
|
72
|
+
]),
|
|
73
|
+
),
|
|
66
74
|
),
|
|
67
|
-
);
|
|
75
|
+
});
|
|
68
76
|
Object.defineProperty(this, 'kind', {
|
|
69
77
|
value: 'schema',
|
|
70
78
|
writable: false,
|
|
@@ -154,7 +162,7 @@ export class PostgresUnboundSchema extends PostgresSchema {
|
|
|
154
162
|
static readonly instance: PostgresUnboundSchema = new PostgresUnboundSchema();
|
|
155
163
|
|
|
156
164
|
constructor(input?: PostgresSchemaInput) {
|
|
157
|
-
super(input ?? { id: UNBOUND_NAMESPACE_ID });
|
|
165
|
+
super(input ?? { id: UNBOUND_NAMESPACE_ID, entries: { table: {}, type: {} } });
|
|
158
166
|
}
|
|
159
167
|
|
|
160
168
|
override qualifier(): string {
|
|
@@ -196,9 +204,19 @@ export function isPostgresSchema(ns: unknown): ns is PostgresSchema {
|
|
|
196
204
|
* by reference and trust the resulting `SqlStorage.namespaces` map to
|
|
197
205
|
* be value-stable for a given input set.
|
|
198
206
|
*/
|
|
199
|
-
export function postgresCreateNamespace(
|
|
207
|
+
export function postgresCreateNamespace(
|
|
208
|
+
input: SqlNamespaceTablesInput,
|
|
209
|
+
enumTypes?: Readonly<Record<string, PostgresEnumStorageEntry>>,
|
|
210
|
+
): PostgresSchema {
|
|
211
|
+
const schemaInput: PostgresSchemaInput = {
|
|
212
|
+
id: input.id,
|
|
213
|
+
entries: {
|
|
214
|
+
table: input.entries.table,
|
|
215
|
+
type: (enumTypes ?? {}) as Record<string, PostgresEnumTypeInput>,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
200
218
|
if (input.id === UNBOUND_NAMESPACE_ID) {
|
|
201
|
-
return new PostgresUnboundSchema(
|
|
219
|
+
return new PostgresUnboundSchema(schemaInput);
|
|
202
220
|
}
|
|
203
|
-
return new PostgresSchema(
|
|
221
|
+
return new PostgresSchema(schemaInput);
|
|
204
222
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { int4, int8, jsonb, pgTable, text, textArray, timestamptz } from '../contract-free/columns';
|
|
2
|
+
export {
|
|
3
|
+
buildControlTableBootstrapQueries,
|
|
4
|
+
buildSignMarkerBootstrapQueries,
|
|
5
|
+
} from '../contract-free/control-bootstrap';
|
|
6
|
+
export { createSchema, createTable } from '../contract-free/ddl';
|
|
7
|
+
export { PostgresTableSource } from '../core/ast/table-source';
|
package/src/exports/control.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { ColumnDefault, Contract } from '@prisma-next/contract/types';
|
|
2
|
-
import type {
|
|
3
|
-
SqlControlFamilyInstance,
|
|
4
|
-
SqlControlTargetDescriptor,
|
|
5
|
-
} from '@prisma-next/family-sql/control';
|
|
2
|
+
import type { SqlControlTargetDescriptor } from '@prisma-next/family-sql/control';
|
|
6
3
|
import { contractToSchemaIR, extractCodecControlHooks } from '@prisma-next/family-sql/control';
|
|
4
|
+
import type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';
|
|
7
5
|
import type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';
|
|
8
6
|
import type {
|
|
9
7
|
ControlTargetInstance,
|
|
@@ -62,8 +60,8 @@ const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresP
|
|
|
62
60
|
contractSerializer: new PostgresContractSerializer(),
|
|
63
61
|
schemaVerifier: new PostgresSchemaVerifier(),
|
|
64
62
|
migrations: {
|
|
65
|
-
createPlanner(
|
|
66
|
-
return createPostgresMigrationPlanner();
|
|
63
|
+
createPlanner(adapter: SqlControlAdapter<'postgres'>) {
|
|
64
|
+
return createPostgresMigrationPlanner(adapter);
|
|
67
65
|
},
|
|
68
66
|
createRunner(family) {
|
|
69
67
|
return createPostgresMigrationRunner(family) as MigrationRunner<'sql', 'postgres'>;
|
|
@@ -107,8 +105,8 @@ const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresP
|
|
|
107
105
|
* Direct method for SQL-specific usage.
|
|
108
106
|
* @deprecated Use migrations.createPlanner() for CLI compatibility.
|
|
109
107
|
*/
|
|
110
|
-
createPlanner(
|
|
111
|
-
return createPostgresMigrationPlanner();
|
|
108
|
+
createPlanner(adapter: SqlControlAdapter<'postgres'>) {
|
|
109
|
+
return createPostgresMigrationPlanner(adapter);
|
|
112
110
|
},
|
|
113
111
|
/**
|
|
114
112
|
* Direct method for SQL-specific usage.
|
package/src/exports/migration.ts
CHANGED
|
@@ -9,6 +9,14 @@ export { MigrationCLI } from '@prisma-next/cli/migration-cli';
|
|
|
9
9
|
// `placeholder("…")` slots, instead of pulling in `@prisma-next/errors`
|
|
10
10
|
// directly. The planner emits an import from this same module.
|
|
11
11
|
export { placeholder } from '@prisma-next/errors/migration';
|
|
12
|
+
export {
|
|
13
|
+
col,
|
|
14
|
+
fn,
|
|
15
|
+
foreignKey,
|
|
16
|
+
lit,
|
|
17
|
+
primaryKey,
|
|
18
|
+
unique,
|
|
19
|
+
} from '@prisma-next/sql-relational-core/contract-free';
|
|
12
20
|
export {
|
|
13
21
|
addColumn,
|
|
14
22
|
alterColumnType,
|
|
@@ -19,9 +27,11 @@ export {
|
|
|
19
27
|
setNotNull,
|
|
20
28
|
} from '../core/migrations/operations/columns';
|
|
21
29
|
export {
|
|
30
|
+
addCheckConstraint,
|
|
22
31
|
addForeignKey,
|
|
23
32
|
addPrimaryKey,
|
|
24
33
|
addUnique,
|
|
34
|
+
dropCheckConstraint,
|
|
25
35
|
dropConstraint,
|
|
26
36
|
} from '../core/migrations/operations/constraints';
|
|
27
37
|
export {
|
|
@@ -31,7 +41,6 @@ export {
|
|
|
31
41
|
} from '../core/migrations/operations/data-transform';
|
|
32
42
|
export {
|
|
33
43
|
createExtension,
|
|
34
|
-
createSchema,
|
|
35
44
|
installExtension,
|
|
36
45
|
} from '../core/migrations/operations/dependencies';
|
|
37
46
|
export {
|
|
@@ -42,7 +51,7 @@ export {
|
|
|
42
51
|
} from '../core/migrations/operations/enums';
|
|
43
52
|
export { createIndex, dropIndex } from '../core/migrations/operations/indexes';
|
|
44
53
|
export { rawSql } from '../core/migrations/operations/raw';
|
|
45
|
-
export {
|
|
54
|
+
export { dropTable } from '../core/migrations/operations/tables';
|
|
46
55
|
// Target-owned base class for migrations. Aliased to `Migration` so
|
|
47
56
|
// user-edited migration.ts files (and the renderer's scaffold) read as
|
|
48
57
|
// `class M extends Migration { … }` without having to thread the
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export {
|
|
2
|
+
AddCheckConstraintCall,
|
|
2
3
|
AddColumnCall,
|
|
3
4
|
AddEnumValuesCall,
|
|
4
5
|
AddForeignKeyCall,
|
|
@@ -11,6 +12,7 @@ export {
|
|
|
11
12
|
CreateSchemaCall,
|
|
12
13
|
CreateTableCall,
|
|
13
14
|
DataTransformCall,
|
|
15
|
+
DropCheckConstraintCall,
|
|
14
16
|
DropColumnCall,
|
|
15
17
|
DropConstraintCall,
|
|
16
18
|
DropDefaultCall,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-ids-C5qzBqus.mjs","names":[],"sources":["../src/core/codec-ids.ts"],"sourcesContent":["export {\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n} from '@prisma-next/sql-relational-core/ast';\nexport const PG_TEXT_CODEC_ID = 'pg/text@1' as const;\nexport const PG_ENUM_CODEC_ID = 'pg/enum@1' as const;\nexport const PG_CHAR_CODEC_ID = 'pg/char@1' as const;\nexport const PG_VARCHAR_CODEC_ID = 'pg/varchar@1' as const;\nexport const PG_INT_CODEC_ID = 'pg/int@1' as const;\nexport const PG_INT2_CODEC_ID = 'pg/int2@1' as const;\nexport const PG_INT4_CODEC_ID = 'pg/int4@1' as const;\nexport const PG_INT8_CODEC_ID = 'pg/int8@1' as const;\nexport const PG_FLOAT_CODEC_ID = 'pg/float@1' as const;\nexport const PG_FLOAT4_CODEC_ID = 'pg/float4@1' as const;\nexport const PG_FLOAT8_CODEC_ID = 'pg/float8@1' as const;\nexport const PG_NUMERIC_CODEC_ID = 'pg/numeric@1' as const;\nexport const PG_BOOL_CODEC_ID = 'pg/bool@1' as const;\nexport const PG_BIT_CODEC_ID = 'pg/bit@1' as const;\nexport const PG_VARBIT_CODEC_ID = 'pg/varbit@1' as const;\nexport const PG_TIMESTAMP_CODEC_ID = 'pg/timestamp@1' as const;\nexport const PG_TIMESTAMPTZ_CODEC_ID = 'pg/timestamptz@1' as const;\nexport const PG_TIME_CODEC_ID = 'pg/time@1' as const;\nexport const PG_TIMETZ_CODEC_ID = 'pg/timetz@1' as const;\nexport const PG_INTERVAL_CODEC_ID = 'pg/interval@1' as const;\nexport const PG_JSON_CODEC_ID = 'pg/json@1' as const;\nexport const PG_JSONB_CODEC_ID = 'pg/jsonb@1' as const;\nexport const PG_BYTEA_CODEC_ID = 'pg/bytea@1' as const;\n"],"mappings":";;AAQA,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,sBAAsB;AACnC,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,oBAAoB;AACjC,MAAa,qBAAqB;AAClC,MAAa,qBAAqB;AAClC,MAAa,sBAAsB;AACnC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAClC,MAAa,wBAAwB;AACrC,MAAa,0BAA0B;AACvC,MAAa,mBAAmB;AAChC,MAAa,qBAAqB;AAClC,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,oBAAoB;AACjC,MAAa,oBAAoB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-ids-DliyCWPY.d.mts","names":[],"sources":["../src/core/codec-ids.ts"],"mappings":";;;cAQa,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,mBAAA;AAAA,cACA,eAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,gBAAA;AAAA,cACA,iBAAA;AAAA,cACA,kBAAA;AAAA,cACA,kBAAA;AAAA,cACA,mBAAA;AAAA,cACA,gBAAA;AAAA,cACA,eAAA;AAAA,cACA,kBAAA;AAAA,cACA,qBAAA;AAAA,cACA,uBAAA;AAAA,cACA,gBAAA;AAAA,cACA,kBAAA;AAAA,cACA,oBAAA;AAAA,cACA,gBAAA;AAAA,cACA,iBAAA;AAAA,cACA,iBAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types-BF1DXTPs.d.mts","names":[],"sources":["../src/core/codec-type-map.ts","../src/exports/codec-types.ts"],"mappings":";;;;;;cA4Ca,kBAAA;EAAA,eA8BH,uCAAA,CAAA,iBAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEE,OAAA,6BAAoC,CAAA,0BAA2B,CAAA,CAAE,CAAA,IAAK,CAAA,CAAE,CAAA,EAAG,CAAA;AAAA,KAE3E,kBAAA,UAA4B,kBAAkB;AAAA,KAE9C,mBAAA,GAAsB,iBAAiB,CAAC,kBAAA;;;KCrExC,UAAA,GAAa,OAAO,CAAC,mBAAA;AAAA,KAI5B,OAAA,kBAAyB,MAAA,qBAA2B,CAAA,0BAClC,KAAA,GAAQ,KAAA,CAAM,CAAA;AAAA,KAGhC,aAAA,eAA4B,MAAA,qBAA2B,OAAA,SAAgB,KAAA;AAAA,KAEhE,IAAA,qBAAyB,aAAa;EAAG,YAAA,EAAc,CAAA;AAAA;AAAA,KACvD,OAAA,qBAA4B,aAAa;EAAG,eAAA,EAAiB,CAAA;AAAA;AAAA,KAC7D,OAAA,+DAAsE,aAAA;EAChF,kBAAA,EAAoB,CAAA;EACpB,cAAA,EAAgB,CAAA;AAAA;AAAA,KAEN,GAAA,qBAAwB,aAAa;EAAG,WAAA,EAAa,CAAA;AAAA;AAAA,KACrD,MAAA,qBAA2B,aAAa;EAAG,cAAA,EAAgB,CAAA;AAAA;AAAA,KAC3D,SAAA,6CAAsD,aAAa;EAC7E,oBAAA,EAAsB,CAAA;AAAA;AAAA,KAEZ,WAAA,6CAAwD,aAAa;EAC/E,sBAAA,EAAwB,CAAA;AAAA;AAAA,KAEd,IAAA,6CAAiD,aAAa;EAAG,eAAA,EAAiB,CAAA;AAAA;AAAA,KAClF,MAAA,6CAAmD,aAAa;EAC1E,iBAAA,EAAmB,CAAA;AAAA;AAAA,KAET,QAAA,6CAAqD,aAAa;EAC5E,mBAAA,EAAqB,CAAA;AAAA"}
|