@prisma/migrate 7.10.0-dev.49 → 7.10.0-dev.58

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.
Files changed (84) hide show
  1. package/dist/bin.js +37 -31
  2. package/dist/{chunk-DP52MO7V.js → chunk-2WAUT755.js} +22 -17
  3. package/dist/{chunk-XTEEOIUV.js → chunk-3DR7R72S.js} +19 -14
  4. package/dist/{chunk-HWBQGGZH.js → chunk-3NKLI5KP.js} +9 -9
  5. package/dist/{chunk-6TSRRBNA.js → chunk-57S5K3DX.js} +7 -7
  6. package/dist/{chunk-7CQBDP4H.js → chunk-6F7CAPL7.js} +9 -10
  7. package/dist/{chunk-P5L7E4AA.js → chunk-6V2VYU3A.js} +28 -23
  8. package/dist/{chunk-ZICOD27L.js → chunk-6W7GTZYX.js} +25 -20
  9. package/dist/{chunk-GBUW4I6U.js → chunk-7KCEXIB2.js} +6 -6
  10. package/dist/{chunk-TEOIOJ7P.js → chunk-A6PUWLVN.js} +6 -6
  11. package/dist/{chunk-2MKUVRMY.js → chunk-D7N4YVZS.js} +36 -31
  12. package/dist/{chunk-DPRQXN36.js → chunk-DTSU3YZP.js} +6 -6
  13. package/dist/{chunk-WA2SOLDQ.js → chunk-EGNBSKBG.js} +8 -8
  14. package/dist/{chunk-DNNMOG7A.js → chunk-F2LZOLZK.js} +25 -24
  15. package/dist/{chunk-PPE4XDUL.js → chunk-GD52HTMX.js} +10 -10
  16. package/dist/{chunk-2HCAA4GX.js → chunk-GHPP2B5T.js} +27 -23
  17. package/dist/{chunk-DIBAT4TU.js → chunk-I7UMFS37.js} +31 -24
  18. package/dist/{chunk-NGEWTXY6.js → chunk-J6BC6QDB.js} +6 -6
  19. package/dist/{chunk-ZUHJASAP.js → chunk-KYZDCMJW.js} +12 -12
  20. package/dist/{chunk-UA3FFRRV.js → chunk-NSQ3NTDD.js} +26 -20
  21. package/dist/{chunk-VEBRKA5H.js → chunk-OQKFK65J.js} +6 -6
  22. package/dist/{chunk-YNB3IN6Q.js → chunk-OXZFIZV6.js} +8 -8
  23. package/dist/{chunk-ESJU6GOY.js → chunk-PCCMNZGX.js} +26 -21
  24. package/dist/{chunk-U5ENWTWF.js → chunk-RRKGNIXU.js} +32 -30
  25. package/dist/{chunk-THJ7K72W.js → chunk-SFFTVLXC.js} +6 -6
  26. package/dist/{chunk-2H5YFAVM.js → chunk-SUVNEDA5.js} +55 -50
  27. package/dist/{chunk-LMZTFDJN.js → chunk-TY3ROQOX.js} +30 -24
  28. package/dist/{chunk-INC5VUX4.js → chunk-ZVRF2A5M.js} +6 -6
  29. package/dist/commands/DbCommand.js +2 -2
  30. package/dist/commands/DbDrop.js +3 -3
  31. package/dist/commands/DbExecute.js +2 -2
  32. package/dist/commands/DbPull.js +3 -3
  33. package/dist/commands/DbPush.js +3 -3
  34. package/dist/commands/DbSeed.js +2 -2
  35. package/dist/commands/MigrateCommand.js +2 -2
  36. package/dist/commands/MigrateDeploy.js +2 -2
  37. package/dist/commands/MigrateDev.js +4 -4
  38. package/dist/commands/MigrateDiff.js +3 -3
  39. package/dist/commands/MigrateReset.js +3 -3
  40. package/dist/commands/MigrateResolve.js +2 -2
  41. package/dist/commands/MigrateStatus.js +2 -2
  42. package/dist/commands/db-command-completion.js +2 -2
  43. package/dist/commands/db-execute-completion.js +2 -2
  44. package/dist/commands/db-pull-completion.js +2 -2
  45. package/dist/commands/db-push-completion.js +2 -2
  46. package/dist/commands/db-seed-completion.js +2 -2
  47. package/dist/commands/migrate-command-completion.js +2 -2
  48. package/dist/commands/migrate-deploy-completion.js +2 -2
  49. package/dist/commands/migrate-dev-completion.js +2 -2
  50. package/dist/commands/migrate-diff-completion.js +2 -2
  51. package/dist/commands/migrate-reset-completion.js +2 -2
  52. package/dist/commands/migrate-resolve-completion.js +2 -2
  53. package/dist/commands/migrate-status-completion.js +2 -2
  54. package/dist/index.js +52 -52
  55. package/dist/src/commands/DbCommand.d.ts +2 -2
  56. package/dist/src/commands/DbDrop.d.ts +3 -2
  57. package/dist/src/commands/DbExecute.d.ts +3 -2
  58. package/dist/src/commands/DbPull.d.ts +3 -2
  59. package/dist/src/commands/DbPush.d.ts +3 -2
  60. package/dist/src/commands/DbSeed.d.ts +3 -2
  61. package/dist/src/commands/MigrateCommand.d.ts +2 -2
  62. package/dist/src/commands/MigrateDeploy.d.ts +3 -2
  63. package/dist/src/commands/MigrateDev.d.ts +3 -2
  64. package/dist/src/commands/MigrateDiff.d.ts +3 -2
  65. package/dist/src/commands/MigrateReset.d.ts +3 -2
  66. package/dist/src/commands/MigrateResolve.d.ts +3 -2
  67. package/dist/src/commands/MigrateStatus.d.ts +3 -2
  68. package/dist/src/commands/db-command-completion.d.ts +1 -1
  69. package/dist/src/commands/db-execute-completion.d.ts +1 -1
  70. package/dist/src/commands/db-pull-completion.d.ts +1 -1
  71. package/dist/src/commands/db-push-completion.d.ts +1 -1
  72. package/dist/src/commands/db-seed-completion.d.ts +1 -1
  73. package/dist/src/commands/migrate-command-completion.d.ts +1 -1
  74. package/dist/src/commands/migrate-deploy-completion.d.ts +1 -1
  75. package/dist/src/commands/migrate-dev-completion.d.ts +1 -1
  76. package/dist/src/commands/migrate-diff-completion.d.ts +1 -1
  77. package/dist/src/commands/migrate-reset-completion.d.ts +1 -1
  78. package/dist/src/commands/migrate-resolve-completion.d.ts +1 -1
  79. package/dist/src/commands/migrate-status-completion.d.ts +1 -1
  80. package/dist/src/utils/errors.d.ts +4 -4
  81. package/dist/src/utils/handleEvaluateDataloss.d.ts +1 -1
  82. package/dist/utils/errors.js +8 -8
  83. package/dist/utils/handleEvaluateDataloss.js +2 -2
  84. package/package.json +9 -9
@@ -16,19 +16,19 @@ 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 chunk_TEOIOJ7P_exports = {};
20
- __export(chunk_TEOIOJ7P_exports, {
19
+ var chunk_A6PUWLVN_exports = {};
20
+ __export(chunk_A6PUWLVN_exports, {
21
21
  migrateResetCompletion: () => migrateResetCompletion
22
22
  });
23
- module.exports = __toCommonJS(chunk_TEOIOJ7P_exports);
24
- var import_completion_values = require("@prisma/internals/src/cli/completion-values");
23
+ module.exports = __toCommonJS(chunk_A6PUWLVN_exports);
24
+ var import_internals = require("@prisma/internals");
25
25
  var migrateResetCompletion = {
26
26
  name: "migrate reset",
27
27
  description: "Reset your database and apply all migrations",
28
28
  options: [
29
29
  { name: "help", alias: "h", description: "Display this help message" },
30
- { name: "schema", description: "Custom path to your Prisma schema", values: import_completion_values.completionSchemaPaths },
31
- { name: "config", description: "Custom path to your Prisma config file", values: import_completion_values.completionConfigPaths },
30
+ { name: "schema", description: "Custom path to your Prisma schema", values: import_internals.completionSchemaPaths },
31
+ { name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths },
32
32
  { name: "force", alias: "f", description: "Skip the confirmation prompt" }
33
33
  ]
34
34
  };
@@ -26,18 +26,18 @@ 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 chunk_2MKUVRMY_exports = {};
30
- __export(chunk_2MKUVRMY_exports, {
29
+ var chunk_D7N4YVZS_exports = {};
30
+ __export(chunk_D7N4YVZS_exports, {
31
31
  DbPull: () => DbPull
32
32
  });
33
- module.exports = __toCommonJS(chunk_2MKUVRMY_exports);
33
+ module.exports = __toCommonJS(chunk_D7N4YVZS_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 import_chunk_ZUHJASAP = require("./chunk-ZUHJASAP.js");
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
43
  var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
@@ -46,18 +46,15 @@ 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
- var DbPull = class _DbPull {
50
- static new() {
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)("$")} prisma db pull [flags/options]
55
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull [flags/options]
59
56
 
60
- The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
57
+ The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma7.config.ts")}).
61
58
 
62
59
  ${(0, import_chunk_SKRR5WT4.bold)("Flags")}
63
60
 
@@ -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)("$")} prisma db pull
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)("$")} prisma db pull --schema=./schema.prisma
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)("$")} prisma db pull --print
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)("$")} prisma db pull --force
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)("$")} prisma db pull --composite-type-depth=2
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,15 +136,15 @@ Set composite types introspection depth to 2 levels
131
136
  }
132
137
  };
133
138
  }
134
- const cmd = "db pull";
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 import_chunk_ZUHJASAP.NoSchemaFoundError();
147
+ throw new import_chunk_KYZDCMJW.NoSchemaFoundError();
143
148
  }
144
149
  (0, import_internals.getSchemaDatasourceProvider)(schemaContext);
145
150
  const firstDatasource = schemaContext.primaryDatasource;
@@ -152,7 +157,7 @@ Set composite types introspection depth to 2 levels
152
157
  if (isReintrospection && !args["--force"] && firstDatasource?.provider === "mongodb") {
153
158
  throw new Error(`Iterating on one schema using re-introspection with db pull is currently not supported with MongoDB provider.
154
159
  You can explicitly ignore and override your current local schema file with ${(0, import_chunk_SKRR5WT4.green)(
155
- (0, import_internals.getCommandWithExecutor)("prisma db pull --force")
160
+ (0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db pull --force`)
156
161
  )}
157
162
  Some information will be lost (relations, comments, mapped fields, @ignore...), follow ${(0, import_internals.link)(
158
163
  "https://github.com/prisma/prisma/issues/9585"
@@ -189,10 +194,10 @@ Some information will be lost (relations, comments, mapped fields, @ignore...),
189
194
  throw new Error(`
190
195
  ${(0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)(`${e.code} `))}${(0, import_chunk_SKRR5WT4.red)("The introspected database was empty:")}
191
196
 
192
- ${(0, import_chunk_SKRR5WT4.bold)("prisma db pull")} could not create any models in your ${(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)(
193
198
  "schema.prisma"
194
199
  )} file and you will not be able to generate Prisma Client with the ${(0, import_chunk_SKRR5WT4.bold)(
195
- (0, import_internals.getCommandWithExecutor)("prisma generate")
200
+ (0, import_internals.getCommandWithExecutor)(`${this.cliCommand} generate`)
196
201
  )} command.
197
202
 
198
203
  ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
@@ -202,16 +207,16 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
202
207
  "schema.prisma"
203
208
  )} points to a database that is not empty (it must contain at least one table).
204
209
 
205
- Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
210
+ Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db pull`))} again.
206
211
  `);
207
212
  } else if (e.code === "P1003") {
208
213
  throw new Error(`
209
214
  ${(0, import_chunk_SKRR5WT4.red)((0, import_chunk_SKRR5WT4.bold)(`${e.code} `))}${(0, import_chunk_SKRR5WT4.red)("The introspected database does not exist:")}
210
215
 
211
- ${(0, import_chunk_SKRR5WT4.bold)("prisma db pull")} could not create any models in your ${(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)(
212
217
  "schema.prisma"
213
218
  )} file and you will not be able to generate Prisma Client with the ${(0, import_chunk_SKRR5WT4.bold)(
214
- (0, import_internals.getCommandWithExecutor)("prisma generate")
219
+ (0, import_internals.getCommandWithExecutor)(`${this.cliCommand} generate`)
215
220
  )} command.
216
221
 
217
222
  ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
@@ -221,7 +226,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("To fix this, you have two options:")}
221
226
  "schema.prisma"
222
227
  )} points to an existing database.
223
228
 
224
- Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db pull"))} again.
229
+ Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} db pull`))} again.
225
230
  `);
226
231
  } else if (e.code === "P1012") {
227
232
  process.stdout.write("\n");
@@ -230,7 +235,7 @@ Then you can run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getComm
230
235
  Introspection failed as your current Prisma schema file is invalid
231
236
 
232
237
  Please fix your current schema manually (using either ${(0, import_chunk_SKRR5WT4.green)(
233
- (0, import_internals.getCommandWithExecutor)("prisma validate")
238
+ (0, import_internals.getCommandWithExecutor)(`${this.cliCommand} validate`)
234
239
  )} or the Prisma VS Code extension to understand what's broken and confirm you fixed it), and then run this command again.
235
240
  Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
236
241
  "--force"
@@ -266,7 +271,7 @@ Or run this command with the ${(0, import_chunk_SKRR5WT4.green)(
266
271
  import_path.default.relative(process.cwd(), introspectedSchemaPath)
267
272
  )} in ${(0, import_chunk_SKRR5WT4.bold)((0, import_internals.formatms)(Math.round(performance.now()) - before))}
268
273
  ${(0, import_chunk_SKRR5WT4.yellow)(introspectionWarningsMessage)}
269
- ${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma generate"))} to generate Prisma Client.`}`);
274
+ ${`Run ${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)(`${this.cliCommand} generate`))} to generate Prisma Client.`}`);
270
275
  }
271
276
  return "";
272
277
  }
@@ -281,8 +286,8 @@ ${warnings}`;
281
286
  if (error) {
282
287
  return new import_internals.HelpError(`
283
288
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
284
- ${_DbPull.help}`);
289
+ ${renderHelp(this.cliCommand)}`);
285
290
  }
286
- return _DbPull.help;
291
+ return renderHelp(this.cliCommand);
287
292
  }
288
293
  };
@@ -16,19 +16,19 @@ 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 chunk_DPRQXN36_exports = {};
20
- __export(chunk_DPRQXN36_exports, {
19
+ var chunk_DTSU3YZP_exports = {};
20
+ __export(chunk_DTSU3YZP_exports, {
21
21
  dbExecuteCompletion: () => dbExecuteCompletion
22
22
  });
23
- module.exports = __toCommonJS(chunk_DPRQXN36_exports);
24
- var import_completion_values = require("@prisma/internals/src/cli/completion-values");
23
+ module.exports = __toCommonJS(chunk_DTSU3YZP_exports);
24
+ var import_internals = require("@prisma/internals");
25
25
  var dbExecuteCompletion = {
26
26
  name: "db execute",
27
27
  description: "Execute SQL or scripts on your database",
28
28
  options: [
29
29
  { name: "help", alias: "h", description: "Display this help message" },
30
- { name: "config", description: "Custom path to your Prisma config file", values: import_completion_values.completionConfigPaths },
31
- { name: "file", description: "Path to a file containing the script to execute", values: import_completion_values.completionSqlScriptPaths },
30
+ { name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths },
31
+ { name: "file", description: "Path to a file containing the script to execute", values: import_internals.completionSqlScriptPaths },
32
32
  { name: "stdin", description: "Use terminal standard input as the script to execute" }
33
33
  ]
34
34
  };
@@ -16,20 +16,20 @@ 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 chunk_WA2SOLDQ_exports = {};
20
- __export(chunk_WA2SOLDQ_exports, {
19
+ var chunk_EGNBSKBG_exports = {};
20
+ __export(chunk_EGNBSKBG_exports, {
21
21
  migrateResolveCompletion: () => migrateResolveCompletion
22
22
  });
23
- module.exports = __toCommonJS(chunk_WA2SOLDQ_exports);
24
- var import_completion_values = require("@prisma/internals/src/cli/completion-values");
23
+ module.exports = __toCommonJS(chunk_EGNBSKBG_exports);
24
+ var import_internals = require("@prisma/internals");
25
25
  var migrateResolveCompletion = {
26
26
  name: "migrate resolve",
27
27
  description: "Mark a migration as applied or rolled back",
28
28
  options: [
29
29
  { name: "help", alias: "h", description: "Display this help message" },
30
- { name: "schema", description: "Custom path to your Prisma schema", values: import_completion_values.completionSchemaPaths },
31
- { name: "config", description: "Custom path to your Prisma config file", values: import_completion_values.completionConfigPaths },
32
- { name: "applied", description: "Mark a migration as applied", values: import_completion_values.completionMigrationIds },
33
- { name: "rolled-back", description: "Mark a migration as rolled back", values: import_completion_values.completionMigrationIds }
30
+ { name: "schema", description: "Custom path to your Prisma schema", values: import_internals.completionSchemaPaths },
31
+ { name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths },
32
+ { name: "applied", description: "Mark a migration as applied", values: import_internals.completionMigrationIds },
33
+ { name: "rolled-back", description: "Mark a migration as rolled back", values: import_internals.completionMigrationIds }
34
34
  ]
35
35
  };
@@ -16,26 +16,20 @@ 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 chunk_DNNMOG7A_exports = {};
20
- __export(chunk_DNNMOG7A_exports, {
19
+ var chunk_F2LZOLZK_exports = {};
20
+ __export(chunk_F2LZOLZK_exports, {
21
21
  MigrateCommand: () => MigrateCommand
22
22
  });
23
- module.exports = __toCommonJS(chunk_DNNMOG7A_exports);
23
+ module.exports = __toCommonJS(chunk_F2LZOLZK_exports);
24
24
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
25
25
  var import_internals = require("@prisma/internals");
26
- var MigrateCommand = class _MigrateCommand {
27
- constructor(cmds) {
28
- this.cmds = cmds;
29
- }
30
- static new(cmds) {
31
- return new _MigrateCommand(cmds);
32
- }
33
- static help = (0, import_internals.format)(`
26
+ function renderHelp(cliCommand) {
27
+ return (0, import_internals.format)(`
34
28
  Update the database schema with migrations
35
29
 
36
30
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
37
31
 
38
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate [command] [options]
32
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate [command] [options]
39
33
 
40
34
  ${(0, import_chunk_SKRR5WT4.bold)("Commands for development")}
41
35
 
@@ -62,26 +56,32 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
62
56
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
63
57
 
64
58
  Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
65
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev
59
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate dev
66
60
 
67
61
  Reset your database and apply all migrations
68
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset
62
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate reset
69
63
 
70
64
  Apply pending migrations to the database in production/staging
71
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy
65
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate deploy
72
66
 
73
67
  Check the status of migrations in the production/staging database
74
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status
68
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate status
75
69
 
76
70
  Specify a schema
77
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status --schema=./schema.prisma
71
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate status --schema=./schema.prisma
78
72
 
79
73
  Compare the database schema from two databases and render the diff as a SQL script
80
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
81
- --from-url "$DATABASE_URL" \\
82
- --to-url "postgresql://login:password@localhost:5432/db" \\
83
- --script
74
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff --from-url "$DATABASE_URL" --to-url "postgresql://login:password@localhost:5432/db" --script
84
75
  `);
76
+ }
77
+ var MigrateCommand = class _MigrateCommand {
78
+ constructor(cmds, cliCommand) {
79
+ this.cmds = cmds;
80
+ this.cliCommand = cliCommand;
81
+ }
82
+ static new(cmds, cliCommand) {
83
+ return new _MigrateCommand(cmds, cliCommand);
84
+ }
85
85
  async parse(argv, config, baseDir) {
86
86
  const args = (0, import_internals.arg)(argv, {
87
87
  "--help": Boolean,
@@ -108,14 +108,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
108
108
  }
109
109
  return cmd.parse(argsForCmd, config, baseDir);
110
110
  }
111
- return (0, import_internals.unknownCommand)(_MigrateCommand.help, commandName);
111
+ return (0, import_internals.unknownCommand)(renderHelp(this.cliCommand), commandName);
112
112
  }
113
113
  help(error) {
114
+ const help = renderHelp(this.cliCommand);
114
115
  if (error) {
115
116
  return new import_internals.HelpError(`
116
117
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
117
- ${_MigrateCommand.help}`);
118
+ ${help}`);
118
119
  }
119
- return _MigrateCommand.help;
120
+ return help;
120
121
  }
121
122
  };
@@ -16,42 +16,42 @@ 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 chunk_PPE4XDUL_exports = {};
20
- __export(chunk_PPE4XDUL_exports, {
19
+ var chunk_GD52HTMX_exports = {};
20
+ __export(chunk_GD52HTMX_exports, {
21
21
  migrateDiffCompletion: () => migrateDiffCompletion
22
22
  });
23
- module.exports = __toCommonJS(chunk_PPE4XDUL_exports);
24
- var import_completion_values = require("@prisma/internals/src/cli/completion-values");
23
+ module.exports = __toCommonJS(chunk_GD52HTMX_exports);
24
+ var import_internals = require("@prisma/internals");
25
25
  var migrateDiffCompletion = {
26
26
  name: "migrate diff",
27
27
  description: "Compare the database schema from two arbitrary sources",
28
28
  options: [
29
29
  { name: "help", alias: "h", description: "Display this help message" },
30
- { name: "config", description: "Custom path to your Prisma config file", values: import_completion_values.completionConfigPaths },
30
+ { name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths },
31
31
  {
32
32
  name: "output",
33
33
  alias: "o",
34
34
  description: "Write the diff to a file instead of stdout",
35
- values: import_completion_values.completionDiffOutputPaths
35
+ values: import_internals.completionDiffOutputPaths
36
36
  },
37
37
  { name: "from-empty", description: "Assume the source data model is empty" },
38
- { name: "from-schema", description: "Path to a Prisma schema file as the source", values: import_completion_values.completionSchemaPaths },
38
+ { name: "from-schema", description: "Path to a Prisma schema file as the source", values: import_internals.completionSchemaPaths },
39
39
  {
40
40
  name: "from-migrations",
41
41
  description: "Path to a Prisma migrations directory as the source",
42
- values: import_completion_values.completionMigrationsDirPaths
42
+ values: import_internals.completionMigrationsDirPaths
43
43
  },
44
44
  { name: "from-config-datasource", description: "Use the datasource from the Prisma config file as the source" },
45
45
  { name: "to-empty", description: "Assume the destination data model is empty" },
46
46
  {
47
47
  name: "to-schema",
48
48
  description: "Path to a Prisma schema file as the destination",
49
- values: import_completion_values.completionSchemaPaths
49
+ values: import_internals.completionSchemaPaths
50
50
  },
51
51
  {
52
52
  name: "to-migrations",
53
53
  description: "Path to a Prisma migrations directory as the destination",
54
- values: import_completion_values.completionMigrationsDirPaths
54
+ values: import_internals.completionMigrationsDirPaths
55
55
  },
56
56
  {
57
57
  name: "to-config-datasource",
@@ -16,26 +16,20 @@ 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 chunk_2HCAA4GX_exports = {};
20
- __export(chunk_2HCAA4GX_exports, {
19
+ var chunk_GHPP2B5T_exports = {};
20
+ __export(chunk_GHPP2B5T_exports, {
21
21
  DbCommand: () => DbCommand
22
22
  });
23
- module.exports = __toCommonJS(chunk_2HCAA4GX_exports);
23
+ module.exports = __toCommonJS(chunk_GHPP2B5T_exports);
24
24
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
25
25
  var import_internals = require("@prisma/internals");
26
- var DbCommand = class _DbCommand {
27
- constructor(cmds) {
28
- this.cmds = cmds;
29
- }
30
- static new(cmds) {
31
- return new _DbCommand(cmds);
32
- }
33
- static help = (0, import_internals.format)(`
26
+ function renderHelp(cliCommand) {
27
+ return (0, import_internals.format)(`
34
28
  ${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Manage your database schema and lifecycle during development.
35
29
 
36
30
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
37
31
 
38
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db [command] [options]
32
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db [command] [options]
39
33
 
40
34
  ${(0, import_chunk_SKRR5WT4.bold)("Options")}
41
35
 
@@ -51,18 +45,27 @@ ${(0, import_chunk_SKRR5WT4.bold)("Commands")}
51
45
 
52
46
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
53
47
 
54
- Run \`prisma db pull\`
55
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db pull
48
+ Run \`${cliCommand} db pull\`
49
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db pull
56
50
 
57
- Run \`prisma db push\`
58
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db push
51
+ Run \`${cliCommand} db push\`
52
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db push
59
53
 
60
- Run \`prisma db seed\`
61
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed
54
+ Run \`${cliCommand} db seed\`
55
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db seed
62
56
 
63
- Run \`prisma db execute\`
64
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
57
+ Run \`${cliCommand} db execute\`
58
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} db execute
65
59
  `);
60
+ }
61
+ var DbCommand = class _DbCommand {
62
+ constructor(cmds, cliCommand) {
63
+ this.cmds = cmds;
64
+ this.cliCommand = cliCommand;
65
+ }
66
+ static new(cmds, cliCommand) {
67
+ return new _DbCommand(cmds, cliCommand);
68
+ }
66
69
  async parse(argv, config, baseDir) {
67
70
  const args = (0, import_internals.arg)(argv, {
68
71
  "--help": Boolean,
@@ -82,14 +85,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
82
85
  const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
83
86
  return cmd.parse(argsForCmd, config, baseDir);
84
87
  }
85
- return (0, import_internals.unknownCommand)(_DbCommand.help, args._[0]);
88
+ return (0, import_internals.unknownCommand)(renderHelp(this.cliCommand), args._[0]);
86
89
  }
87
90
  help(error) {
91
+ const help = renderHelp(this.cliCommand);
88
92
  if (error) {
89
93
  return new import_internals.HelpError(`
90
94
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
91
- ${_DbCommand.help}`);
95
+ ${help}`);
92
96
  }
93
- return _DbCommand.help;
97
+ return help;
94
98
  }
95
99
  };
@@ -26,12 +26,12 @@ 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 chunk_DIBAT4TU_exports = {};
30
- __export(chunk_DIBAT4TU_exports, {
29
+ var chunk_I7UMFS37_exports = {};
30
+ __export(chunk_I7UMFS37_exports, {
31
31
  MigrateDiff: () => MigrateDiff,
32
32
  getRemovedTargetParameterHint: () => getRemovedTargetParameterHint
33
33
  });
34
- module.exports = __toCommonJS(chunk_DIBAT4TU_exports);
34
+ module.exports = __toCommonJS(chunk_I7UMFS37_exports);
35
35
  var import_chunk_VAJ4VX67 = require("./chunk-VAJ4VX67.js");
36
36
  var import_chunk_ZOYXSZ2J = require("./chunk-ZOYXSZ2J.js");
37
37
  var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
@@ -3166,10 +3166,11 @@ var require_main = (0, import_chunk_2ESYSVXG.__commonJS)({
3166
3166
  });
3167
3167
  var import_fs_jetpack = (0, import_chunk_2ESYSVXG.__toESM)(require_main());
3168
3168
  var debug = (0, import_debug.default)("prisma:migrate:diff");
3169
- var helpOptions = (0, import_internals.format)(
3170
- `${(0, import_chunk_SKRR5WT4.bold)("Usage")}
3169
+ function renderHelpOptions(cliCommand) {
3170
+ return (0, import_internals.format)(
3171
+ `${(0, import_chunk_SKRR5WT4.bold)("Usage")}
3171
3172
 
3172
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff [options]
3173
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff [options]
3173
3174
 
3174
3175
  ${(0, import_chunk_SKRR5WT4.bold)("Options")}
3175
3176
 
@@ -3194,16 +3195,14 @@ ${(0, import_chunk_SKRR5WT4.bold)("Flags")}
3194
3195
 
3195
3196
  --script Render a SQL script to stdout instead of the default human readable summary (not supported on MongoDB)
3196
3197
  --exit-code Change the exit code behavior to signal if the diff is empty or not (Empty: 0, Error: 1, Not empty: 2). Default behavior is Success: 0, Error: 1.`
3197
- );
3198
- var MigrateDiff = class _MigrateDiff {
3199
- static new() {
3200
- return new _MigrateDiff();
3201
- }
3202
- static help = (0, import_internals.format)(`
3198
+ );
3199
+ }
3200
+ function renderHelp(cliCommand) {
3201
+ return (0, import_internals.format)(`
3203
3202
  ${process.platform === "win32" ? "" : "\u{1F50D} "}Compares the database schema from two arbitrary sources, and outputs the differences either as a human-readable summary (by default) or an executable script.
3204
3203
 
3205
- ${(0, import_chunk_SKRR5WT4.green)(`prisma migrate diff`)} is a read-only command that does not write to your datasource(s).
3206
- ${(0, import_chunk_SKRR5WT4.green)(`prisma db execute`)} can be used to execute its ${(0, import_chunk_SKRR5WT4.green)(`--script`)} output.
3204
+ ${(0, import_chunk_SKRR5WT4.green)(`${cliCommand} migrate diff`)} is a read-only command that does not write to your datasource(s).
3205
+ ${(0, import_chunk_SKRR5WT4.green)(`${cliCommand} db execute`)} can be used to execute its ${(0, import_chunk_SKRR5WT4.green)(`--script`)} output.
3207
3206
 
3208
3207
  The command takes a source ${(0, import_chunk_SKRR5WT4.green)(`--from-...`)} and a destination ${(0, import_chunk_SKRR5WT4.green)(`--to-...`)}.
3209
3208
  The source and destination must use the same provider,
@@ -3215,42 +3214,50 @@ The default output is a human readable diff, it can be rendered as SQL using \`-
3215
3214
 
3216
3215
  See the documentation for more information ${(0, import_internals.link)("https://pris.ly/d/migrate-diff")}
3217
3216
 
3218
- ${helpOptions}
3217
+ ${renderHelpOptions(cliCommand)}
3219
3218
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
3220
3219
 
3221
3220
  From the configured database to a Prisma datamodel
3222
3221
  e.g. roll forward after a migration failed in the middle
3223
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
3222
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff \\
3224
3223
  --from-config-datasource \\
3225
3224
  --to-schema=next_datamodel.prisma \\
3226
3225
  --script
3227
3226
 
3228
3227
  From a Prisma datamodel to the configured database
3229
3228
  e.g. roll forward after a migration failed in the middle
3230
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
3229
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff \\
3231
3230
  --from-schema=next_datamodel.prisma \\
3232
3231
  --to-config-datasource \\
3233
3232
  --script
3234
3233
 
3235
3234
  From a Prisma Migrate \`migrations\` directory to the configured database
3236
3235
  e.g. generate a migration for a hotfix already applied on production
3237
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
3236
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff \\
3238
3237
  --from-migrations ./migrations \\
3239
3238
  --to-config-datasource \\
3240
3239
  --script
3241
3240
 
3242
- Execute the --script output with \`prisma db execute\` using bash pipe \`|\`
3243
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
3241
+ Execute the --script output with \`${cliCommand} db execute\` using bash pipe \`|\`
3242
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff \\
3244
3243
  --from-[...] \\
3245
3244
  --to-[...] \\
3246
- --script | prisma db execute --stdin --url="$DATABASE_URL"
3245
+ --script | ${cliCommand} db execute --stdin --url="$DATABASE_URL"
3247
3246
 
3248
3247
  Detect if both sources are in sync, it will exit with exit code 2 if changes are detected
3249
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
3248
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} ${cliCommand} migrate diff \\
3250
3249
  --exit-code \\
3251
3250
  --from-[...] \\
3252
3251
  --to-[...]
3253
3252
  `);
3253
+ }
3254
+ var MigrateDiff = class _MigrateDiff {
3255
+ constructor(cliCommand) {
3256
+ this.cliCommand = cliCommand;
3257
+ }
3258
+ static new(cliCommand) {
3259
+ return new _MigrateDiff(cliCommand);
3260
+ }
3254
3261
  async parse(argv, config, baseDir) {
3255
3262
  const args = (0, import_internals.arg)(
3256
3263
  argv,
@@ -3423,9 +3430,9 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
3423
3430
  throw new import_internals.HelpError(`
3424
3431
  ${error}
3425
3432
 
3426
- ${helpOptions}`);
3433
+ ${renderHelpOptions(this.cliCommand)}`);
3427
3434
  }
3428
- return _MigrateDiff.help;
3435
+ return renderHelp(this.cliCommand);
3429
3436
  }
3430
3437
  };
3431
3438
  function getRemovedTargetParameterHint(parameter) {
@@ -16,18 +16,18 @@ 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 chunk_NGEWTXY6_exports = {};
20
- __export(chunk_NGEWTXY6_exports, {
19
+ var chunk_J6BC6QDB_exports = {};
20
+ __export(chunk_J6BC6QDB_exports, {
21
21
  migrateCompletion: () => migrateCompletion
22
22
  });
23
- module.exports = __toCommonJS(chunk_NGEWTXY6_exports);
24
- var import_completion_values = require("@prisma/internals/src/cli/completion-values");
23
+ module.exports = __toCommonJS(chunk_J6BC6QDB_exports);
24
+ var import_internals = require("@prisma/internals");
25
25
  var migrateCompletion = {
26
26
  name: "migrate",
27
27
  description: "Migrate your database",
28
28
  options: [
29
29
  { name: "help", alias: "h", description: "Display this help message" },
30
- { name: "config", description: "Custom path to your Prisma config file", values: import_completion_values.completionConfigPaths },
31
- { name: "schema", description: "Custom path to your Prisma schema", values: import_completion_values.completionSchemaPaths }
30
+ { name: "config", description: "Custom path to your Prisma config file", values: import_internals.completionConfigPaths },
31
+ { name: "schema", description: "Custom path to your Prisma schema", values: import_internals.completionSchemaPaths }
32
32
  ]
33
33
  };