@prisma/migrate 6.6.0-dev.95 → 6.6.0-dev.97
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/Migrate.js +7 -6
- package/dist/SchemaEngine.js +0 -28
- package/dist/SchemaEngineCLI.js +29 -0
- package/dist/SchemaEngineWasm.js +27 -0
- package/dist/bin.js +39 -38
- package/dist/{chunk-NIKXBMZL.js → chunk-344G2PKM.js} +9 -9
- package/dist/{chunk-O6RQXRWU.js → chunk-A4FQW4A5.js} +15 -12
- package/dist/{chunk-7RM467G7.js → chunk-CLSF7VUT.js} +9 -6
- package/dist/{chunk-5LTDMS3H.js → chunk-CU5UT2ED.js} +6 -5
- package/dist/{chunk-TN7JMNXD.js → chunk-CYEVXXRH.js} +15 -12
- package/dist/{chunk-YGBJA7QJ.js → chunk-HIDSEBVV.js} +12 -9
- package/dist/{chunk-D2DGSPW6.js → chunk-I3LT2PO3.js} +10 -6
- package/dist/{chunk-FZGPSDP7.js → chunk-IEEJZC3B.js} +6 -5
- package/dist/chunk-IK3BVD3Y.js +233 -0
- package/dist/{chunk-FFPSJTA6.js → chunk-KW633S3Y.js} +10 -7
- package/dist/{chunk-FYZOCTL6.js → chunk-PGXFC6FT.js} +17 -13
- package/dist/{chunk-V6PVGSDJ.js → chunk-PQKZ53DW.js} +4 -4
- package/dist/{chunk-ZJ4IDCRR.js → chunk-SO3VXCZV.js} +10 -8
- package/dist/{chunk-IQB54PSS.js → chunk-VJNE6UF3.js} +16 -12
- package/dist/{chunk-63X7FE2R.js → chunk-YBS5GSRF.js} +13 -9
- package/dist/{chunk-ZLHWX5PJ.js → chunk-YSWLN2IJ.js} +29 -22
- package/dist/commands/DbExecute.js +8 -7
- package/dist/commands/DbPull.js +13 -9
- package/dist/commands/DbPush.js +10 -9
- package/dist/commands/MigrateDeploy.js +10 -9
- package/dist/commands/MigrateDev.js +11 -10
- package/dist/commands/MigrateDiff.js +9 -8
- package/dist/commands/MigrateReset.js +11 -10
- package/dist/commands/MigrateResolve.js +10 -9
- package/dist/commands/MigrateStatus.js +10 -9
- package/dist/index.js +46 -44
- package/dist/internals/src/WasmSchemaEngineLoader.d.ts +5 -0
- package/dist/internals/src/index.d.ts +2 -1
- package/dist/internals/src/migrateTypes.d.ts +1 -1
- package/dist/internals/src/wasm.d.ts +3 -1
- package/dist/migrate/src/Migrate.d.ts +12 -3
- package/dist/migrate/src/SchemaEngine.d.ts +21 -47
- 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 -1
- package/dist/migrate/src/types.d.ts +6 -10
- package/dist/utils/getDatabaseVersionSafe.js +9 -4
- package/dist/utils/introspectSql.js +9 -4
- package/dist/utils/listMigrations.js +2 -2
- package/package.json +8 -7
|
@@ -1,49 +1,27 @@
|
|
|
1
|
-
import { type MigrateTypes
|
|
1
|
+
import { type MigrateTypes } from '@prisma/internals';
|
|
2
2
|
import type { EngineArgs, EngineResults } from './types';
|
|
3
|
-
export interface
|
|
4
|
-
schemaContext?: SchemaContext;
|
|
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 schemaContext?;
|
|
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, schemaContext, 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,7 +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(
|
|
74
|
+
migrateDiff(input: EngineArgs.MigrateDiffInput): Promise<EngineResults.MigrateDiffOutput>;
|
|
97
75
|
/**
|
|
98
76
|
* Mark a migration as applied in the migrations table.
|
|
99
77
|
* There are two possible outcomes:
|
|
@@ -101,11 +79,11 @@ export declare class SchemaEngine {
|
|
|
101
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.
|
|
102
80
|
* If it is already applied, we return a user-facing error.
|
|
103
81
|
*/
|
|
104
|
-
markMigrationApplied(
|
|
82
|
+
markMigrationApplied(input: EngineArgs.MarkMigrationAppliedInput): Promise<void>;
|
|
105
83
|
/**
|
|
106
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.
|
|
107
85
|
*/
|
|
108
|
-
markMigrationRolledBack(
|
|
86
|
+
markMigrationRolledBack(input: EngineArgs.MarkMigrationRolledBackInput): Promise<void>;
|
|
109
87
|
/**
|
|
110
88
|
* Try to make the database empty: no data and no schema.
|
|
111
89
|
* On most connectors, this is implemented by dropping and recreating the database.
|
|
@@ -117,19 +95,15 @@ export declare class SchemaEngine {
|
|
|
117
95
|
/**
|
|
118
96
|
* The command behind db push.
|
|
119
97
|
*/
|
|
120
|
-
schemaPush(
|
|
98
|
+
schemaPush(input: EngineArgs.SchemaPushInput): Promise<EngineResults.SchemaPush>;
|
|
121
99
|
/**
|
|
122
100
|
* SQL introspection that powers TypedSQL feature
|
|
123
101
|
* @param args
|
|
124
102
|
* @returns
|
|
125
103
|
*/
|
|
126
|
-
introspectSql(
|
|
104
|
+
introspectSql(input: EngineArgs.IntrospectSqlParams): Promise<EngineResults.IntrospectSqlOutput>;
|
|
105
|
+
/**
|
|
106
|
+
* Stop the engine.
|
|
107
|
+
*/
|
|
127
108
|
stop(): void;
|
|
128
|
-
private rejectAll;
|
|
129
|
-
private registerCallback;
|
|
130
|
-
private handleResponse;
|
|
131
|
-
private init;
|
|
132
|
-
private internalInit;
|
|
133
|
-
private runCommand;
|
|
134
|
-
private getRPCPayload;
|
|
135
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,7 +12,8 @@ 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';
|
|
@@ -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
|
};
|
|
@@ -92,7 +92,7 @@ export declare namespace EngineArgs {
|
|
|
92
92
|
schema: MigrateTypes.SchemasContainer;
|
|
93
93
|
baseDirectoryPath: string;
|
|
94
94
|
viewsDirectoryPath: string;
|
|
95
|
-
force?:
|
|
95
|
+
force?: boolean;
|
|
96
96
|
compositeTypeDepth?: number;
|
|
97
97
|
namespaces?: string[];
|
|
98
98
|
}
|
|
@@ -140,17 +140,14 @@ export declare namespace EngineArgs {
|
|
|
140
140
|
};
|
|
141
141
|
type MigrateDiffTargetSchemaDatamodel = MigrateTypes.Tagged<'schemaDatamodel', MigrateTypes.SchemasContainer>;
|
|
142
142
|
type MigrateDiffTargetSchemaDatasource = MigrateTypes.Tagged<'schemaDatasource', MigrateTypes.SchemasWithConfigDir>;
|
|
143
|
-
type MigrateDiffTargetMigrations =
|
|
144
|
-
tag: 'migrations';
|
|
145
|
-
migrationsList: MigrateTypes.MigrationList;
|
|
146
|
-
};
|
|
143
|
+
type MigrateDiffTargetMigrations = MigrateTypes.Tagged<'migrations', MigrateTypes.MigrationList>;
|
|
147
144
|
export type MigrateDiffTarget = MigrateDiffTargetUrl | MigrateDiffTargetEmpty | MigrateDiffTargetSchemaDatamodel | MigrateDiffTargetSchemaDatasource | MigrateDiffTargetMigrations;
|
|
148
145
|
export interface MigrateDiffInput {
|
|
149
146
|
from: MigrateDiffTarget;
|
|
150
147
|
to: MigrateDiffTarget;
|
|
151
148
|
script: boolean;
|
|
152
|
-
shadowDatabaseUrl
|
|
153
|
-
exitCode
|
|
149
|
+
shadowDatabaseUrl: string | null;
|
|
150
|
+
exitCode: boolean | null;
|
|
154
151
|
}
|
|
155
152
|
export interface SchemaPushInput {
|
|
156
153
|
schema: MigrateTypes.SchemasContainer;
|
|
@@ -179,8 +176,7 @@ export declare namespace EngineResults {
|
|
|
179
176
|
migrationScript: string | null;
|
|
180
177
|
extension: string;
|
|
181
178
|
}
|
|
182
|
-
|
|
183
|
-
}
|
|
179
|
+
type DbExecuteOutput = null;
|
|
184
180
|
interface DevDiagnosticOutput {
|
|
185
181
|
action: DevAction;
|
|
186
182
|
}
|
|
@@ -18,12 +18,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var getDatabaseVersionSafe_exports = {};
|
|
20
20
|
__export(getDatabaseVersionSafe_exports, {
|
|
21
|
-
getDatabaseVersionSafe: () =>
|
|
21
|
+
getDatabaseVersionSafe: () => import_chunk_344G2PKM.getDatabaseVersionSafe
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(getDatabaseVersionSafe_exports);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var import_chunk_344G2PKM = require("../chunk-344G2PKM.js");
|
|
25
|
+
var import_chunk_YSWLN2IJ = require("../chunk-YSWLN2IJ.js");
|
|
26
|
+
var import_chunk_URKH6SE2 = require("../chunk-URKH6SE2.js");
|
|
27
|
+
var import_chunk_PQKZ53DW = require("../chunk-PQKZ53DW.js");
|
|
28
|
+
var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
|
|
29
|
+
var import_chunk_I3LT2PO3 = require("../chunk-I3LT2PO3.js");
|
|
27
30
|
var import_chunk_L6KOIJJ5 = require("../chunk-L6KOIJJ5.js");
|
|
31
|
+
var import_chunk_IK3BVD3Y = require("../chunk-IK3BVD3Y.js");
|
|
32
|
+
var import_chunk_OEWQACEH = require("../chunk-OEWQACEH.js");
|
|
28
33
|
var import_chunk_SKRR5WT4 = require("../chunk-SKRR5WT4.js");
|
|
29
34
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
|
@@ -18,12 +18,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var introspectSql_exports = {};
|
|
20
20
|
__export(introspectSql_exports, {
|
|
21
|
-
introspectSql: () =>
|
|
21
|
+
introspectSql: () => import_chunk_CU5UT2ED.introspectSql
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(introspectSql_exports);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var import_chunk_CU5UT2ED = require("../chunk-CU5UT2ED.js");
|
|
25
|
+
var import_chunk_YSWLN2IJ = require("../chunk-YSWLN2IJ.js");
|
|
26
|
+
var import_chunk_URKH6SE2 = require("../chunk-URKH6SE2.js");
|
|
27
|
+
var import_chunk_PQKZ53DW = require("../chunk-PQKZ53DW.js");
|
|
28
|
+
var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
|
|
29
|
+
var import_chunk_I3LT2PO3 = require("../chunk-I3LT2PO3.js");
|
|
27
30
|
var import_chunk_L6KOIJJ5 = require("../chunk-L6KOIJJ5.js");
|
|
31
|
+
var import_chunk_IK3BVD3Y = require("../chunk-IK3BVD3Y.js");
|
|
32
|
+
var import_chunk_OEWQACEH = require("../chunk-OEWQACEH.js");
|
|
28
33
|
var import_chunk_SKRR5WT4 = require("../chunk-SKRR5WT4.js");
|
|
29
34
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var listMigrations_exports = {};
|
|
20
20
|
__export(listMigrations_exports, {
|
|
21
|
-
listMigrations: () =>
|
|
21
|
+
listMigrations: () => import_chunk_PQKZ53DW.listMigrations
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(listMigrations_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_chunk_PQKZ53DW = require("../chunk-PQKZ53DW.js");
|
|
25
25
|
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/migrate",
|
|
3
|
-
"version": "6.6.0-dev.
|
|
3
|
+
"version": "6.6.0-dev.97",
|
|
4
4
|
"description": "This package is intended for Prisma's internal use",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/migrate/src/index.d.ts",
|
|
@@ -56,12 +56,13 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@prisma/engines-version": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
|
|
58
58
|
"prompts": "2.4.2",
|
|
59
|
-
"@prisma/
|
|
60
|
-
"@prisma/
|
|
61
|
-
"@prisma/
|
|
62
|
-
"@prisma/
|
|
63
|
-
"@prisma/
|
|
64
|
-
"@prisma/get-platform": "6.6.0-dev.
|
|
59
|
+
"@prisma/driver-adapter-utils": "6.6.0-dev.97",
|
|
60
|
+
"@prisma/client-generator-registry": "6.6.0-dev.97",
|
|
61
|
+
"@prisma/config": "6.6.0-dev.97",
|
|
62
|
+
"@prisma/debug": "6.6.0-dev.97",
|
|
63
|
+
"@prisma/generator": "6.6.0-dev.97",
|
|
64
|
+
"@prisma/get-platform": "6.6.0-dev.97",
|
|
65
|
+
"@prisma/internals": "6.6.0-dev.97"
|
|
65
66
|
},
|
|
66
67
|
"files": [
|
|
67
68
|
"README.md",
|