@prisma/migrate 6.6.0-dev.1 → 6.6.0-dev.100
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/CLI.js +3 -3
- package/dist/Migrate.js +9 -7
- package/dist/SchemaEngine.js +0 -28
- package/dist/{chunk-RM5LJIEV.js → SchemaEngineCLI.js} +10 -16
- package/dist/{utils/getSchemaPathAndPrint.js → SchemaEngineWasm.js} +8 -8
- package/dist/bin.js +52 -53
- package/dist/chunk-23DZXSTI.js +62 -0
- package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
- package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
- package/dist/chunk-33LPBNDX.js +1399 -0
- package/dist/{chunk-MKK3GSDF.js → chunk-344G2PKM.js} +9 -9
- package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
- package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
- package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
- package/dist/{chunk-ZQ3OWSVS.js → chunk-A4FQW4A5.js} +54 -50
- package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
- package/dist/{chunk-A6PMXMMT.js → chunk-AUGZZ6RT.js} +105 -13
- package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
- package/dist/{chunk-LZOZZRHB.js → chunk-CLSF7VUT.js} +42 -38
- package/dist/{chunk-Q7M5ANIE.js → chunk-CNCVJ2IN.js} +379 -534
- package/dist/{chunk-IR55GBON.js → chunk-CU5UT2ED.js} +19 -18
- package/dist/{chunk-TPJISPJ5.js → chunk-CYEVXXRH.js} +51 -47
- package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
- package/dist/{chunk-5VDXAE53.js → chunk-EJUXYFV3.js} +26 -16
- package/dist/{chunk-X6KW7BYP.js → chunk-HIDSEBVV.js} +55 -54
- package/dist/{chunk-ZOEKRXDP.js → chunk-I3LT2PO3.js} +35 -57
- package/dist/{chunk-E7OXHCDR.js → chunk-IEEJZC3B.js} +56 -49
- package/dist/chunk-IINN7QUV.js +2565 -0
- package/dist/chunk-IK3BVD3Y.js +233 -0
- package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
- package/dist/{chunk-EX2UWGES.js → chunk-KW633S3Y.js} +56 -52
- package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
- package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
- package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
- package/dist/chunk-PQKZ53DW.js +76 -0
- package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
- package/dist/{chunk-X5N72JHI.js → chunk-SO3VXCZV.js} +93 -92
- package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
- package/dist/chunk-URKH6SE2.js +479 -0
- package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
- package/dist/{chunk-POKX77OK.js → chunk-W5SQWSLC.js} +380 -535
- package/dist/{chunk-A4BCLP6K.js → chunk-YBS5GSRF.js} +64 -69
- package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
- package/dist/chunk-YSWLN2IJ.js +890 -0
- package/dist/commands/DbCommand.js +3 -3
- package/dist/commands/DbDrop.js +4 -5
- package/dist/commands/DbExecute.js +10 -8
- package/dist/commands/DbPull.js +17 -16
- package/dist/commands/DbPush.js +12 -11
- package/dist/commands/DbSeed.js +4 -5
- package/dist/commands/MigrateCommand.js +3 -3
- package/dist/commands/MigrateDeploy.js +14 -13
- package/dist/commands/MigrateDev.js +17 -16
- package/dist/commands/MigrateDiff.js +13 -11
- package/dist/commands/MigrateReset.js +16 -15
- package/dist/commands/MigrateResolve.js +12 -11
- package/dist/commands/MigrateStatus.js +12 -11
- package/dist/index.js +58 -60
- package/dist/internals/src/Generator.d.ts +23 -5
- package/dist/internals/src/WasmSchemaEngineLoader.d.ts +5 -0
- package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
- package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
- package/dist/internals/src/cli/getSchema.d.ts +3 -28
- package/dist/internals/src/cli/hashes.d.ts +1 -2
- package/dist/internals/src/cli/schemaContext.d.ts +59 -0
- package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
- package/dist/internals/src/convertCredentials.d.ts +1 -1
- package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
- package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
- package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
- package/dist/internals/src/errorReporting.d.ts +0 -1
- package/dist/internals/src/get-generators/getGenerators.d.ts +22 -9
- package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
- package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
- package/dist/internals/src/index.d.ts +9 -8
- package/dist/internals/src/migrateTypes.d.ts +63 -0
- package/dist/internals/src/panic.d.ts +1 -4
- package/dist/internals/src/resolvePkg.d.ts +7 -0
- package/dist/internals/src/types.d.ts +1 -1
- package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
- package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
- package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
- package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
- package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
- package/dist/internals/src/wasm.d.ts +3 -1
- package/dist/migrate/src/Migrate.d.ts +18 -7
- package/dist/migrate/src/SchemaEngine.d.ts +20 -50
- package/dist/migrate/src/SchemaEngineCLI.d.ts +139 -0
- package/dist/migrate/src/SchemaEngineWasm.d.ts +134 -0
- package/dist/migrate/src/commands/DbExecute.d.ts +1 -1
- package/dist/migrate/src/commands/DbPull.d.ts +1 -1
- package/dist/migrate/src/commands/DbPush.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateDeploy.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateDiff.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateReset.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateResolve.d.ts +1 -1
- package/dist/migrate/src/commands/MigrateStatus.d.ts +1 -1
- package/dist/migrate/src/index.d.ts +2 -2
- package/dist/migrate/src/types.d.ts +19 -19
- package/dist/migrate/src/utils/createMigration.d.ts +21 -0
- package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
- package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
- package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
- package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
- package/dist/migrate/src/utils/seed.d.ts +0 -2
- package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
- package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
- package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
- package/dist/types.js +1 -1
- package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
- package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
- package/dist/utils/byline.js +1 -1
- package/dist/utils/captureStdout.js +3 -3
- package/dist/utils/countModelsAndTypes.js +1 -1
- package/dist/utils/createMigration.js +27 -0
- package/dist/utils/customColors.js +1 -1
- package/dist/utils/ensureDatabaseExists.js +7 -7
- package/dist/utils/errors.js +1 -1
- package/dist/utils/flagErrors.js +1 -1
- package/dist/utils/getDatabaseVersionSafe.js +10 -5
- package/dist/utils/handleEvaluateDataloss.js +1 -1
- package/dist/utils/introspectSql.js +10 -5
- package/dist/utils/isSchemaEmpty.js +1 -1
- package/dist/utils/listMigrations.js +25 -0
- package/dist/utils/now.js +1 -1
- package/dist/utils/printDatasource.js +1 -1
- package/dist/utils/printDatasources.js +5 -5
- package/dist/utils/printFiles.js +5 -5
- package/dist/utils/printIntrospectedSchema.js +1 -1
- package/dist/utils/printMigrationId.js +1 -1
- package/dist/utils/promptForMigrationName.js +3 -3
- package/dist/utils/removeSchemaFiles.js +1 -1
- package/dist/utils/replaceOrAddDatasource.js +1 -1
- package/dist/utils/replaceOrAddDatasource.test.js +1 -1
- package/dist/utils/saveSchemaFiles.js +1 -1
- package/dist/utils/seed.js +4 -7
- package/dist/utils/setupCockroach.js +3 -3
- package/dist/utils/setupMSSQL.js +1583 -710
- package/dist/utils/setupMongo.js +6563 -5984
- package/dist/utils/setupMysql.js +508 -563
- package/dist/utils/setupPostgres.js +3 -3
- package/dist/utils/spinner.js +4 -7
- package/dist/utils/test-handlePanic.js +1 -30
- package/dist/utils/unixSocket.js +1 -1
- package/dist/views/handleViewsIO.js +3 -3
- package/package.json +15 -14
- package/dist/chunk-6C7ESGWY.js +0 -1184
- package/dist/chunk-DIAO4W7O.js +0 -5774
- package/dist/chunk-GKDFIHM2.js +0 -45
- package/dist/chunk-J46BJQHT.js +0 -268
- package/dist/chunk-KXMACMQC.js +0 -660
- package/dist/chunk-YUCPBDWV.js +0 -131
- package/dist/chunk-YYPMC5FN.js +0 -1407
- package/dist/internals/src/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
- package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
- package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
- package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
|
@@ -1,49 +1,27 @@
|
|
|
1
1
|
import { type MigrateTypes } from '@prisma/internals';
|
|
2
2
|
import type { EngineArgs, EngineResults } from './types';
|
|
3
|
-
export interface
|
|
4
|
-
schemaPath?: string;
|
|
5
|
-
debug?: boolean;
|
|
6
|
-
enabledPreviewFeatures?: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare class EngineError extends Error {
|
|
9
|
-
code: number;
|
|
10
|
-
constructor(message: string, code: number);
|
|
11
|
-
}
|
|
12
|
-
export declare class SchemaEngine {
|
|
13
|
-
private debug;
|
|
14
|
-
private child?;
|
|
15
|
-
private schemaPath?;
|
|
16
|
-
private listeners;
|
|
17
|
-
/** _All_ the logs from the engine process. */
|
|
18
|
-
private messages;
|
|
19
|
-
private lastRequest?;
|
|
20
|
-
/** The fields of the last engine log event with an `ERROR` level. */
|
|
21
|
-
private lastError;
|
|
22
|
-
private initPromise?;
|
|
23
|
-
private enabledPreviewFeatures?;
|
|
24
|
-
private latestSchema?;
|
|
3
|
+
export interface SchemaEngine {
|
|
25
4
|
isRunning: boolean;
|
|
26
|
-
constructor({ debug, schemaPath, enabledPreviewFeatures }: SchemaEngineOptions);
|
|
27
5
|
/**
|
|
28
6
|
* Apply the migrations from the migrations directory to the database.
|
|
29
7
|
* This is the command behind prisma migrate deploy.
|
|
30
8
|
*/
|
|
31
|
-
applyMigrations(
|
|
9
|
+
applyMigrations(input: EngineArgs.ApplyMigrationsInput): Promise<EngineResults.ApplyMigrationsOutput>;
|
|
32
10
|
/**
|
|
33
11
|
* Create the logical database from the Prisma schema.
|
|
34
12
|
*/
|
|
35
|
-
createDatabase(
|
|
13
|
+
createDatabase?(input: EngineArgs.CreateDatabaseInput): Promise<EngineResults.CreateDatabaseOutput>;
|
|
36
14
|
/**
|
|
37
15
|
* Create the next migration in the migrations history.
|
|
38
16
|
* If draft is false and there are no unexecutable steps, it will also apply the newly created migration.
|
|
39
17
|
* Note: This will use the shadow database on the connectors where we need one.
|
|
40
18
|
*/
|
|
41
|
-
createMigration(
|
|
19
|
+
createMigration(input: EngineArgs.CreateMigrationInput): Promise<EngineResults.CreateMigrationOutput>;
|
|
42
20
|
/**
|
|
43
21
|
* Execute a database script directly on the specified live database.
|
|
44
22
|
* Note that this may not be defined on all connectors.
|
|
45
23
|
*/
|
|
46
|
-
dbExecute(
|
|
24
|
+
dbExecute(input: EngineArgs.DbExecuteInput): Promise<EngineResults.DbExecuteOutput>;
|
|
47
25
|
/**
|
|
48
26
|
* Make the Schema engine panic. Only useful to test client error handling.
|
|
49
27
|
*/
|
|
@@ -55,23 +33,22 @@ export declare class SchemaEngine {
|
|
|
55
33
|
* Its role is to interpret the diagnostic output,
|
|
56
34
|
* and translate it to a concrete action to be performed by the CLI.
|
|
57
35
|
*/
|
|
58
|
-
devDiagnostic(
|
|
36
|
+
devDiagnostic(input: EngineArgs.DevDiagnosticInput): Promise<EngineResults.DevDiagnosticOutput>;
|
|
59
37
|
/**
|
|
60
38
|
* Read the contents of the migrations directory and the migrations table, and returns their relative statuses.
|
|
61
39
|
* At this stage, the Schema engine only reads,
|
|
62
40
|
* it does not write to the database nor the migrations directory, nor does it use a shadow database.
|
|
63
41
|
*/
|
|
64
|
-
diagnoseMigrationHistory(
|
|
42
|
+
diagnoseMigrationHistory(input: EngineArgs.DiagnoseMigrationHistoryInput): Promise<EngineResults.DiagnoseMigrationHistoryOutput>;
|
|
65
43
|
/**
|
|
66
44
|
* Make sure the Schema engine can connect to the database from the Prisma schema.
|
|
67
45
|
*/
|
|
68
|
-
ensureConnectionValidity(
|
|
46
|
+
ensureConnectionValidity(input: EngineArgs.EnsureConnectionValidityInput): Promise<void>;
|
|
69
47
|
/**
|
|
70
48
|
* Development command for migrations.
|
|
71
49
|
* Evaluate the data loss induced by the next migration the engine would generate on the main database.
|
|
72
50
|
*/
|
|
73
|
-
evaluateDataLoss(
|
|
74
|
-
getDatabaseDescription(schema: string): Promise<string>;
|
|
51
|
+
evaluateDataLoss(input: EngineArgs.EvaluateDataLossInput): Promise<EngineResults.EvaluateDataLossOutput>;
|
|
75
52
|
/**
|
|
76
53
|
* Get the database version for error reporting.
|
|
77
54
|
* If no argument is given, the version of the database associated to the Prisma schema provided
|
|
@@ -82,8 +59,9 @@ export declare class SchemaEngine {
|
|
|
82
59
|
* Given a Prisma schema, introspect the database definitions and update the schema with the results.
|
|
83
60
|
* `compositeTypeDepth` is optional, and only required for MongoDB.
|
|
84
61
|
*/
|
|
85
|
-
introspect(
|
|
86
|
-
|
|
62
|
+
introspect(input: EngineArgs.IntrospectParams & {
|
|
63
|
+
viewsDirectoryPath: string;
|
|
64
|
+
}): Promise<EngineArgs.IntrospectResult>;
|
|
87
65
|
/**
|
|
88
66
|
* Compares two databases schemas from two arbitrary sources,
|
|
89
67
|
* and display the difference as either a human-readable summary,
|
|
@@ -93,11 +71,7 @@ export declare class SchemaEngine {
|
|
|
93
71
|
* The resulting diff should be thought of as a migration from the schema in `args.from` to the schema in `args.to`.
|
|
94
72
|
* By default, we output a human-readable diff. If you want an executable script, pass the "script": true param.
|
|
95
73
|
*/
|
|
96
|
-
migrateDiff(
|
|
97
|
-
/**
|
|
98
|
-
* List the names of the migrations in the migrations directory.
|
|
99
|
-
*/
|
|
100
|
-
listMigrationDirectories(args: EngineArgs.ListMigrationDirectoriesInput): Promise<EngineResults.ListMigrationDirectoriesOutput>;
|
|
74
|
+
migrateDiff(input: EngineArgs.MigrateDiffInput): Promise<EngineResults.MigrateDiffOutput>;
|
|
101
75
|
/**
|
|
102
76
|
* Mark a migration as applied in the migrations table.
|
|
103
77
|
* There are two possible outcomes:
|
|
@@ -105,11 +79,11 @@ export declare class SchemaEngine {
|
|
|
105
79
|
* - The migration is not in the table. We will create a new entry in the migrations table. The started_at and finished_at will be the same.
|
|
106
80
|
* If it is already applied, we return a user-facing error.
|
|
107
81
|
*/
|
|
108
|
-
markMigrationApplied(
|
|
82
|
+
markMigrationApplied(input: EngineArgs.MarkMigrationAppliedInput): Promise<void>;
|
|
109
83
|
/**
|
|
110
84
|
* Mark an existing failed migration as rolled back in the migrations table. It will still be there, but ignored for all purposes except as audit trail.
|
|
111
85
|
*/
|
|
112
|
-
markMigrationRolledBack(
|
|
86
|
+
markMigrationRolledBack(input: EngineArgs.MarkMigrationRolledBackInput): Promise<void>;
|
|
113
87
|
/**
|
|
114
88
|
* Try to make the database empty: no data and no schema.
|
|
115
89
|
* On most connectors, this is implemented by dropping and recreating the database.
|
|
@@ -121,19 +95,15 @@ export declare class SchemaEngine {
|
|
|
121
95
|
/**
|
|
122
96
|
* The command behind db push.
|
|
123
97
|
*/
|
|
124
|
-
schemaPush(
|
|
98
|
+
schemaPush(input: EngineArgs.SchemaPushInput): Promise<EngineResults.SchemaPush>;
|
|
125
99
|
/**
|
|
126
100
|
* SQL introspection that powers TypedSQL feature
|
|
127
101
|
* @param args
|
|
128
102
|
* @returns
|
|
129
103
|
*/
|
|
130
|
-
introspectSql(
|
|
104
|
+
introspectSql(input: EngineArgs.IntrospectSqlParams): Promise<EngineResults.IntrospectSqlOutput>;
|
|
105
|
+
/**
|
|
106
|
+
* Stop the engine.
|
|
107
|
+
*/
|
|
131
108
|
stop(): void;
|
|
132
|
-
private rejectAll;
|
|
133
|
-
private registerCallback;
|
|
134
|
-
private handleResponse;
|
|
135
|
-
private init;
|
|
136
|
-
private internalInit;
|
|
137
|
-
private runCommand;
|
|
138
|
-
private getRPCPayload;
|
|
139
109
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type MigrateTypes, SchemaContext } from '@prisma/internals';
|
|
2
|
+
import type { SchemaEngine } from './SchemaEngine';
|
|
3
|
+
import type { EngineArgs, EngineResults } from './types';
|
|
4
|
+
export declare class EngineError extends Error {
|
|
5
|
+
code: number;
|
|
6
|
+
constructor(message: string, code: number);
|
|
7
|
+
}
|
|
8
|
+
interface SchemaEngineCLISetupInput {
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
enabledPreviewFeatures?: string[];
|
|
11
|
+
schemaContext?: SchemaContext;
|
|
12
|
+
}
|
|
13
|
+
export type SchemaEngineCLIOptions = SchemaEngineCLISetupInput;
|
|
14
|
+
export declare class SchemaEngineCLI implements SchemaEngine {
|
|
15
|
+
private debug;
|
|
16
|
+
private child?;
|
|
17
|
+
private schemaContext?;
|
|
18
|
+
private listeners;
|
|
19
|
+
/** _All_ the logs from the engine process. */
|
|
20
|
+
private messages;
|
|
21
|
+
private lastRequest?;
|
|
22
|
+
/** The fields of the last engine log event with an `ERROR` level. */
|
|
23
|
+
private lastError;
|
|
24
|
+
private initPromise?;
|
|
25
|
+
private enabledPreviewFeatures?;
|
|
26
|
+
private latestSchema?;
|
|
27
|
+
isRunning: boolean;
|
|
28
|
+
private constructor();
|
|
29
|
+
static setup(input: SchemaEngineCLISetupInput): Promise<SchemaEngineCLI>;
|
|
30
|
+
/**
|
|
31
|
+
* Apply the migrations from the migrations directory to the database.
|
|
32
|
+
* This is the command behind prisma migrate deploy.
|
|
33
|
+
*/
|
|
34
|
+
applyMigrations(args: EngineArgs.ApplyMigrationsInput): Promise<EngineResults.ApplyMigrationsOutput>;
|
|
35
|
+
/**
|
|
36
|
+
* Create the logical database from the Prisma schema.
|
|
37
|
+
*/
|
|
38
|
+
createDatabase(args: EngineArgs.CreateDatabaseInput): Promise<EngineResults.CreateDatabaseOutput>;
|
|
39
|
+
/**
|
|
40
|
+
* Create the next migration in the migrations history.
|
|
41
|
+
* If draft is false and there are no unexecutable steps, it will also apply the newly created migration.
|
|
42
|
+
* Note: This will use the shadow database on the connectors where we need one.
|
|
43
|
+
*/
|
|
44
|
+
createMigration(args: EngineArgs.CreateMigrationInput): Promise<EngineResults.CreateMigrationOutput>;
|
|
45
|
+
/**
|
|
46
|
+
* Execute a database script directly on the specified live database.
|
|
47
|
+
* Note that this may not be defined on all connectors.
|
|
48
|
+
*/
|
|
49
|
+
dbExecute(args: EngineArgs.DbExecuteInput): Promise<EngineResults.DbExecuteOutput>;
|
|
50
|
+
/**
|
|
51
|
+
* Make the Schema engine panic. Only useful to test client error handling.
|
|
52
|
+
*/
|
|
53
|
+
debugPanic(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* The method called at the beginning of migrate dev to decide the course of action,
|
|
56
|
+
* based on the current state of the workspace.
|
|
57
|
+
* It acts as a wrapper around diagnoseMigrationHistory.
|
|
58
|
+
* Its role is to interpret the diagnostic output,
|
|
59
|
+
* and translate it to a concrete action to be performed by the CLI.
|
|
60
|
+
*/
|
|
61
|
+
devDiagnostic(args: EngineArgs.DevDiagnosticInput): Promise<EngineResults.DevDiagnosticOutput>;
|
|
62
|
+
/**
|
|
63
|
+
* Read the contents of the migrations directory and the migrations table, and returns their relative statuses.
|
|
64
|
+
* At this stage, the Schema engine only reads,
|
|
65
|
+
* it does not write to the database nor the migrations directory, nor does it use a shadow database.
|
|
66
|
+
*/
|
|
67
|
+
diagnoseMigrationHistory(args: EngineArgs.DiagnoseMigrationHistoryInput): Promise<EngineResults.DiagnoseMigrationHistoryOutput>;
|
|
68
|
+
/**
|
|
69
|
+
* Make sure the Schema engine can connect to the database from the Prisma schema.
|
|
70
|
+
*/
|
|
71
|
+
ensureConnectionValidity(args: EngineArgs.EnsureConnectionValidityInput): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Development command for migrations.
|
|
74
|
+
* Evaluate the data loss induced by the next migration the engine would generate on the main database.
|
|
75
|
+
*/
|
|
76
|
+
evaluateDataLoss(args: EngineArgs.EvaluateDataLossInput): Promise<EngineResults.EvaluateDataLossOutput>;
|
|
77
|
+
getDatabaseDescription(schema: string): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Get the database version for error reporting.
|
|
80
|
+
* If no argument is given, the version of the database associated to the Prisma schema provided
|
|
81
|
+
* in the constructor will be returned.
|
|
82
|
+
*/
|
|
83
|
+
getDatabaseVersion(args?: MigrateTypes.GetDatabaseVersionParams): Promise<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Given a Prisma schema, introspect the database definitions and update the schema with the results.
|
|
86
|
+
* `compositeTypeDepth` is optional, and only required for MongoDB.
|
|
87
|
+
*/
|
|
88
|
+
introspect({ schema, force, baseDirectoryPath, viewsDirectoryPath, compositeTypeDepth, // cannot be undefined
|
|
89
|
+
namespaces, }: EngineArgs.IntrospectParams): Promise<EngineArgs.IntrospectResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Compares two databases schemas from two arbitrary sources,
|
|
92
|
+
* and display the difference as either a human-readable summary,
|
|
93
|
+
* or an executable script that can be passed to dbExecute.
|
|
94
|
+
* Connection to a shadow database is only necessary when either the from or the to params is a migrations directory.
|
|
95
|
+
* Diffs have a direction. Which source is from and which is to matters.
|
|
96
|
+
* The resulting diff should be thought of as a migration from the schema in `args.from` to the schema in `args.to`.
|
|
97
|
+
* By default, we output a human-readable diff. If you want an executable script, pass the "script": true param.
|
|
98
|
+
*/
|
|
99
|
+
migrateDiff(args: EngineArgs.MigrateDiffInput): Promise<EngineResults.MigrateDiffOutput>;
|
|
100
|
+
/**
|
|
101
|
+
* Mark a migration as applied in the migrations table.
|
|
102
|
+
* There are two possible outcomes:
|
|
103
|
+
* - The migration is already in the table, but in a failed state. In this case, we will mark it as rolled back, then create a new entry.
|
|
104
|
+
* - The migration is not in the table. We will create a new entry in the migrations table. The started_at and finished_at will be the same.
|
|
105
|
+
* If it is already applied, we return a user-facing error.
|
|
106
|
+
*/
|
|
107
|
+
markMigrationApplied(args: EngineArgs.MarkMigrationAppliedInput): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Mark an existing failed migration as rolled back in the migrations table. It will still be there, but ignored for all purposes except as audit trail.
|
|
110
|
+
*/
|
|
111
|
+
markMigrationRolledBack(args: EngineArgs.MarkMigrationRolledBackInput): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Try to make the database empty: no data and no schema.
|
|
114
|
+
* On most connectors, this is implemented by dropping and recreating the database.
|
|
115
|
+
* If that fails (most likely because of insufficient permissions),
|
|
116
|
+
* the engine attempts a “best effort reset” by inspecting the contents of the database and dropping them individually.
|
|
117
|
+
* Drop and recreate the database. The migrations will not be applied, as it would overlap with applyMigrations.
|
|
118
|
+
*/
|
|
119
|
+
reset(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* The command behind db push.
|
|
122
|
+
*/
|
|
123
|
+
schemaPush(args: EngineArgs.SchemaPushInput): Promise<EngineResults.SchemaPush>;
|
|
124
|
+
/**
|
|
125
|
+
* SQL introspection that powers TypedSQL feature
|
|
126
|
+
* @param args
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
introspectSql(args: EngineArgs.IntrospectSqlParams): Promise<EngineResults.IntrospectSqlOutput>;
|
|
130
|
+
stop(): void;
|
|
131
|
+
private rejectAll;
|
|
132
|
+
private registerCallback;
|
|
133
|
+
private handleResponse;
|
|
134
|
+
private init;
|
|
135
|
+
private internalInit;
|
|
136
|
+
private runCommand;
|
|
137
|
+
private getRPCPayload;
|
|
138
|
+
}
|
|
139
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { ErrorCapturingSqlDriverAdapterFactory } from '@prisma/driver-adapter-utils';
|
|
2
|
+
import { SchemaContext, wasm } from '@prisma/internals';
|
|
3
|
+
import { SchemaEngine } from './SchemaEngine';
|
|
4
|
+
import { EngineArgs } from './types';
|
|
5
|
+
type SchemaEngineMethods = Omit<wasm.SchemaEngineWasm, 'free'>;
|
|
6
|
+
export type SchemaEngineInput<M extends keyof SchemaEngineMethods> = Parameters<wasm.SchemaEngineWasm[M]>[0];
|
|
7
|
+
export type SchemaEngineOutput<M extends keyof SchemaEngineMethods> = ReturnType<wasm.SchemaEngineWasm[M]>;
|
|
8
|
+
interface SchemaEngineWasmSetupInput {
|
|
9
|
+
adapter: ErrorCapturingSqlDriverAdapterFactory;
|
|
10
|
+
enabledPreviewFeatures?: string[];
|
|
11
|
+
schemaContext?: SchemaContext;
|
|
12
|
+
}
|
|
13
|
+
export interface SchemaEngineWasmOptions extends Omit<SchemaEngineWasmSetupInput, 'adapter'> {
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
engine: wasm.SchemaEngineWasm;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wrapper around `@prisma/schema-engine-wasm`, which will eventually replace `SchemaEngineCLI`.
|
|
19
|
+
*
|
|
20
|
+
* TODOs:
|
|
21
|
+
* - Forward initial schema and preview features to the Wasm engine
|
|
22
|
+
* - Collect and forward logs to the CLI
|
|
23
|
+
* - Catch and throw "rich" connector errors
|
|
24
|
+
*/
|
|
25
|
+
export declare class SchemaEngineWasm implements SchemaEngine {
|
|
26
|
+
private engine;
|
|
27
|
+
private schemaContext?;
|
|
28
|
+
private enabledPreviewFeatures?;
|
|
29
|
+
isRunning: boolean;
|
|
30
|
+
private constructor();
|
|
31
|
+
static setup({ adapter, ...rest }: SchemaEngineWasmSetupInput): Promise<SchemaEngineWasm>;
|
|
32
|
+
private runCommand;
|
|
33
|
+
/**
|
|
34
|
+
* Apply the migrations from the migrations directory to the database.
|
|
35
|
+
* This is the command behind prisma migrate deploy.
|
|
36
|
+
*/
|
|
37
|
+
applyMigrations(input: SchemaEngineInput<'applyMigrations'>): SchemaEngineOutput<'applyMigrations'>;
|
|
38
|
+
/**
|
|
39
|
+
* Create the next migration in the migrations history.
|
|
40
|
+
* If draft is false and there are no unexecutable steps, it will also apply the newly created migration.
|
|
41
|
+
* Note: This will use the shadow database on the connectors where we need one.
|
|
42
|
+
*/
|
|
43
|
+
createMigration(input: SchemaEngineInput<'createMigration'>): SchemaEngineOutput<'createMigration'>;
|
|
44
|
+
/**
|
|
45
|
+
* Execute a database script directly on the specified live database.
|
|
46
|
+
* Note that this may not be defined on all connectors.
|
|
47
|
+
*/
|
|
48
|
+
dbExecute(input: SchemaEngineInput<'dbExecute'>): Promise<null>;
|
|
49
|
+
/**
|
|
50
|
+
* Make the Schema engine panic. Only useful to test client error handling.
|
|
51
|
+
*/
|
|
52
|
+
debugPanic(): Promise<never>;
|
|
53
|
+
/**
|
|
54
|
+
* The method called at the beginning of migrate dev to decide the course of action,
|
|
55
|
+
* based on the current state of the workspace.
|
|
56
|
+
* It acts as a wrapper around diagnoseMigrationHistory.
|
|
57
|
+
* Its role is to interpret the diagnostic output,
|
|
58
|
+
* and translate it to a concrete action to be performed by the CLI.
|
|
59
|
+
*/
|
|
60
|
+
devDiagnostic(input: SchemaEngineInput<'devDiagnostic'>): SchemaEngineOutput<'devDiagnostic'>;
|
|
61
|
+
/**
|
|
62
|
+
* Read the contents of the migrations directory and the migrations table, and returns their relative statuses.
|
|
63
|
+
* At this stage, the Schema engine only reads,
|
|
64
|
+
* it does not write to the database nor the migrations directory, nor does it use a shadow database.
|
|
65
|
+
*/
|
|
66
|
+
diagnoseMigrationHistory(input: SchemaEngineInput<'diagnoseMigrationHistory'>): SchemaEngineOutput<'diagnoseMigrationHistory'>;
|
|
67
|
+
/**
|
|
68
|
+
* Make sure the Schema engine can connect to the database from the Prisma schema.
|
|
69
|
+
*/
|
|
70
|
+
ensureConnectionValidity(input: SchemaEngineInput<'ensureConnectionValidity'>): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Development command for migrations.
|
|
73
|
+
* Evaluate the data loss induced by the next migration the engine would generate on the main database.
|
|
74
|
+
*/
|
|
75
|
+
evaluateDataLoss(input: SchemaEngineInput<'evaluateDataLoss'>): SchemaEngineOutput<'evaluateDataLoss'>;
|
|
76
|
+
/**
|
|
77
|
+
* Get the database version for error reporting.
|
|
78
|
+
* If no argument is given, the version of the database associated to the Prisma schema provided
|
|
79
|
+
* in the constructor will be returned.
|
|
80
|
+
*/
|
|
81
|
+
getDatabaseVersion(input?: SchemaEngineInput<'version'>): SchemaEngineOutput<'version'>;
|
|
82
|
+
/**
|
|
83
|
+
* Given a Prisma schema, introspect the database definitions and update the schema with the results.
|
|
84
|
+
* `compositeTypeDepth` is optional, and only required for MongoDB.
|
|
85
|
+
*/
|
|
86
|
+
introspect({ schema, force, baseDirectoryPath, viewsDirectoryPath, compositeTypeDepth, namespaces, }: EngineArgs.IntrospectParams): SchemaEngineOutput<'introspect'>;
|
|
87
|
+
/**
|
|
88
|
+
* Compares two databases schemas from two arbitrary sources,
|
|
89
|
+
* and display the difference as either a human-readable summary,
|
|
90
|
+
* or an executable script that can be passed to dbExecute.
|
|
91
|
+
* Connection to a shadow database is only necessary when either the from or the to params is a migrations directory.
|
|
92
|
+
* Diffs have a direction. Which source is from and which is to matters.
|
|
93
|
+
* The resulting diff should be thought of as a migration from the schema in `args.from` to the schema in `args.to`.
|
|
94
|
+
* By default, we output a human-readable diff. If you want an executable script, pass the "script": true param.
|
|
95
|
+
*/
|
|
96
|
+
migrateDiff(input: SchemaEngineInput<'diff'>): Promise<{
|
|
97
|
+
exitCode: number;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Mark a migration as applied in the migrations table.
|
|
101
|
+
* There are two possible outcomes:
|
|
102
|
+
* - The migration is already in the table, but in a failed state. In this case, we will mark it as rolled back, then create a new entry.
|
|
103
|
+
* - The migration is not in the table. We will create a new entry in the migrations table. The started_at and finished_at will be the same.
|
|
104
|
+
* If it is already applied, we return a user-facing error.
|
|
105
|
+
*/
|
|
106
|
+
markMigrationApplied(input: SchemaEngineInput<'markMigrationApplied'>): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Mark an existing failed migration as rolled back in the migrations table. It will still be there, but ignored for all purposes except as audit trail.
|
|
109
|
+
*/
|
|
110
|
+
markMigrationRolledBack(input: SchemaEngineInput<'markMigrationRolledBack'>): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Try to make the database empty: no data and no schema.
|
|
113
|
+
* On most connectors, this is implemented by dropping and recreating the database.
|
|
114
|
+
* If that fails (most likely because of insufficient permissions),
|
|
115
|
+
* the engine attempts a “best effort reset” by inspecting the contents of the database and dropping them individually.
|
|
116
|
+
* Drop and recreate the database. The migrations will not be applied, as it would overlap with applyMigrations.
|
|
117
|
+
*/
|
|
118
|
+
reset(): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* The command behind db push.
|
|
121
|
+
*/
|
|
122
|
+
schemaPush(input: SchemaEngineInput<'schemaPush'>): SchemaEngineOutput<'schemaPush'>;
|
|
123
|
+
/**
|
|
124
|
+
* SQL introspection that powers TypedSQL feature
|
|
125
|
+
* @param args
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
128
|
+
introspectSql(input: SchemaEngineInput<'introspectSql'>): SchemaEngineOutput<'introspectSql'>;
|
|
129
|
+
/**
|
|
130
|
+
* Stop the engine.
|
|
131
|
+
*/
|
|
132
|
+
stop(): void;
|
|
133
|
+
}
|
|
134
|
+
export {};
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class DbExecute implements Command {
|
|
4
4
|
static new(): DbExecute;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -4,7 +4,7 @@ export declare class DbPull implements Command {
|
|
|
4
4
|
static new(): DbPull;
|
|
5
5
|
private static help;
|
|
6
6
|
private urlToDatasource;
|
|
7
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
7
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
8
8
|
private getWarningMessage;
|
|
9
9
|
help(error?: string): string | HelpError;
|
|
10
10
|
}
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class DbPush implements Command {
|
|
4
4
|
static new(): DbPush;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class MigrateDeploy implements Command {
|
|
4
4
|
static new(): MigrateDeploy;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -3,7 +3,7 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class MigrateDev implements Command {
|
|
4
4
|
static new(): MigrateDev;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
private logResetReason;
|
|
8
8
|
help(error?: string): string | HelpError;
|
|
9
9
|
}
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class MigrateDiff implements Command {
|
|
4
4
|
static new(): MigrateDiff;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class MigrateReset implements Command {
|
|
4
4
|
static new(): MigrateReset;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class MigrateResolve implements Command {
|
|
4
4
|
static new(): MigrateResolve;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -3,6 +3,6 @@ import { Command, HelpError } from '@prisma/internals';
|
|
|
3
3
|
export declare class MigrateStatus implements Command {
|
|
4
4
|
static new(): MigrateStatus;
|
|
5
5
|
private static help;
|
|
6
|
-
parse(argv: string[], config: PrismaConfigInternal): Promise<string | Error>;
|
|
6
|
+
parse(argv: string[], config: PrismaConfigInternal<any>): Promise<string | Error>;
|
|
7
7
|
help(error?: string): string | HelpError;
|
|
8
8
|
}
|
|
@@ -12,9 +12,9 @@ export { MigrateReset } from './commands/MigrateReset';
|
|
|
12
12
|
export { MigrateResolve } from './commands/MigrateResolve';
|
|
13
13
|
export { MigrateStatus } from './commands/MigrateStatus';
|
|
14
14
|
export { Migrate } from './Migrate';
|
|
15
|
-
export {
|
|
15
|
+
export { SchemaEngineCLI } from './SchemaEngineCLI';
|
|
16
|
+
export { SchemaEngineWasm } from './SchemaEngineWasm';
|
|
16
17
|
export * from './types';
|
|
17
18
|
export { default as byline } from './utils/byline';
|
|
18
19
|
export { getDatabaseVersionSafe } from './utils/getDatabaseVersionSafe';
|
|
19
|
-
export { getSchemaPathAndPrint, printSchemaLoadedMessage } from './utils/getSchemaPathAndPrint';
|
|
20
20
|
export { introspectSql, type IntrospectSqlError, type IntrospectSqlInput, type IntrospectSqlResult, } from './utils/introspectSql';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SqlQueryOutput } from '@prisma/generator
|
|
1
|
+
import type { ActiveConnectorType, SqlQueryOutput } from '@prisma/generator';
|
|
2
2
|
import type { MigrateTypes } from '@prisma/internals';
|
|
3
3
|
import type { IntrospectionViewDefinition } from './views/handleViewsIO';
|
|
4
4
|
export interface RpcRequestResponse {
|
|
@@ -50,7 +50,7 @@ export type HistoryDiagnostic = {
|
|
|
50
50
|
unpersistedMigrationNames: string[];
|
|
51
51
|
} | {
|
|
52
52
|
diagnostic: 'historiesDiverge';
|
|
53
|
-
lastCommonMigrationName: string;
|
|
53
|
+
lastCommonMigrationName: string | null;
|
|
54
54
|
unpersistedMigrationNames: string[];
|
|
55
55
|
unappliedMigrationNames: string[];
|
|
56
56
|
};
|
|
@@ -69,13 +69,13 @@ export declare namespace EngineArgs {
|
|
|
69
69
|
* These RPCs need a sourceConfig, therefore a db connection to function
|
|
70
70
|
*/
|
|
71
71
|
export interface ApplyMigrationsInput {
|
|
72
|
-
|
|
72
|
+
migrationsList: MigrateTypes.MigrationList;
|
|
73
73
|
}
|
|
74
74
|
export interface CreateMigrationInput {
|
|
75
|
-
|
|
75
|
+
migrationsList: MigrateTypes.MigrationList;
|
|
76
76
|
schema: MigrateTypes.SchemasContainer;
|
|
77
77
|
draft: boolean;
|
|
78
|
-
migrationName
|
|
78
|
+
migrationName: string;
|
|
79
79
|
}
|
|
80
80
|
export interface CreateDatabaseInput {
|
|
81
81
|
datasource: MigrateTypes.DatasourceParam;
|
|
@@ -91,7 +91,8 @@ export declare namespace EngineArgs {
|
|
|
91
91
|
export interface IntrospectParams {
|
|
92
92
|
schema: MigrateTypes.SchemasContainer;
|
|
93
93
|
baseDirectoryPath: string;
|
|
94
|
-
|
|
94
|
+
viewsDirectoryPath: string;
|
|
95
|
+
force?: boolean;
|
|
95
96
|
compositeTypeDepth?: number;
|
|
96
97
|
namespaces?: string[];
|
|
97
98
|
}
|
|
@@ -110,24 +111,24 @@ export declare namespace EngineArgs {
|
|
|
110
111
|
views: IntrospectionViewDefinition[] | null;
|
|
111
112
|
}
|
|
112
113
|
export interface DevDiagnosticInput {
|
|
113
|
-
|
|
114
|
+
migrationsList: MigrateTypes.MigrationList;
|
|
114
115
|
}
|
|
115
116
|
export interface DiagnoseMigrationHistoryInput {
|
|
116
|
-
|
|
117
|
+
migrationsList: MigrateTypes.MigrationList;
|
|
117
118
|
optInToShadowDatabase: boolean;
|
|
118
119
|
}
|
|
119
120
|
export interface EnsureConnectionValidityInput {
|
|
120
121
|
datasource: MigrateTypes.DatasourceParam;
|
|
121
122
|
}
|
|
122
123
|
export interface EvaluateDataLossInput {
|
|
123
|
-
|
|
124
|
+
migrationsList: MigrateTypes.MigrationList;
|
|
124
125
|
schema: MigrateTypes.SchemasContainer;
|
|
125
126
|
}
|
|
126
127
|
export interface ListMigrationDirectoriesInput {
|
|
127
128
|
migrationsDirectoryPath: string;
|
|
128
129
|
}
|
|
129
130
|
export interface MarkMigrationAppliedInput {
|
|
130
|
-
|
|
131
|
+
migrationsList: MigrateTypes.MigrationList;
|
|
131
132
|
migrationName: string;
|
|
132
133
|
}
|
|
133
134
|
export interface MarkMigrationRolledBackInput {
|
|
@@ -139,17 +140,14 @@ export declare namespace EngineArgs {
|
|
|
139
140
|
};
|
|
140
141
|
type MigrateDiffTargetSchemaDatamodel = MigrateTypes.Tagged<'schemaDatamodel', MigrateTypes.SchemasContainer>;
|
|
141
142
|
type MigrateDiffTargetSchemaDatasource = MigrateTypes.Tagged<'schemaDatasource', MigrateTypes.SchemasWithConfigDir>;
|
|
142
|
-
type MigrateDiffTargetMigrations =
|
|
143
|
-
tag: 'migrations';
|
|
144
|
-
path: string;
|
|
145
|
-
};
|
|
143
|
+
type MigrateDiffTargetMigrations = MigrateTypes.Tagged<'migrations', MigrateTypes.MigrationList>;
|
|
146
144
|
export type MigrateDiffTarget = MigrateDiffTargetUrl | MigrateDiffTargetEmpty | MigrateDiffTargetSchemaDatamodel | MigrateDiffTargetSchemaDatasource | MigrateDiffTargetMigrations;
|
|
147
145
|
export interface MigrateDiffInput {
|
|
148
146
|
from: MigrateDiffTarget;
|
|
149
147
|
to: MigrateDiffTarget;
|
|
150
148
|
script: boolean;
|
|
151
|
-
shadowDatabaseUrl
|
|
152
|
-
exitCode
|
|
149
|
+
shadowDatabaseUrl: string | null;
|
|
150
|
+
exitCode: boolean | null;
|
|
153
151
|
}
|
|
154
152
|
export interface SchemaPushInput {
|
|
155
153
|
schema: MigrateTypes.SchemasContainer;
|
|
@@ -173,10 +171,12 @@ export declare namespace EngineResults {
|
|
|
173
171
|
database_name: string;
|
|
174
172
|
}
|
|
175
173
|
interface CreateMigrationOutput {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
connectorType: ActiveConnectorType;
|
|
175
|
+
generatedMigrationName: string;
|
|
176
|
+
migrationScript: string | null;
|
|
177
|
+
extension: string;
|
|
179
178
|
}
|
|
179
|
+
type DbExecuteOutput = null;
|
|
180
180
|
interface DevDiagnosticOutput {
|
|
181
181
|
action: DevAction;
|
|
182
182
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ActiveConnectorType } from '@prisma/generator';
|
|
2
|
+
import type { MigrateTypes } from '@prisma/internals';
|
|
3
|
+
type CreateMigrationInput = {
|
|
4
|
+
baseDir: string;
|
|
5
|
+
generatedMigrationName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createMigration({ baseDir, generatedMigrationName }: CreateMigrationInput): Promise<string>;
|
|
8
|
+
type WriteMigrationScriptInput = {
|
|
9
|
+
baseDir: string;
|
|
10
|
+
migrationName: string;
|
|
11
|
+
extension: string;
|
|
12
|
+
script: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function writeMigrationScript({ baseDir, extension, migrationName, script, }: WriteMigrationScriptInput): Promise<void>;
|
|
15
|
+
type WriteMigrationLockfileInput = {
|
|
16
|
+
baseDir: string;
|
|
17
|
+
connectorType: ActiveConnectorType;
|
|
18
|
+
lockfile: Omit<MigrateTypes.MigrationLockfile, 'content'>;
|
|
19
|
+
};
|
|
20
|
+
export declare function writeMigrationLockfile({ baseDir, connectorType, lockfile }: WriteMigrationLockfileInput): Promise<void>;
|
|
21
|
+
export {};
|