@prisma/migrate 6.6.0-dev.94 → 6.6.0-dev.96
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-V6PVGSDJ.js → chunk-PQKZ53DW.js} +4 -4
- package/dist/{chunk-ZJ4IDCRR.js → chunk-SO3VXCZV.js} +10 -8
- package/dist/{chunk-TYGTS7KR.js → chunk-UDTQXU7M.js} +17 -13
- 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
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_IK3BVD3Y_exports = {};
|
|
30
|
+
__export(chunk_IK3BVD3Y_exports, {
|
|
31
|
+
SchemaEngineWasm: () => SchemaEngineWasm
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_IK3BVD3Y_exports);
|
|
34
|
+
var import_chunk_OEWQACEH = require("./chunk-OEWQACEH.js");
|
|
35
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
36
|
+
var import_debug = __toESM(require("@prisma/debug"));
|
|
37
|
+
var import_internals = require("@prisma/internals");
|
|
38
|
+
var SchemaEngineWasm = class _SchemaEngineWasm {
|
|
39
|
+
engine;
|
|
40
|
+
// TODO: forward initial schema to the Wasm engine
|
|
41
|
+
schemaContext;
|
|
42
|
+
// TODO: forward enabled preview features to the Wasm engine
|
|
43
|
+
enabledPreviewFeatures;
|
|
44
|
+
// `isRunning` is set to true when the engine is initialized, and set to false when the engine is stopped
|
|
45
|
+
isRunning = false;
|
|
46
|
+
constructor({ debug = false, enabledPreviewFeatures, schemaContext, engine }) {
|
|
47
|
+
this.schemaContext = schemaContext;
|
|
48
|
+
this.enabledPreviewFeatures = enabledPreviewFeatures;
|
|
49
|
+
if (debug) {
|
|
50
|
+
import_debug.default.enable("SchemaEngine*");
|
|
51
|
+
}
|
|
52
|
+
this.engine = engine;
|
|
53
|
+
}
|
|
54
|
+
static async setup({ adapter, ...rest }) {
|
|
55
|
+
const engine = await import_internals.wasmSchemaEngineLoader.loadSchemaEngine(adapter);
|
|
56
|
+
return new _SchemaEngineWasm({ ...rest, engine });
|
|
57
|
+
}
|
|
58
|
+
runCommand(command, input) {
|
|
59
|
+
this.isRunning = true;
|
|
60
|
+
try {
|
|
61
|
+
return this.engine[command](input);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
const e = error;
|
|
64
|
+
console.error("[schema-engine] error on command %s:\n%s", command, e);
|
|
65
|
+
if ((0, import_internals.isWasmPanic)(e)) {
|
|
66
|
+
const { message, stack } = (0, import_internals.getWasmError)(e);
|
|
67
|
+
throw new import_internals.RustPanic(serializePanic(message), stack, command, import_internals.ErrorArea.LIFT_CLI);
|
|
68
|
+
}
|
|
69
|
+
throw e;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Apply the migrations from the migrations directory to the database.
|
|
74
|
+
* This is the command behind prisma migrate deploy.
|
|
75
|
+
*/
|
|
76
|
+
applyMigrations(input) {
|
|
77
|
+
return this.runCommand("applyMigrations", input);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create the next migration in the migrations history.
|
|
81
|
+
* If draft is false and there are no unexecutable steps, it will also apply the newly created migration.
|
|
82
|
+
* Note: This will use the shadow database on the connectors where we need one.
|
|
83
|
+
*/
|
|
84
|
+
createMigration(input) {
|
|
85
|
+
return this.runCommand("createMigration", input);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Execute a database script directly on the specified live database.
|
|
89
|
+
* Note that this may not be defined on all connectors.
|
|
90
|
+
*/
|
|
91
|
+
async dbExecute(input) {
|
|
92
|
+
await this.runCommand("dbExecute", input);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Make the Schema engine panic. Only useful to test client error handling.
|
|
97
|
+
*/
|
|
98
|
+
async debugPanic() {
|
|
99
|
+
this.runCommand("debugPanic", void 0);
|
|
100
|
+
return Promise.resolve(null);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The method called at the beginning of migrate dev to decide the course of action,
|
|
104
|
+
* based on the current state of the workspace.
|
|
105
|
+
* It acts as a wrapper around diagnoseMigrationHistory.
|
|
106
|
+
* Its role is to interpret the diagnostic output,
|
|
107
|
+
* and translate it to a concrete action to be performed by the CLI.
|
|
108
|
+
*/
|
|
109
|
+
devDiagnostic(input) {
|
|
110
|
+
return this.runCommand("devDiagnostic", input);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Read the contents of the migrations directory and the migrations table, and returns their relative statuses.
|
|
114
|
+
* At this stage, the Schema engine only reads,
|
|
115
|
+
* it does not write to the database nor the migrations directory, nor does it use a shadow database.
|
|
116
|
+
*/
|
|
117
|
+
diagnoseMigrationHistory(input) {
|
|
118
|
+
return this.runCommand("diagnoseMigrationHistory", input);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Make sure the Schema engine can connect to the database from the Prisma schema.
|
|
122
|
+
*/
|
|
123
|
+
async ensureConnectionValidity(input) {
|
|
124
|
+
await this.runCommand("ensureConnectionValidity", input);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Development command for migrations.
|
|
128
|
+
* Evaluate the data loss induced by the next migration the engine would generate on the main database.
|
|
129
|
+
*/
|
|
130
|
+
evaluateDataLoss(input) {
|
|
131
|
+
return this.runCommand("evaluateDataLoss", input);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the database version for error reporting.
|
|
135
|
+
* If no argument is given, the version of the database associated to the Prisma schema provided
|
|
136
|
+
* in the constructor will be returned.
|
|
137
|
+
*/
|
|
138
|
+
getDatabaseVersion(input) {
|
|
139
|
+
return this.runCommand("version", input);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Given a Prisma schema, introspect the database definitions and update the schema with the results.
|
|
143
|
+
* `compositeTypeDepth` is optional, and only required for MongoDB.
|
|
144
|
+
*/
|
|
145
|
+
async introspect({
|
|
146
|
+
schema,
|
|
147
|
+
force = false,
|
|
148
|
+
baseDirectoryPath,
|
|
149
|
+
viewsDirectoryPath,
|
|
150
|
+
compositeTypeDepth = -1,
|
|
151
|
+
namespaces
|
|
152
|
+
}) {
|
|
153
|
+
const introspectResult = await this.runCommand("introspect", {
|
|
154
|
+
schema,
|
|
155
|
+
force,
|
|
156
|
+
compositeTypeDepth,
|
|
157
|
+
namespaces: namespaces ?? null,
|
|
158
|
+
baseDirectoryPath
|
|
159
|
+
});
|
|
160
|
+
const { views } = introspectResult;
|
|
161
|
+
if (views) {
|
|
162
|
+
await (0, import_chunk_OEWQACEH.handleViewsIO)({ views, viewsDirectoryPath });
|
|
163
|
+
}
|
|
164
|
+
return introspectResult;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Compares two databases schemas from two arbitrary sources,
|
|
168
|
+
* and display the difference as either a human-readable summary,
|
|
169
|
+
* or an executable script that can be passed to dbExecute.
|
|
170
|
+
* Connection to a shadow database is only necessary when either the from or the to params is a migrations directory.
|
|
171
|
+
* Diffs have a direction. Which source is from and which is to matters.
|
|
172
|
+
* The resulting diff should be thought of as a migration from the schema in `args.from` to the schema in `args.to`.
|
|
173
|
+
* By default, we output a human-readable diff. If you want an executable script, pass the "script": true param.
|
|
174
|
+
*/
|
|
175
|
+
async migrateDiff(input) {
|
|
176
|
+
const { stdout, ...rest } = await this.runCommand("diff", input);
|
|
177
|
+
if (stdout) {
|
|
178
|
+
process.stdout.write(stdout + "\n");
|
|
179
|
+
}
|
|
180
|
+
return rest;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Mark a migration as applied in the migrations table.
|
|
184
|
+
* There are two possible outcomes:
|
|
185
|
+
* - 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.
|
|
186
|
+
* - 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.
|
|
187
|
+
* If it is already applied, we return a user-facing error.
|
|
188
|
+
*/
|
|
189
|
+
async markMigrationApplied(input) {
|
|
190
|
+
await this.runCommand("markMigrationApplied", input);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* 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.
|
|
194
|
+
*/
|
|
195
|
+
async markMigrationRolledBack(input) {
|
|
196
|
+
await this.runCommand("markMigrationRolledBack", input);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Try to make the database empty: no data and no schema.
|
|
200
|
+
* On most connectors, this is implemented by dropping and recreating the database.
|
|
201
|
+
* If that fails (most likely because of insufficient permissions),
|
|
202
|
+
* the engine attempts a “best effort reset” by inspecting the contents of the database and dropping them individually.
|
|
203
|
+
* Drop and recreate the database. The migrations will not be applied, as it would overlap with applyMigrations.
|
|
204
|
+
*/
|
|
205
|
+
async reset() {
|
|
206
|
+
await this.runCommand("reset", void 0);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The command behind db push.
|
|
210
|
+
*/
|
|
211
|
+
schemaPush(input) {
|
|
212
|
+
return this.runCommand("schemaPush", input);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* SQL introspection that powers TypedSQL feature
|
|
216
|
+
* @param args
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
219
|
+
introspectSql(input) {
|
|
220
|
+
return this.runCommand("introspectSql", input);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Stop the engine.
|
|
224
|
+
*/
|
|
225
|
+
stop() {
|
|
226
|
+
this.isRunning = false;
|
|
227
|
+
this.engine.free();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
function serializePanic(log) {
|
|
231
|
+
return `${(0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)("Error in Schema engine.\nReason: "))}${log}
|
|
232
|
+
`;
|
|
233
|
+
}
|
|
@@ -16,14 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_KW633S3Y_exports = {};
|
|
20
|
+
__export(chunk_KW633S3Y_exports, {
|
|
21
21
|
MigrateResolve: () => MigrateResolve
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var import_chunk_ZLHWX5PJ = require("./chunk-ZLHWX5PJ.js");
|
|
23
|
+
module.exports = __toCommonJS(chunk_KW633S3Y_exports);
|
|
25
24
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
26
25
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
26
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
27
27
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
28
28
|
var import_internals = require("@prisma/internals");
|
|
29
29
|
var MigrateResolve = class _MigrateResolve {
|
|
@@ -108,8 +108,11 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
|
|
|
108
108
|
)}`
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
await
|
|
112
|
-
|
|
111
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
112
|
+
if (!adapter) {
|
|
113
|
+
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
114
|
+
}
|
|
115
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, migrationsDirPath, schemaContext });
|
|
113
116
|
try {
|
|
114
117
|
await migrate.markMigrationApplied({
|
|
115
118
|
migrationId: args["--applied"]
|
|
@@ -130,7 +133,7 @@ Migration ${args["--applied"]} marked as applied.
|
|
|
130
133
|
);
|
|
131
134
|
}
|
|
132
135
|
await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
|
|
133
|
-
const migrate =
|
|
136
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter: void 0, migrationsDirPath, schemaContext });
|
|
134
137
|
try {
|
|
135
138
|
await migrate.markMigrationRolledBack({
|
|
136
139
|
migrationId: args["--rolled-back"]
|
|
@@ -26,11 +26,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_PQKZ53DW_exports = {};
|
|
30
|
+
__export(chunk_PQKZ53DW_exports, {
|
|
31
31
|
listMigrations: () => listMigrations
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_PQKZ53DW_exports);
|
|
34
34
|
var import_promises = __toESM(require("node:fs/promises"));
|
|
35
35
|
var import_node_path = __toESM(require("node:path"));
|
|
36
36
|
async function listMigrations(migrationsDirectoryPath) {
|
|
@@ -58,7 +58,7 @@ async function listMigrations(migrationsDirectoryPath) {
|
|
|
58
58
|
for (const entry of entries.filter((entry2) => entry2.isDirectory())) {
|
|
59
59
|
const migrationPath = import_node_path.default.join(baseDir, entry.name);
|
|
60
60
|
const migrationFileName = "migration.sql";
|
|
61
|
-
const migrationFileContent = await import_promises.default.readFile(import_node_path.default.join(migrationPath, migrationFileName), { encoding: "utf-8" }).then((content) => ({ tag: "ok", value: content })).catch((error) => ({ tag: "error", value: error }));
|
|
61
|
+
const migrationFileContent = await import_promises.default.readFile(import_node_path.default.join(migrationPath, migrationFileName), { encoding: "utf-8" }).then((content) => ({ tag: "ok", value: content })).catch((error) => ({ tag: "error", value: error.message }));
|
|
62
62
|
migrationDirectories.push({
|
|
63
63
|
path: entry.name,
|
|
64
64
|
migrationFile: {
|
|
@@ -26,24 +26,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_SO3VXCZV_exports = {};
|
|
30
|
+
__export(chunk_SO3VXCZV_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_SO3VXCZV_exports);
|
|
34
34
|
var import_chunk_IINN7QUV = require("./chunk-IINN7QUV.js");
|
|
35
|
+
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
35
36
|
var import_chunk_RR6BKMNO = require("./chunk-RR6BKMNO.js");
|
|
36
37
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
38
|
+
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
37
39
|
var import_chunk_AI6DH66U = require("./chunk-AI6DH66U.js");
|
|
38
40
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
39
|
-
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
40
|
-
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
41
41
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
42
|
-
var import_chunk_D2DGSPW6 = require("./chunk-D2DGSPW6.js");
|
|
43
|
-
var import_chunk_OEWQACEH = require("./chunk-OEWQACEH.js");
|
|
44
42
|
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
45
43
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
46
44
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
45
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
46
|
+
var import_chunk_OEWQACEH = require("./chunk-OEWQACEH.js");
|
|
47
47
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
48
48
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
49
49
|
var import_internals = require("@prisma/internals");
|
|
@@ -146,6 +146,7 @@ Set composite types introspection depth to 2 levels
|
|
|
146
146
|
if (!url && !schemaContext && !fromD1) {
|
|
147
147
|
throw new import_chunk_3WC4XD74.NoSchemaFoundError();
|
|
148
148
|
}
|
|
149
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
149
150
|
const { firstDatasource, schema, validationWarning } = await (0, import_chunk_OEWQACEH.z)({ url, schemaContext, fromD1 }).when(
|
|
150
151
|
(input) => input.schemaContext !== null,
|
|
151
152
|
async (input) => {
|
|
@@ -239,7 +240,8 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
239
240
|
)} for more info.`);
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
|
-
const
|
|
243
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, schemaContext: schemaContext ?? void 0 });
|
|
244
|
+
const engine = migrate.engine;
|
|
243
245
|
const basedOn = !args["--url"] && schemaContext?.primaryDatasource ? ` based on datasource defined in ${(0, import_chunk_SKRR5WT4.underline)(schemaContext.loadedFromPathForLogMessages)}` : "";
|
|
244
246
|
const introspectionSpinner = spinnerFactory(`Introspecting${basedOn}`);
|
|
245
247
|
const before = Math.round(performance.now());
|
|
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_UDTQXU7M_exports = {};
|
|
30
|
+
__export(chunk_UDTQXU7M_exports, {
|
|
31
31
|
MigrateDiff: () => MigrateDiff
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var import_chunk_AUGZZ6RT = require("./chunk-AUGZZ6RT.js");
|
|
33
|
+
module.exports = __toCommonJS(chunk_UDTQXU7M_exports);
|
|
35
34
|
var import_chunk_33LPBNDX = require("./chunk-33LPBNDX.js");
|
|
35
|
+
var import_chunk_AUGZZ6RT = require("./chunk-AUGZZ6RT.js");
|
|
36
36
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
38
|
+
var import_chunk_PQKZ53DW = require("./chunk-PQKZ53DW.js");
|
|
39
39
|
var import_chunk_OEWQACEH = require("./chunk-OEWQACEH.js");
|
|
40
40
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
41
41
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
@@ -10166,7 +10166,7 @@ var require_package = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
10166
10166
|
"../internals/package.json"(exports, module2) {
|
|
10167
10167
|
module2.exports = {
|
|
10168
10168
|
name: "@prisma/internals",
|
|
10169
|
-
version: "6.6.0-dev.
|
|
10169
|
+
version: "6.6.0-dev.96",
|
|
10170
10170
|
description: "This package is intended for Prisma's internal use",
|
|
10171
10171
|
main: "dist/index.js",
|
|
10172
10172
|
types: "dist/index.d.ts",
|
|
@@ -10247,11 +10247,13 @@ var require_package = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
10247
10247
|
"@prisma/config": "workspace:*",
|
|
10248
10248
|
"@prisma/debug": "workspace:*",
|
|
10249
10249
|
"@prisma/dmmf": "workspace:*",
|
|
10250
|
+
"@prisma/driver-adapter-utils": "workspace:*",
|
|
10250
10251
|
"@prisma/engines": "workspace:*",
|
|
10251
10252
|
"@prisma/fetch-engine": "workspace:*",
|
|
10252
10253
|
"@prisma/generator": "workspace:*",
|
|
10253
10254
|
"@prisma/generator-helper": "workspace:*",
|
|
10254
10255
|
"@prisma/get-platform": "workspace:*",
|
|
10256
|
+
"@prisma/schema-engine-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
|
|
10255
10257
|
"@prisma/prisma-schema-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
|
|
10256
10258
|
"@prisma/schema-files-loader": "workspace:*",
|
|
10257
10259
|
arg: "5.0.2",
|
|
@@ -10593,9 +10595,10 @@ var WasmPanicRegistry = class {
|
|
|
10593
10595
|
this.message = `RuntimeError: ${value}`;
|
|
10594
10596
|
}
|
|
10595
10597
|
};
|
|
10598
|
+
globalThis.PRISMA_WASM_PANIC_REGISTRY = new WasmPanicRegistry();
|
|
10596
10599
|
var { dependencies } = require_package();
|
|
10597
10600
|
var prismaSchemaWasmVersion = dependencies["@prisma/prisma-schema-wasm"];
|
|
10598
|
-
|
|
10601
|
+
var schemaEngineWasmVersion = dependencies["@prisma/schema-engine-wasm"];
|
|
10599
10602
|
function slugify(str) {
|
|
10600
10603
|
return str.toString().toLowerCase().replace(/\s+/g, "-");
|
|
10601
10604
|
}
|
|
@@ -11199,7 +11202,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11199
11202
|
} else if (args["--from-migrations"]) {
|
|
11200
11203
|
from = {
|
|
11201
11204
|
tag: "migrations",
|
|
11202
|
-
|
|
11205
|
+
...await (0, import_chunk_PQKZ53DW.listMigrations)(args["--from-migrations"])
|
|
11203
11206
|
};
|
|
11204
11207
|
} else if (args["--from-local-d1"]) {
|
|
11205
11208
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
@@ -11241,7 +11244,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11241
11244
|
} else if (args["--to-migrations"]) {
|
|
11242
11245
|
to = {
|
|
11243
11246
|
tag: "migrations",
|
|
11244
|
-
|
|
11247
|
+
...await (0, import_chunk_PQKZ53DW.listMigrations)(args["--to-migrations"])
|
|
11245
11248
|
};
|
|
11246
11249
|
} else if (args["--to-local-d1"]) {
|
|
11247
11250
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--to-local-d1" });
|
|
@@ -11250,7 +11253,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11250
11253
|
url: `file:${d1Database}`
|
|
11251
11254
|
};
|
|
11252
11255
|
}
|
|
11253
|
-
const
|
|
11256
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
11257
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter });
|
|
11254
11258
|
const captureStdout = new import_chunk_VAJ4VX67.CaptureStdout();
|
|
11255
11259
|
const outputPath = args["--output"];
|
|
11256
11260
|
const isOutputDefined = Boolean(outputPath);
|
|
@@ -11264,8 +11268,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11264
11268
|
to,
|
|
11265
11269
|
script: args["--script"] || false,
|
|
11266
11270
|
// default is false
|
|
11267
|
-
shadowDatabaseUrl: args["--shadow-database-url"],
|
|
11268
|
-
exitCode: args["--exit-code"]
|
|
11271
|
+
shadowDatabaseUrl: args["--shadow-database-url"] ?? null,
|
|
11272
|
+
exitCode: args["--exit-code"] ?? null
|
|
11269
11273
|
});
|
|
11270
11274
|
} finally {
|
|
11271
11275
|
migrate.stop();
|
|
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_VJNE6UF3_exports = {};
|
|
30
|
+
__export(chunk_VJNE6UF3_exports, {
|
|
31
31
|
MigrateDiff: () => MigrateDiff
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
var import_chunk_AUGZZ6RT = require("./chunk-AUGZZ6RT.js");
|
|
33
|
+
module.exports = __toCommonJS(chunk_VJNE6UF3_exports);
|
|
35
34
|
var import_chunk_33LPBNDX = require("./chunk-33LPBNDX.js");
|
|
35
|
+
var import_chunk_AUGZZ6RT = require("./chunk-AUGZZ6RT.js");
|
|
36
36
|
var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
38
|
+
var import_chunk_PQKZ53DW = require("./chunk-PQKZ53DW.js");
|
|
39
39
|
var import_chunk_OEWQACEH = require("./chunk-OEWQACEH.js");
|
|
40
40
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
41
41
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
|
@@ -10247,11 +10247,13 @@ var require_package = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
|
10247
10247
|
"@prisma/config": "workspace:*",
|
|
10248
10248
|
"@prisma/debug": "workspace:*",
|
|
10249
10249
|
"@prisma/dmmf": "workspace:*",
|
|
10250
|
+
"@prisma/driver-adapter-utils": "workspace:*",
|
|
10250
10251
|
"@prisma/engines": "workspace:*",
|
|
10251
10252
|
"@prisma/fetch-engine": "workspace:*",
|
|
10252
10253
|
"@prisma/generator": "workspace:*",
|
|
10253
10254
|
"@prisma/generator-helper": "workspace:*",
|
|
10254
10255
|
"@prisma/get-platform": "workspace:*",
|
|
10256
|
+
"@prisma/schema-engine-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
|
|
10255
10257
|
"@prisma/prisma-schema-wasm": "6.6.0-45.fbda4d61f6cc9c7361b803e72f3a0ffeb87db447",
|
|
10256
10258
|
"@prisma/schema-files-loader": "workspace:*",
|
|
10257
10259
|
arg: "5.0.2",
|
|
@@ -10593,9 +10595,10 @@ var WasmPanicRegistry = class {
|
|
|
10593
10595
|
this.message = `RuntimeError: ${value}`;
|
|
10594
10596
|
}
|
|
10595
10597
|
};
|
|
10598
|
+
globalThis.PRISMA_WASM_PANIC_REGISTRY = new WasmPanicRegistry();
|
|
10596
10599
|
var { dependencies } = require_package();
|
|
10597
10600
|
var prismaSchemaWasmVersion = dependencies["@prisma/prisma-schema-wasm"];
|
|
10598
|
-
|
|
10601
|
+
var schemaEngineWasmVersion = dependencies["@prisma/schema-engine-wasm"];
|
|
10599
10602
|
function slugify(str) {
|
|
10600
10603
|
return str.toString().toLowerCase().replace(/\s+/g, "-");
|
|
10601
10604
|
}
|
|
@@ -11199,7 +11202,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11199
11202
|
} else if (args["--from-migrations"]) {
|
|
11200
11203
|
from = {
|
|
11201
11204
|
tag: "migrations",
|
|
11202
|
-
|
|
11205
|
+
...await (0, import_chunk_PQKZ53DW.listMigrations)(args["--from-migrations"])
|
|
11203
11206
|
};
|
|
11204
11207
|
} else if (args["--from-local-d1"]) {
|
|
11205
11208
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
|
|
@@ -11241,7 +11244,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11241
11244
|
} else if (args["--to-migrations"]) {
|
|
11242
11245
|
to = {
|
|
11243
11246
|
tag: "migrations",
|
|
11244
|
-
|
|
11247
|
+
...await (0, import_chunk_PQKZ53DW.listMigrations)(args["--to-migrations"])
|
|
11245
11248
|
};
|
|
11246
11249
|
} else if (args["--to-local-d1"]) {
|
|
11247
11250
|
const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--to-local-d1" });
|
|
@@ -11250,7 +11253,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11250
11253
|
url: `file:${d1Database}`
|
|
11251
11254
|
};
|
|
11252
11255
|
}
|
|
11253
|
-
const
|
|
11256
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
11257
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter });
|
|
11254
11258
|
const captureStdout = new import_chunk_VAJ4VX67.CaptureStdout();
|
|
11255
11259
|
const outputPath = args["--output"];
|
|
11256
11260
|
const isOutputDefined = Boolean(outputPath);
|
|
@@ -11264,8 +11268,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
11264
11268
|
to,
|
|
11265
11269
|
script: args["--script"] || false,
|
|
11266
11270
|
// default is false
|
|
11267
|
-
shadowDatabaseUrl: args["--shadow-database-url"],
|
|
11268
|
-
exitCode: args["--exit-code"]
|
|
11271
|
+
shadowDatabaseUrl: args["--shadow-database-url"] ?? null,
|
|
11272
|
+
exitCode: args["--exit-code"] ?? null
|
|
11269
11273
|
});
|
|
11270
11274
|
} finally {
|
|
11271
11275
|
migrate.stop();
|
|
@@ -26,20 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_YBS5GSRF_exports = {};
|
|
30
|
+
__export(chunk_YBS5GSRF_exports, {
|
|
31
31
|
MigrateDev: () => MigrateDev
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_YBS5GSRF_exports);
|
|
34
34
|
var import_chunk_YBX7R3MT = require("./chunk-YBX7R3MT.js");
|
|
35
35
|
var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
|
|
36
|
+
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
36
37
|
var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
|
|
37
38
|
var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
|
|
38
39
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
39
|
-
var import_chunk_ZLHWX5PJ = require("./chunk-ZLHWX5PJ.js");
|
|
40
|
-
var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
|
|
41
40
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
42
41
|
var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
|
|
42
|
+
var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
|
|
43
43
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
44
44
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
45
45
|
var import_internals = require("@prisma/internals");
|
|
@@ -110,11 +110,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
110
110
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
111
111
|
process.stdout.write("\n");
|
|
112
112
|
(0, import_internals.validate)({ schemas: schemaContext.schemaFiles });
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const adapter = await config.migrate?.adapter(process.env);
|
|
114
|
+
let wasDbCreated;
|
|
115
|
+
if (!adapter) {
|
|
116
|
+
wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
|
|
117
|
+
if (wasDbCreated) {
|
|
118
|
+
process.stdout.write(wasDbCreated + "\n\n");
|
|
119
|
+
}
|
|
116
120
|
}
|
|
117
|
-
const migrate =
|
|
121
|
+
const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, migrationsDirPath, schemaContext });
|
|
118
122
|
let devDiagnostic;
|
|
119
123
|
try {
|
|
120
124
|
devDiagnostic = await migrate.devDiagnostic();
|