@prisma-next/target-postgres 0.3.0-dev.6 → 0.3.0-dev.63
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 +8 -1
- package/dist/control.d.mts +16 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +2947 -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 +7 -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 +33 -33
- package/src/core/migrations/planner-reconciliation.ts +602 -0
- package/src/core/migrations/planner.ts +476 -215
- package/src/core/migrations/runner.ts +29 -34
- package/src/core/migrations/statement-builders.ts +9 -7
- package/src/core/types.ts +5 -0
- package/src/exports/control.ts +9 -8
- 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';
|
|
@@ -141,6 +146,8 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
141
146
|
context: options.context ?? {},
|
|
142
147
|
typeMetadataRegistry: this.family.typeMetadataRegistry,
|
|
143
148
|
frameworkComponents: options.frameworkComponents,
|
|
149
|
+
normalizeDefault: parsePostgresDefault,
|
|
150
|
+
normalizeNativeType: normalizeSchemaNativeType,
|
|
144
151
|
});
|
|
145
152
|
if (!schemaVerifyResult.ok) {
|
|
146
153
|
return runnerFailure('SCHEMA_VERIFY_FAILED', schemaVerifyResult.summary, {
|
|
@@ -371,13 +378,13 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
371
378
|
return Object.freeze({
|
|
372
379
|
id: operation.id,
|
|
373
380
|
label: operation.label,
|
|
374
|
-
...(
|
|
381
|
+
...ifDefined('summary', operation.summary),
|
|
375
382
|
operationClass: operation.operationClass,
|
|
376
383
|
target: operation.target, // Already frozen from plan creation
|
|
377
384
|
precheck: Object.freeze([]),
|
|
378
385
|
execute: Object.freeze([]),
|
|
379
386
|
postcheck: frozenPostcheck,
|
|
380
|
-
...(operation.meta || mergedMeta ?
|
|
387
|
+
...ifDefined('meta', operation.meta || mergedMeta ? mergedMeta : undefined),
|
|
381
388
|
});
|
|
382
389
|
}
|
|
383
390
|
|
|
@@ -388,7 +395,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
388
395
|
if (!marker) {
|
|
389
396
|
return false;
|
|
390
397
|
}
|
|
391
|
-
if (marker.
|
|
398
|
+
if (marker.storageHash !== plan.destination.storageHash) {
|
|
392
399
|
return false;
|
|
393
400
|
}
|
|
394
401
|
if (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) {
|
|
@@ -427,43 +434,31 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
427
434
|
): Result<void, SqlMigrationRunnerFailure> {
|
|
428
435
|
const origin = plan.origin ?? null;
|
|
429
436
|
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
|
-
);
|
|
437
|
+
// No origin assertion on the plan — the caller does not want origin validation.
|
|
438
|
+
// This is the case for `db update`, which introspects the live schema and does not
|
|
439
|
+
// rely on marker continuity. `db init` handles its own marker checks before the runner.
|
|
440
|
+
return okVoid();
|
|
446
441
|
}
|
|
447
442
|
|
|
448
443
|
if (!marker) {
|
|
449
444
|
return runnerFailure(
|
|
450
445
|
'MARKER_ORIGIN_MISMATCH',
|
|
451
|
-
`Missing contract marker: expected origin
|
|
446
|
+
`Missing contract marker: expected origin storage hash ${origin.storageHash}.`,
|
|
452
447
|
{
|
|
453
448
|
meta: {
|
|
454
|
-
|
|
449
|
+
expectedOriginStorageHash: origin.storageHash,
|
|
455
450
|
},
|
|
456
451
|
},
|
|
457
452
|
);
|
|
458
453
|
}
|
|
459
|
-
if (marker.
|
|
454
|
+
if (marker.storageHash !== origin.storageHash) {
|
|
460
455
|
return runnerFailure(
|
|
461
456
|
'MARKER_ORIGIN_MISMATCH',
|
|
462
|
-
`Existing contract marker (${marker.
|
|
457
|
+
`Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`,
|
|
463
458
|
{
|
|
464
459
|
meta: {
|
|
465
|
-
|
|
466
|
-
|
|
460
|
+
markerStorageHash: marker.storageHash,
|
|
461
|
+
expectedOriginStorageHash: origin.storageHash,
|
|
467
462
|
},
|
|
468
463
|
},
|
|
469
464
|
);
|
|
@@ -487,14 +482,14 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
487
482
|
destination: SqlMigrationPlanContractInfo,
|
|
488
483
|
contract: SqlMigrationRunnerExecuteOptions<PostgresPlanTargetDetails>['destinationContract'],
|
|
489
484
|
): Result<void, SqlMigrationRunnerFailure> {
|
|
490
|
-
if (destination.
|
|
485
|
+
if (destination.storageHash !== contract.storageHash) {
|
|
491
486
|
return runnerFailure(
|
|
492
487
|
'DESTINATION_CONTRACT_MISMATCH',
|
|
493
|
-
`Plan destination
|
|
488
|
+
`Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storageHash}).`,
|
|
494
489
|
{
|
|
495
490
|
meta: {
|
|
496
|
-
|
|
497
|
-
|
|
491
|
+
planStorageHash: destination.storageHash,
|
|
492
|
+
contractStorageHash: contract.storageHash,
|
|
498
493
|
},
|
|
499
494
|
},
|
|
500
495
|
);
|
|
@@ -524,11 +519,11 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
524
519
|
existingMarker: ContractMarkerRecord | null,
|
|
525
520
|
): Promise<void> {
|
|
526
521
|
const writeStatements = buildWriteMarkerStatements({
|
|
527
|
-
|
|
522
|
+
storageHash: options.plan.destination.storageHash,
|
|
528
523
|
profileHash:
|
|
529
524
|
options.plan.destination.profileHash ??
|
|
530
525
|
options.destinationContract.profileHash ??
|
|
531
|
-
options.plan.destination.
|
|
526
|
+
options.plan.destination.storageHash,
|
|
532
527
|
contractJson: options.destinationContract,
|
|
533
528
|
canonicalVersion: null,
|
|
534
529
|
meta: {},
|
|
@@ -544,13 +539,13 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
|
|
|
544
539
|
executedOperations: readonly SqlMigrationPlanOperation<PostgresPlanTargetDetails>[],
|
|
545
540
|
): Promise<void> {
|
|
546
541
|
const ledgerStatement = buildLedgerInsertStatement({
|
|
547
|
-
|
|
542
|
+
originStorageHash: existingMarker?.storageHash ?? null,
|
|
548
543
|
originProfileHash: existingMarker?.profileHash ?? null,
|
|
549
|
-
|
|
544
|
+
destinationStorageHash: options.plan.destination.storageHash,
|
|
550
545
|
destinationProfileHash:
|
|
551
546
|
options.plan.destination.profileHash ??
|
|
552
547
|
options.destinationContract.profileHash ??
|
|
553
|
-
options.plan.destination.
|
|
548
|
+
options.plan.destination.storageHash,
|
|
554
549
|
contractJsonBefore: existingMarker?.contractJson ?? null,
|
|
555
550
|
contractJsonAfter: options.destinationContract,
|
|
556
551
|
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 { expandParameterizedNativeType } from '@prisma-next/adapter-postgres/control';
|
|
2
|
+
import type { ContractIR } from '@prisma-next/contract/ir';
|
|
1
3
|
import type {
|
|
2
4
|
ControlTargetInstance,
|
|
3
5
|
MigrationPlanner,
|
|
@@ -7,22 +9,17 @@ import type {
|
|
|
7
9
|
SqlControlFamilyInstance,
|
|
8
10
|
SqlControlTargetDescriptor,
|
|
9
11
|
} from '@prisma-next/family-sql/control';
|
|
12
|
+
import { contractToSchemaIR } from '@prisma-next/family-sql/control';
|
|
13
|
+
import type { SqlStorage } from '@prisma-next/sql-contract/types';
|
|
10
14
|
import { postgresTargetDescriptorMeta } from '../core/descriptor-meta';
|
|
11
15
|
import type { PostgresPlanTargetDetails } from '../core/migrations/planner';
|
|
12
16
|
import { createPostgresMigrationPlanner } from '../core/migrations/planner';
|
|
13
17
|
import { createPostgresMigrationRunner } from '../core/migrations/runner';
|
|
14
18
|
|
|
15
|
-
/**
|
|
16
|
-
* Postgres target descriptor for CLI config.
|
|
17
|
-
*/
|
|
18
19
|
const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresPlanTargetDetails> =
|
|
19
20
|
{
|
|
20
21
|
...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
|
-
*/
|
|
22
|
+
operationSignatures: () => [],
|
|
26
23
|
migrations: {
|
|
27
24
|
createPlanner(_family: SqlControlFamilyInstance) {
|
|
28
25
|
return createPostgresMigrationPlanner() as MigrationPlanner<'sql', 'postgres'>;
|
|
@@ -30,6 +27,10 @@ const postgresTargetDescriptor: SqlControlTargetDescriptor<'postgres', PostgresP
|
|
|
30
27
|
createRunner(family) {
|
|
31
28
|
return createPostgresMigrationRunner(family) as MigrationRunner<'sql', 'postgres'>;
|
|
32
29
|
},
|
|
30
|
+
contractToSchema(contract: ContractIR | null) {
|
|
31
|
+
const storage = contract ? (contract.storage as SqlStorage) : { tables: {} };
|
|
32
|
+
return contractToSchemaIR(storage, expandParameterizedNativeType);
|
|
33
|
+
},
|
|
33
34
|
},
|
|
34
35
|
create(): ControlTargetInstance<'sql', 'postgres'> {
|
|
35
36
|
return {
|
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"}
|