@prisma-next/target-postgres 0.3.0-dev.10 → 0.3.0-dev.113
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/LICENSE +201 -0
- package/README.md +9 -2
- package/dist/control.d.mts +19 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +3513 -0
- package/dist/control.mjs.map +1 -0
- package/dist/descriptor-meta-DxB8oZzB.mjs +13 -0
- package/dist/descriptor-meta-DxB8oZzB.mjs.map +1 -0
- package/dist/pack.d.mts +10 -0
- package/dist/pack.d.mts.map +1 -0
- package/dist/pack.mjs +9 -0
- package/dist/pack.mjs.map +1 -0
- package/dist/runtime.d.mts +9 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +21 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +34 -33
- package/src/core/migrations/planner-identity-values.ts +129 -0
- package/src/core/migrations/planner-recipes.ts +83 -0
- package/src/core/migrations/planner-reconciliation.ts +613 -0
- package/src/core/migrations/planner-sql.ts +329 -0
- package/src/core/migrations/planner-target-details.ts +16 -0
- package/src/core/migrations/planner.ts +411 -406
- package/src/core/migrations/runner.ts +32 -36
- package/src/core/migrations/statement-builders.ts +9 -7
- package/src/core/types.ts +5 -0
- package/src/exports/control.ts +56 -8
- package/src/exports/pack.ts +5 -2
- package/src/exports/runtime.ts +7 -12
- package/dist/chunk-RKEXRSSI.js +0 -14
- package/dist/chunk-RKEXRSSI.js.map +0 -1
- package/dist/core/descriptor-meta.d.ts +0 -9
- package/dist/core/descriptor-meta.d.ts.map +0 -1
- package/dist/core/migrations/planner.d.ts +0 -14
- package/dist/core/migrations/planner.d.ts.map +0 -1
- package/dist/core/migrations/runner.d.ts +0 -8
- package/dist/core/migrations/runner.d.ts.map +0 -1
- package/dist/core/migrations/statement-builders.d.ts +0 -30
- package/dist/core/migrations/statement-builders.d.ts.map +0 -1
- package/dist/exports/control.d.ts +0 -8
- package/dist/exports/control.d.ts.map +0 -1
- package/dist/exports/control.js +0 -1255
- package/dist/exports/control.js.map +0 -1
- package/dist/exports/pack.d.ts +0 -4
- package/dist/exports/pack.d.ts.map +0 -1
- package/dist/exports/pack.js +0 -11
- package/dist/exports/pack.js.map +0 -1
- package/dist/exports/runtime.d.ts +0 -12
- package/dist/exports/runtime.d.ts.map +0 -1
- package/dist/exports/runtime.js +0 -19
- package/dist/exports/runtime.js.map +0 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeSchemaNativeType,
|
|
3
|
+
parsePostgresDefault,
|
|
4
|
+
} from '@prisma-next/adapter-postgres/control';
|
|
1
5
|
import type { ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
2
6
|
import type {
|
|
3
7
|
MigrationOperationPolicy,
|
|
@@ -14,6 +18,7 @@ import { runnerFailure, runnerSuccess } from '@prisma-next/family-sql/control';
|
|
|
14
18
|
import { verifySqlSchema } from '@prisma-next/family-sql/schema-verify';
|
|
15
19
|
import { readMarker } from '@prisma-next/family-sql/verify';
|
|
16
20
|
import { SqlQueryError } from '@prisma-next/sql-errors';
|
|
21
|
+
import { ifDefined } from '@prisma-next/utils/defined';
|
|
17
22
|
import type { Result } from '@prisma-next/utils/result';
|
|
18
23
|
import { ok, okVoid } from '@prisma-next/utils/result';
|
|
19
24
|
import type { PostgresPlanTargetDetails } from './planner';
|
|
@@ -112,11 +117,12 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
112
117
|
return markerCheck;
|
|
113
118
|
}
|
|
114
119
|
|
|
115
|
-
//
|
|
120
|
+
// db update (origin: null) always applies; migration-apply (origin set) skips if marker matches.
|
|
116
121
|
const markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);
|
|
122
|
+
const skipOperations = markerAtDestination && options.plan.origin != null;
|
|
117
123
|
let applyValue: ApplyPlanSuccessValue;
|
|
118
124
|
|
|
119
|
-
if (
|
|
125
|
+
if (skipOperations) {
|
|
120
126
|
applyValue = { operationsExecuted: 0, executedOperations: [] };
|
|
121
127
|
} else {
|
|
122
128
|
const applyResult = await this.applyPlan(driver, options);
|
|
@@ -141,6 +147,8 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
141
147
|
context: options.context ?? {},
|
|
142
148
|
typeMetadataRegistry: this.family.typeMetadataRegistry,
|
|
143
149
|
frameworkComponents: options.frameworkComponents,
|
|
150
|
+
normalizeDefault: parsePostgresDefault,
|
|
151
|
+
normalizeNativeType: normalizeSchemaNativeType,
|
|
144
152
|
});
|
|
145
153
|
if (!schemaVerifyResult.ok) {
|
|
146
154
|
return runnerFailure('SCHEMA_VERIFY_FAILED', schemaVerifyResult.summary, {
|
|
@@ -371,13 +379,13 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
371
379
|
return Object.freeze({
|
|
372
380
|
id: operation.id,
|
|
373
381
|
label: operation.label,
|
|
374
|
-
...(
|
|
382
|
+
...ifDefined('summary', operation.summary),
|
|
375
383
|
operationClass: operation.operationClass,
|
|
376
384
|
target: operation.target, // Already frozen from plan creation
|
|
377
385
|
precheck: Object.freeze([]),
|
|
378
386
|
execute: Object.freeze([]),
|
|
379
387
|
postcheck: frozenPostcheck,
|
|
380
|
-
...(operation.meta || mergedMeta ?
|
|
388
|
+
...ifDefined('meta', operation.meta || mergedMeta ? mergedMeta : undefined),
|
|
381
389
|
});
|
|
382
390
|
}
|
|
383
391
|
|
|
@@ -388,7 +396,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
388
396
|
if (!marker) {
|
|
389
397
|
return false;
|
|
390
398
|
}
|
|
391
|
-
if (marker.
|
|
399
|
+
if (marker.storageHash !== plan.destination.storageHash) {
|
|
392
400
|
return false;
|
|
393
401
|
}
|
|
394
402
|
if (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) {
|
|
@@ -427,43 +435,31 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
427
435
|
): Result<void, SqlMigrationRunnerFailure> {
|
|
428
436
|
const origin = plan.origin ?? null;
|
|
429
437
|
if (!origin) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return okVoid();
|
|
435
|
-
}
|
|
436
|
-
return runnerFailure(
|
|
437
|
-
'MARKER_ORIGIN_MISMATCH',
|
|
438
|
-
`Existing contract marker (${marker.coreHash}) does not match plan origin (no marker expected).`,
|
|
439
|
-
{
|
|
440
|
-
meta: {
|
|
441
|
-
markerCoreHash: marker.coreHash,
|
|
442
|
-
expectedOrigin: null,
|
|
443
|
-
},
|
|
444
|
-
},
|
|
445
|
-
);
|
|
438
|
+
// No origin assertion on the plan — the caller does not want origin validation.
|
|
439
|
+
// This is the case for `db update`, which introspects the live schema and does not
|
|
440
|
+
// rely on marker continuity. `db init` handles its own marker checks before the runner.
|
|
441
|
+
return okVoid();
|
|
446
442
|
}
|
|
447
443
|
|
|
448
444
|
if (!marker) {
|
|
449
445
|
return runnerFailure(
|
|
450
446
|
'MARKER_ORIGIN_MISMATCH',
|
|
451
|
-
`Missing contract marker: expected origin
|
|
447
|
+
`Missing contract marker: expected origin storage hash ${origin.storageHash}.`,
|
|
452
448
|
{
|
|
453
449
|
meta: {
|
|
454
|
-
|
|
450
|
+
expectedOriginStorageHash: origin.storageHash,
|
|
455
451
|
},
|
|
456
452
|
},
|
|
457
453
|
);
|
|
458
454
|
}
|
|
459
|
-
if (marker.
|
|
455
|
+
if (marker.storageHash !== origin.storageHash) {
|
|
460
456
|
return runnerFailure(
|
|
461
457
|
'MARKER_ORIGIN_MISMATCH',
|
|
462
|
-
`Existing contract marker (${marker.
|
|
458
|
+
`Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`,
|
|
463
459
|
{
|
|
464
460
|
meta: {
|
|
465
|
-
|
|
466
|
-
|
|
461
|
+
markerStorageHash: marker.storageHash,
|
|
462
|
+
expectedOriginStorageHash: origin.storageHash,
|
|
467
463
|
},
|
|
468
464
|
},
|
|
469
465
|
);
|
|
@@ -487,14 +483,14 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
487
483
|
destination: SqlMigrationPlanContractInfo,
|
|
488
484
|
contract: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['destinationContract'],
|
|
489
485
|
): Result<void, SqlMigrationRunnerFailure> {
|
|
490
|
-
if (destination.
|
|
486
|
+
if (destination.storageHash !== contract.storageHash) {
|
|
491
487
|
return runnerFailure(
|
|
492
488
|
'DESTINATION_CONTRACT_MISMATCH',
|
|
493
|
-
`Plan destination
|
|
489
|
+
`Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storageHash}).`,
|
|
494
490
|
{
|
|
495
491
|
meta: {
|
|
496
|
-
|
|
497
|
-
|
|
492
|
+
planStorageHash: destination.storageHash,
|
|
493
|
+
contractStorageHash: contract.storageHash,
|
|
498
494
|
},
|
|
499
495
|
},
|
|
500
496
|
);
|
|
@@ -524,11 +520,11 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
524
520
|
existingMarker: ContractMarkerRecord | null,
|
|
525
521
|
): Promise<void> {
|
|
526
522
|
const writeStatements = buildWriteMarkerStatements({
|
|
527
|
-
|
|
523
|
+
storageHash: options.plan.destination.storageHash,
|
|
528
524
|
profileHash:
|
|
529
525
|
options.plan.destination.profileHash ??
|
|
530
526
|
options.destinationContract.profileHash ??
|
|
531
|
-
options.plan.destination.
|
|
527
|
+
options.plan.destination.storageHash,
|
|
532
528
|
contractJson: options.destinationContract,
|
|
533
529
|
canonicalVersion: null,
|
|
534
530
|
meta: {},
|
|
@@ -544,13 +540,13 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
544
540
|
executedOperations: readonly SqlMigrationPlanOperation<PostgresPlanTargetDetails>[],
|
|
545
541
|
): Promise<void> {
|
|
546
542
|
const ledgerStatement = buildLedgerInsertStatement({
|
|
547
|
-
|
|
543
|
+
originStorageHash: existingMarker?.storageHash ?? null,
|
|
548
544
|
originProfileHash: existingMarker?.profileHash ?? null,
|
|
549
|
-
|
|
545
|
+
destinationStorageHash: options.plan.destination.storageHash,
|
|
550
546
|
destinationProfileHash:
|
|
551
547
|
options.plan.destination.profileHash ??
|
|
552
548
|
options.destinationContract.profileHash ??
|
|
553
|
-
options.plan.destination.
|
|
549
|
+
options.plan.destination.storageHash,
|
|
554
550
|
contractJsonBefore: existingMarker?.contractJson ?? null,
|
|
555
551
|
contractJsonAfter: options.destinationContract,
|
|
556
552
|
operations: executedOperations,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { bigintJsonReplacer } from '@prisma-next/contract/types';
|
|
2
|
+
|
|
1
3
|
export interface SqlStatement {
|
|
2
4
|
readonly sql: string;
|
|
3
5
|
readonly params: readonly unknown[];
|
|
@@ -38,7 +40,7 @@ export const ensureLedgerTableStatement: SqlStatement = {
|
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
export interface WriteMarkerInput {
|
|
41
|
-
readonly
|
|
43
|
+
readonly storageHash: string;
|
|
42
44
|
readonly profileHash: string;
|
|
43
45
|
readonly contractJson?: unknown;
|
|
44
46
|
readonly canonicalVersion?: number | null;
|
|
@@ -52,7 +54,7 @@ export function buildWriteMarkerStatements(input: WriteMarkerInput): {
|
|
|
52
54
|
} {
|
|
53
55
|
const params: readonly unknown[] = [
|
|
54
56
|
1,
|
|
55
|
-
input.
|
|
57
|
+
input.storageHash,
|
|
56
58
|
input.profileHash,
|
|
57
59
|
jsonParam(input.contractJson),
|
|
58
60
|
input.canonicalVersion ?? null,
|
|
@@ -99,9 +101,9 @@ export function buildWriteMarkerStatements(input: WriteMarkerInput): {
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
export interface LedgerInsertInput {
|
|
102
|
-
readonly
|
|
104
|
+
readonly originStorageHash?: string | null;
|
|
103
105
|
readonly originProfileHash?: string | null;
|
|
104
|
-
readonly
|
|
106
|
+
readonly destinationStorageHash: string;
|
|
105
107
|
readonly destinationProfileHash?: string | null;
|
|
106
108
|
readonly contractJsonBefore?: unknown;
|
|
107
109
|
readonly contractJsonAfter?: unknown;
|
|
@@ -128,9 +130,9 @@ export function buildLedgerInsertStatement(input: LedgerInsertInput): SqlStateme
|
|
|
128
130
|
$7::jsonb
|
|
129
131
|
)`,
|
|
130
132
|
params: [
|
|
131
|
-
input.
|
|
133
|
+
input.originStorageHash ?? null,
|
|
132
134
|
input.originProfileHash ?? null,
|
|
133
|
-
input.
|
|
135
|
+
input.destinationStorageHash,
|
|
134
136
|
input.destinationProfileHash ?? null,
|
|
135
137
|
jsonParam(input.contractJsonBefore),
|
|
136
138
|
jsonParam(input.contractJsonAfter),
|
|
@@ -140,5 +142,5 @@ export function buildLedgerInsertStatement(input: LedgerInsertInput): SqlStateme
|
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
function jsonParam(value: unknown): string {
|
|
143
|
-
return JSON.stringify(value ?? null);
|
|
145
|
+
return JSON.stringify(value ?? null, bigintJsonReplacer);
|
|
144
146
|
}
|
package/src/exports/control.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
|
|
2
|
+
import type { ColumnDefault } from '@prisma-next/contract/types';
|
|
1
3
|
import type {
|
|
2
4
|
ControlTargetInstance,
|
|
3
5
|
MigrationPlanner,
|
|
@@ -7,22 +9,59 @@ import type {
|
|
|
7
9
|
SqlControlFamilyInstance,
|
|
8
10
|
SqlControlTargetDescriptor,
|
|
9
11
|
} from '@prisma-next/family-sql/control';
|
|
12
|
+
import { contractToSchemaIR, extractCodecControlHooks } from '@prisma-next/family-sql/control';
|
|
13
|
+
import type { SqlContract, SqlStorage, StorageColumn } from '@prisma-next/sql-contract/types';
|
|
14
|
+
import { ifDefined } from '@prisma-next/utils/defined';
|
|
10
15
|
import { postgresTargetDescriptorMeta } from '../core/descriptor-meta';
|
|
11
16
|
import type { PostgresPlanTargetDetails } from '../core/migrations/planner';
|
|
12
17
|
import { createPostgresMigrationPlanner } from '../core/migrations/planner';
|
|
18
|
+
import { renderDefaultLiteral } from '../core/migrations/planner-sql';
|
|
13
19
|
import { createPostgresMigrationRunner } from '../core/migrations/runner';
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
function buildNativeTypeExpander(
|
|
22
|
+
frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', 'postgres'>>,
|
|
23
|
+
) {
|
|
24
|
+
if (!frameworkComponents) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const codecHooks = extractCodecControlHooks(frameworkComponents);
|
|
28
|
+
return (input: {
|
|
29
|
+
readonly nativeType: string;
|
|
30
|
+
readonly codecId?: string;
|
|
31
|
+
readonly typeParams?: Record<string, unknown>;
|
|
32
|
+
}) => {
|
|
33
|
+
if (!input.typeParams) return input.nativeType;
|
|
34
|
+
|
|
35
|
+
if (!input.codecId) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Column declares typeParams for nativeType "${input.nativeType}" but has no codecId. ` +
|
|
38
|
+
'Ensure the column is associated with a codec.',
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const hooks = codecHooks.get(input.codecId);
|
|
43
|
+
if (!hooks?.expandNativeType) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Column declares typeParams for nativeType "${input.nativeType}" ` +
|
|
46
|
+
`but no expandNativeType hook is registered for codecId "${input.codecId}". ` +
|
|
47
|
+
'Ensure the extension providing this codec is included in extensionPacks.',
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return hooks.expandNativeType(input);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function postgresRenderDefault(def: ColumnDefault, column: StorageColumn): string {
|
|
55
|
+
if (def.kind === 'function') {
|
|
56
|
+
return def.expression;
|
|
57
|
+
}
|
|
58
|
+
return renderDefaultLiteral(def.value, column);
|
|
59
|
+
}
|
|
60
|
+
|
|
18
61
|
const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresPlanTargetDetails> =
|
|
19
62
|
{
|
|
20
63
|
...postgresTargetDescriptorMeta,
|
|
21
|
-
|
|
22
|
-
* Migrations capability for CLI to access planner/runner via core types.
|
|
23
|
-
* The SQL-specific planner/runner types are compatible with the generic
|
|
24
|
-
* MigrationPlanner/MigrationRunner interfaces at runtime.
|
|
25
|
-
*/
|
|
64
|
+
operationSignatures: () => [],
|
|
26
65
|
migrations: {
|
|
27
66
|
createPlanner(_family: SqlControlFamilyInstance) {
|
|
28
67
|
return createPostgresMigrationPlanner() as MigrationPlanner<'sql', 'postgres'>;
|
|
@@ -30,6 +69,15 @@ const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresP
|
|
|
30
69
|
createRunner(family) {
|
|
31
70
|
return createPostgresMigrationRunner(family) as MigrationRunner<'sql', 'postgres'>;
|
|
32
71
|
},
|
|
72
|
+
contractToSchema(contract, frameworkComponents) {
|
|
73
|
+
const expander = buildNativeTypeExpander(frameworkComponents);
|
|
74
|
+
return contractToSchemaIR(contract as SqlContract<SqlStorage> | null, {
|
|
75
|
+
annotationNamespace: 'pg',
|
|
76
|
+
...ifDefined('expandNativeType', expander),
|
|
77
|
+
renderDefault: postgresRenderDefault,
|
|
78
|
+
frameworkComponents: frameworkComponents ?? [],
|
|
79
|
+
});
|
|
80
|
+
},
|
|
33
81
|
},
|
|
34
82
|
create(): ControlTargetInstance<'sql', 'postgres'> {
|
|
35
83
|
return {
|
package/src/exports/pack.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { CodecTypes } from '@prisma-next/adapter-postgres/codec-types';
|
|
1
2
|
import type { TargetPackRef } from '@prisma-next/contract/framework-components';
|
|
2
3
|
import { postgresTargetDescriptorMeta } from '../core/descriptor-meta';
|
|
3
4
|
|
|
4
|
-
const postgresPack
|
|
5
|
+
const postgresPack = postgresTargetDescriptorMeta;
|
|
5
6
|
|
|
6
|
-
export default postgresPack
|
|
7
|
+
export default postgresPack as TargetPackRef<'sql', 'postgres'> & {
|
|
8
|
+
readonly __codecTypes?: CodecTypes;
|
|
9
|
+
};
|
package/src/exports/runtime.ts
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '@prisma-next/core-execution-plane/types';
|
|
1
|
+
import type { RuntimeTargetInstance } from '@prisma-next/core-execution-plane/types';
|
|
2
|
+
import { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';
|
|
3
|
+
import type { SqlRuntimeTargetDescriptor } from '@prisma-next/sql-runtime';
|
|
5
4
|
import { postgresTargetDescriptorMeta } from '../core/descriptor-meta';
|
|
6
5
|
|
|
7
|
-
/**
|
|
8
|
-
* Postgres runtime target instance interface.
|
|
9
|
-
*/
|
|
10
6
|
export interface PostgresRuntimeTargetInstance extends RuntimeTargetInstance<'sql', 'postgres'> {}
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
* Postgres target descriptor for runtime plane.
|
|
14
|
-
*/
|
|
15
|
-
const postgresRuntimeTargetDescriptor: RuntimeTargetDescriptor<
|
|
16
|
-
'sql',
|
|
8
|
+
const postgresRuntimeTargetDescriptor: SqlRuntimeTargetDescriptor<
|
|
17
9
|
'postgres',
|
|
18
10
|
PostgresRuntimeTargetInstance
|
|
19
11
|
> = {
|
|
20
12
|
...postgresTargetDescriptorMeta,
|
|
13
|
+
codecs: () => createCodecRegistry(),
|
|
14
|
+
operationSignatures: () => [],
|
|
15
|
+
parameterizedCodecs: () => [],
|
|
21
16
|
create(): PostgresRuntimeTargetInstance {
|
|
22
17
|
return {
|
|
23
18
|
familyId: 'sql',
|
package/dist/chunk-RKEXRSSI.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/core/descriptor-meta.ts
|
|
2
|
-
var postgresTargetDescriptorMeta = {
|
|
3
|
-
kind: "target",
|
|
4
|
-
familyId: "sql",
|
|
5
|
-
targetId: "postgres",
|
|
6
|
-
id: "postgres",
|
|
7
|
-
version: "0.0.1",
|
|
8
|
-
capabilities: {}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
postgresTargetDescriptorMeta
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-RKEXRSSI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":["export const postgresTargetDescriptorMeta = {\n kind: 'target',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {},\n} as const;\n"],"mappings":";AAAO,IAAM,+BAA+B;AAAA,EAC1C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,cAAc,CAAC;AACjB;","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const postgresTargetDescriptorMeta: {
|
|
2
|
-
readonly kind: "target";
|
|
3
|
-
readonly familyId: "sql";
|
|
4
|
-
readonly targetId: "postgres";
|
|
5
|
-
readonly id: "postgres";
|
|
6
|
-
readonly version: "0.0.1";
|
|
7
|
-
readonly capabilities: {};
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=descriptor-meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta.d.ts","sourceRoot":"","sources":["../../src/core/descriptor-meta.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B;;;;;;;CAO/B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { SqlMigrationPlanner } from '@prisma-next/family-sql/control';
|
|
2
|
-
type OperationClass = 'extension' | 'table' | 'unique' | 'index' | 'foreignKey';
|
|
3
|
-
export interface PostgresPlanTargetDetails {
|
|
4
|
-
readonly schema: string;
|
|
5
|
-
readonly objectType: OperationClass;
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly table?: string;
|
|
8
|
-
}
|
|
9
|
-
interface PlannerConfig {
|
|
10
|
-
readonly defaultSchema: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function createPostgresMigrationPlanner(config?: Partial<PlannerConfig>): SqlMigrationPlanner<PostgresPlanTargetDetails>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/planner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mBAAmB,EAIpB,MAAM,iCAAiC,CAAC;AAgBzC,KAAK,cAAc,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAuBhF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAMD,wBAAgB,8BAA8B,CAC5C,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,mBAAmB,CAAC,yBAAyB,CAAC,CAKhD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SqlControlFamilyInstance, SqlMigrationRunner } from '@prisma-next/family-sql/control';
|
|
2
|
-
import type { PostgresPlanTargetDetails } from './planner';
|
|
3
|
-
interface RunnerConfig {
|
|
4
|
-
readonly defaultSchema: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function createPostgresMigrationRunner(family: SqlControlFamilyInstance, config?: Partial<RunnerConfig>): SqlMigrationRunner<PostgresPlanTargetDetails>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,wBAAwB,EAIxB,kBAAkB,EAInB,MAAM,iCAAiC,CAAC;AAOzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAU3D,UAAU,YAAY;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAoCD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,GACjC,kBAAkB,CAAC,yBAAyB,CAAC,CAE/C"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface SqlStatement {
|
|
2
|
-
readonly sql: string;
|
|
3
|
-
readonly params: readonly unknown[];
|
|
4
|
-
}
|
|
5
|
-
export declare const ensurePrismaContractSchemaStatement: SqlStatement;
|
|
6
|
-
export declare const ensureMarkerTableStatement: SqlStatement;
|
|
7
|
-
export declare const ensureLedgerTableStatement: SqlStatement;
|
|
8
|
-
export interface WriteMarkerInput {
|
|
9
|
-
readonly coreHash: string;
|
|
10
|
-
readonly profileHash: string;
|
|
11
|
-
readonly contractJson?: unknown;
|
|
12
|
-
readonly canonicalVersion?: number | null;
|
|
13
|
-
readonly appTag?: string | null;
|
|
14
|
-
readonly meta?: Record<string, unknown>;
|
|
15
|
-
}
|
|
16
|
-
export declare function buildWriteMarkerStatements(input: WriteMarkerInput): {
|
|
17
|
-
readonly insert: SqlStatement;
|
|
18
|
-
readonly update: SqlStatement;
|
|
19
|
-
};
|
|
20
|
-
export interface LedgerInsertInput {
|
|
21
|
-
readonly originCoreHash?: string | null;
|
|
22
|
-
readonly originProfileHash?: string | null;
|
|
23
|
-
readonly destinationCoreHash: string;
|
|
24
|
-
readonly destinationProfileHash?: string | null;
|
|
25
|
-
readonly contractJsonBefore?: unknown;
|
|
26
|
-
readonly contractJsonAfter?: unknown;
|
|
27
|
-
readonly operations: unknown;
|
|
28
|
-
}
|
|
29
|
-
export declare function buildLedgerInsertStatement(input: LedgerInsertInput): SqlStatement;
|
|
30
|
-
//# sourceMappingURL=statement-builders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"statement-builders.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/statement-builders.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,mCAAmC,EAAE,YAGjD,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,YAYxC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,YAaxC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,GAAG;IACnE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B,CA+CA;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA6BjF"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SqlControlTargetDescriptor } from '@prisma-next/family-sql/control';
|
|
2
|
-
import type { PostgresPlanTargetDetails } from '../core/migrations/planner';
|
|
3
|
-
/**
|
|
4
|
-
* Postgres target descriptor for CLI config.
|
|
5
|
-
*/
|
|
6
|
-
declare const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresPlanTargetDetails>;
|
|
7
|
-
export default postgresTargetDescriptor;
|
|
8
|
-
//# sourceMappingURL=control.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/exports/control.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAI5E;;GAEG;AACH,QAAA,MAAM,wBAAwB,EAAE,0BAA0B,CAAC,UAAU,EAAE,yBAAyB,CAoC7F,CAAC;AAEJ,eAAe,wBAAwB,CAAC"}
|