@prisma/migrate 7.10.0-dev.8 → 7.10.0-integration-prisma7-project-closeout.10
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 +4 -4
- package/dist/SchemaEngineCLI.js +4 -4
- package/dist/SchemaEngineWasm.js +4 -4
- package/dist/bin.js +41 -35
- package/dist/{chunk-FXSCTGN2.js → chunk-3C5DQOOW.js} +5 -5
- package/dist/{chunk-HWBQGGZH.js → chunk-3NKLI5KP.js} +9 -9
- package/dist/{chunk-6TSRRBNA.js → chunk-57S5K3DX.js} +7 -7
- package/dist/{chunk-UA3FFRRV.js → chunk-5YSI4XSU.js} +25 -19
- package/dist/{chunk-7CQBDP4H.js → chunk-6F7CAPL7.js} +9 -10
- package/dist/{chunk-GBUW4I6U.js → chunk-7KCEXIB2.js} +6 -6
- package/dist/{chunk-TEOIOJ7P.js → chunk-A6PUWLVN.js} +6 -6
- package/dist/{chunk-LZ2DWYUY.js → chunk-BWFPKWBD.js} +7 -7
- package/dist/{chunk-QCPYZUFF.js → chunk-BZ2JSF42.js} +31 -29
- package/dist/{chunk-DPRQXN36.js → chunk-DTSU3YZP.js} +6 -6
- package/dist/{chunk-WA2SOLDQ.js → chunk-EGNBSKBG.js} +8 -8
- package/dist/{chunk-DNNMOG7A.js → chunk-F2LZOLZK.js} +25 -24
- package/dist/{chunk-PPE4XDUL.js → chunk-GD52HTMX.js} +10 -10
- package/dist/{chunk-2HCAA4GX.js → chunk-GHPP2B5T.js} +27 -23
- package/dist/{chunk-XTEEOIUV.js → chunk-HMVLLUKH.js} +18 -13
- package/dist/{chunk-WP5M3D4N.js → chunk-I3UQXXYF.js} +30 -27
- package/dist/{chunk-RM4WK3ML.js → chunk-I7UMFS37.js} +33 -26
- package/dist/{chunk-CQTYRADU.js → chunk-IKF6HBHH.js} +23 -18
- package/dist/{chunk-NGEWTXY6.js → chunk-J6BC6QDB.js} +6 -6
- package/dist/{chunk-6DDIA3ZD.js → chunk-KDAXJMEP.js} +5 -5
- package/dist/{chunk-ZUHJASAP.js → chunk-KYZDCMJW.js} +12 -12
- package/dist/{chunk-AL3XYISJ.js → chunk-MQ76MQ53.js} +55 -50
- package/dist/{chunk-VEBRKA5H.js → chunk-OQKFK65J.js} +6 -6
- package/dist/{chunk-YNB3IN6Q.js → chunk-OXZFIZV6.js} +8 -8
- package/dist/{chunk-THJ7K72W.js → chunk-SFFTVLXC.js} +6 -6
- package/dist/{chunk-PEUHUCS4.js → chunk-T25WPL3D.js} +632 -625
- package/dist/{chunk-NHSJJSXU.js → chunk-TKQMAG6L.js} +5 -5
- package/dist/{chunk-6EQA63NM.js → chunk-UWVWZK5Z.js} +38 -32
- package/dist/{chunk-TW5MYPTK.js → chunk-VJKZQVKX.js} +26 -21
- package/dist/{chunk-DL2W77GY.js → chunk-W4WHE5HS.js} +33 -30
- package/dist/{chunk-TDN3QQTH.js → chunk-Y3QVFDLE.js} +29 -24
- package/dist/{chunk-RGXJYLMD.js → chunk-ZOYXSZ2J.js} +5 -5
- package/dist/{chunk-INC5VUX4.js → chunk-ZVRF2A5M.js} +6 -6
- package/dist/commands/DbCommand.js +2 -2
- package/dist/commands/DbDrop.js +3 -3
- package/dist/commands/DbExecute.js +5 -5
- package/dist/commands/DbPull.js +6 -6
- package/dist/commands/DbPush.js +6 -6
- package/dist/commands/DbSeed.js +2 -2
- package/dist/commands/MigrateCommand.js +2 -2
- package/dist/commands/MigrateDeploy.js +5 -5
- package/dist/commands/MigrateDev.js +7 -7
- package/dist/commands/MigrateDiff.js +6 -6
- package/dist/commands/MigrateReset.js +6 -6
- package/dist/commands/MigrateResolve.js +5 -5
- package/dist/commands/MigrateStatus.js +5 -5
- package/dist/commands/db-command-completion.js +2 -2
- package/dist/commands/db-execute-completion.js +2 -2
- package/dist/commands/db-pull-completion.js +2 -2
- package/dist/commands/db-push-completion.js +2 -2
- package/dist/commands/db-seed-completion.js +2 -2
- package/dist/commands/migrate-command-completion.js +2 -2
- package/dist/commands/migrate-deploy-completion.js +2 -2
- package/dist/commands/migrate-dev-completion.js +2 -2
- package/dist/commands/migrate-diff-completion.js +2 -2
- package/dist/commands/migrate-reset-completion.js +2 -2
- package/dist/commands/migrate-resolve-completion.js +2 -2
- package/dist/commands/migrate-status-completion.js +2 -2
- package/dist/index.js +63 -63
- package/dist/src/commands/DbCommand.d.ts +2 -2
- package/dist/src/commands/DbDrop.d.ts +3 -2
- package/dist/src/commands/DbExecute.d.ts +3 -2
- package/dist/src/commands/DbPull.d.ts +3 -2
- package/dist/src/commands/DbPush.d.ts +3 -2
- package/dist/src/commands/DbSeed.d.ts +3 -2
- package/dist/src/commands/MigrateCommand.d.ts +2 -2
- package/dist/src/commands/MigrateDeploy.d.ts +3 -2
- package/dist/src/commands/MigrateDev.d.ts +3 -2
- package/dist/src/commands/MigrateDiff.d.ts +3 -2
- package/dist/src/commands/MigrateReset.d.ts +3 -2
- package/dist/src/commands/MigrateResolve.d.ts +3 -2
- package/dist/src/commands/MigrateStatus.d.ts +3 -2
- package/dist/src/commands/db-command-completion.d.ts +1 -1
- package/dist/src/commands/db-execute-completion.d.ts +1 -1
- package/dist/src/commands/db-pull-completion.d.ts +1 -1
- package/dist/src/commands/db-push-completion.d.ts +1 -1
- package/dist/src/commands/db-seed-completion.d.ts +1 -1
- package/dist/src/commands/migrate-command-completion.d.ts +1 -1
- package/dist/src/commands/migrate-deploy-completion.d.ts +1 -1
- package/dist/src/commands/migrate-dev-completion.d.ts +1 -1
- package/dist/src/commands/migrate-diff-completion.d.ts +1 -1
- package/dist/src/commands/migrate-reset-completion.d.ts +1 -1
- package/dist/src/commands/migrate-resolve-completion.d.ts +1 -1
- package/dist/src/commands/migrate-status-completion.d.ts +1 -1
- package/dist/src/utils/errors.d.ts +4 -4
- package/dist/src/utils/handleEvaluateDataloss.d.ts +1 -1
- package/dist/utils/errors.js +8 -8
- package/dist/utils/getDatabaseVersionSafe.js +5 -5
- package/dist/utils/handleEvaluateDataloss.js +2 -2
- package/dist/utils/introspectSql.js +5 -5
- package/dist/utils/setupMSSQL.js +142 -56
- package/dist/views/handleViewsIO.js +2 -2
- package/package.json +12 -12
|
@@ -16,12 +16,12 @@ 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_TKQMAG6L_exports = {};
|
|
20
|
+
__export(chunk_TKQMAG6L_exports, {
|
|
21
21
|
introspectSql: () => introspectSql
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(chunk_TKQMAG6L_exports);
|
|
24
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
25
25
|
var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
|
|
26
26
|
async function introspectSql(schemaContext, config, baseDir, queries) {
|
|
27
27
|
if (!isTypedSqlEnabled(schemaContext.generators)) {
|
|
@@ -34,7 +34,7 @@ async function introspectSql(schemaContext, config, baseDir, queries) {
|
|
|
34
34
|
if (!supportedProviders.includes(firstDatasource.activeProvider)) {
|
|
35
35
|
throw new Error(`Typed SQL is supported only for ${supportedProviders.join(", ")} providers`);
|
|
36
36
|
}
|
|
37
|
-
const migrate = await
|
|
37
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({ schemaContext, schemaEngineConfig: config, baseDir });
|
|
38
38
|
const schemaEngine = migrate.engine;
|
|
39
39
|
const results = [];
|
|
40
40
|
const errors = [];
|
|
@@ -26,36 +26,33 @@ 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_UWVWZK5Z_exports = {};
|
|
30
|
+
__export(chunk_UWVWZK5Z_exports, {
|
|
31
31
|
DbPull: () => DbPull
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_UWVWZK5Z_exports);
|
|
34
34
|
var import_chunk_ZOT2HSX5 = require("./chunk-ZOT2HSX5.js");
|
|
35
35
|
var import_chunk_AHJ2N6BJ = require("./chunk-AHJ2N6BJ.js");
|
|
36
36
|
var import_chunk_JZ75RIMZ = require("./chunk-JZ75RIMZ.js");
|
|
37
37
|
var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
|
|
38
38
|
var import_chunk_JFKDSUIE = require("./chunk-JFKDSUIE.js");
|
|
39
39
|
var import_chunk_LGYRZ6CV = require("./chunk-LGYRZ6CV.js");
|
|
40
|
-
var
|
|
40
|
+
var import_chunk_KYZDCMJW = require("./chunk-KYZDCMJW.js");
|
|
41
41
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
42
42
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
43
|
-
var
|
|
43
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
44
44
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
45
45
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
46
46
|
var import_internals = require("@prisma/internals");
|
|
47
47
|
var import_path = __toESM(require("path"));
|
|
48
48
|
var debug = (0, import_debug.default)("prisma:db:pull");
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return new _DbPull();
|
|
52
|
-
}
|
|
53
|
-
static help = (0, import_internals.format)(`
|
|
49
|
+
function renderHelp(cliCommand) {
|
|
50
|
+
return (0, import_internals.format)(`
|
|
54
51
|
Pull the state from the database to the Prisma schema using introspection
|
|
55
52
|
|
|
56
53
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
57
54
|
|
|
58
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
55
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull [flags/options]
|
|
59
56
|
|
|
60
57
|
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
|
|
61
58
|
|
|
@@ -77,21 +74,29 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
77
74
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
78
75
|
|
|
79
76
|
With an existing Prisma schema
|
|
80
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
77
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull
|
|
81
78
|
|
|
82
79
|
Or specify a Prisma schema path
|
|
83
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
80
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull --schema=./schema.prisma
|
|
84
81
|
|
|
85
82
|
Instead of saving the result to the filesystem, you can also print it to stdout
|
|
86
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
83
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull --print
|
|
87
84
|
|
|
88
85
|
Overwrite the current schema with the introspected schema instead of enriching it
|
|
89
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
86
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull --force
|
|
90
87
|
|
|
91
88
|
Set composite types introspection depth to 2 levels
|
|
92
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
89
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull --composite-type-depth=2
|
|
93
90
|
|
|
94
91
|
`);
|
|
92
|
+
}
|
|
93
|
+
var DbPull = class _DbPull {
|
|
94
|
+
constructor(cliCommand) {
|
|
95
|
+
this.cliCommand = cliCommand;
|
|
96
|
+
}
|
|
97
|
+
static new(cliCommand) {
|
|
98
|
+
return new _DbPull(cliCommand);
|
|
99
|
+
}
|
|
95
100
|
async parse(argv, config, baseDir = process.cwd()) {
|
|
96
101
|
const args = (0, import_internals.arg)(argv, {
|
|
97
102
|
"--help": Boolean,
|
|
@@ -131,16 +136,17 @@ Set composite types introspection depth to 2 levels
|
|
|
131
136
|
}
|
|
132
137
|
};
|
|
133
138
|
}
|
|
134
|
-
const cmd =
|
|
135
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config: cmdSpecificConfig, cmd });
|
|
136
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
139
|
+
const cmd = `${this.cliCommand} db pull`;
|
|
140
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config: cmdSpecificConfig, command: cmd });
|
|
141
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
137
142
|
if (schemaContext && !args["--print"]) {
|
|
138
143
|
(0, import_internals.printSchemaLoadedMessage)(schemaContext.loadedFromPathForLogMessages);
|
|
139
144
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext?.primaryDatasource, validatedConfig) });
|
|
140
145
|
}
|
|
141
146
|
if (!schemaContext) {
|
|
142
|
-
throw new
|
|
147
|
+
throw new import_chunk_KYZDCMJW.NoSchemaFoundError();
|
|
143
148
|
}
|
|
149
|
+
(0, import_internals.getSchemaDatasourceProvider)(schemaContext);
|
|
144
150
|
const firstDatasource = schemaContext.primaryDatasource;
|
|
145
151
|
const schema = schemaContext.schemaFiles;
|
|
146
152
|
await (0, import_internals.getConfig)({
|
|
@@ -151,13 +157,13 @@ Set composite types introspection depth to 2 levels
|
|
|
151
157
|
if (isReintrospection && !args["--force"] && firstDatasource?.provider === "mongodb") {
|
|
152
158
|
throw new Error(`Iterating on one schema using re-introspection with db pull is currently not supported with MongoDB provider.
|
|
153
159
|
You can explicitly ignore and override your current local schema file with ${(0, import_chunk_SKRR5WT4.green)(
|
|
154
|
-
(0, import_internals.getCommandWithExecutor)(
|
|
160
|
+
(0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db pull --force`)
|
|
155
161
|
)}
|
|
156
162
|
Some information will be lost (relations, comments, mapped fields, @ignore...), follow ${(0, import_internals.link)(
|
|
157
163
|
"https://github.com/prisma/prisma/issues/9585"
|
|
158
164
|
)} for more info.`);
|
|
159
165
|
}
|
|
160
|
-
const migrate = await
|
|
166
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
161
167
|
schemaEngineConfig: cmdSpecificConfig,
|
|
162
168
|
baseDir,
|
|
163
169
|
schemaContext,
|
|
@@ -188,10 +194,10 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
|
|
|
188
194
|
throw new Error(`
|
|
189
195
|
${(0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)(`${e.code} `))}${(0, import_chunk_SKRR5WT4.red)("The introspected database was empty:")}
|
|
190
196
|
|
|
191
|
-
${(0, import_chunk_SKRR5WT4.bold)(
|
|
197
|
+
${(0, import_chunk_SKRR5WT4.bold)(`${this.cliCommand} db pull`)} could not create any models in your ${(0, import_chunk_SKRR5WT4.bold)(
|
|
192
198
|
"schema.prisma"
|
|
193
199
|
)} file and you will not be able to generate Prisma Client with the ${(0, import_chunk_SKRR5WT4.bold)(
|
|
194
|
-
(0, import_internals.getCommandWithExecutor)(
|
|
200
|
+
(0, import_internals.getCommandWithExecutor)(`${this.cliCommand} generate`)
|
|
195
201
|
)} command.
|
|
196
202
|
|
|
197
203
|
${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
@@ -201,16 +207,16 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
201
207
|
"schema.prisma"
|
|
202
208
|
)} points to a database that is not empty (it must contain at least one table).
|
|
203
209
|
|
|
204
|
-
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
210
|
+
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db pull`))} again.
|
|
205
211
|
`);
|
|
206
212
|
} else if (e.code === "P1003") {
|
|
207
213
|
throw new Error(`
|
|
208
214
|
${(0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)(`${e.code} `))}${(0, import_chunk_SKRR5WT4.red)("The introspected database does not exist:")}
|
|
209
215
|
|
|
210
|
-
${(0, import_chunk_SKRR5WT4.bold)(
|
|
216
|
+
${(0, import_chunk_SKRR5WT4.bold)(`${this.cliCommand} db pull`)} could not create any models in your ${(0, import_chunk_SKRR5WT4.bold)(
|
|
211
217
|
"schema.prisma"
|
|
212
218
|
)} file and you will not be able to generate Prisma Client with the ${(0, import_chunk_SKRR5WT4.bold)(
|
|
213
|
-
(0, import_internals.getCommandWithExecutor)(
|
|
219
|
+
(0, import_internals.getCommandWithExecutor)(`${this.cliCommand} generate`)
|
|
214
220
|
)} command.
|
|
215
221
|
|
|
216
222
|
${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
@@ -220,7 +226,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
|
|
|
220
226
|
"schema.prisma"
|
|
221
227
|
)} points to an existing database.
|
|
222
228
|
|
|
223
|
-
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
229
|
+
Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db pull`))} again.
|
|
224
230
|
`);
|
|
225
231
|
} else if (e.code === "P1012") {
|
|
226
232
|
process.stdout.write("\n");
|
|
@@ -229,7 +235,7 @@ Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getComm
|
|
|
229
235
|
Introspection failed as your current Prisma schema file is invalid
|
|
230
236
|
|
|
231
237
|
Please fix your current schema manually (using either ${(0, import_chunk_SKRR5WT4.green)(
|
|
232
|
-
(0, import_internals.getCommandWithExecutor)(
|
|
238
|
+
(0, import_internals.getCommandWithExecutor)(`${this.cliCommand} validate`)
|
|
233
239
|
)} or the Prisma VS Code extension to understand what's broken and confirm you fixed it), and then run this command again.
|
|
234
240
|
Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
|
|
235
241
|
"--force"
|
|
@@ -265,7 +271,7 @@ Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
|
|
|
265
271
|
import_path.default.relative(process.cwd(), introspectedSchemaPath)
|
|
266
272
|
)} in ${(0, import_chunk_SKRR5WT4.bold)((0, import_internals.formatms)(Math.round(performance.now()) - before))}
|
|
267
273
|
${(0, import_chunk_SKRR5WT4.yellow)(introspectionWarningsMessage)}
|
|
268
|
-
${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
274
|
+
${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} generate`))} to generate Prisma Client.`}`);
|
|
269
275
|
}
|
|
270
276
|
return "";
|
|
271
277
|
}
|
|
@@ -280,8 +286,8 @@ ${warnings}`;
|
|
|
280
286
|
if (error) {
|
|
281
287
|
return new import_internals.HelpError(`
|
|
282
288
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
283
|
-
${
|
|
289
|
+
${renderHelp(this.cliCommand)}`);
|
|
284
290
|
}
|
|
285
|
-
return
|
|
291
|
+
return renderHelp(this.cliCommand);
|
|
286
292
|
}
|
|
287
293
|
};
|
|
@@ -26,30 +26,27 @@ 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_VJKZQVKX_exports = {};
|
|
30
|
+
__export(chunk_VJKZQVKX_exports, {
|
|
31
31
|
MigrateReset: () => MigrateReset
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_VJKZQVKX_exports);
|
|
34
34
|
var import_chunk_G222ME3D = require("./chunk-G222ME3D.js");
|
|
35
35
|
var import_chunk_PHX6STZ3 = require("./chunk-PHX6STZ3.js");
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_KYZDCMJW = require("./chunk-KYZDCMJW.js");
|
|
37
37
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
38
38
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
39
|
-
var
|
|
39
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
40
40
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
41
41
|
var import_internals = require("@prisma/internals");
|
|
42
42
|
var import_prompts = __toESM(require("prompts"));
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return new _MigrateReset();
|
|
46
|
-
}
|
|
47
|
-
static help = (0, import_internals.format)(`
|
|
43
|
+
function renderHelp(cliCommand) {
|
|
44
|
+
return (0, import_internals.format)(`
|
|
48
45
|
Reset your database and apply all migrations, all data will be lost
|
|
49
46
|
|
|
50
47
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
51
48
|
|
|
52
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
49
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate reset [options]
|
|
53
50
|
|
|
54
51
|
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
|
|
55
52
|
|
|
@@ -63,14 +60,22 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
63
60
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
64
61
|
|
|
65
62
|
Reset your database and apply all migrations, all data will be lost
|
|
66
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
63
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate reset
|
|
67
64
|
|
|
68
65
|
Specify a schema
|
|
69
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
66
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate reset --schema=./schema.prisma
|
|
70
67
|
|
|
71
68
|
Use --force to skip the confirmation prompt
|
|
72
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
69
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate reset --force
|
|
73
70
|
`);
|
|
71
|
+
}
|
|
72
|
+
var MigrateReset = class _MigrateReset {
|
|
73
|
+
constructor(cliCommand) {
|
|
74
|
+
this.cliCommand = cliCommand;
|
|
75
|
+
}
|
|
76
|
+
static new(cliCommand) {
|
|
77
|
+
return new _MigrateReset(cliCommand);
|
|
78
|
+
}
|
|
74
79
|
async parse(argv, config, baseDir) {
|
|
75
80
|
const args = (0, import_internals.arg)(argv, {
|
|
76
81
|
"--help": Boolean,
|
|
@@ -94,12 +99,12 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
94
99
|
baseDir
|
|
95
100
|
})
|
|
96
101
|
});
|
|
97
|
-
const cmd =
|
|
98
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
|
|
102
|
+
const cmd = `${this.cliCommand} migrate reset`;
|
|
103
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, command: cmd });
|
|
104
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
99
105
|
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
|
|
100
106
|
const datasourceInfo = (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig);
|
|
101
107
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
102
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
103
108
|
const successMessage = await (0, import_chunk_BRPS327A.ensureDatabaseExists)(
|
|
104
109
|
baseDir,
|
|
105
110
|
(0, import_internals.getSchemaDatasourceProvider)(schemaContext),
|
|
@@ -111,7 +116,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
111
116
|
process.stdout.write("\n");
|
|
112
117
|
if (!args["--force"]) {
|
|
113
118
|
if (!(0, import_internals.canPrompt)()) {
|
|
114
|
-
throw new
|
|
119
|
+
throw new import_chunk_KYZDCMJW.MigrateResetEnvNonInteractiveError();
|
|
115
120
|
}
|
|
116
121
|
const confirmation = await (0, import_prompts.default)({
|
|
117
122
|
type: "confirm",
|
|
@@ -129,7 +134,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
129
134
|
externalTables: config.tables?.external ?? [],
|
|
130
135
|
externalEnums: config.enums?.external ?? []
|
|
131
136
|
};
|
|
132
|
-
const migrate = await
|
|
137
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
133
138
|
schemaEngineConfig: config,
|
|
134
139
|
baseDir,
|
|
135
140
|
migrationsDirPath,
|
|
@@ -167,8 +172,8 @@ ${(0, import_chunk_G222ME3D.printFilesFromMigrationIds)("migrations", migrationI
|
|
|
167
172
|
if (error) {
|
|
168
173
|
return new import_internals.HelpError(`
|
|
169
174
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
170
|
-
${
|
|
175
|
+
${renderHelp(this.cliCommand)}`);
|
|
171
176
|
}
|
|
172
|
-
return
|
|
177
|
+
return renderHelp(this.cliCommand);
|
|
173
178
|
}
|
|
174
179
|
};
|
|
@@ -26,35 +26,32 @@ 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_W4WHE5HS_exports = {};
|
|
30
|
+
__export(chunk_W4WHE5HS_exports, {
|
|
31
31
|
MigrateDev: () => MigrateDev
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_W4WHE5HS_exports);
|
|
34
34
|
var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_6F7CAPL7 = require("./chunk-6F7CAPL7.js");
|
|
36
36
|
var import_chunk_G222ME3D = require("./chunk-G222ME3D.js");
|
|
37
37
|
var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_KYZDCMJW = require("./chunk-KYZDCMJW.js");
|
|
39
39
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
40
40
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
41
|
-
var
|
|
41
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
42
42
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
43
43
|
var import_node_path = __toESM(require("node:path"));
|
|
44
44
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
45
45
|
var import_internals = require("@prisma/internals");
|
|
46
46
|
var import_prompts = __toESM(require("prompts"));
|
|
47
47
|
var debug = (0, import_debug.default)("prisma:migrate:dev");
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return new _MigrateDev();
|
|
51
|
-
}
|
|
52
|
-
static help = (0, import_internals.format)(`
|
|
48
|
+
function renderHelp(cliCommand) {
|
|
49
|
+
return (0, import_internals.format)(`
|
|
53
50
|
${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
|
|
54
51
|
|
|
55
52
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
56
53
|
|
|
57
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
54
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate dev [options]
|
|
58
55
|
|
|
59
56
|
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
|
|
60
57
|
|
|
@@ -71,14 +68,22 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
|
|
|
71
68
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
72
69
|
|
|
73
70
|
Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
|
|
74
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
71
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate dev
|
|
75
72
|
|
|
76
73
|
Specify a schema
|
|
77
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
74
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate dev --schema=./schema.prisma
|
|
78
75
|
|
|
79
76
|
Create a migration without applying it
|
|
80
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
77
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate dev --create-only
|
|
81
78
|
`);
|
|
79
|
+
}
|
|
80
|
+
var MigrateDev = class _MigrateDev {
|
|
81
|
+
constructor(cliCommand) {
|
|
82
|
+
this.cliCommand = cliCommand;
|
|
83
|
+
}
|
|
84
|
+
static new(cliCommand) {
|
|
85
|
+
return new _MigrateDev(cliCommand);
|
|
86
|
+
}
|
|
82
87
|
async parse(argv, config, baseDir) {
|
|
83
88
|
const args = (0, import_internals.arg)(argv, {
|
|
84
89
|
"--help": Boolean,
|
|
@@ -117,18 +122,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
117
122
|
}
|
|
118
123
|
};
|
|
119
124
|
}
|
|
120
|
-
const cmd =
|
|
121
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config: cmdSpecificConfig, cmd });
|
|
122
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
125
|
+
const cmd = `${this.cliCommand} migrate dev`;
|
|
126
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config: cmdSpecificConfig, command: cmd });
|
|
127
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
128
|
+
const datasourceProvider = (0, import_internals.getSchemaDatasourceProvider)(schemaContext);
|
|
123
129
|
const datasourceInfo = (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig);
|
|
124
130
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
|
|
125
131
|
process.stdout.write("\n");
|
|
126
132
|
(0, import_internals.validate)({ schemas: schemaContext.schemaFiles });
|
|
127
|
-
const successMessage = await (0, import_chunk_BRPS327A.ensureDatabaseExists)(
|
|
128
|
-
baseDir,
|
|
129
|
-
(0, import_internals.getSchemaDatasourceProvider)(schemaContext),
|
|
130
|
-
validatedConfig
|
|
131
|
-
);
|
|
133
|
+
const successMessage = await (0, import_chunk_BRPS327A.ensureDatabaseExists)(baseDir, datasourceProvider, validatedConfig);
|
|
132
134
|
if (successMessage) {
|
|
133
135
|
process.stdout.write(successMessage + "\n\n");
|
|
134
136
|
}
|
|
@@ -136,7 +138,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
136
138
|
externalTables: cmdSpecificConfig.tables?.external ?? [],
|
|
137
139
|
externalEnums: cmdSpecificConfig.enums?.external ?? []
|
|
138
140
|
};
|
|
139
|
-
const migrate = await
|
|
141
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
140
142
|
schemaEngineConfig: cmdSpecificConfig,
|
|
141
143
|
baseDir,
|
|
142
144
|
migrationsDirPath,
|
|
@@ -161,7 +163,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
|
161
163
|
});
|
|
162
164
|
process.stdout.write(
|
|
163
165
|
`
|
|
164
|
-
You may use ${(0, import_chunk_SKRR5WT4.red)(
|
|
166
|
+
You may use ${(0, import_chunk_SKRR5WT4.red)(`${this.cliCommand} migrate reset`)} to drop the development database.
|
|
165
167
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will be lost."))}
|
|
166
168
|
`
|
|
167
169
|
);
|
|
@@ -198,8 +200,9 @@ ${(0, import_chunk_G222ME3D.printFilesFromMigrationIds)(
|
|
|
198
200
|
await migrate.stop();
|
|
199
201
|
throw e;
|
|
200
202
|
}
|
|
201
|
-
const unexecutableStepsError = (0,
|
|
203
|
+
const unexecutableStepsError = (0, import_chunk_6F7CAPL7.handleUnexecutableSteps)(
|
|
202
204
|
evaluateDataLossResult.unexecutableSteps,
|
|
205
|
+
this.cliCommand,
|
|
203
206
|
args["--create-only"]
|
|
204
207
|
);
|
|
205
208
|
if (unexecutableStepsError) {
|
|
@@ -219,7 +222,7 @@ ${(0, import_chunk_G222ME3D.printFilesFromMigrationIds)(
|
|
|
219
222
|
if (!args["--force"]) {
|
|
220
223
|
if (!(0, import_internals.canPrompt)()) {
|
|
221
224
|
await migrate.stop();
|
|
222
|
-
throw new
|
|
225
|
+
throw new import_chunk_KYZDCMJW.MigrateDevEnvNonInteractiveError(this.cliCommand);
|
|
223
226
|
}
|
|
224
227
|
const message = args["--create-only"] ? "Are you sure you want to create this migration?" : "Are you sure you want to create and apply this migration?";
|
|
225
228
|
const confirmation = await (0, import_prompts.default)({
|
|
@@ -259,7 +262,7 @@ ${(0, import_chunk_G222ME3D.printFilesFromMigrationIds)(
|
|
|
259
262
|
createMigrationResult.generatedMigrationName
|
|
260
263
|
)}
|
|
261
264
|
|
|
262
|
-
You can now edit it and apply it by running ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
265
|
+
You can now edit it and apply it by running ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate dev`))}.`;
|
|
263
266
|
}
|
|
264
267
|
const { appliedMigrationNames } = await migrate.applyMigrations();
|
|
265
268
|
migrationIds = appliedMigrationNames;
|
|
@@ -319,8 +322,8 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
|
|
|
319
322
|
if (error) {
|
|
320
323
|
return new import_internals.HelpError(`
|
|
321
324
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
322
|
-
${
|
|
325
|
+
${renderHelp(this.cliCommand)}`);
|
|
323
326
|
}
|
|
324
|
-
return
|
|
327
|
+
return renderHelp(this.cliCommand);
|
|
325
328
|
}
|
|
326
329
|
};
|
|
@@ -26,28 +26,25 @@ 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_Y3QVFDLE_exports = {};
|
|
30
|
+
__export(chunk_Y3QVFDLE_exports, {
|
|
31
31
|
MigrateStatus: () => MigrateStatus
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
33
|
+
module.exports = __toCommonJS(chunk_Y3QVFDLE_exports);
|
|
34
34
|
var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
|
|
35
35
|
var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
|
|
37
37
|
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
38
38
|
var import_debug = __toESM(require("@prisma/debug"));
|
|
39
39
|
var import_internals = require("@prisma/internals");
|
|
40
40
|
var debug = (0, import_debug.default)("prisma:migrate:status");
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return new _MigrateStatus();
|
|
44
|
-
}
|
|
45
|
-
static help = (0, import_internals.format)(`
|
|
41
|
+
function renderHelp(cliCommand) {
|
|
42
|
+
return (0, import_internals.format)(`
|
|
46
43
|
Check the status of your database migrations
|
|
47
44
|
|
|
48
45
|
${(0, import_chunk_SKRR5WT4.bold)("Usage")}
|
|
49
46
|
|
|
50
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
47
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate status [options]
|
|
51
48
|
|
|
52
49
|
The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
|
|
53
50
|
|
|
@@ -60,11 +57,19 @@ Check the status of your database migrations
|
|
|
60
57
|
${(0, import_chunk_SKRR5WT4.bold)("Examples")}
|
|
61
58
|
|
|
62
59
|
Check the status of your database migrations
|
|
63
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
60
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate status
|
|
64
61
|
|
|
65
62
|
Specify a schema
|
|
66
|
-
${(0, import_chunk_SKRR5WT4.dim)("$")}
|
|
63
|
+
${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate status --schema=./schema.prisma
|
|
67
64
|
`);
|
|
65
|
+
}
|
|
66
|
+
var MigrateStatus = class _MigrateStatus {
|
|
67
|
+
constructor(cliCommand) {
|
|
68
|
+
this.cliCommand = cliCommand;
|
|
69
|
+
}
|
|
70
|
+
static new(cliCommand) {
|
|
71
|
+
return new _MigrateStatus(cliCommand);
|
|
72
|
+
}
|
|
68
73
|
async parse(argv, config, baseDir) {
|
|
69
74
|
const args = (0, import_internals.arg)(
|
|
70
75
|
argv,
|
|
@@ -91,15 +96,15 @@ Check the status of your database migrations
|
|
|
91
96
|
})
|
|
92
97
|
});
|
|
93
98
|
const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
|
|
94
|
-
const cmd =
|
|
95
|
-
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
|
|
96
|
-
(0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
|
|
99
|
+
const cmd = `${this.cliCommand} migrate status`;
|
|
100
|
+
const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, command: cmd });
|
|
101
|
+
(0, import_internals.checkUnsupportedDataProxy)({ command: cmd, validatedConfig });
|
|
97
102
|
(0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig) });
|
|
98
103
|
const schemaFilter = {
|
|
99
104
|
externalTables: config.tables?.external ?? [],
|
|
100
105
|
externalEnums: config.enums?.external ?? []
|
|
101
106
|
};
|
|
102
|
-
const migrate = await
|
|
107
|
+
const migrate = await import_chunk_ZOYXSZ2J.Migrate.setup({
|
|
103
108
|
schemaEngineConfig: config,
|
|
104
109
|
baseDir,
|
|
105
110
|
migrationsDirPath,
|
|
@@ -138,8 +143,8 @@ Check the status of your database migrations
|
|
|
138
143
|
`Following migration${unappliedMigrations.length > 1 ? "s" : ""} have not yet been applied:
|
|
139
144
|
${unappliedMigrations.join("\n")}
|
|
140
145
|
|
|
141
|
-
To apply migrations in development run ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
142
|
-
To apply migrations in production run ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
146
|
+
To apply migrations in development run ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate dev`)))}.
|
|
147
|
+
To apply migrations in production run ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate deploy`)))}.
|
|
143
148
|
`
|
|
144
149
|
);
|
|
145
150
|
process.exit(1);
|
|
@@ -167,7 +172,7 @@ ${(0, import_internals.link)("https://pris.ly/d/migrate-baseline")}`);
|
|
|
167
172
|
console.error(`The current database is not managed by Prisma Migrate.
|
|
168
173
|
|
|
169
174
|
If you want to keep the current database structure and data and create new migrations, baseline this database with the migration "${migrationId}":
|
|
170
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
175
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --applied "${migrationId}"`)))}
|
|
171
176
|
|
|
172
177
|
Read more about how to baseline an existing production database:
|
|
173
178
|
https://pris.ly/d/migrate-baseline`);
|
|
@@ -180,17 +185,17 @@ https://pris.ly/d/migrate-baseline`);
|
|
|
180
185
|
${failedMigrations.join("\n")}
|
|
181
186
|
|
|
182
187
|
During development if the failed migration(s) have not been deployed to a production database you can then fix the migration(s) and run ${(0, import_chunk_SKRR5WT4.bold)(
|
|
183
|
-
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
188
|
+
(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate dev`))
|
|
184
189
|
)}.
|
|
185
190
|
`
|
|
186
191
|
);
|
|
187
192
|
console.error(`The failed migration(s) can be marked as rolled back or applied:
|
|
188
193
|
|
|
189
194
|
- If you rolled back the migration(s) manually:
|
|
190
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
195
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --rolled-back "${failedMigrations[0]}"`)))}
|
|
191
196
|
|
|
192
197
|
- If you fixed the database manually (hotfix):
|
|
193
|
-
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(
|
|
198
|
+
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} migrate resolve --applied "${failedMigrations[0]}"`)))}
|
|
194
199
|
|
|
195
200
|
Read more about how to resolve migration issues in a production database:
|
|
196
201
|
${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}`);
|
|
@@ -207,8 +212,8 @@ ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}`);
|
|
|
207
212
|
if (error) {
|
|
208
213
|
return new import_internals.HelpError(`
|
|
209
214
|
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
|
|
210
|
-
${
|
|
215
|
+
${renderHelp(this.cliCommand)}`);
|
|
211
216
|
}
|
|
212
|
-
return
|
|
217
|
+
return renderHelp(this.cliCommand);
|
|
213
218
|
}
|
|
214
219
|
};
|
|
@@ -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_ZOYXSZ2J_exports = {};
|
|
20
|
+
__export(chunk_ZOYXSZ2J_exports, {
|
|
21
21
|
Migrate: () => Migrate
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_ZOYXSZ2J_exports);
|
|
24
24
|
var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
|
|
25
25
|
var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
|
|
26
|
-
var
|
|
26
|
+
var import_chunk_KDAXJMEP = require("./chunk-KDAXJMEP.js");
|
|
27
27
|
var import_internals = require("@prisma/internals");
|
|
28
28
|
var Migrate = class _Migrate {
|
|
29
29
|
engine;
|
|
@@ -41,7 +41,7 @@ var Migrate = class _Migrate {
|
|
|
41
41
|
static async setup({ schemaContext, schemaEngineConfig, ...rest }) {
|
|
42
42
|
const schemaEngine = await (async () => {
|
|
43
43
|
const datasource = schemaEngineConfig.datasource;
|
|
44
|
-
return await
|
|
44
|
+
return await import_chunk_KDAXJMEP.SchemaEngineCLI.setup({ datasource, schemaContext, ...rest });
|
|
45
45
|
})();
|
|
46
46
|
return new _Migrate({ engine: schemaEngine, schemaContext, ...rest });
|
|
47
47
|
}
|