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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/Migrate.js +4 -4
  2. package/dist/SchemaEngine.js +4 -4
  3. package/dist/bin.js +39 -40
  4. package/dist/{chunk-EXUBPCXZ.js → chunk-3H4RLVCQ.js} +12 -12
  5. package/dist/{chunk-ZLGLVUFD.js → chunk-E2XKFV2C.js} +8 -8
  6. package/dist/{chunk-XVL5RF2T.js → chunk-GUBDW6S7.js} +11 -11
  7. package/dist/{chunk-BAVMZZAR.js → chunk-HODZFC64.js} +7 -7
  8. package/dist/{chunk-BAFPAACN.js → chunk-ILJRJJ3S.js} +4 -4
  9. package/dist/{chunk-LLGEQ76N.js → chunk-ILQWQHQO.js} +11 -11
  10. package/dist/{chunk-E3KHFUFQ.js → chunk-J77IRNPE.js} +9 -124
  11. package/dist/{chunk-76XWADEV.js → chunk-KEPR65SW.js} +6 -6
  12. package/dist/{chunk-NIFQA5SB.js → chunk-LAHPBQAT.js} +61 -143
  13. package/dist/{chunk-MWEO3VUS.js → chunk-LJOMIPJW.js} +7 -7
  14. package/dist/{chunk-GJN3CSXW.js → chunk-NKL64AIB.js} +6 -6
  15. package/dist/{chunk-VWV2NY26.js → chunk-NKQGJ3AE.js} +7 -3
  16. package/dist/{chunk-XLLUFIQK.js → chunk-PCJYN6LT.js} +6 -5
  17. package/dist/{chunk-SV5GANSI.js → chunk-PFEH6ILG.js} +6 -6
  18. package/dist/{chunk-ZBOJAYON.js → chunk-PNBMPQYH.js} +6 -6
  19. package/dist/{chunk-W3ROQKBN.js → chunk-V7DE6JTG.js} +4 -4
  20. package/dist/{chunk-WD642UYX.js → chunk-WCDK5V6K.js} +62 -144
  21. package/dist/{chunk-UJWMQPUH.js → chunk-X6GGREJW.js} +6 -6
  22. package/dist/{chunk-WIZM7TFT.js → chunk-YKUZUAXA.js} +443 -55
  23. package/dist/{chunk-YOW3VBYS.js → chunk-Z4OLB2H4.js} +6 -6
  24. package/dist/commands/DbExecute.js +5 -5
  25. package/dist/commands/DbPull.js +6 -6
  26. package/dist/commands/DbPush.js +5 -5
  27. package/dist/commands/DbSeed.js +4 -5
  28. package/dist/commands/MigrateDeploy.js +5 -5
  29. package/dist/commands/MigrateDev.js +6 -7
  30. package/dist/commands/MigrateDiff.js +6 -7
  31. package/dist/commands/MigrateReset.js +6 -7
  32. package/dist/commands/MigrateResolve.js +5 -5
  33. package/dist/commands/MigrateStatus.js +5 -5
  34. package/dist/index.js +45 -46
  35. package/dist/internals/src/utils/isCurrentBinInstalledGlobally.d.ts +1 -1
  36. package/dist/{multipart-parser-KKECAI5D.js → multipart-parser-73VM3J4A.js} +10 -7
  37. package/dist/{multipart-parser-47FFAP42-P3F6TPHJ.js → multipart-parser-ITART6UP-FFJAMHWE.js} +25 -22
  38. package/dist/utils/getDatabaseVersionSafe.js +4 -4
  39. package/dist/utils/introspectSql.js +3 -3
  40. package/dist/utils/removeSchemaFiles.js +3 -3
  41. package/dist/utils/saveSchemaFiles.js +3 -3
  42. package/dist/utils/seed.js +6 -7
  43. package/dist/utils/setupMSSQL.js +62 -59
  44. package/dist/utils/setupMongo.js +5 -4
  45. package/dist/utils/setupMysql.js +45 -0
  46. package/package.json +8 -9
  47. package/dist/chunk-EFPE3Q7J.js +0 -424
  48. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkYarnVersion.d.ts +0 -9
@@ -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_NIFQA5SB_exports = {};
30
- __export(chunk_NIFQA5SB_exports, {
29
+ var chunk_LAHPBQAT_exports = {};
30
+ __export(chunk_LAHPBQAT_exports, {
31
31
  MigrateDiff: () => MigrateDiff,
32
32
  init_MigrateDiff: () => init_MigrateDiff
33
33
  });
34
- module.exports = __toCommonJS(chunk_NIFQA5SB_exports);
35
- var import_chunk_VWV2NY26 = require("./chunk-VWV2NY26.js");
34
+ module.exports = __toCommonJS(chunk_LAHPBQAT_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) {
@@ -6167,9 +6170,9 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
6167
6170
  usesPrismaSchemaFolder: () => usesPrismaSchemaFolder2
6168
6171
  });
6169
6172
  module2.exports = __toCommonJS2(src_exports);
6170
- var import_node_path22 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("path"));
6173
+ var import_node_path22 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("node:path"));
6171
6174
  var import_prisma_schema_wasm2 = (0, import_chunk_WWAWV7DQ.__require)("@prisma/prisma-schema-wasm");
6172
- var import_node_path5 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("path"));
6175
+ var import_node_path5 = __toESM22((0, import_chunk_WWAWV7DQ.__require)("node:path"));
6173
6176
  function createFileNameToKeyMapper(options) {
6174
6177
  if (options.caseSensitive) {
6175
6178
  return (fileName) => fileName;
@@ -6394,15 +6397,15 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
6394
6397
  }
6395
6398
  });
6396
6399
  async function findUp(name, {
6397
- cwd = import_process.default.cwd(),
6400
+ cwd = import_node_process.default.cwd(),
6398
6401
  type = "file",
6399
6402
  stopAt
6400
6403
  } = {}) {
6401
- let directory = import_path.default.resolve(toPath(cwd) ?? "");
6402
- const { root } = import_path.default.parse(directory);
6403
- stopAt = import_path.default.resolve(directory, toPath(stopAt ?? root));
6404
+ let directory = import_node_path.default.resolve(toPath(cwd) ?? "");
6405
+ const { root } = import_node_path.default.parse(directory);
6406
+ stopAt = import_node_path.default.resolve(directory, toPath(stopAt ?? root));
6404
6407
  while (directory && directory !== stopAt && directory !== root) {
6405
- const filePath = import_path.default.isAbsolute(name) ? name : import_path.default.join(directory, name);
6408
+ const filePath = import_node_path.default.isAbsolute(name) ? name : import_node_path.default.join(directory, name);
6406
6409
  try {
6407
6410
  const stats = await import_promises.default.stat(filePath);
6408
6411
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
@@ -6410,14 +6413,14 @@ async function findUp(name, {
6410
6413
  }
6411
6414
  } catch {
6412
6415
  }
6413
- directory = import_path.default.dirname(directory);
6416
+ directory = import_node_path.default.dirname(directory);
6414
6417
  }
6415
6418
  }
6416
6419
  var toPath;
6417
6420
  var init_find_up_simple = (0, import_chunk_WWAWV7DQ.__esm)({
6418
6421
  "../../node_modules/.pnpm/find-up-simple@1.0.0/node_modules/find-up-simple/index.js"() {
6419
6422
  "use strict";
6420
- toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_url.fileURLToPath)(urlOrPath) : urlOrPath;
6423
+ toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
6421
6424
  }
6422
6425
  });
6423
6426
  var require_js_tokens = (0, import_chunk_WWAWV7DQ.__commonJS)({
@@ -10689,8 +10692,8 @@ var require_typos = (0, import_chunk_WWAWV7DQ.__commonJS)({
10689
10692
  var require_fixer = (0, import_chunk_WWAWV7DQ.__commonJS)({
10690
10693
  "../../node_modules/.pnpm/normalize-package-data@6.0.0/node_modules/normalize-package-data/lib/fixer.js"(exports, module2) {
10691
10694
  "use strict";
10692
- var isValidSemver = (0, import_chunk_VWV2NY26.require_valid)();
10693
- var cleanSemver = (0, import_chunk_VWV2NY26.require_clean)();
10695
+ var isValidSemver = (0, import_chunk_NKQGJ3AE.require_valid)();
10696
+ var cleanSemver = (0, import_chunk_NKQGJ3AE.require_clean)();
10694
10697
  var validateLicense = require_validate_npm_package_license();
10695
10698
  var hostedGitInfo = require_lib5();
10696
10699
  var isBuiltinModule = require_is_core_module();
@@ -11238,7 +11241,7 @@ var init_default = (0, import_chunk_WWAWV7DQ.__esm)({
11238
11241
  }
11239
11242
  });
11240
11243
  function toPath2(urlOrPath) {
11241
- return urlOrPath instanceof URL ? (0, import_url2.fileURLToPath)(urlOrPath) : urlOrPath;
11244
+ return urlOrPath instanceof URL ? (0, import_node_url2.fileURLToPath)(urlOrPath) : urlOrPath;
11242
11245
  }
11243
11246
  var init_node = (0, import_chunk_WWAWV7DQ.__esm)({
11244
11247
  "../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js"() {
@@ -11257,7 +11260,7 @@ var init_read_pkg = (0, import_chunk_WWAWV7DQ.__esm)({
11257
11260
  init_parse_json();
11258
11261
  import_normalize_package_data = (0, import_chunk_WWAWV7DQ.__toESM)(require_normalize(), 1);
11259
11262
  init_node();
11260
- getPackagePath = (cwd) => import_path2.default.resolve(toPath2(cwd) ?? ".", "package.json");
11263
+ getPackagePath = (cwd) => import_node_path2.default.resolve(toPath2(cwd) ?? ".", "package.json");
11261
11264
  _readPackage = (file, normalize) => {
11262
11265
  const json = typeof file === "string" ? parseJson(file) : file;
11263
11266
  if (normalize) {
@@ -11273,7 +11276,7 @@ async function readPackageUp(options) {
11273
11276
  return;
11274
11277
  }
11275
11278
  return {
11276
- packageJson: await readPackage({ ...options, cwd: import_path3.default.dirname(filePath) }),
11279
+ packageJson: await readPackage({ ...options, cwd: import_node_path3.default.dirname(filePath) }),
11277
11280
  path: filePath
11278
11281
  };
11279
11282
  }
@@ -11566,7 +11569,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
11566
11569
  "checkpoint-client": "1.1.33",
11567
11570
  "cli-truncate": "2.1.0",
11568
11571
  dotenv: "16.0.3",
11569
- esbuild: "0.23.0",
11572
+ esbuild: "0.24.0",
11570
11573
  "escape-string-regexp": "4.0.0",
11571
11574
  execa: "5.1.1",
11572
11575
  "fast-glob": "3.3.2",
@@ -11611,7 +11614,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
11611
11614
  "@prisma/fetch-engine": "workspace:*",
11612
11615
  "@prisma/generator-helper": "workspace:*",
11613
11616
  "@prisma/get-platform": "workspace:*",
11614
- "@prisma/prisma-schema-wasm": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2",
11617
+ "@prisma/prisma-schema-wasm": "5.23.0-13.06d4b2f30bf4fc71a1cb03bdc0f69f8c2a5c2b9c",
11615
11618
  "@prisma/schema-files-loader": "workspace:*",
11616
11619
  arg: "5.0.2",
11617
11620
  prompts: "2.4.2"
@@ -11671,7 +11674,7 @@ var init_errorHelpers = (0, import_chunk_WWAWV7DQ.__esm)({
11671
11674
  }
11672
11675
  });
11673
11676
  function relativizePathInPSLError(error) {
11674
- return error.replaceAll(process.cwd() + import_path4.default.sep, "");
11677
+ return error.replaceAll(process.cwd() + import_node_path4.default.sep, "");
11675
11678
  }
11676
11679
  var init_relativizePathInPSLError = (0, import_chunk_WWAWV7DQ.__esm)({
11677
11680
  "../internals/src/engine-commands/relativizePathInPSLError.ts"() {
@@ -11902,7 +11905,7 @@ async function readSchemaFromSingleFile(schemaPath) {
11902
11905
  const schemaTuple = [schemaPath, file];
11903
11906
  return {
11904
11907
  ok: true,
11905
- schema: { schemaPath, schemaRootDir: import_path5.default.dirname(schemaPath), schemas: [schemaTuple] }
11908
+ schema: { schemaPath, schemaRootDir: import_path.default.dirname(schemaPath), schemas: [schemaTuple] }
11906
11909
  };
11907
11910
  }
11908
11911
  async function readSchemaFromDirectory(schemaPath) {
@@ -11960,10 +11963,10 @@ async function readSchemaFromFileOrDirectory(schemaPath) {
11960
11963
  }
11961
11964
  async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName }) {
11962
11965
  if (schemaPathFromArgs) {
11963
- const absPath = import_path5.default.resolve(cwd, schemaPathFromArgs);
11966
+ const absPath = import_path.default.resolve(cwd, schemaPathFromArgs);
11964
11967
  const customSchemaResult = await readSchemaFromFileOrDirectory(absPath);
11965
11968
  if (!customSchemaResult.ok) {
11966
- const relPath = import_path5.default.relative(cwd, absPath);
11969
+ const relPath = import_path.default.relative(cwd, absPath);
11967
11970
  throw new Error(
11968
11971
  `Could not load \`${argumentName}\` from provided path \`${relPath}\`: ${renderLookupError(
11969
11972
  customSchemaResult.error
@@ -11980,14 +11983,9 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName
11980
11983
  if (defaultResult.ok) {
11981
11984
  return defaultResult;
11982
11985
  }
11983
- const yarnResult = await getSchemaFromYarn1Workspace(cwd, defaultResult.error.failures);
11984
- if (yarnResult.ok) {
11985
- return yarnResult;
11986
- }
11987
- const finalError = yarnResult.error.kind === "Yarn1WorkspaceSchemaNotFound" ? defaultResult.error : yarnResult.error;
11988
11986
  return {
11989
11987
  ok: false,
11990
- error: finalError
11988
+ error: defaultResult.error
11991
11989
  };
11992
11990
  }
11993
11991
  function renderLookupError(error) {
@@ -12014,7 +12012,7 @@ function renderDefaultLookupError(error, cwd) {
12014
12012
  for (const failure of error.failures) {
12015
12013
  const filePath = failure.rule.schemaPath.path;
12016
12014
  if (!printedPaths.has(failure.rule.schemaPath.path)) {
12017
- parts.push(`${import_path5.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
12015
+ parts.push(`${import_path.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
12018
12016
  printedPaths.add(filePath);
12019
12017
  }
12020
12018
  }
@@ -12041,20 +12039,20 @@ async function getSchemaFromPackageJson(cwd) {
12041
12039
  const schemaPathFromPkgJson = prismaConfig.data.schema;
12042
12040
  if (typeof schemaPathFromPkgJson !== "string") {
12043
12041
  throw new Error(
12044
- `Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path5.default.relative(
12042
+ `Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path.default.relative(
12045
12043
  cwd,
12046
12044
  prismaConfig.packagePath
12047
12045
  )}\` must be of type string`
12048
12046
  );
12049
12047
  }
12050
- const absoluteSchemaPath = import_path5.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path5.default.resolve(import_path5.default.dirname(prismaConfig.packagePath), schemaPathFromPkgJson);
12048
+ const absoluteSchemaPath = import_path.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path.default.resolve(import_path.default.dirname(prismaConfig.packagePath), schemaPathFromPkgJson);
12051
12049
  const lookupResult = await readSchemaFromFileOrDirectory(absoluteSchemaPath);
12052
12050
  if (!lookupResult.ok) {
12053
12051
  throw new Error(
12054
- `Could not load schema from \`${import_path5.default.relative(
12052
+ `Could not load schema from \`${import_path.default.relative(
12055
12053
  cwd,
12056
12054
  absoluteSchemaPath
12057
- )}\` provided by "prisma.schema" config of \`${import_path5.default.relative(
12055
+ )}\` provided by "prisma.schema" config of \`${import_path.default.relative(
12058
12056
  cwd,
12059
12057
  prismaConfig.packagePath
12060
12058
  )}\`: ${renderLookupError(lookupResult.error)}`
@@ -12062,71 +12060,30 @@ async function getSchemaFromPackageJson(cwd) {
12062
12060
  }
12063
12061
  return lookupResult;
12064
12062
  }
12065
- async function getSchemaFromYarn1Workspace(cwd, pastFailures) {
12066
- if (!process.env.npm_config_user_agent?.includes("yarn")) {
12067
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
12068
- }
12069
- let workspaces;
12070
- try {
12071
- const { stdout: version2 } = await import_execa.default.command("yarn --version", {
12072
- cwd
12073
- });
12074
- if (version2.startsWith("2")) {
12075
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
12076
- }
12077
- const { stdout } = await import_execa.default.command("yarn workspaces info --json", {
12078
- cwd
12079
- });
12080
- const json = getJson(stdout);
12081
- workspaces = Object.values(json);
12082
- } catch {
12083
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
12084
- }
12085
- const workspaceRootDir = await findWorkspaceRoot(cwd);
12086
- if (!workspaceRootDir) {
12087
- return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
12088
- }
12089
- for (const workspace of workspaces) {
12090
- const workspacePath = import_path5.default.join(workspaceRootDir, workspace.location);
12091
- const workspaceSchema = await tryWorkspacePath(workspacePath, pastFailures);
12092
- if (workspaceSchema.ok) {
12093
- return workspaceSchema;
12094
- }
12095
- }
12096
- const rootPathSchema = await tryWorkspacePath(workspaceRootDir, pastFailures);
12097
- return rootPathSchema;
12098
- }
12099
- async function tryWorkspacePath(cwd, pastFailures) {
12100
- const pkgJson = await getSchemaFromPackageJson(cwd);
12101
- if (pkgJson.ok) {
12102
- return pkgJson;
12103
- }
12104
- return getDefaultSchema(cwd, pastFailures);
12105
- }
12106
12063
  async function getDefaultSchema(cwd, failures = []) {
12107
12064
  const schemaPrisma = {
12108
12065
  schemaPath: {
12109
- path: import_path5.default.join(cwd, "schema.prisma"),
12066
+ path: import_path.default.join(cwd, "schema.prisma"),
12110
12067
  kind: "file"
12111
12068
  }
12112
12069
  };
12113
12070
  const prismaSchemaFile = {
12114
12071
  schemaPath: {
12115
- path: import_path5.default.join(cwd, "prisma", "schema.prisma"),
12072
+ path: import_path.default.join(cwd, "prisma", "schema.prisma"),
12116
12073
  kind: "file"
12117
12074
  },
12118
12075
  conflictsWith: {
12119
- path: import_path5.default.join(cwd, "prisma", "schema"),
12076
+ path: import_path.default.join(cwd, "prisma", "schema"),
12120
12077
  kind: "directory"
12121
12078
  }
12122
12079
  };
12123
12080
  const prismaSchemaFolder = {
12124
12081
  schemaPath: {
12125
- path: import_path5.default.join(cwd, "prisma", "schema"),
12082
+ path: import_path.default.join(cwd, "prisma", "schema"),
12126
12083
  kind: "directory"
12127
12084
  },
12128
12085
  conflictsWith: {
12129
- path: import_path5.default.join(cwd, "prisma", "schema.prisma"),
12086
+ path: import_path.default.join(cwd, "prisma", "schema.prisma"),
12130
12087
  kind: "file"
12131
12088
  }
12132
12089
  };
@@ -12142,7 +12099,7 @@ async function getDefaultSchema(cwd, failures = []) {
12142
12099
  const conflictingSchema = await loadSchemaFromDefaultLocation(rule.conflictsWith);
12143
12100
  if (conflictingSchema.ok) {
12144
12101
  throw new Error(
12145
- `Found Prisma Schemas at both \`${import_path5.default.relative(cwd, rule.schemaPath.path)}\` and \`${import_path5.default.relative(
12102
+ `Found Prisma Schemas at both \`${import_path.default.relative(cwd, rule.schemaPath.path)}\` and \`${import_path.default.relative(
12146
12103
  cwd,
12147
12104
  rule.conflictsWith.path
12148
12105
  )}\`. Please remove one.`
@@ -12167,50 +12124,11 @@ async function loadSchemaFromDefaultLocation(lookupPath) {
12167
12124
  return readSchemaFromDirectory(lookupPath.path);
12168
12125
  }
12169
12126
  }
12170
- function getJson(stdout) {
12171
- const firstCurly = stdout.indexOf("{");
12172
- const lastCurly = stdout.lastIndexOf("}");
12173
- const sliced = stdout.slice(firstCurly, lastCurly + 1);
12174
- return JSON.parse(sliced);
12175
- }
12176
- function isPkgJsonWorkspaceRoot(pkgJson) {
12177
- const workspaces = pkgJson.workspaces;
12178
- if (!workspaces) {
12179
- return false;
12180
- }
12181
- return Array.isArray(workspaces) || workspaces.packages !== void 0;
12182
- }
12183
- async function isNearestPkgJsonWorkspaceRoot(cwd) {
12184
- const pkgJson = await readPackageUp({ cwd, normalize: false });
12185
- if (!pkgJson) {
12186
- return null;
12187
- }
12188
- return {
12189
- isRoot: isPkgJsonWorkspaceRoot(pkgJson.packageJson),
12190
- path: pkgJson.path
12191
- };
12192
- }
12193
- async function findWorkspaceRoot(cwd) {
12194
- let pkgJson = await isNearestPkgJsonWorkspaceRoot(cwd);
12195
- if (!pkgJson) {
12196
- return null;
12197
- }
12198
- if (pkgJson.isRoot === true) {
12199
- return import_path5.default.dirname(pkgJson.path);
12200
- }
12201
- const pkgJsonParentDir = import_path5.default.dirname(import_path5.default.dirname(pkgJson.path));
12202
- pkgJson = await isNearestPkgJsonWorkspaceRoot(pkgJsonParentDir);
12203
- if (!pkgJson || pkgJson.isRoot === false) {
12204
- return null;
12205
- }
12206
- return import_path5.default.dirname(pkgJson.path);
12207
- }
12208
- var import_schema_files_loader, import_execa, readFile, stat, debug2;
12127
+ var import_schema_files_loader, readFile, stat, debug2;
12209
12128
  var init_getSchema = (0, import_chunk_WWAWV7DQ.__esm)({
12210
12129
  "../internals/src/cli/getSchema.ts"() {
12211
12130
  "use strict";
12212
12131
  import_schema_files_loader = (0, import_chunk_WWAWV7DQ.__toESM)(require_dist());
12213
- import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_WIZM7TFT.require_execa)());
12214
12132
  (0, import_chunk_6TE2RIPN.init_colors)();
12215
12133
  init_read_package_up();
12216
12134
  init_engine_commands();
@@ -12225,7 +12143,7 @@ var init_MigrateDiff = (0, import_chunk_WWAWV7DQ.__esm)({
12225
12143
  import_fs_jetpack = (0, import_chunk_WWAWV7DQ.__toESM)(require_main());
12226
12144
  (0, import_chunk_6TE2RIPN.init_colors)();
12227
12145
  init_getSchema();
12228
- (0, import_chunk_MWEO3VUS.init_Migrate)();
12146
+ (0, import_chunk_LJOMIPJW.init_Migrate)();
12229
12147
  (0, import_chunk_TKAGMA5K.init_captureStdout)();
12230
12148
  debug3 = (0, import_debug3.default)("prisma:migrate:diff");
12231
12149
  helpOptions = (0, import_internals.format)(
@@ -12330,7 +12248,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12330
12248
  };
12331
12249
  } else if (args["--from-schema-datasource"]) {
12332
12250
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--from-schema-datasource"], printMessage: false });
12333
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--from-schema-datasource"]), {
12251
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datasource"]), {
12334
12252
  argumentName: "--from-schema-datasource"
12335
12253
  });
12336
12254
  const config = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
@@ -12339,7 +12257,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12339
12257
  ...(0, import_internals.toSchemasWithConfigDir)(schema, config)
12340
12258
  };
12341
12259
  } else if (args["--from-schema-datamodel"]) {
12342
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--from-schema-datamodel"]), {
12260
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--from-schema-datamodel"]), {
12343
12261
  argumentName: "--from-schema-datamodel"
12344
12262
  });
12345
12263
  from = {
@@ -12354,7 +12272,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12354
12272
  } else if (args["--from-migrations"]) {
12355
12273
  from = {
12356
12274
  tag: "migrations",
12357
- path: import_path6.default.resolve(args["--from-migrations"])
12275
+ path: import_path2.default.resolve(args["--from-migrations"])
12358
12276
  };
12359
12277
  } else if (args["--from-local-d1"]) {
12360
12278
  const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--from-local-d1" });
@@ -12370,7 +12288,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12370
12288
  };
12371
12289
  } else if (args["--to-schema-datasource"]) {
12372
12290
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--to-schema-datasource"], printMessage: false });
12373
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--to-schema-datasource"]), {
12291
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datasource"]), {
12374
12292
  argumentName: "--to-schema-datasource"
12375
12293
  });
12376
12294
  const config = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
@@ -12379,7 +12297,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12379
12297
  ...(0, import_internals.toSchemasWithConfigDir)(schema, config)
12380
12298
  };
12381
12299
  } else if (args["--to-schema-datamodel"]) {
12382
- const schema = await getSchemaWithPath(import_path6.default.resolve(args["--to-schema-datamodel"]), {
12300
+ const schema = await getSchemaWithPath(import_path2.default.resolve(args["--to-schema-datamodel"]), {
12383
12301
  argumentName: "--to-schema-datamodel"
12384
12302
  });
12385
12303
  to = {
@@ -12394,7 +12312,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12394
12312
  } else if (args["--to-migrations"]) {
12395
12313
  to = {
12396
12314
  tag: "migrations",
12397
- path: import_path6.default.resolve(args["--to-migrations"])
12315
+ path: import_path2.default.resolve(args["--to-migrations"])
12398
12316
  };
12399
12317
  } else if (args["--to-local-d1"]) {
12400
12318
  const d1Database = await (0, import_internals.locateLocalCloudflareD1)({ arg: "--to-local-d1" });
@@ -12403,7 +12321,7 @@ ${(0, import_chunk_6TE2RIPN.bold)("Flags")}
12403
12321
  url: `file:${d1Database}`
12404
12322
  };
12405
12323
  }
12406
- const migrate = new import_chunk_MWEO3VUS.Migrate();
12324
+ const migrate = new import_chunk_LJOMIPJW.Migrate();
12407
12325
  const captureStdout = new import_chunk_TKAGMA5K.CaptureStdout();
12408
12326
  const outputPath = args["--output"];
12409
12327
  const isOutputDefined = Boolean(outputPath);
@@ -26,14 +26,14 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_MWEO3VUS_exports = {};
30
- __export(chunk_MWEO3VUS_exports, {
29
+ var chunk_LJOMIPJW_exports = {};
30
+ __export(chunk_LJOMIPJW_exports, {
31
31
  Migrate: () => Migrate,
32
32
  init_Migrate: () => init_Migrate
33
33
  });
34
- module.exports = __toCommonJS(chunk_MWEO3VUS_exports);
34
+ module.exports = __toCommonJS(chunk_LJOMIPJW_exports);
35
35
  var import_chunk_6C7ESGWY = require("./chunk-6C7ESGWY.js");
36
- var import_chunk_XLLUFIQK = require("./chunk-XLLUFIQK.js");
36
+ var import_chunk_PCJYN6LT = require("./chunk-PCJYN6LT.js");
37
37
  var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
38
38
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
39
39
  var import_engines_version = require("@prisma/engines-version");
@@ -543,19 +543,19 @@ var init_Migrate = (0, import_chunk_WWAWV7DQ.__esm)({
543
543
  "src/Migrate.ts"() {
544
544
  (0, import_chunk_6TE2RIPN.init_colors)();
545
545
  import_log_update = (0, import_chunk_WWAWV7DQ.__toESM)(require_log_update());
546
- (0, import_chunk_XLLUFIQK.init_SchemaEngine)();
546
+ (0, import_chunk_PCJYN6LT.init_SchemaEngine)();
547
547
  packageJson = eval(`require('../package.json')`);
548
548
  Migrate = class {
549
549
  constructor(schemaPath, enabledPreviewFeatures) {
550
550
  if (schemaPath) {
551
551
  this.schemaPath = import_path.default.resolve(process.cwd(), schemaPath);
552
552
  this.migrationsDirectoryPath = import_path.default.join(import_path.default.dirname(this.schemaPath), "migrations");
553
- this.engine = new import_chunk_XLLUFIQK.SchemaEngine({
553
+ this.engine = new import_chunk_PCJYN6LT.SchemaEngine({
554
554
  schemaPath: this.schemaPath,
555
555
  enabledPreviewFeatures
556
556
  });
557
557
  } else {
558
- this.engine = new import_chunk_XLLUFIQK.SchemaEngine({
558
+ this.engine = new import_chunk_PCJYN6LT.SchemaEngine({
559
559
  enabledPreviewFeatures
560
560
  });
561
561
  }
@@ -26,20 +26,20 @@ 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_GJN3CSXW_exports = {};
30
- __export(chunk_GJN3CSXW_exports, {
29
+ var chunk_NKL64AIB_exports = {};
30
+ __export(chunk_NKL64AIB_exports, {
31
31
  getDatabaseVersionSafe: () => getDatabaseVersionSafe,
32
32
  init_getDatabaseVersionSafe: () => init_getDatabaseVersionSafe
33
33
  });
34
- module.exports = __toCommonJS(chunk_GJN3CSXW_exports);
35
- var import_chunk_XLLUFIQK = require("./chunk-XLLUFIQK.js");
34
+ module.exports = __toCommonJS(chunk_NKL64AIB_exports);
35
+ var import_chunk_PCJYN6LT = require("./chunk-PCJYN6LT.js");
36
36
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
37
37
  var import_debug = __toESM(require("@prisma/debug"));
38
38
  async function getDatabaseVersionSafe(args) {
39
39
  let engine;
40
40
  let dbVersion;
41
41
  try {
42
- engine = new import_chunk_XLLUFIQK.SchemaEngine({});
42
+ engine = new import_chunk_PCJYN6LT.SchemaEngine({});
43
43
  dbVersion = await engine.getDatabaseVersion(args);
44
44
  } catch (e) {
45
45
  debug(e);
@@ -53,7 +53,7 @@ async function getDatabaseVersionSafe(args) {
53
53
  var debug;
54
54
  var init_getDatabaseVersionSafe = (0, import_chunk_WWAWV7DQ.__esm)({
55
55
  "src/utils/getDatabaseVersionSafe.ts"() {
56
- (0, import_chunk_XLLUFIQK.init_SchemaEngine)();
56
+ (0, import_chunk_PCJYN6LT.init_SchemaEngine)();
57
57
  debug = (0, import_debug.default)("prisma:cli");
58
58
  }
59
59
  });
@@ -16,8 +16,8 @@ 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_VWV2NY26_exports = {};
20
- __export(chunk_VWV2NY26_exports, {
19
+ var chunk_NKQGJ3AE_exports = {};
20
+ __export(chunk_NKQGJ3AE_exports, {
21
21
  require_clean: () => require_clean,
22
22
  require_constants: () => require_constants,
23
23
  require_debug: () => require_debug,
@@ -28,7 +28,7 @@ __export(chunk_VWV2NY26_exports, {
28
28
  require_semver: () => require_semver,
29
29
  require_valid: () => require_valid
30
30
  });
31
- module.exports = __toCommonJS(chunk_VWV2NY26_exports);
31
+ module.exports = __toCommonJS(chunk_NKQGJ3AE_exports);
32
32
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
33
33
  var require_debug = (0, import_chunk_WWAWV7DQ.__commonJS)({
34
34
  "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js"(exports, module2) {
@@ -353,6 +353,8 @@ var require_semver = (0, import_chunk_WWAWV7DQ.__commonJS)({
353
353
  this.inc("patch", identifier, identifierBase);
354
354
  this.inc("pre", identifier, identifierBase);
355
355
  break;
356
+ // If the input is a non-prerelease version, this acts the same as
357
+ // prepatch.
356
358
  case "prerelease":
357
359
  if (this.prerelease.length === 0) {
358
360
  this.inc("patch", identifier, identifierBase);
@@ -380,6 +382,8 @@ var require_semver = (0, import_chunk_WWAWV7DQ.__commonJS)({
380
382
  }
381
383
  this.prerelease = [];
382
384
  break;
385
+ // This probably shouldn't be used publicly.
386
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
383
387
  case "pre": {
384
388
  const base = Number(identifierBase) ? 1 : 0;
385
389
  if (!identifier && identifierBase === false) {
@@ -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;