@prisma/migrate 6.19.0-integration-next.22 → 6.19.0

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 (52) hide show
  1. package/dist/Migrate.js +3 -3
  2. package/dist/bin.js +28 -27
  3. package/dist/{chunk-KWS3KTC2.js → chunk-3AKRTEIK.js} +11 -10
  4. package/dist/{chunk-QXGJ64OM.js → chunk-6ORQRJLP.js} +53 -18
  5. package/dist/{chunk-TCBZUTEL.js → chunk-7TVX3D4W.js} +65 -27
  6. package/dist/{chunk-UBJBWA5R.js → chunk-BHJMJSM4.js} +7 -6
  7. package/dist/{chunk-WF7UXKO5.js → chunk-D4TRX77Y.js} +9 -6
  8. package/dist/{chunk-V5D5NSLS.js → chunk-D6LYHB65.js} +25 -33
  9. package/dist/{chunk-SWKWTYSR.js → chunk-F2XCBEZ4.js} +13 -10
  10. package/dist/{chunk-Y66LIIF7.js → chunk-J33EXHZB.js} +12 -9
  11. package/dist/{chunk-LNQIFWXN.js → chunk-NB4FRYRQ.js} +5 -5
  12. package/dist/{chunk-PYQR4PVV.js → chunk-O35BTK6Y.js} +13 -9
  13. package/dist/{chunk-FRY7T46S.js → chunk-OP2BDF75.js} +11 -10
  14. package/dist/{chunk-L7EZFBB4.js → chunk-PHXLQVPT.js} +68 -40
  15. package/dist/{chunk-XA2JOJS2.js → chunk-QVMYNWAN.js} +70 -157
  16. package/dist/{chunk-SJKDB5VT.js → chunk-R4IWP35Z.js} +9 -8
  17. package/dist/chunk-RR6BKMNO.js +80 -0
  18. package/dist/{chunk-5VRSNV7F.js → chunk-TW22Y3AA.js} +7 -6
  19. package/dist/{chunk-T2ACIU5M.js → chunk-VU5BLQUI.js} +8 -14
  20. package/dist/{chunk-JX2HIV7V.js → chunk-VV4M6AN7.js} +10 -10
  21. package/dist/{chunk-GY34KW2I.js → chunk-Z27SI4AV.js} +4 -6
  22. package/dist/{chunk-FWKRNLVM.js → chunk-ZTIS675B.js} +82 -68
  23. package/dist/commands/DbDrop.js +2 -2
  24. package/dist/commands/DbExecute.js +4 -4
  25. package/dist/commands/DbPull.js +6 -5
  26. package/dist/commands/DbPush.js +4 -4
  27. package/dist/commands/DbSeed.js +3 -3
  28. package/dist/commands/MigrateDeploy.js +4 -4
  29. package/dist/commands/MigrateDev.js +5 -5
  30. package/dist/commands/MigrateDiff.js +4 -4
  31. package/dist/commands/MigrateReset.js +5 -5
  32. package/dist/commands/MigrateResolve.js +4 -4
  33. package/dist/commands/MigrateStatus.js +4 -4
  34. package/dist/index.js +32 -31
  35. package/dist/internals/src/cli/getSchema.d.ts +15 -1
  36. package/dist/migrate/src/Migrate.d.ts +2 -1
  37. package/dist/migrate/src/utils/introspectSql.d.ts +1 -2
  38. package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +2 -0
  39. package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +1 -0
  40. package/dist/migrate/src/utils/seed.d.ts +6 -0
  41. package/dist/utils/getDatabaseVersionSafe.js +4 -4
  42. package/dist/utils/introspectSql.js +4 -4
  43. package/dist/utils/replaceOrAddDatasource.js +25 -0
  44. package/dist/utils/replaceOrAddDatasource.test.js +207 -0
  45. package/dist/utils/seed.js +3 -2
  46. package/dist/utils/setupCockroach.js +2 -2
  47. package/dist/utils/setupMSSQL.js +30480 -31090
  48. package/dist/utils/setupMongo.js +768 -2048
  49. package/dist/utils/setupPostgres.js +2 -2
  50. package/dist/utils/spinner.js +3 -3
  51. package/package.json +11 -11
  52. package/dist/open-GFNXULGD.js +0 -593
@@ -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_V5D5NSLS_exports = {};
30
- __export(chunk_V5D5NSLS_exports, {
29
+ var chunk_D6LYHB65_exports = {};
30
+ __export(chunk_D6LYHB65_exports, {
31
31
  Migrate: () => Migrate
32
32
  });
33
- module.exports = __toCommonJS(chunk_V5D5NSLS_exports);
34
- var import_chunk_JX2HIV7V = require("./chunk-JX2HIV7V.js");
33
+ module.exports = __toCommonJS(chunk_D6LYHB65_exports);
35
34
  var import_chunk_T64SUJ5L = require("./chunk-T64SUJ5L.js");
35
+ var import_chunk_VV4M6AN7 = require("./chunk-VV4M6AN7.js");
36
36
  var import_chunk_GGA2F64G = require("./chunk-GGA2F64G.js");
37
37
  var import_chunk_23DZXSTI = require("./chunk-23DZXSTI.js");
38
38
  var import_chunk_22YP3RXZ = require("./chunk-22YP3RXZ.js");
@@ -46,11 +46,9 @@ var import_node_process = __toESM(require("node:process"));
46
46
  var import_node_process2 = __toESM(require("node:process"));
47
47
  var base_exports = {};
48
48
  (0, import_chunk_2ESYSVXG.__export)(base_exports, {
49
- ConEmu: () => ConEmu,
50
49
  beep: () => beep,
51
50
  clearScreen: () => clearScreen,
52
51
  clearTerminal: () => clearTerminal,
53
- clearViewport: () => clearViewport,
54
52
  cursorBackward: () => cursorBackward,
55
53
  cursorDown: () => cursorDown,
56
54
  cursorForward: () => cursorForward,
@@ -78,8 +76,7 @@ var base_exports = {};
78
76
  image: () => image,
79
77
  link: () => link,
80
78
  scrollDown: () => scrollDown,
81
- scrollUp: () => scrollUp,
82
- setCwd: () => setCwd
79
+ scrollUp: () => scrollUp
83
80
  });
84
81
  var isBrowser = globalThis.window?.document !== void 0;
85
82
  var isNode = globalThis.process?.versions?.node !== void 0;
@@ -163,7 +160,6 @@ var eraseScreen = ESC + "2J";
163
160
  var scrollUp = ESC + "S";
164
161
  var scrollDown = ESC + "T";
165
162
  var clearScreen = "\x1Bc";
166
- var clearViewport = `${eraseScreen}${ESC}H`;
167
163
  var clearTerminal = isWindows2 ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
168
164
  var enterAlternativeScreen = ESC + "?1049h";
169
165
  var exitAlternativeScreen = ESC + "?1049l";
@@ -193,8 +189,7 @@ var image = (data, options = {}) => {
193
189
  if (options.preserveAspectRatio === false) {
194
190
  returnValue += ";preserveAspectRatio=0";
195
191
  }
196
- const imageBuffer = Buffer.from(data);
197
- return returnValue + `;size=${imageBuffer.byteLength}:` + imageBuffer.toString("base64") + BEL;
192
+ return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
198
193
  };
199
194
  var iTerm = {
200
195
  setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
@@ -215,10 +210,6 @@ var iTerm = {
215
210
  return returnValue + BEL;
216
211
  }
217
212
  };
218
- var ConEmu = {
219
- setCwd: (cwd = cwdFunction()) => `${OSC}9;9;${cwd}${BEL}`
220
- };
221
- var setCwd = (cwd = cwdFunction()) => iTerm.setCwd(cwd) + ConEmu.setCwd(cwd);
222
213
  var ANSI_BACKGROUND_OFFSET = 10;
223
214
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
224
215
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -317,7 +308,7 @@ function assembleStyles() {
317
308
  styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
318
309
  Object.defineProperties(styles, {
319
310
  rgbToAnsi256: {
320
- value(red, green, blue) {
311
+ value: (red, green, blue) => {
321
312
  if (red === green && green === blue) {
322
313
  if (red < 8) {
323
314
  return 16;
@@ -332,7 +323,7 @@ function assembleStyles() {
332
323
  enumerable: false
333
324
  },
334
325
  hexToRgb: {
335
- value(hex) {
326
+ value: (hex) => {
336
327
  const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
337
328
  if (!matches) {
338
329
  return [0, 0, 0];
@@ -357,7 +348,7 @@ function assembleStyles() {
357
348
  enumerable: false
358
349
  },
359
350
  ansi256ToAnsi: {
360
- value(code) {
351
+ value: (code) => {
361
352
  if (code < 8) {
362
353
  return 30 + code;
363
354
  }
@@ -415,14 +406,14 @@ var ANSI_SGR_TERMINATOR = "m";
415
406
  var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
416
407
  var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
417
408
  var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
418
- var wordLengths = (string) => string.split(" ").map((character) => (0, import_chunk_JX2HIV7V.stringWidth)(character));
409
+ var wordLengths = (string) => string.split(" ").map((character) => (0, import_chunk_VV4M6AN7.stringWidth)(character));
419
410
  var wrapWord = (rows, word, columns) => {
420
411
  const characters = [...word];
421
412
  let isInsideEscape = false;
422
413
  let isInsideLinkEscape = false;
423
- let visible = (0, import_chunk_JX2HIV7V.stringWidth)((0, import_chunk_JX2HIV7V.stripAnsi)(rows.at(-1)));
414
+ let visible = (0, import_chunk_VV4M6AN7.stringWidth)((0, import_chunk_VV4M6AN7.stripAnsi)(rows.at(-1)));
424
415
  for (const [index, character] of characters.entries()) {
425
- const characterLength = (0, import_chunk_JX2HIV7V.stringWidth)(character);
416
+ const characterLength = (0, import_chunk_VV4M6AN7.stringWidth)(character);
426
417
  if (visible + characterLength <= columns) {
427
418
  rows[rows.length - 1] += character;
428
419
  } else {
@@ -459,7 +450,7 @@ var stringVisibleTrimSpacesRight = (string) => {
459
450
  const words = string.split(" ");
460
451
  let last = words.length;
461
452
  while (last > 0) {
462
- if ((0, import_chunk_JX2HIV7V.stringWidth)(words[last - 1]) > 0) {
453
+ if ((0, import_chunk_VV4M6AN7.stringWidth)(words[last - 1]) > 0) {
463
454
  break;
464
455
  }
465
456
  last--;
@@ -482,7 +473,7 @@ var exec = (string, columns, options = {}) => {
482
473
  if (options.trim !== false) {
483
474
  rows[rows.length - 1] = rows.at(-1).trimStart();
484
475
  }
485
- let rowLength = (0, import_chunk_JX2HIV7V.stringWidth)(rows.at(-1));
476
+ let rowLength = (0, import_chunk_VV4M6AN7.stringWidth)(rows.at(-1));
486
477
  if (index !== 0) {
487
478
  if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
488
479
  rows.push("");
@@ -560,12 +551,11 @@ function isFullwidthCodePoint(codePoint) {
560
551
  if (!Number.isInteger(codePoint)) {
561
552
  return false;
562
553
  }
563
- return (0, import_chunk_JX2HIV7V.isFullWidth)(codePoint) || (0, import_chunk_JX2HIV7V.isWide)(codePoint);
554
+ return (0, import_chunk_VV4M6AN7.eastAsianWidth)(codePoint) === 2;
564
555
  }
565
556
  var ESCAPES2 = /* @__PURE__ */ new Set([27, 155]);
566
557
  var CODE_POINT_0 = "0".codePointAt(0);
567
558
  var CODE_POINT_9 = "9".codePointAt(0);
568
- var MAX_ANSI_SEQUENCE_LENGTH = 19;
569
559
  var endCodesSet = /* @__PURE__ */ new Set();
570
560
  var endCodesMap = /* @__PURE__ */ new Map();
571
561
  for (const [start, end] of ansi_styles_default.codes) {
@@ -599,7 +589,7 @@ function findNumberIndex(string) {
599
589
  return -1;
600
590
  }
601
591
  function parseAnsiCode(string, offset) {
602
- string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
592
+ string = string.slice(offset, offset + 19);
603
593
  const startIndex = findNumberIndex(string);
604
594
  if (startIndex !== -1) {
605
595
  let endIndex = string.indexOf("m", startIndex);
@@ -627,15 +617,15 @@ function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
627
617
  continue;
628
618
  }
629
619
  }
630
- const isFullWidth2 = isFullwidthCodePoint(codePoint);
620
+ const isFullWidth = isFullwidthCodePoint(codePoint);
631
621
  const character = String.fromCodePoint(codePoint);
632
622
  returnValue.push({
633
623
  type: "character",
634
624
  value: character,
635
- isFullWidth: isFullWidth2
625
+ isFullWidth
636
626
  });
637
627
  index += character.length;
638
- visibleCount += isFullWidth2 ? 2 : character.length;
628
+ visibleCount += isFullWidth ? 2 : character.length;
639
629
  if (visibleCount >= endCharacter) {
640
630
  break;
641
631
  }
@@ -697,7 +687,7 @@ var fitToTerminalHeight = (stream, text) => {
697
687
  const terminalHeight = stream.rows ?? defaultTerminalHeight;
698
688
  const lines = text.split("\n");
699
689
  const toRemove = Math.max(0, lines.length - terminalHeight);
700
- return toRemove ? sliceAnsi(text, (0, import_chunk_JX2HIV7V.stripAnsi)(lines.slice(0, toRemove).join("\n")).length + 1) : text;
690
+ return toRemove ? sliceAnsi(text, (0, import_chunk_VV4M6AN7.stripAnsi)(lines.slice(0, toRemove).join("\n")).length + 1) : text;
701
691
  };
702
692
  function createLogUpdate(stream, { showCursor = false } = {}) {
703
693
  let previousLineCount = 0;
@@ -710,7 +700,7 @@ function createLogUpdate(stream, { showCursor = false } = {}) {
710
700
  };
711
701
  const render = (...arguments_) => {
712
702
  if (!showCursor) {
713
- import_chunk_JX2HIV7V.cli_cursor_default.hide();
703
+ import_chunk_VV4M6AN7.cli_cursor_default.hide();
714
704
  }
715
705
  let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
716
706
  const width = getWidth(stream);
@@ -730,7 +720,7 @@ function createLogUpdate(stream, { showCursor = false } = {}) {
730
720
  render.done = () => {
731
721
  reset();
732
722
  if (!showCursor) {
733
- import_chunk_JX2HIV7V.cli_cursor_default.show();
723
+ import_chunk_VV4M6AN7.cli_cursor_default.show();
734
724
  }
735
725
  };
736
726
  return render;
@@ -884,8 +874,9 @@ var Migrate = class _Migrate {
884
874
  unexecutable
885
875
  };
886
876
  }
887
- async tryToRunGenerate() {
877
+ async tryToRunGenerate(datasourceInfo) {
888
878
  if (!this.schemaContext) throw new Error("this.schemaContext is undefined");
879
+ const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
889
880
  const message = [];
890
881
  process.stdout.write("\n");
891
882
  log_update_default(`Running generate... ${(0, import_chunk_SKRR5WT4.dim)("(Use --skip-generate to skip the generators)")}`);
@@ -893,6 +884,7 @@ var Migrate = class _Migrate {
893
884
  schemaContext: this.schemaContext,
894
885
  printDownloadProgress: true,
895
886
  version: import_engines_version.enginesVersion,
887
+ noEngine: skipEngines,
896
888
  registry: import_client_generator_registry.defaultRegistry.toInternal()
897
889
  });
898
890
  for (const generator of generators) {
@@ -26,11 +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_SWKWTYSR_exports = {};
30
- __export(chunk_SWKWTYSR_exports, {
29
+ var chunk_F2XCBEZ4_exports = {};
30
+ __export(chunk_F2XCBEZ4_exports, {
31
31
  MigrateDev: () => MigrateDev
32
32
  });
33
- module.exports = __toCommonJS(chunk_SWKWTYSR_exports);
33
+ module.exports = __toCommonJS(chunk_F2XCBEZ4_exports);
34
34
  var import_chunk_C3722PDA = require("./chunk-C3722PDA.js");
35
35
  var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
36
36
  var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
@@ -38,8 +38,8 @@ var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
38
38
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
39
39
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
40
40
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
41
- var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
42
- var import_chunk_V5D5NSLS = require("./chunk-V5D5NSLS.js");
41
+ var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
42
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
43
43
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
44
44
  var import_node_path = __toESM(require("node:path"));
45
45
  var import_debug = __toESM(require("@prisma/debug"));
@@ -52,7 +52,7 @@ var MigrateDev = class _MigrateDev {
52
52
  }
53
53
  static help = (0, import_internals.format)(`
54
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
-
55
+
56
56
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
57
57
 
58
58
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev [options]
@@ -100,6 +100,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
100
100
  if (args["--help"]) {
101
101
  return this.help();
102
102
  }
103
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
103
104
  const schemaContext = await (0, import_internals.loadSchemaContext)({
104
105
  schemaPathFromArg: args["--schema"],
105
106
  schemaPathFromConfig: config.schema,
@@ -123,7 +124,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
123
124
  externalTables: config.tables?.external ?? [],
124
125
  externalEnums: config.enums?.external ?? []
125
126
  };
126
- const migrate = await import_chunk_V5D5NSLS.Migrate.setup({
127
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
127
128
  schemaEngineConfig: config,
128
129
  migrationsDirPath,
129
130
  schemaContext,
@@ -280,15 +281,17 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
280
281
  );
281
282
  }
282
283
  if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
283
- await migrate.tryToRunGenerate();
284
+ await migrate.tryToRunGenerate(datasourceInfo);
284
285
  process.stdout.write("\n");
285
286
  }
286
287
  if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
287
288
  try {
288
- const seedCommand = config.migrations?.seed;
289
+ const seedCommandFromPrismaConfig = config.migrations?.seed;
290
+ const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
291
+ const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
289
292
  if (seedCommand) {
290
293
  process.stdout.write("\n");
291
- const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand });
294
+ const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand });
292
295
  if (successfulSeeding) {
293
296
  process.stdout.write(`
294
297
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
@@ -26,18 +26,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_Y66LIIF7_exports = {};
30
- __export(chunk_Y66LIIF7_exports, {
29
+ var chunk_J33EXHZB_exports = {};
30
+ __export(chunk_J33EXHZB_exports, {
31
31
  MigrateReset: () => MigrateReset
32
32
  });
33
- module.exports = __toCommonJS(chunk_Y66LIIF7_exports);
33
+ module.exports = __toCommonJS(chunk_J33EXHZB_exports);
34
34
  var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
35
35
  var import_chunk_FBDQVK4W = require("./chunk-FBDQVK4W.js");
36
36
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
37
37
  var import_chunk_2FXU5NZQ = require("./chunk-2FXU5NZQ.js");
38
38
  var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
39
- var import_chunk_L7EZFBB4 = require("./chunk-L7EZFBB4.js");
40
- var import_chunk_V5D5NSLS = require("./chunk-V5D5NSLS.js");
39
+ var import_chunk_PHXLQVPT = require("./chunk-PHXLQVPT.js");
40
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
41
41
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
42
42
  var import_internals = require("@prisma/internals");
43
43
  var import_prompts = __toESM(require("prompts"));
@@ -90,6 +90,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
90
90
  if (args["--help"]) {
91
91
  return this.help();
92
92
  }
93
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
93
94
  const schemaContext = await (0, import_internals.loadSchemaContext)({
94
95
  schemaPathFromArg: args["--schema"],
95
96
  schemaPathFromConfig: config.schema,
@@ -127,7 +128,7 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
127
128
  externalTables: config.tables?.external ?? [],
128
129
  externalEnums: config.enums?.external ?? []
129
130
  };
130
- const migrate = await import_chunk_V5D5NSLS.Migrate.setup({
131
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({
131
132
  schemaEngineConfig: config,
132
133
  migrationsDirPath,
133
134
  schemaContext,
@@ -159,13 +160,15 @@ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)("migrations", migrationI
159
160
  );
160
161
  }
161
162
  if (!process.env.PRISMA_MIGRATE_SKIP_GENERATE && !args["--skip-generate"]) {
162
- await migrate.tryToRunGenerate();
163
+ await migrate.tryToRunGenerate(datasourceInfo);
163
164
  }
164
165
  if (!process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
165
- const seedCommand = config.migrations?.seed;
166
+ const seedCommandFromPrismaConfig = config.migrations?.seed;
167
+ const seedCommandFromPkgJson = await (0, import_chunk_PHXLQVPT.getSeedCommandFromPackageJson)(process.cwd());
168
+ const seedCommand = seedCommandFromPrismaConfig ?? seedCommandFromPkgJson;
166
169
  if (seedCommand) {
167
170
  process.stdout.write("\n");
168
- const successfulSeeding = await (0, import_chunk_L7EZFBB4.executeSeedCommand)({ commandFromConfig: seedCommand });
171
+ const successfulSeeding = await (0, import_chunk_PHXLQVPT.executeSeedCommand)({ commandFromConfig: seedCommand });
169
172
  if (successfulSeeding) {
170
173
  process.stdout.write(`
171
174
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
@@ -26,19 +26,19 @@ 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_LNQIFWXN_exports = {};
30
- __export(chunk_LNQIFWXN_exports, {
29
+ var chunk_NB4FRYRQ_exports = {};
30
+ __export(chunk_NB4FRYRQ_exports, {
31
31
  getDatabaseVersionSafe: () => getDatabaseVersionSafe
32
32
  });
33
- module.exports = __toCommonJS(chunk_LNQIFWXN_exports);
34
- var import_chunk_V5D5NSLS = require("./chunk-V5D5NSLS.js");
33
+ module.exports = __toCommonJS(chunk_NB4FRYRQ_exports);
34
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
35
35
  var import_debug = __toESM(require("@prisma/debug"));
36
36
  var debug = (0, import_debug.default)("prisma:cli");
37
37
  async function getDatabaseVersionSafe(args) {
38
38
  let migrate;
39
39
  let dbVersion;
40
40
  try {
41
- migrate = await import_chunk_V5D5NSLS.Migrate.setup({});
41
+ migrate = await import_chunk_D6LYHB65.Migrate.setup({});
42
42
  dbVersion = await migrate.engine.getDatabaseVersion(args);
43
43
  } catch (e) {
44
44
  debug(e);
@@ -16,14 +16,15 @@ 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_PYQR4PVV_exports = {};
20
- __export(chunk_PYQR4PVV_exports, {
19
+ var chunk_O35BTK6Y_exports = {};
20
+ __export(chunk_O35BTK6Y_exports, {
21
21
  introspectSql: () => introspectSql
22
22
  });
23
- module.exports = __toCommonJS(chunk_PYQR4PVV_exports);
24
- var import_chunk_V5D5NSLS = require("./chunk-V5D5NSLS.js");
23
+ module.exports = __toCommonJS(chunk_O35BTK6Y_exports);
24
+ var import_chunk_D6LYHB65 = require("./chunk-D6LYHB65.js");
25
+ var import_internals = require("@prisma/internals");
25
26
  var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
26
- async function introspectSql(schemaContext, config, queries) {
27
+ async function introspectSql(schemaContext, queries) {
27
28
  if (!isTypedSqlEnabled(schemaContext.generators)) {
28
29
  throw new Error(`\`typedSql\` preview feature needs to be enabled in ${schemaContext.loadedFromPathForLogMessages}`);
29
30
  }
@@ -34,16 +35,19 @@ async function introspectSql(schemaContext, config, queries) {
34
35
  if (!supportedProviders.includes(firstDatasource.activeProvider)) {
35
36
  throw new Error(`Typed SQL is supported only for ${supportedProviders.join(", ")} providers`);
36
37
  }
37
- if (config.engine !== "classic") {
38
- throw new Error("TypedSQL currently requires classic engine");
38
+ const url = (0, import_internals.getEffectiveUrl)(firstDatasource).value;
39
+ if (!url) {
40
+ throw new Error(
41
+ `Could not get url from datasource ${firstDatasource.name} in ${schemaContext.loadedFromPathForLogMessages}`
42
+ );
39
43
  }
40
- const migrate = await import_chunk_V5D5NSLS.Migrate.setup({ schemaContext, schemaEngineConfig: config });
44
+ const migrate = await import_chunk_D6LYHB65.Migrate.setup({ schemaContext });
41
45
  const schemaEngine = migrate.engine;
42
46
  const results = [];
43
47
  const errors = [];
44
48
  try {
45
49
  for (const query of queries) {
46
- const queryResult = await introspectSingleQuery(schemaEngine, config.datasource.url, query);
50
+ const queryResult = await introspectSingleQuery(schemaEngine, url, query);
47
51
  if (queryResult.ok) {
48
52
  results.push(queryResult.result);
49
53
  } else {
@@ -16,12 +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_FRY7T46S_exports = {};
20
- __export(chunk_FRY7T46S_exports, {
19
+ var chunk_OP2BDF75_exports = {};
20
+ __export(chunk_OP2BDF75_exports, {
21
21
  require_ms: () => require_ms,
22
- require_src: () => require_src
22
+ require_src: () => require_src,
23
+ require_supports_color: () => require_supports_color
23
24
  });
24
- module.exports = __toCommonJS(chunk_FRY7T46S_exports);
25
+ module.exports = __toCommonJS(chunk_OP2BDF75_exports);
25
26
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
26
27
  var require_ms = (0, import_chunk_2ESYSVXG.__commonJS)({
27
28
  "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module2) {
@@ -139,7 +140,7 @@ var require_ms = (0, import_chunk_2ESYSVXG.__commonJS)({
139
140
  }
140
141
  });
141
142
  var require_common = (0, import_chunk_2ESYSVXG.__commonJS)({
142
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js"(exports, module2) {
143
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports, module2) {
143
144
  "use strict";
144
145
  function setup(env) {
145
146
  createDebug.debug = createDebug;
@@ -241,7 +242,7 @@ var require_common = (0, import_chunk_2ESYSVXG.__commonJS)({
241
242
  createDebug.namespaces = namespaces;
242
243
  createDebug.names = [];
243
244
  createDebug.skips = [];
244
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
245
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
245
246
  for (const ns of split) {
246
247
  if (ns[0] === "-") {
247
248
  createDebug.skips.push(ns.slice(1));
@@ -315,7 +316,7 @@ var require_common = (0, import_chunk_2ESYSVXG.__commonJS)({
315
316
  }
316
317
  });
317
318
  var require_browser = (0, import_chunk_2ESYSVXG.__commonJS)({
318
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js"(exports, module2) {
319
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports, module2) {
319
320
  "use strict";
320
321
  exports.formatArgs = formatArgs;
321
322
  exports.save = save;
@@ -458,7 +459,7 @@ var require_browser = (0, import_chunk_2ESYSVXG.__commonJS)({
458
459
  function load() {
459
460
  let r;
460
461
  try {
461
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
462
+ r = exports.storage.getItem("debug");
462
463
  } catch (error) {
463
464
  }
464
465
  if (!r && typeof process !== "undefined" && "env" in process) {
@@ -607,7 +608,7 @@ var require_supports_color = (0, import_chunk_2ESYSVXG.__commonJS)({
607
608
  }
608
609
  });
609
610
  var require_node = (0, import_chunk_2ESYSVXG.__commonJS)({
610
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js"(exports, module2) {
611
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports, module2) {
611
612
  "use strict";
612
613
  var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
613
614
  var util = (0, import_chunk_2ESYSVXG.__require)("util");
@@ -780,7 +781,7 @@ var require_node = (0, import_chunk_2ESYSVXG.__commonJS)({
780
781
  }
781
782
  });
782
783
  var require_src = (0, import_chunk_2ESYSVXG.__commonJS)({
783
- "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js"(exports, module2) {
784
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports, module2) {
784
785
  "use strict";
785
786
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
786
787
  module2.exports = require_browser();