@prisma/migrate 5.23.0-dev.2 → 5.23.0-dev.21

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 (48) hide show
  1. package/dist/Migrate.js +4 -4
  2. package/dist/SchemaEngine.js +4 -4
  3. package/dist/bin.js +39 -40
  4. package/dist/{chunk-EXUBPCXZ.js → chunk-3H4RLVCQ.js} +12 -12
  5. package/dist/{chunk-ZLGLVUFD.js → chunk-E2XKFV2C.js} +8 -8
  6. package/dist/{chunk-XVL5RF2T.js → chunk-GUBDW6S7.js} +11 -11
  7. package/dist/{chunk-BAVMZZAR.js → chunk-HODZFC64.js} +7 -7
  8. package/dist/{chunk-BAFPAACN.js → chunk-ILJRJJ3S.js} +4 -4
  9. package/dist/{chunk-LLGEQ76N.js → chunk-ILQWQHQO.js} +11 -11
  10. package/dist/{chunk-E3KHFUFQ.js → chunk-J77IRNPE.js} +9 -124
  11. package/dist/{chunk-76XWADEV.js → chunk-KEPR65SW.js} +6 -6
  12. package/dist/{chunk-NIFQA5SB.js → chunk-LAHPBQAT.js} +61 -143
  13. package/dist/{chunk-MWEO3VUS.js → chunk-LJOMIPJW.js} +7 -7
  14. package/dist/{chunk-GJN3CSXW.js → chunk-NKL64AIB.js} +6 -6
  15. package/dist/{chunk-VWV2NY26.js → chunk-NKQGJ3AE.js} +7 -3
  16. package/dist/{chunk-XLLUFIQK.js → chunk-PCJYN6LT.js} +6 -5
  17. package/dist/{chunk-SV5GANSI.js → chunk-PFEH6ILG.js} +6 -6
  18. package/dist/{chunk-ZBOJAYON.js → chunk-PNBMPQYH.js} +6 -6
  19. package/dist/{chunk-W3ROQKBN.js → chunk-V7DE6JTG.js} +4 -4
  20. package/dist/{chunk-WD642UYX.js → chunk-WDEGF6OA.js} +62 -144
  21. package/dist/{chunk-UJWMQPUH.js → chunk-X6GGREJW.js} +6 -6
  22. package/dist/{chunk-WIZM7TFT.js → chunk-YKUZUAXA.js} +443 -55
  23. package/dist/{chunk-YOW3VBYS.js → chunk-Z4OLB2H4.js} +6 -6
  24. package/dist/commands/DbExecute.js +5 -5
  25. package/dist/commands/DbPull.js +6 -6
  26. package/dist/commands/DbPush.js +5 -5
  27. package/dist/commands/DbSeed.js +4 -5
  28. package/dist/commands/MigrateDeploy.js +5 -5
  29. package/dist/commands/MigrateDev.js +6 -7
  30. package/dist/commands/MigrateDiff.js +6 -7
  31. package/dist/commands/MigrateReset.js +6 -7
  32. package/dist/commands/MigrateResolve.js +5 -5
  33. package/dist/commands/MigrateStatus.js +5 -5
  34. package/dist/index.js +45 -46
  35. package/dist/internals/src/utils/isCurrentBinInstalledGlobally.d.ts +1 -1
  36. package/dist/{multipart-parser-KKECAI5D.js → multipart-parser-73VM3J4A.js} +10 -7
  37. package/dist/{multipart-parser-47FFAP42-P3F6TPHJ.js → multipart-parser-ITART6UP-FFJAMHWE.js} +25 -22
  38. package/dist/utils/getDatabaseVersionSafe.js +4 -4
  39. package/dist/utils/introspectSql.js +3 -3
  40. package/dist/utils/removeSchemaFiles.js +3 -3
  41. package/dist/utils/saveSchemaFiles.js +3 -3
  42. package/dist/utils/seed.js +6 -7
  43. package/dist/utils/setupMSSQL.js +62 -59
  44. package/dist/utils/setupMongo.js +5 -4
  45. package/dist/utils/setupMysql.js +45 -0
  46. package/package.json +9 -10
  47. package/dist/chunk-EFPE3Q7J.js +0 -424
  48. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.d.ts +0 -9
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,21 +17,38 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_WIZM7TFT_exports = {};
20
- __export(chunk_WIZM7TFT_exports, {
21
- require_execa: () => require_execa
29
+ var chunk_YKUZUAXA_exports = {};
30
+ __export(chunk_YKUZUAXA_exports, {
31
+ executeSeedCommand: () => executeSeedCommand,
32
+ getSeedCommandFromPackageJson: () => getSeedCommandFromPackageJson,
33
+ init_seed: () => init_seed,
34
+ legacyTsNodeScriptWarning: () => legacyTsNodeScriptWarning,
35
+ verifySeedConfigAndReturnMessage: () => verifySeedConfigAndReturnMessage
22
36
  });
23
- module.exports = __toCommonJS(chunk_WIZM7TFT_exports);
37
+ module.exports = __toCommonJS(chunk_YKUZUAXA_exports);
24
38
  var import_chunk_J46BJQHT = require("./chunk-J46BJQHT.js");
39
+ var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
25
40
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
41
+ var import_debug = __toESM(require("@prisma/debug"));
42
+ var import_internals = require("@prisma/internals");
43
+ var import_fs = __toESM(require("fs"));
44
+ var import_path = __toESM(require("path"));
26
45
  var require_windows = (0, import_chunk_WWAWV7DQ.__commonJS)({
27
46
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
28
47
  "use strict";
29
48
  module2.exports = isexe;
30
49
  isexe.sync = sync;
31
- var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
32
- function checkPathExt(path, options) {
50
+ var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
51
+ function checkPathExt(path2, options) {
33
52
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
34
53
  if (!pathext) {
35
54
  return true;
@@ -40,25 +59,25 @@ var require_windows = (0, import_chunk_WWAWV7DQ.__commonJS)({
40
59
  }
41
60
  for (var i = 0; i < pathext.length; i++) {
42
61
  var p = pathext[i].toLowerCase();
43
- if (p && path.substr(-p.length).toLowerCase() === p) {
62
+ if (p && path2.substr(-p.length).toLowerCase() === p) {
44
63
  return true;
45
64
  }
46
65
  }
47
66
  return false;
48
67
  }
49
- function checkStat(stat, path, options) {
68
+ function checkStat(stat, path2, options) {
50
69
  if (!stat.isSymbolicLink() && !stat.isFile()) {
51
70
  return false;
52
71
  }
53
- return checkPathExt(path, options);
72
+ return checkPathExt(path2, options);
54
73
  }
55
- function isexe(path, options, cb) {
56
- fs.stat(path, function(er, stat) {
57
- cb(er, er ? false : checkStat(stat, path, options));
74
+ function isexe(path2, options, cb) {
75
+ fs2.stat(path2, function(er, stat) {
76
+ cb(er, er ? false : checkStat(stat, path2, options));
58
77
  });
59
78
  }
60
- function sync(path, options) {
61
- return checkStat(fs.statSync(path), path, options);
79
+ function sync(path2, options) {
80
+ return checkStat(fs2.statSync(path2), path2, options);
62
81
  }
63
82
  }
64
83
  });
@@ -67,14 +86,14 @@ var require_mode = (0, import_chunk_WWAWV7DQ.__commonJS)({
67
86
  "use strict";
68
87
  module2.exports = isexe;
69
88
  isexe.sync = sync;
70
- var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
71
- function isexe(path, options, cb) {
72
- fs.stat(path, function(er, stat) {
89
+ var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
90
+ function isexe(path2, options, cb) {
91
+ fs2.stat(path2, function(er, stat) {
73
92
  cb(er, er ? false : checkStat(stat, options));
74
93
  });
75
94
  }
76
- function sync(path, options) {
77
- return checkStat(fs.statSync(path), options);
95
+ function sync(path2, options) {
96
+ return checkStat(fs2.statSync(path2), options);
78
97
  }
79
98
  function checkStat(stat, options) {
80
99
  return stat.isFile() && checkMode(stat, options);
@@ -97,7 +116,7 @@ var require_mode = (0, import_chunk_WWAWV7DQ.__commonJS)({
97
116
  var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
98
117
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
99
118
  "use strict";
100
- var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
119
+ var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
101
120
  var core;
102
121
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
103
122
  core = require_windows();
@@ -106,7 +125,7 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
106
125
  }
107
126
  module2.exports = isexe;
108
127
  isexe.sync = sync;
109
- function isexe(path, options, cb) {
128
+ function isexe(path2, options, cb) {
110
129
  if (typeof options === "function") {
111
130
  cb = options;
112
131
  options = {};
@@ -116,7 +135,7 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
116
135
  throw new TypeError("callback not provided");
117
136
  }
118
137
  return new Promise(function(resolve, reject) {
119
- isexe(path, options || {}, function(er, is) {
138
+ isexe(path2, options || {}, function(er, is) {
120
139
  if (er) {
121
140
  reject(er);
122
141
  } else {
@@ -125,7 +144,7 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
125
144
  });
126
145
  });
127
146
  }
128
- core(path, options || {}, function(er, is) {
147
+ core(path2, options || {}, function(er, is) {
129
148
  if (er) {
130
149
  if (er.code === "EACCES" || options && options.ignoreErrors) {
131
150
  er = null;
@@ -135,9 +154,9 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
135
154
  cb(er, is);
136
155
  });
137
156
  }
138
- function sync(path, options) {
157
+ function sync(path2, options) {
139
158
  try {
140
- return core.sync(path, options || {});
159
+ return core.sync(path2, options || {});
141
160
  } catch (er) {
142
161
  if (options && options.ignoreErrors || er.code === "EACCES") {
143
162
  return false;
@@ -152,7 +171,7 @@ var require_which = (0, import_chunk_WWAWV7DQ.__commonJS)({
152
171
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
153
172
  "use strict";
154
173
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
155
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
174
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
156
175
  var COLON = isWindows ? ";" : ":";
157
176
  var isexe = require_isexe();
158
177
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -190,7 +209,7 @@ var require_which = (0, import_chunk_WWAWV7DQ.__commonJS)({
190
209
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
191
210
  const ppRaw = pathEnv[i];
192
211
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
193
- const pCmd = path.join(pathPart, cmd);
212
+ const pCmd = path2.join(pathPart, cmd);
194
213
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
195
214
  resolve(subStep(p, i, 0));
196
215
  });
@@ -217,7 +236,7 @@ var require_which = (0, import_chunk_WWAWV7DQ.__commonJS)({
217
236
  for (let i = 0; i < pathEnv.length; i++) {
218
237
  const ppRaw = pathEnv[i];
219
238
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
220
- const pCmd = path.join(pathPart, cmd);
239
+ const pCmd = path2.join(pathPart, cmd);
221
240
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
222
241
  for (let j = 0; j < pathExt.length; j++) {
223
242
  const cur = p + pathExt[j];
@@ -261,7 +280,7 @@ var require_path_key = (0, import_chunk_WWAWV7DQ.__commonJS)({
261
280
  var require_resolveCommand = (0, import_chunk_WWAWV7DQ.__commonJS)({
262
281
  "../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
263
282
  "use strict";
264
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
283
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
265
284
  var which = require_which();
266
285
  var getPathKey = require_path_key();
267
286
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -279,7 +298,7 @@ var require_resolveCommand = (0, import_chunk_WWAWV7DQ.__commonJS)({
279
298
  try {
280
299
  resolved = which.sync(parsed.command, {
281
300
  path: env[getPathKey({ env })],
282
- pathExt: withoutPathExt ? path.delimiter : void 0
301
+ pathExt: withoutPathExt ? path2.delimiter : void 0
283
302
  });
284
303
  } catch (e) {
285
304
  } finally {
@@ -288,7 +307,7 @@ var require_resolveCommand = (0, import_chunk_WWAWV7DQ.__commonJS)({
288
307
  }
289
308
  }
290
309
  if (resolved) {
291
- resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
310
+ resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
292
311
  }
293
312
  return resolved;
294
313
  }
@@ -336,8 +355,8 @@ var require_shebang_command = (0, import_chunk_WWAWV7DQ.__commonJS)({
336
355
  if (!match) {
337
356
  return null;
338
357
  }
339
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
340
- const binary = path.split("/").pop();
358
+ const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
359
+ const binary = path2.split("/").pop();
341
360
  if (binary === "env") {
342
361
  return argument;
343
362
  }
@@ -348,16 +367,16 @@ var require_shebang_command = (0, import_chunk_WWAWV7DQ.__commonJS)({
348
367
  var require_readShebang = (0, import_chunk_WWAWV7DQ.__commonJS)({
349
368
  "../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
350
369
  "use strict";
351
- var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
370
+ var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
352
371
  var shebangCommand = require_shebang_command();
353
372
  function readShebang(command) {
354
373
  const size = 150;
355
374
  const buffer = Buffer.alloc(size);
356
375
  let fd;
357
376
  try {
358
- fd = fs.openSync(command, "r");
359
- fs.readSync(fd, buffer, 0, size, 0);
360
- fs.closeSync(fd);
377
+ fd = fs2.openSync(command, "r");
378
+ fs2.readSync(fd, buffer, 0, size, 0);
379
+ fs2.closeSync(fd);
361
380
  } catch (e) {
362
381
  }
363
382
  return shebangCommand(buffer.toString());
@@ -368,7 +387,7 @@ var require_readShebang = (0, import_chunk_WWAWV7DQ.__commonJS)({
368
387
  var require_parse = (0, import_chunk_WWAWV7DQ.__commonJS)({
369
388
  "../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
370
389
  "use strict";
371
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
390
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
372
391
  var resolveCommand = require_resolveCommand();
373
392
  var escape = require_escape();
374
393
  var readShebang = require_readShebang();
@@ -393,7 +412,7 @@ var require_parse = (0, import_chunk_WWAWV7DQ.__commonJS)({
393
412
  const needsShell = !isExecutableRegExp.test(commandFile);
394
413
  if (parsed.options.forceShell || needsShell) {
395
414
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
396
- parsed.command = path.normalize(parsed.command);
415
+ parsed.command = path2.normalize(parsed.command);
397
416
  parsed.command = escape.command(parsed.command);
398
417
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
399
418
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -517,7 +536,7 @@ var require_strip_final_newline = (0, import_chunk_WWAWV7DQ.__commonJS)({
517
536
  var require_npm_run_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
518
537
  "../../node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js"(exports, module2) {
519
538
  "use strict";
520
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
539
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
521
540
  var pathKey = require_path_key();
522
541
  var npmRunPath = (options) => {
523
542
  options = {
@@ -527,16 +546,16 @@ var require_npm_run_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
527
546
  ...options
528
547
  };
529
548
  let previous;
530
- let cwdPath = path.resolve(options.cwd);
549
+ let cwdPath = path2.resolve(options.cwd);
531
550
  const result = [];
532
551
  while (previous !== cwdPath) {
533
- result.push(path.join(cwdPath, "node_modules/.bin"));
552
+ result.push(path2.join(cwdPath, "node_modules/.bin"));
534
553
  previous = cwdPath;
535
- cwdPath = path.resolve(cwdPath, "..");
554
+ cwdPath = path2.resolve(cwdPath, "..");
536
555
  }
537
- const execPathDir = path.resolve(options.cwd, options.execPath, "..");
556
+ const execPathDir = path2.resolve(options.cwd, options.execPath, "..");
538
557
  result.push(execPathDir);
539
- return result.concat(options.path).join(path.delimiter);
558
+ return result.concat(options.path).join(path2.delimiter);
540
559
  };
541
560
  module2.exports = npmRunPath;
542
561
  module2.exports.default = npmRunPath;
@@ -546,9 +565,9 @@ var require_npm_run_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
546
565
  ...options
547
566
  };
548
567
  const env = { ...options.env };
549
- const path2 = pathKey({ env });
550
- options.path = env[path2];
551
- env[path2] = module2.exports(options);
568
+ const path3 = pathKey({ env });
569
+ options.path = env[path3];
570
+ env[path3] = module2.exports(options);
552
571
  return env;
553
572
  };
554
573
  }
@@ -1451,7 +1470,7 @@ var require_command = (0, import_chunk_WWAWV7DQ.__commonJS)({
1451
1470
  var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1452
1471
  "../../node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js"(exports, module2) {
1453
1472
  "use strict";
1454
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
1473
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
1455
1474
  var childProcess = (0, import_chunk_WWAWV7DQ.__require)("child_process");
1456
1475
  var crossSpawn = require_cross_spawn();
1457
1476
  var stripFinalNewline = require_strip_final_newline();
@@ -1493,7 +1512,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1493
1512
  };
1494
1513
  options.env = getEnv(options);
1495
1514
  options.stdio = normalizeStdio(options);
1496
- if (process.platform === "win32" && path.basename(file, ".exe") === "cmd") {
1515
+ if (process.platform === "win32" && path2.basename(file, ".exe") === "cmd") {
1497
1516
  args.unshift("/q");
1498
1517
  }
1499
1518
  return { file, args, options, parsed };
@@ -1507,7 +1526,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1507
1526
  }
1508
1527
  return value;
1509
1528
  };
1510
- var execa = (file, args, options) => {
1529
+ var execa2 = (file, args, options) => {
1511
1530
  const parsed = handleArguments(file, args, options);
1512
1531
  const command = joinCommand(file, args);
1513
1532
  const escapedCommand = getEscapedCommand(file, args);
@@ -1580,7 +1599,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1580
1599
  spawned.all = makeAllStream(spawned, parsed.options);
1581
1600
  return mergePromise(spawned, handlePromiseOnce);
1582
1601
  };
1583
- module2.exports = execa;
1602
+ module2.exports = execa2;
1584
1603
  module2.exports.sync = (file, args, options) => {
1585
1604
  const parsed = handleArguments(file, args, options);
1586
1605
  const command = joinCommand(file, args);
@@ -1638,11 +1657,11 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1638
1657
  };
1639
1658
  module2.exports.command = (command, options) => {
1640
1659
  const [file, ...args] = parseCommand(command);
1641
- return execa(file, args, options);
1660
+ return execa2(file, args, options);
1642
1661
  };
1643
1662
  module2.exports.commandSync = (command, options) => {
1644
1663
  const [file, ...args] = parseCommand(command);
1645
- return execa.sync(file, args, options);
1664
+ return execa2.sync(file, args, options);
1646
1665
  };
1647
1666
  module2.exports.node = (scriptPath, args, options = {}) => {
1648
1667
  if (args && !Array.isArray(args) && typeof args === "object") {
@@ -1655,7 +1674,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1655
1674
  nodePath = process.execPath,
1656
1675
  nodeOptions = defaultExecArgv
1657
1676
  } = options;
1658
- return execa(
1677
+ return execa2(
1659
1678
  nodePath,
1660
1679
  [
1661
1680
  ...nodeOptions,
@@ -1674,3 +1693,372 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1674
1693
  };
1675
1694
  }
1676
1695
  });
1696
+ var require_path_exists = (0, import_chunk_WWAWV7DQ.__commonJS)({
1697
+ "../../node_modules/.pnpm/path-exists@3.0.0/node_modules/path-exists/index.js"(exports, module2) {
1698
+ "use strict";
1699
+ var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
1700
+ module2.exports = (fp) => new Promise((resolve) => {
1701
+ fs2.access(fp, (err) => {
1702
+ resolve(!err);
1703
+ });
1704
+ });
1705
+ module2.exports.sync = (fp) => {
1706
+ try {
1707
+ fs2.accessSync(fp);
1708
+ return true;
1709
+ } catch (err) {
1710
+ return false;
1711
+ }
1712
+ };
1713
+ }
1714
+ });
1715
+ var require_p_try = (0, import_chunk_WWAWV7DQ.__commonJS)({
1716
+ "../../node_modules/.pnpm/p-try@2.2.0/node_modules/p-try/index.js"(exports, module2) {
1717
+ "use strict";
1718
+ var pTry = (fn, ...arguments_) => new Promise((resolve) => {
1719
+ resolve(fn(...arguments_));
1720
+ });
1721
+ module2.exports = pTry;
1722
+ module2.exports.default = pTry;
1723
+ }
1724
+ });
1725
+ var require_p_limit = (0, import_chunk_WWAWV7DQ.__commonJS)({
1726
+ "../../node_modules/.pnpm/p-limit@2.3.0/node_modules/p-limit/index.js"(exports, module2) {
1727
+ "use strict";
1728
+ var pTry = require_p_try();
1729
+ var pLimit = (concurrency) => {
1730
+ if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
1731
+ return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));
1732
+ }
1733
+ const queue = [];
1734
+ let activeCount = 0;
1735
+ const next = () => {
1736
+ activeCount--;
1737
+ if (queue.length > 0) {
1738
+ queue.shift()();
1739
+ }
1740
+ };
1741
+ const run = (fn, resolve, ...args) => {
1742
+ activeCount++;
1743
+ const result = pTry(fn, ...args);
1744
+ resolve(result);
1745
+ result.then(next, next);
1746
+ };
1747
+ const enqueue = (fn, resolve, ...args) => {
1748
+ if (activeCount < concurrency) {
1749
+ run(fn, resolve, ...args);
1750
+ } else {
1751
+ queue.push(run.bind(null, fn, resolve, ...args));
1752
+ }
1753
+ };
1754
+ const generator = (fn, ...args) => new Promise((resolve) => enqueue(fn, resolve, ...args));
1755
+ Object.defineProperties(generator, {
1756
+ activeCount: {
1757
+ get: () => activeCount
1758
+ },
1759
+ pendingCount: {
1760
+ get: () => queue.length
1761
+ },
1762
+ clearQueue: {
1763
+ value: () => {
1764
+ queue.length = 0;
1765
+ }
1766
+ }
1767
+ });
1768
+ return generator;
1769
+ };
1770
+ module2.exports = pLimit;
1771
+ module2.exports.default = pLimit;
1772
+ }
1773
+ });
1774
+ var require_p_locate = (0, import_chunk_WWAWV7DQ.__commonJS)({
1775
+ "../../node_modules/.pnpm/p-locate@3.0.0/node_modules/p-locate/index.js"(exports, module2) {
1776
+ "use strict";
1777
+ var pLimit = require_p_limit();
1778
+ var EndError = class extends Error {
1779
+ constructor(value) {
1780
+ super();
1781
+ this.value = value;
1782
+ }
1783
+ };
1784
+ var testElement = (el, tester) => Promise.resolve(el).then(tester);
1785
+ var finder = (el) => Promise.all(el).then((val) => val[1] === true && Promise.reject(new EndError(val[0])));
1786
+ module2.exports = (iterable, tester, opts) => {
1787
+ opts = Object.assign({
1788
+ concurrency: Infinity,
1789
+ preserveOrder: true
1790
+ }, opts);
1791
+ const limit = pLimit(opts.concurrency);
1792
+ const items = [...iterable].map((el) => [el, limit(testElement, el, tester)]);
1793
+ const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity);
1794
+ return Promise.all(items.map((el) => checkLimit(finder, el))).then(() => {
1795
+ }).catch((err) => err instanceof EndError ? err.value : Promise.reject(err));
1796
+ };
1797
+ }
1798
+ });
1799
+ var require_locate_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
1800
+ "../../node_modules/.pnpm/locate-path@3.0.0/node_modules/locate-path/index.js"(exports, module2) {
1801
+ "use strict";
1802
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
1803
+ var pathExists = require_path_exists();
1804
+ var pLocate = require_p_locate();
1805
+ module2.exports = (iterable, options) => {
1806
+ options = Object.assign({
1807
+ cwd: process.cwd()
1808
+ }, options);
1809
+ return pLocate(iterable, (el) => pathExists(path2.resolve(options.cwd, el)), options);
1810
+ };
1811
+ module2.exports.sync = (iterable, options) => {
1812
+ options = Object.assign({
1813
+ cwd: process.cwd()
1814
+ }, options);
1815
+ for (const el of iterable) {
1816
+ if (pathExists.sync(path2.resolve(options.cwd, el))) {
1817
+ return el;
1818
+ }
1819
+ }
1820
+ };
1821
+ }
1822
+ });
1823
+ var require_find_up = (0, import_chunk_WWAWV7DQ.__commonJS)({
1824
+ "../../node_modules/.pnpm/find-up@3.0.0/node_modules/find-up/index.js"(exports, module2) {
1825
+ "use strict";
1826
+ var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
1827
+ var locatePath = require_locate_path();
1828
+ module2.exports = (filename, opts = {}) => {
1829
+ const startDir = path2.resolve(opts.cwd || "");
1830
+ const { root } = path2.parse(startDir);
1831
+ const filenames = [].concat(filename);
1832
+ return new Promise((resolve) => {
1833
+ (function find(dir) {
1834
+ locatePath(filenames, { cwd: dir }).then((file) => {
1835
+ if (file) {
1836
+ resolve(path2.join(dir, file));
1837
+ } else if (dir === root) {
1838
+ resolve(null);
1839
+ } else {
1840
+ find(path2.dirname(dir));
1841
+ }
1842
+ });
1843
+ })(startDir);
1844
+ });
1845
+ };
1846
+ module2.exports.sync = (filename, opts = {}) => {
1847
+ let dir = path2.resolve(opts.cwd || "");
1848
+ const { root } = path2.parse(dir);
1849
+ const filenames = [].concat(filename);
1850
+ while (true) {
1851
+ const file = locatePath.sync(filenames, { cwd: dir });
1852
+ if (file) {
1853
+ return path2.join(dir, file);
1854
+ }
1855
+ if (dir === root) {
1856
+ return null;
1857
+ }
1858
+ dir = path2.dirname(dir);
1859
+ }
1860
+ };
1861
+ }
1862
+ });
1863
+ var require_pkg_up = (0, import_chunk_WWAWV7DQ.__commonJS)({
1864
+ "../../node_modules/.pnpm/pkg-up@3.1.0/node_modules/pkg-up/index.js"(exports, module2) {
1865
+ "use strict";
1866
+ var findUp = require_find_up();
1867
+ module2.exports = async ({ cwd } = {}) => findUp("package.json", { cwd });
1868
+ module2.exports.sync = ({ cwd } = {}) => findUp.sync("package.json", { cwd });
1869
+ }
1870
+ });
1871
+ async function verifySeedConfigAndReturnMessage(schemaPath) {
1872
+ const cwd = process.cwd();
1873
+ const detected = detectSeedFiles(cwd, schemaPath);
1874
+ const prismaConfig = await (0, import_internals.getPrismaConfigFromPackageJson)(cwd);
1875
+ if (prismaConfig && prismaConfig.data?.seed) {
1876
+ return void 0;
1877
+ }
1878
+ const packageManager = "npm i -D";
1879
+ let message = `${(0, import_chunk_6TE2RIPN.red)(
1880
+ 'To configure seeding in your project you need to add a "prisma.seed" property in your package.json with the command to execute it:'
1881
+ )}
1882
+
1883
+ 1. Open the package.json of your project
1884
+ `;
1885
+ if (detected.numberOfSeedFiles) {
1886
+ await legacyTsNodeScriptWarning();
1887
+ message += `2. Add the following example to it:`;
1888
+ if (detected.js) {
1889
+ message += `
1890
+ \`\`\`
1891
+ "prisma": {
1892
+ "seed": "node ${detected.js}"
1893
+ }
1894
+ \`\`\`
1895
+ `;
1896
+ } else if (detected.ts) {
1897
+ message += `
1898
+ \`\`\`
1899
+ "prisma": {
1900
+ "seed": "ts-node ${detected.ts}"
1901
+ }
1902
+ \`\`\`
1903
+ If you are using ESM (ECMAScript modules):
1904
+ \`\`\`
1905
+ "prisma": {
1906
+ "seed": "node --loader ts-node/esm ${detected.ts}"
1907
+ }
1908
+ \`\`\`
1909
+
1910
+ 3. Install the required dependencies by running:
1911
+ ${(0, import_chunk_6TE2RIPN.green)(`${packageManager} ts-node typescript @types/node`)}
1912
+ `;
1913
+ } else if (detected.sh) {
1914
+ message += `
1915
+ \`\`\`
1916
+ "prisma": {
1917
+ "seed": "${detected.sh}"
1918
+ }
1919
+ \`\`\`
1920
+ And run \`chmod +x ${detected.sh}\` to make it executable.`;
1921
+ }
1922
+ } else {
1923
+ message += `2. Add one of the following examples to your package.json:
1924
+
1925
+ ${(0, import_chunk_6TE2RIPN.bold)("TypeScript:")}
1926
+ \`\`\`
1927
+ "prisma": {
1928
+ "seed": "ts-node ./prisma/seed.ts"
1929
+ }
1930
+ \`\`\`
1931
+ If you are using ESM (ECMAScript modules):
1932
+ \`\`\`
1933
+ "prisma": {
1934
+ "seed": "node --loader ts-node/esm ./prisma/seed.ts"
1935
+ }
1936
+ \`\`\`
1937
+
1938
+ And install the required dependencies by running:
1939
+ ${packageManager} ts-node typescript @types/node
1940
+
1941
+ ${(0, import_chunk_6TE2RIPN.bold)("JavaScript:")}
1942
+ \`\`\`
1943
+ "prisma": {
1944
+ "seed": "node ./prisma/seed.js"
1945
+ }
1946
+ \`\`\`
1947
+
1948
+ ${(0, import_chunk_6TE2RIPN.bold)("Bash:")}
1949
+ \`\`\`
1950
+ "prisma": {
1951
+ "seed": "./prisma/seed.sh"
1952
+ }
1953
+ \`\`\`
1954
+ And run \`chmod +x prisma/seed.sh\` to make it executable.`;
1955
+ }
1956
+ message += `
1957
+ More information in our documentation:
1958
+ ${(0, import_internals.link)("https://pris.ly/d/seeding")}`;
1959
+ return message;
1960
+ }
1961
+ async function getSeedCommandFromPackageJson(cwd) {
1962
+ const prismaConfig = await (0, import_internals.getPrismaConfigFromPackageJson)(cwd);
1963
+ debug({ prismaConfig });
1964
+ if (!prismaConfig || !prismaConfig.data?.seed) {
1965
+ return null;
1966
+ }
1967
+ const seedCommandFromPkgJson = prismaConfig.data.seed;
1968
+ if (typeof seedCommandFromPkgJson !== "string") {
1969
+ throw new Error(
1970
+ `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_path.default.relative(
1971
+ cwd,
1972
+ prismaConfig.packagePath
1973
+ )}\` must be of type string`
1974
+ );
1975
+ }
1976
+ if (!seedCommandFromPkgJson) {
1977
+ throw new Error(
1978
+ `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_path.default.relative(
1979
+ cwd,
1980
+ prismaConfig.packagePath
1981
+ )}\` cannot be empty`
1982
+ );
1983
+ }
1984
+ return seedCommandFromPkgJson;
1985
+ }
1986
+ async function executeSeedCommand({
1987
+ commandFromConfig,
1988
+ extraArgs
1989
+ }) {
1990
+ const command = extraArgs ? `${commandFromConfig} ${extraArgs}` : commandFromConfig;
1991
+ process.stdout.write(`Running seed command \`${(0, import_chunk_6TE2RIPN.italic)(command)}\` ...
1992
+ `);
1993
+ try {
1994
+ await import_execa.default.command(command, {
1995
+ stdout: "inherit",
1996
+ stderr: "inherit"
1997
+ });
1998
+ } catch (_e) {
1999
+ const e = _e;
2000
+ debug({ e });
2001
+ console.error((0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.red)(`
2002
+ An error occurred while running the seed command:`)));
2003
+ console.error((0, import_chunk_6TE2RIPN.red)(e.stderr || String(e)));
2004
+ return false;
2005
+ }
2006
+ return true;
2007
+ }
2008
+ function detectSeedFiles(cwd, schemaPath) {
2009
+ let parentDirectory = import_path.default.relative(cwd, import_path.default.join(cwd, "prisma"));
2010
+ if (schemaPath) {
2011
+ parentDirectory = import_path.default.relative(cwd, import_path.default.dirname(schemaPath));
2012
+ }
2013
+ const seedPath = import_path.default.join(parentDirectory, "seed.");
2014
+ const detected = {
2015
+ seedPath,
2016
+ numberOfSeedFiles: 0,
2017
+ js: "",
2018
+ ts: "",
2019
+ sh: ""
2020
+ };
2021
+ const extensions = ["js", "ts", "sh"];
2022
+ for (const extension of extensions) {
2023
+ const fullPath = seedPath + extension;
2024
+ if (!import_fs.default.existsSync(fullPath)) {
2025
+ continue;
2026
+ }
2027
+ detected[extension] = fullPath;
2028
+ detected.numberOfSeedFiles++;
2029
+ }
2030
+ debug({ detected });
2031
+ return detected;
2032
+ }
2033
+ async function legacyTsNodeScriptWarning() {
2034
+ const scripts = await getScriptsFromPackageJson();
2035
+ if (scripts?.["ts-node"]) {
2036
+ import_internals.logger.warn(
2037
+ (0, import_chunk_6TE2RIPN.yellow)(`The "ts-node" script in the package.json is not used anymore since version 3.0 and can now be removed.`)
2038
+ );
2039
+ }
2040
+ return void 0;
2041
+ }
2042
+ async function getScriptsFromPackageJson(cwd = process.cwd()) {
2043
+ try {
2044
+ const pkgJsonPath = await (0, import_pkg_up.default)({ cwd });
2045
+ if (!pkgJsonPath) {
2046
+ return null;
2047
+ }
2048
+ const pkgJsonString = await import_fs.default.promises.readFile(pkgJsonPath, "utf-8");
2049
+ const pkgJson = JSON.parse(pkgJsonString);
2050
+ const { "ts-node": tsnode } = pkgJson.scripts;
2051
+ return { "ts-node": tsnode };
2052
+ } catch {
2053
+ return null;
2054
+ }
2055
+ }
2056
+ var import_execa, import_pkg_up, debug;
2057
+ var init_seed = (0, import_chunk_WWAWV7DQ.__esm)({
2058
+ "src/utils/seed.ts"() {
2059
+ import_execa = (0, import_chunk_WWAWV7DQ.__toESM)(require_execa());
2060
+ (0, import_chunk_6TE2RIPN.init_colors)();
2061
+ import_pkg_up = (0, import_chunk_WWAWV7DQ.__toESM)(require_pkg_up());
2062
+ debug = (0, import_debug.default)("prisma:migrate:seed");
2063
+ }
2064
+ });