@prisma/migrate 6.20.0-dev.7 → 6.20.0-dev.9

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 (88) hide show
  1. package/dist/CLI.js +2 -2
  2. package/dist/Migrate.js +4 -8
  3. package/dist/SchemaEngineCLI.js +4 -4
  4. package/dist/SchemaEngineWasm.js +4 -4
  5. package/dist/bin.js +71 -74
  6. package/dist/chunk-3MCWUFUJ.js +169 -0
  7. package/dist/{chunk-O35BTK6Y.js → chunk-7BNYLV6P.js} +7 -14
  8. package/dist/{chunk-F2XCBEZ4.js → chunk-AIUUIREM.js} +27 -53
  9. package/dist/{chunk-74LUB4XX.js → chunk-BRPS327A.js} +23 -45
  10. package/dist/{chunk-7TVX3D4W.js → chunk-CQ6GMT2G.js} +23 -69
  11. package/dist/{chunk-EJG7GKM7.js → chunk-DCXZOUQV.js} +5 -5
  12. package/dist/{chunk-LLO7YF56.js → chunk-DYXUXG3K.js} +7 -7
  13. package/dist/{chunk-GSX25HRL.js → chunk-ENVEA7LT.js} +10 -13
  14. package/dist/{chunk-6ORQRJLP.js → chunk-FEUKQ7J3.js} +38 -132
  15. package/dist/{chunk-BHJMJSM4.js → chunk-IQWOR45L.js} +28 -24
  16. package/dist/{chunk-R4IWP35Z.js → chunk-IVL273O6.js} +20 -20
  17. package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
  18. package/dist/{chunk-3AKRTEIK.js → chunk-N4SBKLAB.js} +24 -23
  19. package/dist/{chunk-NGQA5JTN.js → chunk-OAHBNV3B.js} +5 -5
  20. package/dist/{chunk-22YP3RXZ.js → chunk-OZ26HKM7.js} +7 -7
  21. package/dist/{chunk-AXR7LS2N.js → chunk-PEUHUCS4.js} +4 -5
  22. package/dist/{chunk-TW22Y3AA.js → chunk-QAOWTYGM.js} +31 -32
  23. package/dist/{chunk-2FXU5NZQ.js → chunk-QOPTDDIH.js} +5 -10
  24. package/dist/{chunk-J33EXHZB.js → chunk-S4LY555Z.js} +26 -46
  25. package/dist/{chunk-NB4FRYRQ.js → chunk-TLHUBVSH.js} +6 -6
  26. package/dist/{chunk-Z27SI4AV.js → chunk-TRUKHPCA.js} +20 -15
  27. package/dist/{chunk-D4TRX77Y.js → chunk-WF7UXKO5.js} +6 -9
  28. package/dist/{chunk-ZTIS675B.js → chunk-XFASRSQR.js} +81 -172
  29. package/dist/{chunk-3WC4XD74.js → chunk-XGTVKL4L.js} +11 -4
  30. package/dist/{chunk-VU5BLQUI.js → chunk-ZOT2HSX5.js} +218 -22
  31. package/dist/commands/DbCommand.js +2 -2
  32. package/dist/commands/DbDrop.js +5 -5
  33. package/dist/commands/DbExecute.js +5 -9
  34. package/dist/commands/DbPull.js +10 -16
  35. package/dist/commands/DbPush.js +8 -12
  36. package/dist/commands/DbSeed.js +3 -3
  37. package/dist/commands/MigrateCommand.js +2 -2
  38. package/dist/commands/MigrateDeploy.js +7 -11
  39. package/dist/commands/MigrateDev.js +8 -13
  40. package/dist/commands/MigrateDiff.js +6 -9
  41. package/dist/commands/MigrateReset.js +8 -13
  42. package/dist/commands/MigrateResolve.js +7 -11
  43. package/dist/commands/MigrateStatus.js +7 -11
  44. package/dist/index.js +44 -48
  45. package/dist/internals/src/cli/getSchema.d.ts +1 -15
  46. package/dist/migrate/src/CLI.d.ts +1 -1
  47. package/dist/migrate/src/Migrate.d.ts +2 -3
  48. package/dist/migrate/src/SchemaEngineCLI.d.ts +4 -3
  49. package/dist/migrate/src/commands/DbCommand.d.ts +1 -1
  50. package/dist/migrate/src/commands/DbDrop.d.ts +1 -1
  51. package/dist/migrate/src/commands/DbExecute.d.ts +1 -1
  52. package/dist/migrate/src/commands/DbPull.d.ts +1 -2
  53. package/dist/migrate/src/commands/DbPush.d.ts +1 -1
  54. package/dist/migrate/src/commands/MigrateCommand.d.ts +1 -1
  55. package/dist/migrate/src/commands/MigrateDeploy.d.ts +1 -1
  56. package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
  57. package/dist/migrate/src/commands/MigrateDiff.d.ts +2 -1
  58. package/dist/migrate/src/commands/MigrateReset.d.ts +1 -1
  59. package/dist/migrate/src/commands/MigrateResolve.d.ts +1 -1
  60. package/dist/migrate/src/commands/MigrateStatus.d.ts +1 -1
  61. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +9 -5
  62. package/dist/migrate/src/utils/errors.d.ts +3 -0
  63. package/dist/migrate/src/utils/getDatabaseVersionSafe.d.ts +2 -1
  64. package/dist/migrate/src/utils/introspectSql.d.ts +2 -2
  65. package/dist/migrate/src/utils/printDatasource.d.ts +1 -3
  66. package/dist/migrate/src/utils/seed.d.ts +0 -6
  67. package/dist/utils/ensureDatabaseExists.js +6 -6
  68. package/dist/utils/errors.js +8 -7
  69. package/dist/utils/getDatabaseVersionSafe.js +5 -9
  70. package/dist/utils/introspectSql.js +5 -9
  71. package/dist/utils/printDatasource.js +2 -2
  72. package/dist/utils/printDatasources.js +31 -3
  73. package/dist/utils/seed.js +2 -3
  74. package/dist/utils/setupMSSQL.js +18 -3
  75. package/dist/utils/spinner.js +2 -3
  76. package/dist/views/handleViewsIO.js +2 -2
  77. package/package.json +11 -11
  78. package/dist/chunk-AI6DH66U.js +0 -55
  79. package/dist/chunk-D6LYHB65.js +0 -905
  80. package/dist/chunk-RR6BKMNO.js +0 -80
  81. package/dist/chunk-T64SUJ5L.js +0 -46
  82. package/dist/chunk-VV4M6AN7.js +0 -233
  83. package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +0 -2
  84. package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +0 -1
  85. package/dist/migrate/src/utils/warnDatasourceDriverAdapter.d.ts +0 -2
  86. package/dist/utils/replaceOrAddDatasource.js +0 -25
  87. package/dist/utils/replaceOrAddDatasource.test.js +0 -207
  88. package/dist/utils/warnDatasourceDriverAdapter.js +0 -25
@@ -26,24 +26,21 @@ 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_PHXLQVPT_exports = {};
30
- __export(chunk_PHXLQVPT_exports, {
31
- executeSeedCommand: () => executeSeedCommand,
32
- getSeedCommandFromPackageJson: () => getSeedCommandFromPackageJson
29
+ var chunk_L7EZFBB4_exports = {};
30
+ __export(chunk_L7EZFBB4_exports, {
31
+ executeSeedCommand: () => executeSeedCommand
33
32
  });
34
- module.exports = __toCommonJS(chunk_PHXLQVPT_exports);
33
+ module.exports = __toCommonJS(chunk_L7EZFBB4_exports);
35
34
  var import_chunk_3WDCTXHL = require("./chunk-3WDCTXHL.js");
36
35
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
37
36
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
38
- var import_node_path = __toESM(require("node:path"));
39
- var import_config = require("@prisma/config");
40
37
  var import_debug = __toESM(require("@prisma/debug"));
41
38
  var import_node_buffer = require("node:buffer");
42
- var import_node_path2 = __toESM(require("node:path"));
39
+ var import_node_path = __toESM(require("node:path"));
43
40
  var import_node_child_process = __toESM(require("node:child_process"));
44
41
  var import_node_process = __toESM(require("node:process"));
45
42
  var import_node_process2 = __toESM(require("node:process"));
46
- var import_node_path3 = __toESM(require("node:path"));
43
+ var import_node_path2 = __toESM(require("node:path"));
47
44
  var import_node_url = require("node:url");
48
45
  var import_node_process3 = __toESM(require("node:process"));
49
46
  var import_node_os = require("node:os");
@@ -63,7 +60,7 @@ var require_windows = (0, import_chunk_2ESYSVXG.__commonJS)({
63
60
  module2.exports = isexe;
64
61
  isexe.sync = sync;
65
62
  var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
66
- function checkPathExt(path4, options) {
63
+ function checkPathExt(path3, options) {
67
64
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
68
65
  if (!pathext) {
69
66
  return true;
@@ -74,25 +71,25 @@ var require_windows = (0, import_chunk_2ESYSVXG.__commonJS)({
74
71
  }
75
72
  for (var i = 0; i < pathext.length; i++) {
76
73
  var p = pathext[i].toLowerCase();
77
- if (p && path4.substr(-p.length).toLowerCase() === p) {
74
+ if (p && path3.substr(-p.length).toLowerCase() === p) {
78
75
  return true;
79
76
  }
80
77
  }
81
78
  return false;
82
79
  }
83
- function checkStat(stat, path4, options) {
80
+ function checkStat(stat, path3, options) {
84
81
  if (!stat.isSymbolicLink() && !stat.isFile()) {
85
82
  return false;
86
83
  }
87
- return checkPathExt(path4, options);
84
+ return checkPathExt(path3, options);
88
85
  }
89
- function isexe(path4, options, cb) {
90
- fs.stat(path4, function(er, stat) {
91
- cb(er, er ? false : checkStat(stat, path4, options));
86
+ function isexe(path3, options, cb) {
87
+ fs.stat(path3, function(er, stat) {
88
+ cb(er, er ? false : checkStat(stat, path3, options));
92
89
  });
93
90
  }
94
- function sync(path4, options) {
95
- return checkStat(fs.statSync(path4), path4, options);
91
+ function sync(path3, options) {
92
+ return checkStat(fs.statSync(path3), path3, options);
96
93
  }
97
94
  }
98
95
  });
@@ -102,13 +99,13 @@ var require_mode = (0, import_chunk_2ESYSVXG.__commonJS)({
102
99
  module2.exports = isexe;
103
100
  isexe.sync = sync;
104
101
  var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
105
- function isexe(path4, options, cb) {
106
- fs.stat(path4, function(er, stat) {
102
+ function isexe(path3, options, cb) {
103
+ fs.stat(path3, function(er, stat) {
107
104
  cb(er, er ? false : checkStat(stat, options));
108
105
  });
109
106
  }
110
- function sync(path4, options) {
111
- return checkStat(fs.statSync(path4), options);
107
+ function sync(path3, options) {
108
+ return checkStat(fs.statSync(path3), options);
112
109
  }
113
110
  function checkStat(stat, options) {
114
111
  return stat.isFile() && checkMode(stat, options);
@@ -140,7 +137,7 @@ var require_isexe = (0, import_chunk_2ESYSVXG.__commonJS)({
140
137
  }
141
138
  module2.exports = isexe;
142
139
  isexe.sync = sync;
143
- function isexe(path4, options, cb) {
140
+ function isexe(path3, options, cb) {
144
141
  if (typeof options === "function") {
145
142
  cb = options;
146
143
  options = {};
@@ -150,7 +147,7 @@ var require_isexe = (0, import_chunk_2ESYSVXG.__commonJS)({
150
147
  throw new TypeError("callback not provided");
151
148
  }
152
149
  return new Promise(function(resolve, reject) {
153
- isexe(path4, options || {}, function(er, is) {
150
+ isexe(path3, options || {}, function(er, is) {
154
151
  if (er) {
155
152
  reject(er);
156
153
  } else {
@@ -159,7 +156,7 @@ var require_isexe = (0, import_chunk_2ESYSVXG.__commonJS)({
159
156
  });
160
157
  });
161
158
  }
162
- core(path4, options || {}, function(er, is) {
159
+ core(path3, options || {}, function(er, is) {
163
160
  if (er) {
164
161
  if (er.code === "EACCES" || options && options.ignoreErrors) {
165
162
  er = null;
@@ -169,9 +166,9 @@ var require_isexe = (0, import_chunk_2ESYSVXG.__commonJS)({
169
166
  cb(er, is);
170
167
  });
171
168
  }
172
- function sync(path4, options) {
169
+ function sync(path3, options) {
173
170
  try {
174
- return core.sync(path4, options || {});
171
+ return core.sync(path3, options || {});
175
172
  } catch (er) {
176
173
  if (options && options.ignoreErrors || er.code === "EACCES") {
177
174
  return false;
@@ -186,7 +183,7 @@ var require_which = (0, import_chunk_2ESYSVXG.__commonJS)({
186
183
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
187
184
  "use strict";
188
185
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
189
- var path4 = (0, import_chunk_2ESYSVXG.__require)("path");
186
+ var path3 = (0, import_chunk_2ESYSVXG.__require)("path");
190
187
  var COLON = isWindows ? ";" : ":";
191
188
  var isexe = require_isexe();
192
189
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -224,7 +221,7 @@ var require_which = (0, import_chunk_2ESYSVXG.__commonJS)({
224
221
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
225
222
  const ppRaw = pathEnv[i];
226
223
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
227
- const pCmd = path4.join(pathPart, cmd);
224
+ const pCmd = path3.join(pathPart, cmd);
228
225
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
229
226
  resolve(subStep(p, i, 0));
230
227
  });
@@ -251,7 +248,7 @@ var require_which = (0, import_chunk_2ESYSVXG.__commonJS)({
251
248
  for (let i = 0; i < pathEnv.length; i++) {
252
249
  const ppRaw = pathEnv[i];
253
250
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
254
- const pCmd = path4.join(pathPart, cmd);
251
+ const pCmd = path3.join(pathPart, cmd);
255
252
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
256
253
  for (let j = 0; j < pathExt.length; j++) {
257
254
  const cur = p + pathExt[j];
@@ -295,7 +292,7 @@ var require_path_key = (0, import_chunk_2ESYSVXG.__commonJS)({
295
292
  var require_resolveCommand = (0, import_chunk_2ESYSVXG.__commonJS)({
296
293
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
297
294
  "use strict";
298
- var path4 = (0, import_chunk_2ESYSVXG.__require)("path");
295
+ var path3 = (0, import_chunk_2ESYSVXG.__require)("path");
299
296
  var which = require_which();
300
297
  var getPathKey = require_path_key();
301
298
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -313,7 +310,7 @@ var require_resolveCommand = (0, import_chunk_2ESYSVXG.__commonJS)({
313
310
  try {
314
311
  resolved = which.sync(parsed.command, {
315
312
  path: env[getPathKey({ env })],
316
- pathExt: withoutPathExt ? path4.delimiter : void 0
313
+ pathExt: withoutPathExt ? path3.delimiter : void 0
317
314
  });
318
315
  } catch (e) {
319
316
  } finally {
@@ -322,7 +319,7 @@ var require_resolveCommand = (0, import_chunk_2ESYSVXG.__commonJS)({
322
319
  }
323
320
  }
324
321
  if (resolved) {
325
- resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
322
+ resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
326
323
  }
327
324
  return resolved;
328
325
  }
@@ -370,8 +367,8 @@ var require_shebang_command = (0, import_chunk_2ESYSVXG.__commonJS)({
370
367
  if (!match) {
371
368
  return null;
372
369
  }
373
- const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
374
- const binary = path4.split("/").pop();
370
+ const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
371
+ const binary = path3.split("/").pop();
375
372
  if (binary === "env") {
376
373
  return argument;
377
374
  }
@@ -402,7 +399,7 @@ var require_readShebang = (0, import_chunk_2ESYSVXG.__commonJS)({
402
399
  var require_parse = (0, import_chunk_2ESYSVXG.__commonJS)({
403
400
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
404
401
  "use strict";
405
- var path4 = (0, import_chunk_2ESYSVXG.__require)("path");
402
+ var path3 = (0, import_chunk_2ESYSVXG.__require)("path");
406
403
  var resolveCommand = require_resolveCommand();
407
404
  var escape = require_escape();
408
405
  var readShebang = require_readShebang();
@@ -427,7 +424,7 @@ var require_parse = (0, import_chunk_2ESYSVXG.__commonJS)({
427
424
  const needsShell = !isExecutableRegExp.test(commandFile);
428
425
  if (parsed.options.forceShell || needsShell) {
429
426
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
430
- parsed.command = path4.normalize(parsed.command);
427
+ parsed.command = path3.normalize(parsed.command);
431
428
  parsed.command = escape.command(parsed.command);
432
429
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
433
430
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -600,7 +597,7 @@ var npmRunPath = ({
600
597
  addExecPath = true
601
598
  } = {}) => {
602
599
  const cwdString = cwd instanceof URL ? (0, import_node_url.fileURLToPath)(cwd) : cwd;
603
- const cwdPath = import_node_path3.default.resolve(cwdString);
600
+ const cwdPath = import_node_path2.default.resolve(cwdString);
604
601
  const result = [];
605
602
  if (preferLocal) {
606
603
  applyPreferLocal(result, cwdPath);
@@ -608,19 +605,19 @@ var npmRunPath = ({
608
605
  if (addExecPath) {
609
606
  applyExecPath(result, execPath, cwdPath);
610
607
  }
611
- return [...result, pathOption].join(import_node_path3.default.delimiter);
608
+ return [...result, pathOption].join(import_node_path2.default.delimiter);
612
609
  };
613
610
  var applyPreferLocal = (result, cwdPath) => {
614
611
  let previous;
615
612
  while (previous !== cwdPath) {
616
- result.push(import_node_path3.default.join(cwdPath, "node_modules/.bin"));
613
+ result.push(import_node_path2.default.join(cwdPath, "node_modules/.bin"));
617
614
  previous = cwdPath;
618
- cwdPath = import_node_path3.default.resolve(cwdPath, "..");
615
+ cwdPath = import_node_path2.default.resolve(cwdPath, "..");
619
616
  }
620
617
  };
621
618
  var applyExecPath = (result, execPath, cwdPath) => {
622
619
  const execPathString = execPath instanceof URL ? (0, import_node_url.fileURLToPath)(execPath) : execPath;
623
- result.push(import_node_path3.default.resolve(cwdPath, execPathString, ".."));
620
+ result.push(import_node_path2.default.resolve(cwdPath, execPathString, ".."));
624
621
  };
625
622
  var npmRunPathEnv = ({ env = import_node_process2.default.env, ...options } = {}) => {
626
623
  env = { ...env };
@@ -1665,7 +1662,7 @@ var handleArguments = (file, args, options = {}) => {
1665
1662
  };
1666
1663
  options.env = getEnv(options);
1667
1664
  options.stdio = normalizeStdio(options);
1668
- if (import_node_process.default.platform === "win32" && import_node_path2.default.basename(file, ".exe") === "cmd") {
1665
+ if (import_node_process.default.platform === "win32" && import_node_path.default.basename(file, ".exe") === "cmd") {
1669
1666
  args.unshift("/q");
1670
1667
  }
1671
1668
  return { file, args, options, parsed };
@@ -1841,31 +1838,6 @@ function execaCommand(command, options) {
1841
1838
  return execa(file, args, options);
1842
1839
  }
1843
1840
  var debug = (0, import_debug.default)("prisma:migrate:seed");
1844
- async function getSeedCommandFromPackageJson(cwd) {
1845
- const prismaConfig = await (0, import_config.loadConfigFromPackageJson)(cwd);
1846
- debug({ prismaConfig });
1847
- if (!prismaConfig?.config?.seed) {
1848
- return null;
1849
- }
1850
- const seedCommandFromPkgJson = prismaConfig.config.seed;
1851
- if (typeof seedCommandFromPkgJson !== "string") {
1852
- throw new Error(
1853
- `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_node_path.default.relative(
1854
- cwd,
1855
- prismaConfig.loadedFromFile
1856
- )}\` must be of type string`
1857
- );
1858
- }
1859
- if (!seedCommandFromPkgJson) {
1860
- throw new Error(
1861
- `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_node_path.default.relative(
1862
- cwd,
1863
- prismaConfig.loadedFromFile
1864
- )}\` cannot be empty`
1865
- );
1866
- }
1867
- return prismaConfig.config.seed;
1868
- }
1869
1841
  async function executeSeedCommand({
1870
1842
  commandFromConfig,
1871
1843
  extraArgs
@@ -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_3AKRTEIK_exports = {};
20
- __export(chunk_3AKRTEIK_exports, {
19
+ var chunk_N4SBKLAB_exports = {};
20
+ __export(chunk_N4SBKLAB_exports, {
21
21
  MigrateResolve: () => MigrateResolve
22
22
  });
23
- module.exports = __toCommonJS(chunk_3AKRTEIK_exports);
24
- var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
25
- var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
26
- var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
23
+ module.exports = __toCommonJS(chunk_N4SBKLAB_exports);
24
+ var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
25
+ var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
26
+ var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
27
27
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
28
28
  var import_internals = require("@prisma/internals");
29
29
  var MigrateResolve = class _MigrateResolve {
@@ -31,7 +31,7 @@ var MigrateResolve = class _MigrateResolve {
31
31
  return new _MigrateResolve();
32
32
  }
33
33
  static help = (0, import_internals.format)(`
34
- Resolve issues with database migrations in deployment databases:
34
+ Resolve issues with database migrations in deployment databases:
35
35
  - recover from failed migrations
36
36
  - baseline databases when starting to use Prisma Migrate on existing databases
37
37
  - reconcile hotfixes done manually on databases with your migration history
@@ -39,11 +39,13 @@ Resolve issues with database migrations in deployment databases:
39
39
  Run "prisma migrate status" to identify if you need to use resolve.
40
40
 
41
41
  Read more about resolving migration history issues: ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}
42
-
42
+
43
43
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
44
44
 
45
45
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve [options]
46
-
46
+
47
+ The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
48
+
47
49
  ${(0, import_chunk_SKRR5WT4.bold)("Options")}
48
50
 
49
51
  -h, --help Display this help message
@@ -54,7 +56,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
54
56
 
55
57
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
56
58
 
57
- Update migrations table, recording a specific migration as applied
59
+ Update migrations table, recording a specific migration as applied
58
60
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --applied 20201231000000_add_users_table
59
61
 
60
62
  Update migrations table, recording a specific migration as rolled back
@@ -63,7 +65,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
63
65
  Specify a schema
64
66
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
65
67
  `);
66
- async parse(argv, config) {
68
+ async parse(argv, config, configDir) {
67
69
  const args = (0, import_internals.arg)(
68
70
  argv,
69
71
  {
@@ -83,16 +85,15 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
83
85
  if (args["--help"]) {
84
86
  return this.help();
85
87
  }
86
- await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
87
88
  const schemaContext = await (0, import_internals.loadSchemaContext)({
88
89
  schemaPathFromArg: args["--schema"],
89
- schemaPathFromConfig: config.schema,
90
- schemaEngineConfig: config
90
+ schemaPathFromConfig: config.schema
91
91
  });
92
92
  const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
93
- const adapter = config.engine === "js" ? await config.adapter() : void 0;
94
- (0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate resolve", schemaContext });
95
- (0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource), adapter });
93
+ const cmd = "migrate resolve";
94
+ const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
95
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
96
+ (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig) });
96
97
  if (!args["--applied"] && !args["--rolled-back"]) {
97
98
  throw new Error(
98
99
  `--applied or --rolled-back must be part of the command like:
@@ -110,11 +111,10 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.green)((0, import_in
110
111
  )}`
111
112
  );
112
113
  }
113
- if (!adapter) {
114
- await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
115
- }
116
- const migrate = await import_chunk_D6LYHB65.Migrate.setup({
114
+ await (0, import_chunk_BRPS327A.ensureCanConnectToDatabase)(configDir, validatedConfig);
115
+ const migrate = await import_chunk_3MCWUFUJ.Migrate.setup({
117
116
  schemaEngineConfig: config,
117
+ configDir,
118
118
  migrationsDirPath,
119
119
  schemaContext,
120
120
  extensions: config["extensions"]
@@ -138,9 +138,10 @@ Migration ${args["--applied"]} marked as applied.
138
138
  )}`
139
139
  );
140
140
  }
141
- await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
142
- const migrate = await import_chunk_D6LYHB65.Migrate.setup({
141
+ await (0, import_chunk_BRPS327A.ensureCanConnectToDatabase)(configDir, validatedConfig);
142
+ const migrate = await import_chunk_3MCWUFUJ.Migrate.setup({
143
143
  schemaEngineConfig: config,
144
+ configDir,
144
145
  migrationsDirPath,
145
146
  schemaContext,
146
147
  extensions: config["extensions"]
@@ -16,11 +16,11 @@ 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_NGQA5JTN_exports = {};
20
- __export(chunk_NGQA5JTN_exports, {
19
+ var chunk_OAHBNV3B_exports = {};
20
+ __export(chunk_OAHBNV3B_exports, {
21
21
  CLI: () => CLI
22
22
  });
23
- module.exports = __toCommonJS(chunk_NGQA5JTN_exports);
23
+ module.exports = __toCommonJS(chunk_OAHBNV3B_exports);
24
24
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
25
25
  var import_internals = require("@prisma/internals");
26
26
  var CLI = class _CLI {
@@ -30,7 +30,7 @@ var CLI = class _CLI {
30
30
  static new(cmds) {
31
31
  return new _CLI(cmds);
32
32
  }
33
- async parse(argv, config) {
33
+ async parse(argv, config, configDir) {
34
34
  const args = (0, import_internals.arg)(argv, {
35
35
  "--help": Boolean,
36
36
  "-h": "--help",
@@ -61,7 +61,7 @@ var CLI = class _CLI {
61
61
  } else {
62
62
  argsForCmd = args._.slice(1);
63
63
  }
64
- return cmd.parse(argsForCmd, config);
64
+ return cmd.parse(argsForCmd, config, configDir);
65
65
  }
66
66
  return (0, import_internals.unknownCommand)(this.help(), args._[0]);
67
67
  }
@@ -26,13 +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_22YP3RXZ_exports = {};
30
- __export(chunk_22YP3RXZ_exports, {
29
+ var chunk_OZ26HKM7_exports = {};
30
+ __export(chunk_OZ26HKM7_exports, {
31
31
  SchemaEngineWasm: () => SchemaEngineWasm
32
32
  });
33
- module.exports = __toCommonJS(chunk_22YP3RXZ_exports);
34
- var import_chunk_GSX25HRL = require("./chunk-GSX25HRL.js");
35
- var import_chunk_AXR7LS2N = require("./chunk-AXR7LS2N.js");
33
+ module.exports = __toCommonJS(chunk_OZ26HKM7_exports);
34
+ var import_chunk_ENVEA7LT = require("./chunk-ENVEA7LT.js");
35
+ var import_chunk_PEUHUCS4 = require("./chunk-PEUHUCS4.js");
36
36
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
37
37
  var import_debug = __toESM(require("@prisma/debug"));
38
38
  var import_internals = require("@prisma/internals");
@@ -83,7 +83,7 @@ var SchemaEngineWasm = class _SchemaEngineWasm {
83
83
  const { message, stack } = (0, import_internals.getWasmError)(e);
84
84
  throw new import_internals.RustPanic(serializePanic(message), stack, command, import_internals.ErrorArea.LIFT_CLI);
85
85
  } else if ("code" in error) {
86
- throw new import_chunk_GSX25HRL.EngineError((0, import_chunk_SKRR5WT4.red)(`${error.code}
86
+ throw new import_chunk_ENVEA7LT.EngineError((0, import_chunk_SKRR5WT4.red)(`${error.code}
87
87
 
88
88
  ${(0, import_internals.relativizePathInPSLError)(error.message)}
89
89
  `), error.code);
@@ -189,7 +189,7 @@ ${(0, import_internals.relativizePathInPSLError)(error.message)}
189
189
  });
190
190
  const { views } = introspectResult;
191
191
  if (views) {
192
- await (0, import_chunk_AXR7LS2N.handleViewsIO)({ views, viewsDirectoryPath });
192
+ await (0, import_chunk_PEUHUCS4.handleViewsIO)({ views, viewsDirectoryPath });
193
193
  }
194
194
  return introspectResult;
195
195
  }
@@ -26,12 +26,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_AXR7LS2N_exports = {};
30
- __export(chunk_AXR7LS2N_exports, {
31
- handleViewsIO: () => handleViewsIO,
32
- z: () => z
29
+ var chunk_PEUHUCS4_exports = {};
30
+ __export(chunk_PEUHUCS4_exports, {
31
+ handleViewsIO: () => handleViewsIO
33
32
  });
34
- module.exports = __toCommonJS(chunk_AXR7LS2N_exports);
33
+ module.exports = __toCommonJS(chunk_PEUHUCS4_exports);
35
34
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
36
35
  var import_internals = require("@prisma/internals");
37
36
  var import_path = __toESM(require("path"));
@@ -26,16 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_TW22Y3AA_exports = {};
30
- __export(chunk_TW22Y3AA_exports, {
29
+ var chunk_QAOWTYGM_exports = {};
30
+ __export(chunk_QAOWTYGM_exports, {
31
31
  DbPush: () => DbPush
32
32
  });
33
- module.exports = __toCommonJS(chunk_TW22Y3AA_exports);
33
+ module.exports = __toCommonJS(chunk_QAOWTYGM_exports);
34
34
  var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
35
- var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
36
- var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
37
- var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
38
- var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
35
+ var import_chunk_XGTVKL4L = require("./chunk-XGTVKL4L.js");
36
+ var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
37
+ var import_chunk_BRPS327A = require("./chunk-BRPS327A.js");
38
+ var import_chunk_3MCWUFUJ = require("./chunk-3MCWUFUJ.js");
39
39
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
40
40
  var import_internals = require("@prisma/internals");
41
41
  var import_prompts = __toESM(require("prompts"));
@@ -50,6 +50,8 @@ ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
50
50
 
51
51
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db push [options]
52
52
 
53
+ The datasource URL configuration is read from the Prisma config file (e.g., ${(0, import_chunk_SKRR5WT4.italic)("prisma.config.ts")}).
54
+
53
55
  ${(0, import_chunk_SKRR5WT4.bold)("Options")}
54
56
 
55
57
  -h, --help Display this help message
@@ -57,7 +59,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
57
59
  --schema Custom path to your Prisma schema
58
60
  --accept-data-loss Ignore data loss warnings
59
61
  --force-reset Force a reset of the database before push
60
- --skip-generate Skip triggering generators (e.g. Prisma Client)
61
62
 
62
63
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
63
64
 
@@ -70,7 +71,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
70
71
  Ignore data loss warnings
71
72
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db push --accept-data-loss
72
73
  `);
73
- async parse(argv, config) {
74
+ async parse(argv, config, configDir) {
74
75
  const args = (0, import_internals.arg)(
75
76
  argv,
76
77
  {
@@ -78,7 +79,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
78
79
  "-h": "--help",
79
80
  "--accept-data-loss": Boolean,
80
81
  "--force-reset": Boolean,
81
- "--skip-generate": Boolean,
82
82
  "--schema": String,
83
83
  "--config": String,
84
84
  "--telemetry-information": String
@@ -91,38 +91,40 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
91
91
  if (args["--help"]) {
92
92
  return this.help();
93
93
  }
94
- await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
95
94
  const schemaContext = await (0, import_internals.loadSchemaContext)({
96
95
  schemaPathFromArg: args["--schema"],
97
- schemaPathFromConfig: config.schema,
98
- schemaEngineConfig: config
96
+ schemaPathFromConfig: config.schema
99
97
  });
100
98
  const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext, config);
101
- (0, import_internals.checkUnsupportedDataProxy)({ cmd: "db push", schemaContext });
102
- const datasourceInfo = (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource);
103
- const adapter = config.engine === "js" ? await config.adapter() : void 0;
104
- (0, import_chunk_2FXU5NZQ.printDatasource)({ datasourceInfo, adapter });
99
+ const cmd = "db push";
100
+ const validatedConfig = (0, import_internals.validatePrismaConfigWithDatasource)({ config, cmd });
101
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd, validatedConfig });
102
+ const datasourceInfo = (0, import_chunk_BRPS327A.parseDatasourceInfo)(schemaContext.primaryDatasource, validatedConfig);
103
+ (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
105
104
  const schemaFilter = {
106
105
  externalTables: config.tables?.external ?? [],
107
106
  externalEnums: config.enums?.external ?? []
108
107
  };
109
- const migrate = await import_chunk_D6LYHB65.Migrate.setup({
108
+ const migrate = await import_chunk_3MCWUFUJ.Migrate.setup({
110
109
  schemaEngineConfig: config,
110
+ configDir,
111
111
  migrationsDirPath,
112
112
  schemaContext,
113
113
  schemaFilter,
114
114
  extensions: config["extensions"]
115
115
  });
116
- if (!adapter) {
117
- try {
118
- const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
119
- if (wasDbCreated) {
120
- process.stdout.write("\n" + wasDbCreated + "\n");
121
- }
122
- } catch (e) {
123
- process.stdout.write("\n");
124
- throw e;
116
+ try {
117
+ const successMessage = await (0, import_chunk_BRPS327A.ensureDatabaseExists)(
118
+ configDir,
119
+ (0, import_internals.getSchemaDatasourceProvider)(schemaContext),
120
+ validatedConfig
121
+ );
122
+ if (successMessage) {
123
+ process.stdout.write("\n" + successMessage + "\n");
125
124
  }
125
+ } catch (e) {
126
+ process.stdout.write("\n");
127
+ throw e;
126
128
  }
127
129
  let wasDatabaseReset = false;
128
130
  if (args["--force-reset"]) {
@@ -192,7 +194,7 @@ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will
192
194
  if (!args["--accept-data-loss"]) {
193
195
  if (!(0, import_internals.canPrompt)()) {
194
196
  await migrate.stop();
195
- throw new import_chunk_3WC4XD74.DbPushIgnoreWarningsWithFlagError();
197
+ throw new import_chunk_XGTVKL4L.DbPushIgnoreWarningsWithFlagError();
196
198
  }
197
199
  process.stdout.write("\n");
198
200
  const confirmation = await (0, import_prompts.default)({
@@ -225,16 +227,13 @@ The database is already in sync with the Prisma schema.
225
227
  const rocketEmoji = process.platform === "win32" ? "" : "\u{1F680} ";
226
228
  const migrationSuccessStdMessage = "Your database is now in sync with your Prisma schema.";
227
229
  const migrationSuccessMongoMessage = "Your database indexes are now in sync with your Prisma schema.";
228
- const provider = adapter?.provider ?? schemaContext.primaryDatasource?.activeProvider;
230
+ const provider = schemaContext.primaryDatasource?.activeProvider;
229
231
  process.stdout.write(
230
232
  `
231
233
  ${rocketEmoji}${provider === "mongodb" ? migrationSuccessMongoMessage : migrationSuccessStdMessage} ${migrationTimeMessage}
232
234
  `
233
235
  );
234
236
  }
235
- if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
236
- await migrate.tryToRunGenerate(datasourceInfo);
237
- }
238
237
  return ``;
239
238
  }
240
239
  help(error) {
@@ -16,16 +16,13 @@ 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_2FXU5NZQ_exports = {};
20
- __export(chunk_2FXU5NZQ_exports, {
19
+ var chunk_QOPTDDIH_exports = {};
20
+ __export(chunk_QOPTDDIH_exports, {
21
21
  printDatasource: () => printDatasource
22
22
  });
23
- module.exports = __toCommonJS(chunk_2FXU5NZQ_exports);
23
+ module.exports = __toCommonJS(chunk_QOPTDDIH_exports);
24
24
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
25
- function printDatasource({
26
- datasourceInfo,
27
- adapter
28
- }) {
25
+ function printDatasource({ datasourceInfo }) {
29
26
  if (!datasourceInfo.name || !datasourceInfo.prettyProvider) return;
30
27
  let message = `Datasource "${datasourceInfo.name}": ${datasourceInfo.prettyProvider} database`;
31
28
  if (datasourceInfo.dbName) {
@@ -36,9 +33,7 @@ function printDatasource({
36
33
  } else if (datasourceInfo.schema) {
37
34
  message += `, schema "${datasourceInfo.schema}"`;
38
35
  }
39
- if (adapter) {
40
- message += ` using driver adapter "${adapter.adapterName}"`;
41
- } else if (datasourceInfo.dbLocation) {
36
+ if (datasourceInfo.dbLocation) {
42
37
  message += ` at "${datasourceInfo.dbLocation}"`;
43
38
  }
44
39
  process.stdout.write((0, import_chunk_SKRR5WT4.dim)(message) + "\n");