@prisma/migrate 5.23.0-integration-engines-5-23-0-8-integration-include-field-native-type-data-to-dmmf-f616ccc38c3d791e452ebd52f830a7fad0161650.2 → 5.23.0-integration-engines-5-23-0-17-implicit-m2m-id-701e194f51e12fda9d113117e2c8300f554160d3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) 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-IS2AYOEI.js → chunk-3SNQUH74.js} +63 -145
  6. package/dist/{chunk-ZLGLVUFD.js → chunk-E2XKFV2C.js} +8 -8
  7. package/dist/{chunk-XVL5RF2T.js → chunk-GUBDW6S7.js} +11 -11
  8. package/dist/{chunk-BAVMZZAR.js → chunk-HODZFC64.js} +7 -7
  9. package/dist/{chunk-BAFPAACN.js → chunk-ILJRJJ3S.js} +4 -4
  10. package/dist/{chunk-LLGEQ76N.js → chunk-ILQWQHQO.js} +11 -11
  11. package/dist/{chunk-76XWADEV.js → chunk-KEPR65SW.js} +6 -6
  12. package/dist/{chunk-MWEO3VUS.js → chunk-LJOMIPJW.js} +7 -7
  13. package/dist/{chunk-GJN3CSXW.js → chunk-NKL64AIB.js} +6 -6
  14. package/dist/{chunk-VWV2NY26.js → chunk-NKQGJ3AE.js} +7 -3
  15. package/dist/{chunk-Z42EGZQH.js → chunk-NS6WV5WI.js} +64 -146
  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-UJWMQPUH.js → chunk-X6GGREJW.js} +6 -6
  21. package/dist/{chunk-WIZM7TFT.js → chunk-YKUZUAXA.js} +443 -55
  22. package/dist/{chunk-YOW3VBYS.js → chunk-Z4OLB2H4.js} +6 -6
  23. package/dist/commands/DbExecute.js +5 -5
  24. package/dist/commands/DbPull.js +6 -6
  25. package/dist/commands/DbPush.js +5 -5
  26. package/dist/commands/DbSeed.js +4 -5
  27. package/dist/commands/MigrateDeploy.js +5 -5
  28. package/dist/commands/MigrateDev.js +6 -7
  29. package/dist/commands/MigrateDiff.js +6 -7
  30. package/dist/commands/MigrateReset.js +6 -7
  31. package/dist/commands/MigrateResolve.js +5 -5
  32. package/dist/commands/MigrateStatus.js +5 -5
  33. package/dist/index.js +45 -46
  34. package/dist/internals/src/utils/isCurrentBinInstalledGlobally.d.ts +1 -1
  35. package/dist/{multipart-parser-KKECAI5D.js → multipart-parser-73VM3J4A.js} +10 -7
  36. package/dist/{multipart-parser-47FFAP42-P3F6TPHJ.js → multipart-parser-ITART6UP-FFJAMHWE.js} +25 -22
  37. package/dist/utils/getDatabaseVersionSafe.js +4 -4
  38. package/dist/utils/introspectSql.js +3 -3
  39. package/dist/utils/removeSchemaFiles.js +3 -3
  40. package/dist/utils/saveSchemaFiles.js +3 -3
  41. package/dist/utils/seed.js +6 -7
  42. package/dist/utils/setupMSSQL.js +49 -46
  43. package/dist/utils/setupMongo.js +23081 -21199
  44. package/dist/utils/setupMysql.js +45 -0
  45. package/package.json +12 -13
  46. package/dist/chunk-EFPE3Q7J.js +0 -424
  47. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.d.ts +0 -9
@@ -26,39 +26,38 @@ 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_Z42EGZQH_exports = {};
30
- __export(chunk_Z42EGZQH_exports, {
29
+ var chunk_NS6WV5WI_exports = {};
30
+ __export(chunk_NS6WV5WI_exports, {
31
31
  MigrateDiff: () => MigrateDiff,
32
32
  init_MigrateDiff: () => init_MigrateDiff
33
33
  });
34
- module.exports = __toCommonJS(chunk_Z42EGZQH_exports);
35
- var import_chunk_VWV2NY26 = require("./chunk-VWV2NY26.js");
34
+ module.exports = __toCommonJS(chunk_NS6WV5WI_exports);
35
+ var import_chunk_NKQGJ3AE = require("./chunk-NKQGJ3AE.js");
36
36
  var import_chunk_XRTNIFND = require("./chunk-XRTNIFND.js");
37
37
  var import_chunk_TKAGMA5K = require("./chunk-TKAGMA5K.js");
38
- var import_chunk_WIZM7TFT = require("./chunk-WIZM7TFT.js");
39
- var import_chunk_MWEO3VUS = require("./chunk-MWEO3VUS.js");
38
+ var import_chunk_LJOMIPJW = require("./chunk-LJOMIPJW.js");
40
39
  var import_chunk_LVFPGUOH = require("./chunk-LVFPGUOH.js");
41
40
  var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
42
41
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
43
- var import_process = __toESM(require("process"));
44
- var import_promises = __toESM(require("fs/promises"));
45
- var import_url = require("url");
46
- var import_path = __toESM(require("path"));
47
- var import_url2 = require("url");
48
- var import_promises2 = __toESM(require("fs/promises"));
49
- var import_path2 = __toESM(require("path"));
50
- var import_path3 = __toESM(require("path"));
42
+ var import_node_process = __toESM(require("node:process"));
43
+ var import_promises = __toESM(require("node:fs/promises"));
44
+ var import_node_url = require("node:url");
45
+ var import_node_path = __toESM(require("node:path"));
46
+ var import_node_url2 = require("node:url");
47
+ var import_promises2 = __toESM(require("node:fs/promises"));
48
+ var import_node_path2 = __toESM(require("node:path"));
49
+ var import_node_path3 = __toESM(require("node:path"));
51
50
  var import_prisma_schema_wasm = __toESM(require("@prisma/prisma-schema-wasm"));
52
- var import_path4 = __toESM(require("path"));
51
+ var import_node_path4 = __toESM(require("node:path"));
53
52
  var import_debug = __toESM(require("@prisma/debug"));
54
53
  var import_get_platform = require("@prisma/get-platform");
55
54
  var import_debug2 = require("@prisma/debug");
56
55
  var import_fs = __toESM(require("fs"));
57
- var import_path5 = __toESM(require("path"));
56
+ var import_path = __toESM(require("path"));
58
57
  var import_util = require("util");
59
58
  var import_debug3 = __toESM(require("@prisma/debug"));
60
59
  var import_internals = require("@prisma/internals");
61
- var import_path6 = __toESM(require("path"));
60
+ var import_path2 = __toESM(require("path"));
62
61
  var require_promisify = (0, import_chunk_WWAWV7DQ.__commonJS)({
63
62
  "../../node_modules/.pnpm/fs-jetpack@5.1.0/node_modules/fs-jetpack/lib/utils/promisify.js"(exports, module2) {
64
63
  "use strict";
@@ -1615,6 +1614,7 @@ var require_minimatch = (0, import_chunk_WWAWV7DQ.__commonJS)({
1615
1614
  continue;
1616
1615
  }
1617
1616
  switch (c) {
1617
+ /* istanbul ignore next */
1618
1618
  case "/": {
1619
1619
  return false;
1620
1620
  }
@@ -1622,6 +1622,8 @@ var require_minimatch = (0, import_chunk_WWAWV7DQ.__commonJS)({
1622
1622
  clearStateChar();
1623
1623
  escaping = true;
1624
1624
  continue;
1625
+ // the various stateChar values
1626
+ // for the "extglob" stuff.
1625
1627
  case "?":
1626
1628
  case "*":
1627
1629
  case "+":
@@ -1681,6 +1683,7 @@ var require_minimatch = (0, import_chunk_WWAWV7DQ.__commonJS)({
1681
1683
  clearStateChar();
1682
1684
  re += "|";
1683
1685
  continue;
1686
+ // these are mostly the same in regexp and glob
1684
1687
  case "[":
1685
1688
  clearStateChar();
1686
1689
  if (inClass) {
@@ -5395,9 +5398,9 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
5395
5398
  usesPrismaSchemaFolder: () => usesPrismaSchemaFolder2
5396
5399
  });
5397
5400
  module2.exports = __toCommonJS2(src_exports);
5398
- var import_node_path22 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("path"));
5401
+ var import_node_path22 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("node:path"));
5399
5402
  var import_prisma_schema_wasm2 = (0, import_chunk_WWAWV7DQ.__require)("@prisma/prisma-schema-wasm");
5400
- var import_node_path5 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("path"));
5403
+ var import_node_path5 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("node:path"));
5401
5404
  function createFileNameToKeyMapper(options) {
5402
5405
  if (options.caseSensitive) {
5403
5406
  return (fileName) => fileName;
@@ -5622,15 +5625,15 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
5622
5625
  }
5623
5626
  });
5624
5627
  async function findUp(name, {
5625
- cwd = import_process.default.cwd(),
5628
+ cwd = import_node_process.default.cwd(),
5626
5629
  type = "file",
5627
5630
  stopAt
5628
5631
  } = {}) {
5629
- let directory = import_path.default.resolve(toPath(cwd) ?? "");
5630
- const { root } = import_path.default.parse(directory);
5631
- stopAt = import_path.default.resolve(directory, toPath(stopAt ?? root));
5632
+ let directory = import_node_path.default.resolve(toPath(cwd) ?? "");
5633
+ const { root } = import_node_path.default.parse(directory);
5634
+ stopAt = import_node_path.default.resolve(directory, toPath(stopAt ?? root));
5632
5635
  while (directory && directory !== stopAt && directory !== root) {
5633
- const filePath = import_path.default.isAbsolute(name) ? name : import_path.default.join(directory, name);
5636
+ const filePath = import_node_path.default.isAbsolute(name) ? name : import_node_path.default.join(directory, name);
5634
5637
  try {
5635
5638
  const stats = await import_promises.default.stat(filePath);
5636
5639
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
@@ -5638,14 +5641,14 @@ async function findUp(name, {
5638
5641
  }
5639
5642
  } catch {
5640
5643
  }
5641
- directory = import_path.default.dirname(directory);
5644
+ directory = import_node_path.default.dirname(directory);
5642
5645
  }
5643
5646
  }
5644
5647
  var toPath;
5645
5648
  var init_find_up_simple = (0, import_chunk_WWAWV7DQ.__esm)({
5646
5649
  "../../node_modules/.pnpm/find-up-simple@1.0.0/node_modules/find-up-simple/index.js"() {
5647
5650
  "use strict";
5648
- toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_url.fileURLToPath)(urlOrPath) : urlOrPath;
5651
+ toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
5649
5652
  }
5650
5653
  });
5651
5654
  var require_js_tokens = (0, import_chunk_WWAWV7DQ.__commonJS)({
@@ -9917,8 +9920,8 @@ var require_typos = (0, import_chunk_WWAWV7DQ.__commonJS)({
9917
9920
  var require_fixer = (0, import_chunk_WWAWV7DQ.__commonJS)({
9918
9921
  "../../node_modules/.pnpm/normalize-package-data@6.0.0/node_modules/normalize-package-data/lib/fixer.js"(exports, module2) {
9919
9922
  "use strict";
9920
- var isValidSemver = (0, import_chunk_VWV2NY26.require_valid)();
9921
- var cleanSemver = (0, import_chunk_VWV2NY26.require_clean)();
9923
+ var isValidSemver = (0, import_chunk_NKQGJ3AE.require_valid)();
9924
+ var cleanSemver = (0, import_chunk_NKQGJ3AE.require_clean)();
9922
9925
  var validateLicense = require_validate_npm_package_license();
9923
9926
  var hostedGitInfo = require_lib5();
9924
9927
  var isBuiltinModule = require_is_core_module();
@@ -10466,7 +10469,7 @@ var init_default = (0, import_chunk_WWAWV7DQ.__esm)({
10466
10469
  }
10467
10470
  });
10468
10471
  function toPath2(urlOrPath) {
10469
- return urlOrPath instanceof URL ? (0, import_url2.fileURLToPath)(urlOrPath) : urlOrPath;
10472
+ return urlOrPath instanceof URL ? (0, import_node_url2.fileURLToPath)(urlOrPath) : urlOrPath;
10470
10473
  }
10471
10474
  var init_node = (0, import_chunk_WWAWV7DQ.__esm)({
10472
10475
  "../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js"() {
@@ -10485,7 +10488,7 @@ var init_read_pkg = (0, import_chunk_WWAWV7DQ.__esm)({
10485
10488
  init_parse_json();
10486
10489
  import_normalize_package_data = (0, import_chunk_WWAWV7DQ.__toESM)(require_normalize(), 1);
10487
10490
  init_node();
10488
- getPackagePath = (cwd) => import_path2.default.resolve(toPath2(cwd) ?? ".", "package.json");
10491
+ getPackagePath = (cwd) => import_node_path2.default.resolve(toPath2(cwd) ?? ".", "package.json");
10489
10492
  _readPackage = (file, normalize) => {
10490
10493
  const json = typeof file === "string" ? parseJson(file) : file;
10491
10494
  if (normalize) {
@@ -10501,7 +10504,7 @@ async function readPackageUp(options) {
10501
10504
  return;
10502
10505
  }
10503
10506
  return {
10504
- packageJson: await readPackage({ ...options, cwd: import_path3.default.dirname(filePath) }),
10507
+ packageJson: await readPackage({ ...options, cwd: import_node_path3.default.dirname(filePath) }),
10505
10508
  path: filePath
10506
10509
  };
10507
10510
  }
@@ -10754,7 +10757,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
10754
10757
  "../internals/package.json"(exports, module2) {
10755
10758
  module2.exports = {
10756
10759
  name: "@prisma/internals",
10757
- version: "5.23.0-integration-engines-5-23-0-8-integration-include-field-native-type-data-to-dmmf-f616ccc38c3d791e452ebd52f830a7fad0161650.2",
10760
+ version: "5.23.0-integration-engines-5-23-0-17-implicit-m2m-id-701e194f51e12fda9d113117e2c8300f554160d3.1",
10758
10761
  description: "This package is intended for Prisma's internal use",
10759
10762
  main: "dist/index.js",
10760
10763
  types: "dist/index.d.ts",
@@ -10785,16 +10788,16 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
10785
10788
  "@babel/helper-validator-identifier": "7.24.7",
10786
10789
  "@opentelemetry/api": "1.9.0",
10787
10790
  "@swc/core": "1.2.204",
10788
- "@swc/jest": "0.2.36",
10791
+ "@swc/jest": "0.2.37",
10789
10792
  "@types/babel__helper-validator-identifier": "7.15.2",
10790
- "@types/jest": "29.5.12",
10793
+ "@types/jest": "29.5.14",
10791
10794
  "@types/node": "18.19.31",
10792
10795
  "@types/resolve": "1.20.6",
10793
10796
  archiver: "6.0.2",
10794
10797
  "checkpoint-client": "1.1.33",
10795
10798
  "cli-truncate": "2.1.0",
10796
10799
  dotenv: "16.0.3",
10797
- esbuild: "0.23.0",
10800
+ esbuild: "0.24.0",
10798
10801
  "escape-string-regexp": "4.0.0",
10799
10802
  execa: "5.1.1",
10800
10803
  "fast-glob": "3.3.2",
@@ -10839,7 +10842,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
10839
10842
  "@prisma/fetch-engine": "workspace:*",
10840
10843
  "@prisma/generator-helper": "workspace:*",
10841
10844
  "@prisma/get-platform": "workspace:*",
10842
- "@prisma/prisma-schema-wasm": "5.23.0-8.integration-include-field-native-type-data-to-dmmf-f616ccc38c3d791e452ebd52f830a7fad0161650",
10845
+ "@prisma/prisma-schema-wasm": "5.23.0-17.implicit-m2m-id-701e194f51e12fda9d113117e2c8300f554160d3",
10843
10846
  "@prisma/schema-files-loader": "workspace:*",
10844
10847
  arg: "5.0.2",
10845
10848
  prompts: "2.4.2"
@@ -10899,7 +10902,7 @@ var init_errorHelpers = (0, import_chunk_WWAWV7DQ.__esm)({
10899
10902
  }
10900
10903
  });
10901
10904
  function relativizePathInPSLError(error) {
10902
- return error.replaceAll(process.cwd() + import_path4.default.sep, "");
10905
+ return error.replaceAll(process.cwd() + import_node_path4.default.sep, "");
10903
10906
  }
10904
10907
  var init_relativizePathInPSLError = (0, import_chunk_WWAWV7DQ.__esm)({
10905
10908
  "../internals/src/engine-commands/relativizePathInPSLError.ts"() {
@@ -11130,7 +11133,7 @@ async function readSchemaFromSingleFile(schemaPath) {
11130
11133
  const schemaTuple = [schemaPath, file];
11131
11134
  return {
11132
11135
  ok: true,
11133
- schema: { schemaPath, schemaRootDir: import_path5.default.dirname(schemaPath), schemas: [schemaTuple] }
11136
+ schema: { schemaPath, schemaRootDir: import_path.default.dirname(schemaPath), schemas: [schemaTuple] }
11134
11137
  };
11135
11138
  }
11136
11139
  async function readSchemaFromDirectory(schemaPath) {
@@ -11188,10 +11191,10 @@ async function readSchemaFromFileOrDirectory(schemaPath) {
11188
11191
  }
11189
11192
  async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName }) {
11190
11193
  if (schemaPathFromArgs) {
11191
- const absPath = import_path5.default.resolve(cwd, schemaPathFromArgs);
11194
+ const absPath = import_path.default.resolve(cwd, schemaPathFromArgs);
11192
11195
  const customSchemaResult = await readSchemaFromFileOrDirectory(absPath);
11193
11196
  if (!customSchemaResult.ok) {
11194
- const relPath = import_path5.default.relative(cwd, absPath);
11197
+ const relPath = import_path.default.relative(cwd, absPath);
11195
11198
  throw new Error(
11196
11199
  `Could not load \`${argumentName}\` from provided path \`${relPath}\`: ${renderLookupError(
11197
11200
  customSchemaResult.error
@@ -11208,14 +11211,9 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName
11208
11211
  if (defaultResult.ok) {
11209
11212
  return defaultResult;
11210
11213
  }
11211
- const yarnResult = await getSchemaFromYarn1Workspace(cwd, defaultResult.error.failures);
11212
- if (yarnResult.ok) {
11213
- return yarnResult;
11214
- }
11215
- const finalError = yarnResult.error.kind === "Yarn1WorkspaceSchemaNotFound" ? defaultResult.error : yarnResult.error;
11216
11214
  return {
11217
11215
  ok: false,
11218
- error: finalError
11216
+ error: defaultResult.error
11219
11217
  };
11220
11218
  }
11221
11219
  function renderLookupError(error) {
@@ -11242,7 +11240,7 @@ function renderDefaultLookupError(error, cwd) {
11242
11240
  for (const failure of error.failures) {
11243
11241
  const filePath = failure.rule.schemaPath.path;
11244
11242
  if (!printedPaths.has(failure.rule.schemaPath.path)) {
11245
- parts.push(`${import_path5.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
11243
+ parts.push(`${import_path.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
11246
11244
  printedPaths.add(filePath);
11247
11245
  }
11248
11246
  }
@@ -11269,20 +11267,20 @@ async function getSchemaFromPackageJson(cwd) {
11269
11267
  const schemaPathFromPkgJson = prismaConfig.data.schema;
11270
11268
  if (typeof schemaPathFromPkgJson !== "string") {
11271
11269
  throw new Error(
11272
- `Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path5.default.relative(
11270
+ `Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path.default.relative(
11273
11271
  cwd,
11274
11272
  prismaConfig.packagePath
11275
11273
  )}\` must be of type string`
11276
11274
  );
11277
11275
  }
11278
- const absoluteSchemaPath = import_path5.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path5.default.resolve(import_path5.default.dirname(prismaConfig.packagePath), schemaPathFromPkgJson);
11276
+ const absoluteSchemaPath = import_path.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path.default.resolve(import_path.default.dirname(prismaConfig.packagePath), schemaPathFromPkgJson);
11279
11277
  const lookupResult = await readSchemaFromFileOrDirectory(absoluteSchemaPath);
11280
11278
  if (!lookupResult.ok) {
11281
11279
  throw new Error(
11282
- `Could not load schema from \`${import_path5.default.relative(
11280
+ `Could not load schema from \`${import_path.default.relative(
11283
11281
  cwd,
11284
11282
  absoluteSchemaPath
11285
- )}\` provided by "prisma.schema" config of \`${import_path5.default.relative(
11283
+ )}\` provided by "prisma.schema" config of \`${import_path.default.relative(
11286
11284
  cwd,
11287
11285
  prismaConfig.packagePath
11288
11286
  )}\`: ${renderLookupError(lookupResult.error)}`
@@ -11290,71 +11288,30 @@ async function getSchemaFromPackageJson(cwd) {
11290
11288
  }
11291
11289
  return lookupResult;
11292
11290
  }
11293
- async function getSchemaFromYarn1Workspace(cwd, pastFailures) {
11294
- if (!process.env.npm_config_user_agent?.includes("yarn")) {
11295
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11296
- }
11297
- let workspaces;
11298
- try {
11299
- const { stdout: version2 } = await import_execa.default.command("yarn --version", {
11300
- cwd
11301
- });
11302
- if (version2.startsWith("2")) {
11303
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11304
- }
11305
- const { stdout } = await import_execa.default.command("yarn workspaces info --json", {
11306
- cwd
11307
- });
11308
- const json = getJson(stdout);
11309
- workspaces = Object.values(json);
11310
- } catch {
11311
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11312
- }
11313
- const workspaceRootDir = await findWorkspaceRoot(cwd);
11314
- if (!workspaceRootDir) {
11315
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11316
- }
11317
- for (const workspace of workspaces) {
11318
- const workspacePath = import_path5.default.join(workspaceRootDir, workspace.location);
11319
- const workspaceSchema = await tryWorkspacePath(workspacePath, pastFailures);
11320
- if (workspaceSchema.ok) {
11321
- return workspaceSchema;
11322
- }
11323
- }
11324
- const rootPathSchema = await tryWorkspacePath(workspaceRootDir, pastFailures);
11325
- return rootPathSchema;
11326
- }
11327
- async function tryWorkspacePath(cwd, pastFailures) {
11328
- const pkgJson = await getSchemaFromPackageJson(cwd);
11329
- if (pkgJson.ok) {
11330
- return pkgJson;
11331
- }
11332
- return getDefaultSchema(cwd, pastFailures);
11333
- }
11334
11291
  async function getDefaultSchema(cwd, failures = []) {
11335
11292
  const schemaPrisma = {
11336
11293
  schemaPath: {
11337
- path: import_path5.default.join(cwd, "schema.prisma"),
11294
+ path: import_path.default.join(cwd, "schema.prisma"),
11338
11295
  kind: "file"
11339
11296
  }
11340
11297
  };
11341
11298
  const prismaSchemaFile = {
11342
11299
  schemaPath: {
11343
- path: import_path5.default.join(cwd, "prisma", "schema.prisma"),
11300
+ path: import_path.default.join(cwd, "prisma", "schema.prisma"),
11344
11301
  kind: "file"
11345
11302
  },
11346
11303
  conflictsWith: {
11347
- path: import_path5.default.join(cwd, "prisma", "schema"),
11304
+ path: import_path.default.join(cwd, "prisma", "schema"),
11348
11305
  kind: "directory"
11349
11306
  }
11350
11307
  };
11351
11308
  const prismaSchemaFolder = {
11352
11309
  schemaPath: {
11353
- path: import_path5.default.join(cwd, "prisma", "schema"),
11310
+ path: import_path.default.join(cwd, "prisma", "schema"),
11354
11311
  kind: "directory"
11355
11312
  },
11356
11313
  conflictsWith: {
11357
- path: import_path5.default.join(cwd, "prisma", "schema.prisma"),
11314
+ path: import_path.default.join(cwd, "prisma", "schema.prisma"),
11358
11315
  kind: "file"
11359
11316
  }
11360
11317
  };
@@ -11370,7 +11327,7 @@ async function getDefaultSchema(cwd, failures = []) {
11370
11327
  const conflictingSchema = await loadSchemaFromDefaultLocation(rule.conflictsWith);
11371
11328
  if (conflictingSchema.ok) {
11372
11329
  throw new Error(
11373
- `Found Prisma Schemas at both \`${import_path5.default.relative(cwd, rule.schemaPath.path)}\` and \`${import_path5.default.relative(
11330
+ `Found Prisma Schemas at both \`${import_path.default.relative(cwd, rule.schemaPath.path)}\` and \`${import_path.default.relative(
11374
11331
  cwd,
11375
11332
  rule.conflictsWith.path
11376
11333
  )}\`. Please remove one.`
@@ -11395,50 +11352,11 @@ async function loadSchemaFromDefaultLocation(lookupPath) {
11395
11352
  return readSchemaFromDirectory(lookupPath.path);
11396
11353
  }
11397
11354
  }
11398
- function getJson(stdout) {
11399
- const firstCurly = stdout.indexOf("{");
11400
- const lastCurly = stdout.lastIndexOf("}");
11401
- const sliced = stdout.slice(firstCurly, lastCurly + 1);
11402
- return JSON.parse(sliced);
11403
- }
11404
- function isPkgJsonWorkspaceRoot(pkgJson) {
11405
- const workspaces = pkgJson.workspaces;
11406
- if (!workspaces) {
11407
- return false;
11408
- }
11409
- return Array.isArray(workspaces) || workspaces.packages !== void 0;
11410
- }
11411
- async function isNearestPkgJsonWorkspaceRoot(cwd) {
11412
- const pkgJson = await readPackageUp({ cwd, normalize: false });
11413
- if (!pkgJson) {
11414
- return null;
11415
- }
11416
- return {
11417
- isRoot: isPkgJsonWorkspaceRoot(pkgJson.packageJson),
11418
- path: pkgJson.path
11419
- };
11420
- }
11421
- async function findWorkspaceRoot(cwd) {
11422
- let pkgJson = await isNearestPkgJsonWorkspaceRoot(cwd);
11423
- if (!pkgJson) {
11424
- return null;
11425
- }
11426
- if (pkgJson.isRoot === true) {
11427
- return import_path5.default.dirname(pkgJson.path);
11428
- }
11429
- const pkgJsonParentDir = import_path5.default.dirname(import_path5.default.dirname(pkgJson.path));
11430
- pkgJson = await isNearestPkgJsonWorkspaceRoot(pkgJsonParentDir);
11431
- if (!pkgJson || pkgJson.isRoot === false) {
11432
- return null;
11433
- }
11434
- return import_path5.default.dirname(pkgJson.path);
11435
- }
11436
- var import_schema_files_loader, import_execa, readFile, stat, debug2;
11355
+ var import_schema_files_loader, readFile, stat, debug2;
11437
11356
  var init_getSchema = (0, import_chunk_WWAWV7DQ.__esm)({
11438
11357
  "../internals/src/cli/getSchema.ts"() {
11439
11358
  "use strict";
11440
11359
  import_schema_files_loader = (0, import_chunk_WWAWV7DQ.__toESM)(require_dist());
11441
- import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_WIZM7TFT.require_execa)());
11442
11360
  (0, import_chunk_6TE2RIPN.init_colors)();
11443
11361
  init_read_package_up();
11444
11362
  init_engine_commands();
@@ -11453,7 +11371,7 @@ var init_MigrateDiff = (0, import_chunk_WWAWV7DQ.__esm)({
11453
11371
  import_fs_jetpack = (0, import_chunk_WWAWV7DQ.__toESM)(require_main());
11454
11372
  (0, import_chunk_6TE2RIPN.init_colors)();
11455
11373
  init_getSchema();
11456
- (0, import_chunk_MWEO3VUS.init_Migrate)();
11374
+ (0, import_chunk_LJOMIPJW.init_Migrate)();
11457
11375
  (0, import_chunk_TKAGMA5K.init_captureStdout)();
11458
11376
  debug3 = (0, import_debug3.default)("prisma:migrate:diff");
11459
11377
  helpOptions = (0, import_internals.format)(
@@ -11558,7 +11476,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11558
11476
  };
11559
11477
  } else if (args["--from-schema-datasource"]) {
11560
11478
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--from-schema-datasource"], printMessage: false });
11561
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--from-schema-datasource"]), {
11479
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datasource"]), {
11562
11480
  argumentName: "--from-schema-datasource"
11563
11481
  });
11564
11482
  const config = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
@@ -11567,7 +11485,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11567
11485
  ...(0, import_internals.toSchemasWithConfigDir)(schema, config)
11568
11486
  };
11569
11487
  } else if (args["--from-schema-datamodel"]) {
11570
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--from-schema-datamodel"]), {
11488
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datamodel"]), {
11571
11489
  argumentName: "--from-schema-datamodel"
11572
11490
  });
11573
11491
  from = {
@@ -11582,7 +11500,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11582
11500
  } else if (args["--from-migrations"]) {
11583
11501
  from = {
11584
11502
  tag: "migrations",
11585
- path: import_path6.default.resolve(args["--from-migrations"])
11503
+ path: import_path2.default.resolve(args["--from-migrations"])
11586
11504
  };
11587
11505
  } else if (args["--from-local-d1"]) {
11588
11506
  const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
@@ -11598,7 +11516,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11598
11516
  };
11599
11517
  } else if (args["--to-schema-datasource"]) {
11600
11518
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--to-schema-datasource"], printMessage: false });
11601
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--to-schema-datasource"]), {
11519
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datasource"]), {
11602
11520
  argumentName: "--to-schema-datasource"
11603
11521
  });
11604
11522
  const config = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
@@ -11607,7 +11525,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11607
11525
  ...(0, import_internals.toSchemasWithConfigDir)(schema, config)
11608
11526
  };
11609
11527
  } else if (args["--to-schema-datamodel"]) {
11610
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--to-schema-datamodel"]), {
11528
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datamodel"]), {
11611
11529
  argumentName: "--to-schema-datamodel"
11612
11530
  });
11613
11531
  to = {
@@ -11622,7 +11540,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11622
11540
  } else if (args["--to-migrations"]) {
11623
11541
  to = {
11624
11542
  tag: "migrations",
11625
- path: import_path6.default.resolve(args["--to-migrations"])
11543
+ path: import_path2.default.resolve(args["--to-migrations"])
11626
11544
  };
11627
11545
  } else if (args["--to-local-d1"]) {
11628
11546
  const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--to-local-d1" });
@@ -11631,7 +11549,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
11631
11549
  url: `file:${d1Database}`
11632
11550
  };
11633
11551
  }
11634
- const migrate = new import_chunk_MWEO3VUS.Migrate();
11552
+ const migrate = new import_chunk_LJOMIPJW.Migrate();
11635
11553
  const captureStdout = new import_chunk_TKAGMA5K.CaptureStdout();
11636
11554
  const outputPath = args["--output"];
11637
11555
  const isOutputDefined = Boolean(outputPath);
@@ -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_XLLUFIQK_exports = {};
30
- __export(chunk_XLLUFIQK_exports, {
29
+ var chunk_PCJYN6LT_exports = {};
30
+ __export(chunk_PCJYN6LT_exports, {
31
31
  EngineError: () => EngineError,
32
32
  SchemaEngine: () => SchemaEngine,
33
33
  init_SchemaEngine: () => init_SchemaEngine
34
34
  });
35
- module.exports = __toCommonJS(chunk_XLLUFIQK_exports);
35
+ module.exports = __toCommonJS(chunk_PCJYN6LT_exports);
36
36
  var import_chunk_LVFPGUOH = require("./chunk-LVFPGUOH.js");
37
37
  var import_chunk_AAATUOV6 = require("./chunk-AAATUOV6.js");
38
38
  var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
39
39
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
40
- var import_path = __toESM(require("path"));
40
+ var import_node_path = __toESM(require("node:path"));
41
41
  var import_debug = __toESM(require("@prisma/debug"));
42
42
  var import_internals = require("@prisma/internals");
43
43
  var import_child_process = require("child_process");
@@ -174,7 +174,7 @@ var init_SchemaEngine = (0, import_chunk_WWAWV7DQ.__esm)({
174
174
  );
175
175
  const { views } = introspectResult;
176
176
  if (views) {
177
- const schemaPath = this.schemaPath ?? import_path.default.join(process.cwd(), "prisma");
177
+ const schemaPath = this.schemaPath ?? import_node_path.default.join(process.cwd(), "prisma");
178
178
  await (0, import_chunk_LVFPGUOH.handleViewsIO)({ views, schemaPath });
179
179
  }
180
180
  return introspectResult;
@@ -360,6 +360,7 @@ ${this.lastError?.backtrace ?? ""}`;
360
360
  case import_internals.SchemaEngineExitCode.Panic:
361
361
  handlePanic();
362
362
  break;
363
+ // treat unknown error codes as panics
363
364
  default:
364
365
  handlePanic();
365
366
  }
@@ -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_SV5GANSI_exports = {};
30
- __export(chunk_SV5GANSI_exports, {
29
+ var chunk_PFEH6ILG_exports = {};
30
+ __export(chunk_PFEH6ILG_exports, {
31
31
  MigrateStatus: () => MigrateStatus,
32
32
  init_MigrateStatus: () => init_MigrateStatus
33
33
  });
34
- module.exports = __toCommonJS(chunk_SV5GANSI_exports);
35
- var import_chunk_MWEO3VUS = require("./chunk-MWEO3VUS.js");
34
+ module.exports = __toCommonJS(chunk_PFEH6ILG_exports);
35
+ var import_chunk_LJOMIPJW = require("./chunk-LJOMIPJW.js");
36
36
  var import_chunk_EYA6AFSF = require("./chunk-EYA6AFSF.js");
37
37
  var import_chunk_Q7ACZDDT = require("./chunk-Q7ACZDDT.js");
38
38
  var import_chunk_KEBB7UIB = require("./chunk-KEBB7UIB.js");
@@ -44,7 +44,7 @@ var debug, _MigrateStatus, MigrateStatus;
44
44
  var init_MigrateStatus = (0, import_chunk_WWAWV7DQ.__esm)({
45
45
  "src/commands/MigrateStatus.ts"() {
46
46
  (0, import_chunk_6TE2RIPN.init_colors)();
47
- (0, import_chunk_MWEO3VUS.init_Migrate)();
47
+ (0, import_chunk_LJOMIPJW.init_Migrate)();
48
48
  (0, import_chunk_KEBB7UIB.init_ensureDatabaseExists)();
49
49
  (0, import_chunk_EYA6AFSF.init_getSchemaPathAndPrint)();
50
50
  (0, import_chunk_Q7ACZDDT.init_printDatasource)();
@@ -74,7 +74,7 @@ var init_MigrateStatus = (0, import_chunk_WWAWV7DQ.__esm)({
74
74
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true });
75
75
  const { schemaPath } = await (0, import_chunk_EYA6AFSF.getSchemaPathAndPrint)(args["--schema"]);
76
76
  (0, import_chunk_Q7ACZDDT.printDatasource)({ datasourceInfo: await (0, import_chunk_KEBB7UIB.getDatasourceInfo)({ schemaPath }) });
77
- const migrate = new import_chunk_MWEO3VUS.Migrate(schemaPath);
77
+ const migrate = new import_chunk_LJOMIPJW.Migrate(schemaPath);
78
78
  await (0, import_chunk_KEBB7UIB.ensureCanConnectToDatabase)(schemaPath);
79
79
  let diagnoseResult;
80
80
  let listMigrationDirectoriesResult;
@@ -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_ZBOJAYON_exports = {};
30
- __export(chunk_ZBOJAYON_exports, {
29
+ var chunk_PNBMPQYH_exports = {};
30
+ __export(chunk_PNBMPQYH_exports, {
31
31
  DbExecute: () => DbExecute,
32
32
  init_DbExecute: () => init_DbExecute
33
33
  });
34
- module.exports = __toCommonJS(chunk_ZBOJAYON_exports);
35
- var import_chunk_MWEO3VUS = require("./chunk-MWEO3VUS.js");
34
+ module.exports = __toCommonJS(chunk_PNBMPQYH_exports);
35
+ var import_chunk_LJOMIPJW = require("./chunk-LJOMIPJW.js");
36
36
  var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
37
37
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
38
38
  var import_internals = require("@prisma/internals");
@@ -72,7 +72,7 @@ var init_DbExecute = (0, import_chunk_WWAWV7DQ.__esm)({
72
72
  "src/commands/DbExecute.ts"() {
73
73
  import_get_stdin = (0, import_chunk_WWAWV7DQ.__toESM)(require_get_stdin());
74
74
  (0, import_chunk_6TE2RIPN.init_colors)();
75
- (0, import_chunk_MWEO3VUS.init_Migrate)();
75
+ (0, import_chunk_LJOMIPJW.init_Migrate)();
76
76
  helpOptions = (0, import_internals.format)(
77
77
  `${(0, import_chunk_6TE2RIPN.bold)("Usage")}
78
78
 
@@ -171,7 +171,7 @@ See \`${(0, import_chunk_6TE2RIPN.green)((0, import_internals.getCommandWithExec
171
171
  ...(0, import_internals.toSchemasWithConfigDir)(schemaWithPath, config)
172
172
  };
173
173
  }
174
- const migrate = new import_chunk_MWEO3VUS.Migrate();
174
+ const migrate = new import_chunk_LJOMIPJW.Migrate();
175
175
  try {
176
176
  await migrate.engine.dbExecute({
177
177
  script,
@@ -26,14 +26,14 @@ 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_W3ROQKBN_exports = {};
30
- __export(chunk_W3ROQKBN_exports, {
29
+ var chunk_V7DE6JTG_exports = {};
30
+ __export(chunk_V7DE6JTG_exports, {
31
31
  init_removeSchemaFiles: () => init_removeSchemaFiles,
32
32
  removeSchemaFiles: () => removeSchemaFiles
33
33
  });
34
- module.exports = __toCommonJS(chunk_W3ROQKBN_exports);
34
+ module.exports = __toCommonJS(chunk_V7DE6JTG_exports);
35
35
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
36
- var import_promises = __toESM(require("fs/promises"));
36
+ var import_promises = __toESM(require("node:fs/promises"));
37
37
  async function removeSchemaFiles(files) {
38
38
  await Promise.all(files.map(([path]) => import_promises.default.rm(path)));
39
39
  }
@@ -26,14 +26,14 @@ 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_UJWMQPUH_exports = {};
30
- __export(chunk_UJWMQPUH_exports, {
29
+ var chunk_X6GGREJW_exports = {};
30
+ __export(chunk_X6GGREJW_exports, {
31
31
  MigrateDeploy: () => MigrateDeploy,
32
32
  init_MigrateDeploy: () => init_MigrateDeploy
33
33
  });
34
- module.exports = __toCommonJS(chunk_UJWMQPUH_exports);
34
+ module.exports = __toCommonJS(chunk_X6GGREJW_exports);
35
35
  var import_chunk_WOOPRG54 = require("./chunk-WOOPRG54.js");
36
- var import_chunk_MWEO3VUS = require("./chunk-MWEO3VUS.js");
36
+ var import_chunk_LJOMIPJW = require("./chunk-LJOMIPJW.js");
37
37
  var import_chunk_EYA6AFSF = require("./chunk-EYA6AFSF.js");
38
38
  var import_chunk_Q7ACZDDT = require("./chunk-Q7ACZDDT.js");
39
39
  var import_chunk_KEBB7UIB = require("./chunk-KEBB7UIB.js");
@@ -45,7 +45,7 @@ var debug, _MigrateDeploy, MigrateDeploy;
45
45
  var init_MigrateDeploy = (0, import_chunk_WWAWV7DQ.__esm)({
46
46
  "src/commands/MigrateDeploy.ts"() {
47
47
  (0, import_chunk_6TE2RIPN.init_colors)();
48
- (0, import_chunk_MWEO3VUS.init_Migrate)();
48
+ (0, import_chunk_LJOMIPJW.init_Migrate)();
49
49
  (0, import_chunk_KEBB7UIB.init_ensureDatabaseExists)();
50
50
  (0, import_chunk_EYA6AFSF.init_getSchemaPathAndPrint)();
51
51
  (0, import_chunk_Q7ACZDDT.init_printDatasource)();
@@ -76,7 +76,7 @@ var init_MigrateDeploy = (0, import_chunk_WWAWV7DQ.__esm)({
76
76
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true });
77
77
  const { schemaPath } = await (0, import_chunk_EYA6AFSF.getSchemaPathAndPrint)(args["--schema"]);
78
78
  (0, import_chunk_Q7ACZDDT.printDatasource)({ datasourceInfo: await (0, import_chunk_KEBB7UIB.getDatasourceInfo)({ schemaPath }) });
79
- const migrate = new import_chunk_MWEO3VUS.Migrate(schemaPath);
79
+ const migrate = new import_chunk_LJOMIPJW.Migrate(schemaPath);
80
80
  try {
81
81
  const wasDbCreated = await (0, import_chunk_KEBB7UIB.ensureDatabaseExists)("apply", schemaPath);
82
82
  if (wasDbCreated) {