@prisma/migrate 6.6.0-dev.24 → 6.6.0-dev.25

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 (91) hide show
  1. package/dist/CLI.js +3 -3
  2. package/dist/Migrate.js +6 -6
  3. package/dist/SchemaEngine.js +5 -5
  4. package/dist/bin.js +43 -43
  5. package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
  6. package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
  7. package/dist/{chunk-J4DAOTRR.js → chunk-324Z6HS7.js} +41 -43
  8. package/dist/chunk-33LPBNDX.js +1399 -0
  9. package/dist/{chunk-3WTXX6CQ.js → chunk-5LKIRKDL.js} +60 -60
  10. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  11. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  12. package/dist/{chunk-F62CN63F.js → chunk-B4SUSDC2.js} +30 -31
  13. package/dist/{chunk-ODH7XYW7.js → chunk-BURHAP6O.js} +46 -48
  14. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  15. package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
  16. package/dist/{chunk-MREGRQDD.js → chunk-FBWTUBJC.js} +46 -45
  17. package/dist/{chunk-MATFO4ZW.js → chunk-G7PJKEOV.js} +33 -33
  18. package/dist/{chunk-PW3LNSDM.js → chunk-GPNGRJAR.js} +33 -35
  19. package/dist/{chunk-NAXFX7K7.js → chunk-HJFSTAJX.js} +30 -32
  20. package/dist/{chunk-4ZFVT4RS.js → chunk-IINN7QUV.js} +165 -190
  21. package/dist/{chunk-IR55GBON.js → chunk-IWC5MH4R.js} +5 -5
  22. package/dist/{chunk-ZOEKRXDP.js → chunk-K43RXWQY.js} +21 -18
  23. package/dist/{chunk-3OQIC7NW.js → chunk-KMHFSDY6.js} +43 -45
  24. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  25. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  26. package/dist/{chunk-MKK3GSDF.js → chunk-MKS2ZJJ5.js} +5 -5
  27. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  28. package/dist/{chunk-IY67YUOD.js → chunk-NJYZPNB4.js} +54 -56
  29. package/dist/{chunk-7X4MPZIO.js → chunk-NYVWWESL.js} +322 -336
  30. package/dist/{chunk-EGPJABTW.js → chunk-TGV6QGEF.js} +69 -69
  31. package/dist/{chunk-3VFKYWQZ.js → chunk-URKH6SE2.js} +73 -80
  32. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  33. package/dist/{chunk-N5UBDQRA.js → chunk-VVP3QZ7Q.js} +21 -21
  34. package/dist/{chunk-DAYMMAJB.js → chunk-YBNDKPPO.js} +36 -38
  35. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  36. package/dist/{chunk-LQO5JIBW.js → chunk-YHLTCM34.js} +323 -337
  37. package/dist/{chunk-A6PMXMMT.js → chunk-ZB5NPOJW.js} +13 -13
  38. package/dist/{chunk-V5TUSOJX.js → chunk-ZGR2WQ62.js} +38 -40
  39. package/dist/commands/DbCommand.js +3 -3
  40. package/dist/commands/DbDrop.js +3 -3
  41. package/dist/commands/DbExecute.js +7 -7
  42. package/dist/commands/DbPull.js +9 -9
  43. package/dist/commands/DbPush.js +7 -7
  44. package/dist/commands/DbSeed.js +4 -4
  45. package/dist/commands/MigrateCommand.js +3 -3
  46. package/dist/commands/MigrateDeploy.js +9 -9
  47. package/dist/commands/MigrateDev.js +11 -11
  48. package/dist/commands/MigrateDiff.js +10 -10
  49. package/dist/commands/MigrateReset.js +10 -10
  50. package/dist/commands/MigrateResolve.js +7 -7
  51. package/dist/commands/MigrateStatus.js +7 -7
  52. package/dist/index.js +46 -46
  53. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  54. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  55. package/dist/types.js +1 -1
  56. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  57. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  58. package/dist/utils/byline.js +1 -1
  59. package/dist/utils/captureStdout.js +3 -3
  60. package/dist/utils/countModelsAndTypes.js +1 -1
  61. package/dist/utils/customColors.js +1 -1
  62. package/dist/utils/ensureDatabaseExists.js +1 -1
  63. package/dist/utils/errors.js +1 -1
  64. package/dist/utils/flagErrors.js +1 -1
  65. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  66. package/dist/utils/getSchemaPathAndPrint.js +1 -1
  67. package/dist/utils/handleEvaluateDataloss.js +1 -1
  68. package/dist/utils/introspectSql.js +5 -5
  69. package/dist/utils/isSchemaEmpty.js +1 -1
  70. package/dist/utils/now.js +1 -1
  71. package/dist/utils/printDatasource.js +1 -1
  72. package/dist/utils/printDatasources.js +5 -5
  73. package/dist/utils/printFiles.js +5 -5
  74. package/dist/utils/printIntrospectedSchema.js +1 -1
  75. package/dist/utils/printMigrationId.js +1 -1
  76. package/dist/utils/promptForMigrationName.js +3 -3
  77. package/dist/utils/removeSchemaFiles.js +1 -1
  78. package/dist/utils/replaceOrAddDatasource.js +1 -1
  79. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  80. package/dist/utils/saveSchemaFiles.js +1 -1
  81. package/dist/utils/seed.js +4 -4
  82. package/dist/utils/setupCockroach.js +3 -3
  83. package/dist/utils/setupMSSQL.js +759 -675
  84. package/dist/utils/setupMongo.js +552 -552
  85. package/dist/utils/setupMysql.js +508 -563
  86. package/dist/utils/setupPostgres.js +3 -3
  87. package/dist/utils/spinner.js +4 -4
  88. package/dist/utils/unixSocket.js +1 -1
  89. package/dist/views/handleViewsIO.js +3 -3
  90. package/package.json +6 -6
  91. package/dist/chunk-YYPMC5FN.js +0 -1407
@@ -16,16 +16,16 @@ 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_F62CN63F_exports = {};
20
- __export(chunk_F62CN63F_exports, {
19
+ var chunk_B4SUSDC2_exports = {};
20
+ __export(chunk_B4SUSDC2_exports, {
21
21
  DbSeed: () => DbSeed
22
22
  });
23
- module.exports = __toCommonJS(chunk_F62CN63F_exports);
24
- var import_chunk_3WTXX6CQ = require("./chunk-3WTXX6CQ.js");
23
+ module.exports = __toCommonJS(chunk_B4SUSDC2_exports);
24
+ var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
25
25
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
26
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
26
+ var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
27
27
  var import_internals = require("@prisma/internals");
28
- var require_arg = (0, import_chunk_WWAWV7DQ.__commonJS)({
28
+ var require_arg = (0, import_chunk_2ESYSVXG.__commonJS)({
29
29
  "../../node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.js"(exports, module2) {
30
30
  "use strict";
31
31
  var flagSymbol = Symbol("arg flag");
@@ -168,11 +168,28 @@ var require_arg = (0, import_chunk_WWAWV7DQ.__commonJS)({
168
168
  module2.exports = arg2;
169
169
  }
170
170
  });
171
- var import_arg = (0, import_chunk_WWAWV7DQ.__toESM)(require_arg());
172
- var _DbSeed = class _DbSeed2 {
171
+ var import_arg = (0, import_chunk_2ESYSVXG.__toESM)(require_arg());
172
+ var DbSeed = class _DbSeed {
173
173
  static new() {
174
- return new _DbSeed2();
174
+ return new _DbSeed();
175
175
  }
176
+ static help = (0, import_internals.format)(`
177
+ ${process.platform === "win32" ? "" : "\u{1F64C} "}Seed your database
178
+
179
+ ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
180
+
181
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed [options]
182
+
183
+ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
184
+
185
+ -h, --help Display this help message
186
+ --config Custom path to your Prisma config file
187
+
188
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
189
+
190
+ Passing extra arguments to the seed command
191
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 value2
192
+ `);
176
193
  async parse(argv, config) {
177
194
  const args = (0, import_internals.arg)(
178
195
  argv,
@@ -197,10 +214,10 @@ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 va
197
214
  return this.help();
198
215
  }
199
216
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
200
- const seedCommandFromPkgJson = await (0, import_chunk_3WTXX6CQ.getSeedCommandFromPackageJson)(process.cwd());
217
+ const seedCommandFromPkgJson = await (0, import_chunk_5LKIRKDL.getSeedCommandFromPackageJson)(process.cwd());
201
218
  if (!seedCommandFromPkgJson) return ``;
202
219
  const extraArgs = args._.join(" ");
203
- const successfulSeeding = await (0, import_chunk_3WTXX6CQ.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson, extraArgs });
220
+ const successfulSeeding = await (0, import_chunk_5LKIRKDL.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson, extraArgs });
204
221
  if (successfulSeeding) {
205
222
  return `
206
223
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.`;
@@ -212,26 +229,8 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
212
229
  if (error) {
213
230
  return new import_internals.HelpError(`
214
231
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
215
- ${_DbSeed2.help}`);
232
+ ${_DbSeed.help}`);
216
233
  }
217
- return _DbSeed2.help;
234
+ return _DbSeed.help;
218
235
  }
219
236
  };
220
- (0, import_chunk_WWAWV7DQ.__publicField)(_DbSeed, "help", (0, import_internals.format)(`
221
- ${process.platform === "win32" ? "" : "\u{1F64C} "}Seed your database
222
-
223
- ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
224
-
225
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed [options]
226
-
227
- ${(0, import_chunk_SKRR5WT4.bold)("Options")}
228
-
229
- -h, --help Display this help message
230
- --config Custom path to your Prisma config file
231
-
232
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
233
-
234
- Passing extra arguments to the seed command
235
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db seed -- --arg1 value1 --arg2 value2
236
- `));
237
- var DbSeed = _DbSeed;
@@ -26,31 +26,59 @@ 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_ODH7XYW7_exports = {};
30
- __export(chunk_ODH7XYW7_exports, {
29
+ var chunk_BURHAP6O_exports = {};
30
+ __export(chunk_BURHAP6O_exports, {
31
31
  MigrateDev: () => MigrateDev
32
32
  });
33
- module.exports = __toCommonJS(chunk_ODH7XYW7_exports);
34
- var import_chunk_OCQGHQED = require("./chunk-OCQGHQED.js");
33
+ module.exports = __toCommonJS(chunk_BURHAP6O_exports);
34
+ var import_chunk_YBX7R3MT = require("./chunk-YBX7R3MT.js");
35
35
  var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
36
- var import_chunk_3WTXX6CQ = require("./chunk-3WTXX6CQ.js");
37
- var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
36
+ var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
37
+ var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
38
38
  var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
39
- var import_chunk_N5UBDQRA = require("./chunk-N5UBDQRA.js");
39
+ var import_chunk_VVP3QZ7Q = require("./chunk-VVP3QZ7Q.js");
40
40
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
41
41
  var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
42
42
  var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
43
43
  var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
44
44
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
45
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
46
45
  var import_debug = __toESM(require("@prisma/debug"));
47
46
  var import_internals = require("@prisma/internals");
48
47
  var import_prompts = __toESM(require("prompts"));
49
48
  var debug = (0, import_debug.default)("prisma:migrate:dev");
50
- var _MigrateDev = class _MigrateDev2 {
49
+ var MigrateDev = class _MigrateDev {
51
50
  static new() {
52
- return new _MigrateDev2();
51
+ return new _MigrateDev();
53
52
  }
53
+ static help = (0, import_internals.format)(`
54
+ ${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)
55
+
56
+ ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
57
+
58
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
59
+
60
+ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
61
+
62
+ -h, --help Display this help message
63
+ --config Custom path to your Prisma config file
64
+ --schema Custom path to your Prisma schema
65
+ -n, --name Name the migration
66
+ --create-only Create a new migration but do not apply it
67
+ The migration will be empty if there are no changes in Prisma schema
68
+ --skip-generate Skip triggering generators (e.g. Prisma Client)
69
+ --skip-seed Skip triggering seed
70
+
71
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
72
+
73
+ 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)("$")} prisma migrate dev
75
+
76
+ Specify a schema
77
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --schema=./schema.prisma
78
+
79
+ Create a migration without applying it
80
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --create-only
81
+ `);
54
82
  async parse(argv, config) {
55
83
  const args = (0, import_internals.arg)(argv, {
56
84
  "--help": Boolean,
@@ -89,7 +117,7 @@ var _MigrateDev = class _MigrateDev2 {
89
117
  if (wasDbCreated) {
90
118
  process.stdout.write(wasDbCreated + "\n\n");
91
119
  }
92
- const migrate = new import_chunk_N5UBDQRA.Migrate(schemaPath);
120
+ const migrate = new import_chunk_VVP3QZ7Q.Migrate(schemaPath);
93
121
  let devDiagnostic;
94
122
  try {
95
123
  devDiagnostic = await migrate.devDiagnostic();
@@ -121,7 +149,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will
121
149
  `
122
150
  The following migration(s) have been applied:
123
151
 
124
- ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
152
+ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
125
153
  "migrations",
126
154
  appliedMigrationNames,
127
155
  {
@@ -181,7 +209,7 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
181
209
  }
182
210
  let migrationName = void 0;
183
211
  if (evaluateDataLossResult.migrationSteps > 0 || args["--create-only"]) {
184
- const getMigrationNameResult = await (0, import_chunk_OCQGHQED.getMigrationName)(args["--name"]);
212
+ const getMigrationNameResult = await (0, import_chunk_YBX7R3MT.getMigrationName)(args["--name"]);
185
213
  if (getMigrationNameResult.userCancelled) {
186
214
  process.stdout.write(getMigrationNameResult.userCancelled + "\n");
187
215
  migrate.stop();
@@ -226,7 +254,7 @@ You can now edit it and apply it by running ${(0, import_chunk_SKRR5WT4.green)((
226
254
  `
227
255
  The following migration(s) have been created and applied from new schema changes:
228
256
 
229
- ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
257
+ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
230
258
  "migrations",
231
259
  migrationIds,
232
260
  {
@@ -244,10 +272,10 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
244
272
  }
245
273
  if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
246
274
  try {
247
- const seedCommandFromPkgJson = await (0, import_chunk_3WTXX6CQ.getSeedCommandFromPackageJson)(process.cwd());
275
+ const seedCommandFromPkgJson = await (0, import_chunk_5LKIRKDL.getSeedCommandFromPackageJson)(process.cwd());
248
276
  if (seedCommandFromPkgJson) {
249
277
  process.stdout.write("\n");
250
- const successfulSeeding = await (0, import_chunk_3WTXX6CQ.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
278
+ const successfulSeeding = await (0, import_chunk_5LKIRKDL.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
251
279
  if (successfulSeeding) {
252
280
  process.stdout.write(`
253
281
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
@@ -286,38 +314,8 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
286
314
  if (error) {
287
315
  return new import_internals.HelpError(`
288
316
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
289
- ${_MigrateDev2.help}`);
317
+ ${_MigrateDev.help}`);
290
318
  }
291
- return _MigrateDev2.help;
319
+ return _MigrateDev.help;
292
320
  }
293
321
  };
294
- (0, import_chunk_WWAWV7DQ.__publicField)(_MigrateDev, "help", (0, import_internals.format)(`
295
- ${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)
296
-
297
- ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
298
-
299
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
300
-
301
- ${(0, import_chunk_SKRR5WT4.bold)("Options")}
302
-
303
- -h, --help Display this help message
304
- --config Custom path to your Prisma config file
305
- --schema Custom path to your Prisma schema
306
- -n, --name Name the migration
307
- --create-only Create a new migration but do not apply it
308
- The migration will be empty if there are no changes in Prisma schema
309
- --skip-generate Skip triggering generators (e.g. Prisma Client)
310
- --skip-seed Skip triggering seed
311
-
312
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
313
-
314
- Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
315
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev
316
-
317
- Specify a schema
318
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --schema=./schema.prisma
319
-
320
- Create a migration without applying it
321
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev --create-only
322
- `));
323
- var MigrateDev = _MigrateDev;
@@ -16,52 +16,21 @@ 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_W2SZNLK4_exports = {};
20
- __export(chunk_W2SZNLK4_exports, {
19
+ var chunk_EJG7GKM7_exports = {};
20
+ __export(chunk_EJG7GKM7_exports, {
21
21
  DbCommand: () => DbCommand
22
22
  });
23
- module.exports = __toCommonJS(chunk_W2SZNLK4_exports);
23
+ module.exports = __toCommonJS(chunk_EJG7GKM7_exports);
24
24
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
25
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
26
25
  var import_internals = require("@prisma/internals");
27
- var _DbCommand = class _DbCommand2 {
26
+ var DbCommand = class _DbCommand {
28
27
  constructor(cmds) {
29
28
  this.cmds = cmds;
30
29
  }
31
30
  static new(cmds) {
32
- return new _DbCommand2(cmds);
31
+ return new _DbCommand(cmds);
33
32
  }
34
- async parse(argv, config) {
35
- const args = (0, import_internals.arg)(argv, {
36
- "--help": Boolean,
37
- "-h": "--help",
38
- "--config": String,
39
- "--preview-feature": Boolean,
40
- "--telemetry-information": String
41
- });
42
- if ((0, import_internals.isError)(args)) {
43
- return this.help(args.message);
44
- }
45
- if (args._.length === 0 || args["--help"]) {
46
- return this.help();
47
- }
48
- const cmd = this.cmds[args._[0]];
49
- if (cmd) {
50
- const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
51
- return cmd.parse(argsForCmd, config);
52
- }
53
- return (0, import_internals.unknownCommand)(_DbCommand2.help, args._[0]);
54
- }
55
- help(error) {
56
- if (error) {
57
- return new import_internals.HelpError(`
58
- ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
59
- ${_DbCommand2.help}`);
60
- }
61
- return _DbCommand2.help;
62
- }
63
- };
64
- (0, import_chunk_WWAWV7DQ.__publicField)(_DbCommand, "help", (0, import_internals.format)(`
33
+ static help = (0, import_internals.format)(`
65
34
  ${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Manage your database schema and lifecycle during development.
66
35
 
67
36
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
@@ -93,5 +62,34 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
93
62
 
94
63
  Run \`prisma db execute\`
95
64
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
96
- `));
97
- var DbCommand = _DbCommand;
65
+ `);
66
+ async parse(argv, config) {
67
+ const args = (0, import_internals.arg)(argv, {
68
+ "--help": Boolean,
69
+ "-h": "--help",
70
+ "--config": String,
71
+ "--preview-feature": Boolean,
72
+ "--telemetry-information": String
73
+ });
74
+ if ((0, import_internals.isError)(args)) {
75
+ return this.help(args.message);
76
+ }
77
+ if (args._.length === 0 || args["--help"]) {
78
+ return this.help();
79
+ }
80
+ const cmd = this.cmds[args._[0]];
81
+ if (cmd) {
82
+ const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
83
+ return cmd.parse(argsForCmd, config);
84
+ }
85
+ return (0, import_internals.unknownCommand)(_DbCommand.help, args._[0]);
86
+ }
87
+ help(error) {
88
+ if (error) {
89
+ return new import_internals.HelpError(`
90
+ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
91
+ ${_DbCommand.help}`);
92
+ }
93
+ return _DbCommand.help;
94
+ }
95
+ };
@@ -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 chunk_5PSO7BDO_exports = {};
20
- __export(chunk_5PSO7BDO_exports, {
19
+ var chunk_EJUXYFV3_exports = {};
20
+ __export(chunk_EJUXYFV3_exports, {
21
21
  require_ms: () => require_ms,
22
22
  require_src: () => require_src
23
23
  });
24
- module.exports = __toCommonJS(chunk_5PSO7BDO_exports);
25
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
26
- var require_ms = (0, import_chunk_WWAWV7DQ.__commonJS)({
24
+ module.exports = __toCommonJS(chunk_EJUXYFV3_exports);
25
+ var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
26
+ var require_ms = (0, import_chunk_2ESYSVXG.__commonJS)({
27
27
  "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module2) {
28
28
  "use strict";
29
29
  var s = 1e3;
@@ -138,7 +138,7 @@ var require_ms = (0, import_chunk_WWAWV7DQ.__commonJS)({
138
138
  }
139
139
  }
140
140
  });
141
- var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
141
+ var require_common = (0, import_chunk_2ESYSVXG.__commonJS)({
142
142
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports, module2) {
143
143
  "use strict";
144
144
  function setup(env) {
@@ -314,7 +314,7 @@ var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
314
314
  module2.exports = setup;
315
315
  }
316
316
  });
317
- var require_browser = (0, import_chunk_WWAWV7DQ.__commonJS)({
317
+ var require_browser = (0, import_chunk_2ESYSVXG.__commonJS)({
318
318
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports, module2) {
319
319
  "use strict";
320
320
  exports.formatArgs = formatArgs;
@@ -483,7 +483,7 @@ var require_browser = (0, import_chunk_WWAWV7DQ.__commonJS)({
483
483
  };
484
484
  }
485
485
  });
486
- var require_has_flag = (0, import_chunk_WWAWV7DQ.__commonJS)({
486
+ var require_has_flag = (0, import_chunk_2ESYSVXG.__commonJS)({
487
487
  "../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
488
488
  "use strict";
489
489
  module2.exports = (flag, argv = process.argv) => {
@@ -494,11 +494,11 @@ var require_has_flag = (0, import_chunk_WWAWV7DQ.__commonJS)({
494
494
  };
495
495
  }
496
496
  });
497
- var require_supports_color = (0, import_chunk_WWAWV7DQ.__commonJS)({
497
+ var require_supports_color = (0, import_chunk_2ESYSVXG.__commonJS)({
498
498
  "../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"(exports, module2) {
499
499
  "use strict";
500
- var os = (0, import_chunk_WWAWV7DQ.__require)("os");
501
- var tty = (0, import_chunk_WWAWV7DQ.__require)("tty");
500
+ var os = (0, import_chunk_2ESYSVXG.__require)("os");
501
+ var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
502
502
  var hasFlag = require_has_flag();
503
503
  var { env } = process;
504
504
  var flagForceColor;
@@ -606,11 +606,11 @@ var require_supports_color = (0, import_chunk_WWAWV7DQ.__commonJS)({
606
606
  };
607
607
  }
608
608
  });
609
- var require_node = (0, import_chunk_WWAWV7DQ.__commonJS)({
609
+ var require_node = (0, import_chunk_2ESYSVXG.__commonJS)({
610
610
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports, module2) {
611
611
  "use strict";
612
- var tty = (0, import_chunk_WWAWV7DQ.__require)("tty");
613
- var util = (0, import_chunk_WWAWV7DQ.__require)("util");
612
+ var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
613
+ var util = (0, import_chunk_2ESYSVXG.__require)("util");
614
614
  exports.init = init;
615
615
  exports.log = log;
616
616
  exports.formatArgs = formatArgs;
@@ -779,7 +779,7 @@ var require_node = (0, import_chunk_WWAWV7DQ.__commonJS)({
779
779
  };
780
780
  }
781
781
  });
782
- var require_src = (0, import_chunk_WWAWV7DQ.__commonJS)({
782
+ var require_src = (0, import_chunk_2ESYSVXG.__commonJS)({
783
783
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports, module2) {
784
784
  "use strict";
785
785
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
@@ -26,14 +26,13 @@ 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_MREGRQDD_exports = {};
30
- __export(chunk_MREGRQDD_exports, {
29
+ var chunk_FBWTUBJC_exports = {};
30
+ __export(chunk_FBWTUBJC_exports, {
31
31
  DbExecute: () => DbExecute
32
32
  });
33
- module.exports = __toCommonJS(chunk_MREGRQDD_exports);
34
- var import_chunk_N5UBDQRA = require("./chunk-N5UBDQRA.js");
33
+ module.exports = __toCommonJS(chunk_FBWTUBJC_exports);
34
+ var import_chunk_VVP3QZ7Q = require("./chunk-VVP3QZ7Q.js");
35
35
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
36
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
37
36
  var import_internals = require("@prisma/internals");
38
37
  var import_fs = __toESM(require("fs"));
39
38
  var import_path = __toESM(require("path"));
@@ -82,10 +81,48 @@ ${(0, import_chunk_SKRR5WT4.bold)("Flags")}
82
81
 
83
82
  --stdin Use the terminal standard input as the script to be executed`
84
83
  );
85
- var _DbExecute = class _DbExecute2 {
84
+ var DbExecute = class _DbExecute {
86
85
  static new() {
87
- return new _DbExecute2();
86
+ return new _DbExecute();
88
87
  }
88
+ // TODO: This command needs to get proper support for `prisma.config.ts` eventually. Not just taking the schema path
89
+ // from prisma.config.ts but likely to support driver adapters, too?
90
+ // See https://linear.app/prisma-company/issue/ORM-639/prisma-db-execute-support-prismaconfigts-and-driver-adapters
91
+ static help = (0, import_internals.format)(`
92
+ ${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
93
+
94
+ This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
95
+ `--stdin`
96
+ )} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
97
+ The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
98
+
99
+ The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
100
+
101
+ On SQL databases, this command takes as input a SQL script.
102
+ The whole script will be sent as a single command to the database.
103
+
104
+ ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
105
+
106
+ ${helpOptions}
107
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
108
+
109
+ Execute the content of a SQL script file to the datasource URL taken from the schema
110
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
111
+ --file ./script.sql \\
112
+ --schema schema.prisma
113
+
114
+ Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
115
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
116
+ prisma db execute \\
117
+ --stdin \\
118
+ --url="$DATABASE_URL"
119
+
120
+ Like previous example, but exposing the datasource url credentials to your terminal history
121
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
122
+ prisma db execute \\
123
+ --stdin \\
124
+ --url="mysql://root:root@localhost/mydb"
125
+ `);
89
126
  async parse(argv, config) {
90
127
  const args = (0, import_internals.arg)(
91
128
  argv,
@@ -161,7 +198,7 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
161
198
  ...(0, import_internals.toSchemasWithConfigDir)(schemaWithPath, engineConfig)
162
199
  };
163
200
  }
164
- const migrate = new import_chunk_N5UBDQRA.Migrate();
201
+ const migrate = new import_chunk_VVP3QZ7Q.Migrate();
165
202
  try {
166
203
  await migrate.engine.dbExecute({
167
204
  script,
@@ -179,42 +216,6 @@ ${error}
179
216
 
180
217
  ${helpOptions}`);
181
218
  }
182
- return _DbExecute2.help;
219
+ return _DbExecute.help;
183
220
  }
184
221
  };
185
- (0, import_chunk_WWAWV7DQ.__publicField)(_DbExecute, "help", (0, import_internals.format)(`
186
- ${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
187
-
188
- This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
189
- `--stdin`
190
- )} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
191
- The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
192
-
193
- The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
194
-
195
- On SQL databases, this command takes as input a SQL script.
196
- The whole script will be sent as a single command to the database.
197
-
198
- ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
199
-
200
- ${helpOptions}
201
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
202
-
203
- Execute the content of a SQL script file to the datasource URL taken from the schema
204
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
205
- --file ./script.sql \\
206
- --schema schema.prisma
207
-
208
- Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
209
- ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
210
- prisma db execute \\
211
- --stdin \\
212
- --url="$DATABASE_URL"
213
-
214
- Like previous example, but exposing the datasource url credentials to your terminal history
215
- ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
216
- prisma db execute \\
217
- --stdin \\
218
- --url="mysql://root:root@localhost/mydb"
219
- `));
220
- var DbExecute = _DbExecute;