@prisma/migrate 6.6.0-dev.1 → 6.6.0-dev.100

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 (169) hide show
  1. package/dist/CLI.js +3 -3
  2. package/dist/Migrate.js +9 -7
  3. package/dist/SchemaEngine.js +0 -28
  4. package/dist/{chunk-RM5LJIEV.js → SchemaEngineCLI.js} +10 -16
  5. package/dist/{utils/getSchemaPathAndPrint.js → SchemaEngineWasm.js} +8 -8
  6. package/dist/bin.js +52 -53
  7. package/dist/chunk-23DZXSTI.js +62 -0
  8. package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
  9. package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
  10. package/dist/chunk-33LPBNDX.js +1399 -0
  11. package/dist/{chunk-MKK3GSDF.js → chunk-344G2PKM.js} +9 -9
  12. package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  13. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  14. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  15. package/dist/{chunk-ZQ3OWSVS.js → chunk-A4FQW4A5.js} +54 -50
  16. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  17. package/dist/{chunk-A6PMXMMT.js → chunk-AUGZZ6RT.js} +105 -13
  18. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  19. package/dist/{chunk-LZOZZRHB.js → chunk-CLSF7VUT.js} +42 -38
  20. package/dist/{chunk-Q7M5ANIE.js → chunk-CNCVJ2IN.js} +379 -534
  21. package/dist/{chunk-IR55GBON.js → chunk-CU5UT2ED.js} +19 -18
  22. package/dist/{chunk-TPJISPJ5.js → chunk-CYEVXXRH.js} +51 -47
  23. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  24. package/dist/{chunk-5VDXAE53.js → chunk-EJUXYFV3.js} +26 -16
  25. package/dist/{chunk-X6KW7BYP.js → chunk-HIDSEBVV.js} +55 -54
  26. package/dist/{chunk-ZOEKRXDP.js → chunk-I3LT2PO3.js} +35 -57
  27. package/dist/{chunk-E7OXHCDR.js → chunk-IEEJZC3B.js} +56 -49
  28. package/dist/chunk-IINN7QUV.js +2565 -0
  29. package/dist/chunk-IK3BVD3Y.js +233 -0
  30. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  31. package/dist/{chunk-EX2UWGES.js → chunk-KW633S3Y.js} +56 -52
  32. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  33. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  34. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  35. package/dist/chunk-PQKZ53DW.js +76 -0
  36. package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
  37. package/dist/{chunk-X5N72JHI.js → chunk-SO3VXCZV.js} +93 -92
  38. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  39. package/dist/chunk-URKH6SE2.js +479 -0
  40. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  41. package/dist/{chunk-POKX77OK.js → chunk-W5SQWSLC.js} +380 -535
  42. package/dist/{chunk-A4BCLP6K.js → chunk-YBS5GSRF.js} +64 -69
  43. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  44. package/dist/chunk-YSWLN2IJ.js +890 -0
  45. package/dist/commands/DbCommand.js +3 -3
  46. package/dist/commands/DbDrop.js +4 -5
  47. package/dist/commands/DbExecute.js +10 -8
  48. package/dist/commands/DbPull.js +17 -16
  49. package/dist/commands/DbPush.js +12 -11
  50. package/dist/commands/DbSeed.js +4 -5
  51. package/dist/commands/MigrateCommand.js +3 -3
  52. package/dist/commands/MigrateDeploy.js +14 -13
  53. package/dist/commands/MigrateDev.js +17 -16
  54. package/dist/commands/MigrateDiff.js +13 -11
  55. package/dist/commands/MigrateReset.js +16 -15
  56. package/dist/commands/MigrateResolve.js +12 -11
  57. package/dist/commands/MigrateStatus.js +12 -11
  58. package/dist/index.js +58 -60
  59. package/dist/internals/src/Generator.d.ts +23 -5
  60. package/dist/internals/src/WasmSchemaEngineLoader.d.ts +5 -0
  61. package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
  62. package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
  63. package/dist/internals/src/cli/getSchema.d.ts +3 -28
  64. package/dist/internals/src/cli/hashes.d.ts +1 -2
  65. package/dist/internals/src/cli/schemaContext.d.ts +59 -0
  66. package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
  67. package/dist/internals/src/convertCredentials.d.ts +1 -1
  68. package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
  69. package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
  70. package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
  71. package/dist/internals/src/errorReporting.d.ts +0 -1
  72. package/dist/internals/src/get-generators/getGenerators.d.ts +22 -9
  73. package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
  74. package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
  75. package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
  76. package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
  77. package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
  78. package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
  79. package/dist/internals/src/index.d.ts +9 -8
  80. package/dist/internals/src/migrateTypes.d.ts +63 -0
  81. package/dist/internals/src/panic.d.ts +1 -4
  82. package/dist/internals/src/resolvePkg.d.ts +7 -0
  83. package/dist/internals/src/types.d.ts +1 -1
  84. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  85. package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
  86. package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
  87. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  88. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  89. package/dist/internals/src/wasm.d.ts +3 -1
  90. package/dist/migrate/src/Migrate.d.ts +18 -7
  91. package/dist/migrate/src/SchemaEngine.d.ts +20 -50
  92. package/dist/migrate/src/SchemaEngineCLI.d.ts +139 -0
  93. package/dist/migrate/src/SchemaEngineWasm.d.ts +134 -0
  94. package/dist/migrate/src/commands/DbExecute.d.ts +1 -1
  95. package/dist/migrate/src/commands/DbPull.d.ts +1 -1
  96. package/dist/migrate/src/commands/DbPush.d.ts +1 -1
  97. package/dist/migrate/src/commands/MigrateDeploy.d.ts +1 -1
  98. package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
  99. package/dist/migrate/src/commands/MigrateDiff.d.ts +1 -1
  100. package/dist/migrate/src/commands/MigrateReset.d.ts +1 -1
  101. package/dist/migrate/src/commands/MigrateResolve.d.ts +1 -1
  102. package/dist/migrate/src/commands/MigrateStatus.d.ts +1 -1
  103. package/dist/migrate/src/index.d.ts +2 -2
  104. package/dist/migrate/src/types.d.ts +19 -19
  105. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  106. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  107. package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
  108. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  109. package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
  110. package/dist/migrate/src/utils/seed.d.ts +0 -2
  111. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  112. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  113. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  114. package/dist/types.js +1 -1
  115. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  116. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  117. package/dist/utils/byline.js +1 -1
  118. package/dist/utils/captureStdout.js +3 -3
  119. package/dist/utils/countModelsAndTypes.js +1 -1
  120. package/dist/utils/createMigration.js +27 -0
  121. package/dist/utils/customColors.js +1 -1
  122. package/dist/utils/ensureDatabaseExists.js +7 -7
  123. package/dist/utils/errors.js +1 -1
  124. package/dist/utils/flagErrors.js +1 -1
  125. package/dist/utils/getDatabaseVersionSafe.js +10 -5
  126. package/dist/utils/handleEvaluateDataloss.js +1 -1
  127. package/dist/utils/introspectSql.js +10 -5
  128. package/dist/utils/isSchemaEmpty.js +1 -1
  129. package/dist/utils/listMigrations.js +25 -0
  130. package/dist/utils/now.js +1 -1
  131. package/dist/utils/printDatasource.js +1 -1
  132. package/dist/utils/printDatasources.js +5 -5
  133. package/dist/utils/printFiles.js +5 -5
  134. package/dist/utils/printIntrospectedSchema.js +1 -1
  135. package/dist/utils/printMigrationId.js +1 -1
  136. package/dist/utils/promptForMigrationName.js +3 -3
  137. package/dist/utils/removeSchemaFiles.js +1 -1
  138. package/dist/utils/replaceOrAddDatasource.js +1 -1
  139. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  140. package/dist/utils/saveSchemaFiles.js +1 -1
  141. package/dist/utils/seed.js +4 -7
  142. package/dist/utils/setupCockroach.js +3 -3
  143. package/dist/utils/setupMSSQL.js +1583 -710
  144. package/dist/utils/setupMongo.js +6563 -5984
  145. package/dist/utils/setupMysql.js +508 -563
  146. package/dist/utils/setupPostgres.js +3 -3
  147. package/dist/utils/spinner.js +4 -7
  148. package/dist/utils/test-handlePanic.js +1 -30
  149. package/dist/utils/unixSocket.js +1 -1
  150. package/dist/views/handleViewsIO.js +3 -3
  151. package/package.json +15 -14
  152. package/dist/chunk-6C7ESGWY.js +0 -1184
  153. package/dist/chunk-DIAO4W7O.js +0 -5774
  154. package/dist/chunk-GKDFIHM2.js +0 -45
  155. package/dist/chunk-J46BJQHT.js +0 -268
  156. package/dist/chunk-KXMACMQC.js +0 -660
  157. package/dist/chunk-YUCPBDWV.js +0 -131
  158. package/dist/chunk-YYPMC5FN.js +0 -1407
  159. package/dist/internals/src/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
  160. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
  161. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
  162. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
  163. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
  164. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
  165. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
  166. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
  167. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
  168. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
  169. package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
@@ -16,32 +16,33 @@ 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_IR55GBON_exports = {};
20
- __export(chunk_IR55GBON_exports, {
19
+ var chunk_CU5UT2ED_exports = {};
20
+ __export(chunk_CU5UT2ED_exports, {
21
21
  introspectSql: () => introspectSql
22
22
  });
23
- module.exports = __toCommonJS(chunk_IR55GBON_exports);
24
- var import_chunk_ZOEKRXDP = require("./chunk-ZOEKRXDP.js");
23
+ module.exports = __toCommonJS(chunk_CU5UT2ED_exports);
24
+ var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
25
25
  var import_internals = require("@prisma/internals");
26
26
  var supportedProviders = ["postgresql", "cockroachdb", "mysql", "sqlite"];
27
- async function introspectSql(schemaPath, queries) {
28
- const schema = await (0, import_internals.getSchemaWithPath)(schemaPath);
29
- const config = await (0, import_internals.getConfig)({ datamodel: schema.schemas });
30
- if (!supportedProviders.includes(config.datasources?.[0]?.activeProvider)) {
31
- throw new Error(`Typed SQL is supported only for ${supportedProviders.join(", ")} providers`);
32
- }
33
- if (!isTypedSqlEnabled(config)) {
34
- throw new Error(`\`typedSql\` preview feature needs to be enabled in ${schema.schemaPath}`);
27
+ async function introspectSql(schemaContext, queries) {
28
+ if (!isTypedSqlEnabled(schemaContext.generators)) {
29
+ throw new Error(`\`typedSql\` preview feature needs to be enabled in ${schemaContext.loadedFromPathForLogMessages}`);
35
30
  }
36
- const firstDatasource = config.datasources[0];
31
+ const firstDatasource = schemaContext.primaryDatasource;
37
32
  if (!firstDatasource) {
38
- throw new Error(`Could not find datasource in schema ${schema.schemaPath}`);
33
+ throw new Error(`Could not find datasource in schema ${schemaContext.loadedFromPathForLogMessages}`);
34
+ }
35
+ if (!supportedProviders.includes(firstDatasource.activeProvider)) {
36
+ throw new Error(`Typed SQL is supported only for ${supportedProviders.join(", ")} providers`);
39
37
  }
40
38
  const url = (0, import_internals.getEffectiveUrl)(firstDatasource).value;
41
39
  if (!url) {
42
- throw new Error(`Could not get url from datasource ${firstDatasource.name} in ${schema.schemaPath}`);
40
+ throw new Error(
41
+ `Could not get url from datasource ${firstDatasource.name} in ${schemaContext.loadedFromPathForLogMessages}`
42
+ );
43
43
  }
44
- const schemaEngine = new import_chunk_ZOEKRXDP.SchemaEngine({ schemaPath: schema.schemaPath });
44
+ const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ schemaContext });
45
+ const schemaEngine = migrate.engine;
45
46
  const results = [];
46
47
  const errors = [];
47
48
  try {
@@ -91,6 +92,6 @@ async function introspectSingleQuery(schemaEngine, url, query) {
91
92
  };
92
93
  }
93
94
  }
94
- function isTypedSqlEnabled(config) {
95
- return config.generators.some((gen) => gen?.previewFeatures?.includes("typedSql"));
95
+ function isTypedSqlEnabled(generators) {
96
+ return generators.some((gen) => gen?.previewFeatures?.includes("typedSql"));
96
97
  }
@@ -26,25 +26,45 @@ 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_TPJISPJ5_exports = {};
30
- __export(chunk_TPJISPJ5_exports, {
29
+ var chunk_CYEVXXRH_exports = {};
30
+ __export(chunk_CYEVXXRH_exports, {
31
31
  MigrateDeploy: () => MigrateDeploy
32
32
  });
33
- module.exports = __toCommonJS(chunk_TPJISPJ5_exports);
34
- var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
35
- var import_chunk_KXMACMQC = require("./chunk-KXMACMQC.js");
36
- var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
33
+ module.exports = __toCommonJS(chunk_CYEVXXRH_exports);
34
+ var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
37
35
  var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
38
- var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
36
+ var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
37
+ var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
39
38
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
40
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
41
39
  var import_debug = __toESM(require("@prisma/debug"));
42
40
  var import_internals = require("@prisma/internals");
43
41
  var debug = (0, import_debug.default)("prisma:migrate:deploy");
44
- var _MigrateDeploy = class _MigrateDeploy2 {
42
+ var MigrateDeploy = class _MigrateDeploy {
45
43
  static new() {
46
- return new _MigrateDeploy2();
44
+ return new _MigrateDeploy();
47
45
  }
46
+ static help = (0, import_internals.format)(`
47
+ Apply pending migrations to update the database schema in production/staging
48
+
49
+ ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
50
+
51
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy [options]
52
+
53
+ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
54
+
55
+ -h, --help Display this help message
56
+ --config Custom path to your Prisma config file
57
+ --schema Custom path to your Prisma schema
58
+
59
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
60
+
61
+ Deploy your pending migrations to your production/staging database
62
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy
63
+
64
+ Specify a schema
65
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy --schema=./schema.prisma
66
+
67
+ `);
48
68
  async parse(argv, config) {
49
69
  const args = (0, import_internals.arg)(
50
70
  argv,
@@ -60,22 +80,29 @@ var _MigrateDeploy = class _MigrateDeploy2 {
60
80
  if ((0, import_internals.isError)(args)) {
61
81
  return this.help(args.message);
62
82
  }
63
- await (0, import_internals.checkUnsupportedDataProxy)("migrate deploy", args, config.schema, true);
64
83
  if (args["--help"]) {
65
84
  return this.help();
66
85
  }
67
86
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
68
- const { schemaPath } = await (0, import_chunk_GKDFIHM2.getSchemaPathAndPrint)(args["--schema"], config.schema);
69
- (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: await (0, import_chunk_DJMFXNR4.getDatasourceInfo)({ schemaPath }) });
70
- const migrate = new import_chunk_KXMACMQC.Migrate(schemaPath);
71
- try {
72
- const wasDbCreated = await (0, import_chunk_DJMFXNR4.ensureDatabaseExists)("apply", schemaPath);
73
- if (wasDbCreated) {
74
- process.stdout.write("\n" + wasDbCreated + "\n");
87
+ const schemaContext = await (0, import_internals.loadSchemaContext)({
88
+ schemaPathFromArg: args["--schema"],
89
+ schemaPathFromConfig: config.schema
90
+ });
91
+ const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext);
92
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate deploy", schemaContext });
93
+ (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource) });
94
+ const adapter = await config.migrate?.adapter(process.env);
95
+ const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, migrationsDirPath, schemaContext });
96
+ if (!adapter) {
97
+ try {
98
+ const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
99
+ if (wasDbCreated) {
100
+ process.stdout.write("\n" + wasDbCreated + "\n");
101
+ }
102
+ } catch (e) {
103
+ process.stdout.write("\n");
104
+ throw e;
75
105
  }
76
- } catch (e) {
77
- process.stdout.write("\n");
78
- throw e;
79
106
  }
80
107
  const listMigrationDirectoriesResult = await migrate.listMigrationDirectories();
81
108
  debug({ listMigrationDirectoriesResult });
@@ -104,7 +131,7 @@ var _MigrateDeploy = class _MigrateDeploy2 {
104
131
  } else {
105
132
  return `The following migration(s) have been applied:
106
133
 
107
- ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
134
+ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
108
135
  "migrations",
109
136
  migrationIds,
110
137
  {
@@ -119,31 +146,8 @@ ${(0, import_chunk_SKRR5WT4.green)("All migrations have been successfully applie
119
146
  if (error) {
120
147
  return new import_internals.HelpError(`
121
148
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
122
- ${_MigrateDeploy2.help}`);
149
+ ${_MigrateDeploy.help}`);
123
150
  }
124
- return _MigrateDeploy2.help;
151
+ return _MigrateDeploy.help;
125
152
  }
126
153
  };
127
- (0, import_chunk_WWAWV7DQ.__publicField)(_MigrateDeploy, "help", (0, import_internals.format)(`
128
- Apply pending migrations to update the database schema in production/staging
129
-
130
- ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
131
-
132
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy [options]
133
-
134
- ${(0, import_chunk_SKRR5WT4.bold)("Options")}
135
-
136
- -h, --help Display this help message
137
- --config Custom path to your Prisma config file
138
- --schema Custom path to your Prisma schema
139
-
140
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
141
-
142
- Deploy your pending migrations to your production/staging database
143
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy
144
-
145
- Specify a schema
146
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy --schema=./schema.prisma
147
-
148
- `));
149
- var MigrateDeploy = _MigrateDeploy;
@@ -16,52 +16,21 @@ 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_W2SZNLK4_exports = {};
20
- __export(chunk_W2SZNLK4_exports, {
19
+ var chunk_EJG7GKM7_exports = {};
20
+ __export(chunk_EJG7GKM7_exports, {
21
21
  DbCommand: () => DbCommand
22
22
  });
23
- module.exports = __toCommonJS(chunk_W2SZNLK4_exports);
23
+ module.exports = __toCommonJS(chunk_EJG7GKM7_exports);
24
24
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
25
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
26
25
  var import_internals = require("@prisma/internals");
27
- var _DbCommand = class _DbCommand2 {
26
+ var DbCommand = class _DbCommand {
28
27
  constructor(cmds) {
29
28
  this.cmds = cmds;
30
29
  }
31
30
  static new(cmds) {
32
- return new _DbCommand2(cmds);
31
+ return new _DbCommand(cmds);
33
32
  }
34
- async parse(argv, config) {
35
- const args = (0, import_internals.arg)(argv, {
36
- "--help": Boolean,
37
- "-h": "--help",
38
- "--config": String,
39
- "--preview-feature": Boolean,
40
- "--telemetry-information": String
41
- });
42
- if ((0, import_internals.isError)(args)) {
43
- return this.help(args.message);
44
- }
45
- if (args._.length === 0 || args["--help"]) {
46
- return this.help();
47
- }
48
- const cmd = this.cmds[args._[0]];
49
- if (cmd) {
50
- const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
51
- return cmd.parse(argsForCmd, config);
52
- }
53
- return (0, import_internals.unknownCommand)(_DbCommand2.help, args._[0]);
54
- }
55
- help(error) {
56
- if (error) {
57
- return new import_internals.HelpError(`
58
- ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
59
- ${_DbCommand2.help}`);
60
- }
61
- return _DbCommand2.help;
62
- }
63
- };
64
- (0, import_chunk_WWAWV7DQ.__publicField)(_DbCommand, "help", (0, import_internals.format)(`
33
+ static help = (0, import_internals.format)(`
65
34
  ${process.platform === "win32" ? "" : "\u{1F3CB}\uFE0F "}Manage your database schema and lifecycle during development.
66
35
 
67
36
  ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
@@ -93,5 +62,34 @@ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
93
62
 
94
63
  Run \`prisma db execute\`
95
64
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
96
- `));
97
- var DbCommand = _DbCommand;
65
+ `);
66
+ async parse(argv, config) {
67
+ const args = (0, import_internals.arg)(argv, {
68
+ "--help": Boolean,
69
+ "-h": "--help",
70
+ "--config": String,
71
+ "--preview-feature": Boolean,
72
+ "--telemetry-information": String
73
+ });
74
+ if ((0, import_internals.isError)(args)) {
75
+ return this.help(args.message);
76
+ }
77
+ if (args._.length === 0 || args["--help"]) {
78
+ return this.help();
79
+ }
80
+ const cmd = this.cmds[args._[0]];
81
+ if (cmd) {
82
+ const argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
83
+ return cmd.parse(argsForCmd, config);
84
+ }
85
+ return (0, import_internals.unknownCommand)(_DbCommand.help, args._[0]);
86
+ }
87
+ help(error) {
88
+ if (error) {
89
+ return new import_internals.HelpError(`
90
+ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
91
+ ${_DbCommand.help}`);
92
+ }
93
+ return _DbCommand.help;
94
+ }
95
+ };
@@ -16,15 +16,14 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_5VDXAE53_exports = {};
20
- __export(chunk_5VDXAE53_exports, {
19
+ var chunk_EJUXYFV3_exports = {};
20
+ __export(chunk_EJUXYFV3_exports, {
21
21
  require_ms: () => require_ms,
22
22
  require_src: () => require_src
23
23
  });
24
- module.exports = __toCommonJS(chunk_5VDXAE53_exports);
25
- var import_chunk_RM5LJIEV = require("./chunk-RM5LJIEV.js");
26
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
27
- var require_ms = (0, import_chunk_WWAWV7DQ.__commonJS)({
24
+ module.exports = __toCommonJS(chunk_EJUXYFV3_exports);
25
+ var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
26
+ var require_ms = (0, import_chunk_2ESYSVXG.__commonJS)({
28
27
  "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module2) {
29
28
  "use strict";
30
29
  var s = 1e3;
@@ -139,7 +138,7 @@ var require_ms = (0, import_chunk_WWAWV7DQ.__commonJS)({
139
138
  }
140
139
  }
141
140
  });
142
- var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
141
+ var require_common = (0, import_chunk_2ESYSVXG.__commonJS)({
143
142
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports, module2) {
144
143
  "use strict";
145
144
  function setup(env) {
@@ -315,7 +314,7 @@ var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
315
314
  module2.exports = setup;
316
315
  }
317
316
  });
318
- var require_browser = (0, import_chunk_WWAWV7DQ.__commonJS)({
317
+ var require_browser = (0, import_chunk_2ESYSVXG.__commonJS)({
319
318
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports, module2) {
320
319
  "use strict";
321
320
  exports.formatArgs = formatArgs;
@@ -484,12 +483,23 @@ var require_browser = (0, import_chunk_WWAWV7DQ.__commonJS)({
484
483
  };
485
484
  }
486
485
  });
487
- var require_supports_color = (0, import_chunk_WWAWV7DQ.__commonJS)({
486
+ var require_has_flag = (0, import_chunk_2ESYSVXG.__commonJS)({
487
+ "../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
488
+ "use strict";
489
+ module2.exports = (flag, argv = process.argv) => {
490
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
491
+ const position = argv.indexOf(prefix + flag);
492
+ const terminatorPosition = argv.indexOf("--");
493
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
494
+ };
495
+ }
496
+ });
497
+ var require_supports_color = (0, import_chunk_2ESYSVXG.__commonJS)({
488
498
  "../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"(exports, module2) {
489
499
  "use strict";
490
- var os = (0, import_chunk_WWAWV7DQ.__require)("os");
491
- var tty = (0, import_chunk_WWAWV7DQ.__require)("tty");
492
- var hasFlag = (0, import_chunk_RM5LJIEV.require_has_flag)();
500
+ var os = (0, import_chunk_2ESYSVXG.__require)("os");
501
+ var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
502
+ var hasFlag = require_has_flag();
493
503
  var { env } = process;
494
504
  var flagForceColor;
495
505
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
@@ -596,11 +606,11 @@ var require_supports_color = (0, import_chunk_WWAWV7DQ.__commonJS)({
596
606
  };
597
607
  }
598
608
  });
599
- var require_node = (0, import_chunk_WWAWV7DQ.__commonJS)({
609
+ var require_node = (0, import_chunk_2ESYSVXG.__commonJS)({
600
610
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports, module2) {
601
611
  "use strict";
602
- var tty = (0, import_chunk_WWAWV7DQ.__require)("tty");
603
- var util = (0, import_chunk_WWAWV7DQ.__require)("util");
612
+ var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
613
+ var util = (0, import_chunk_2ESYSVXG.__require)("util");
604
614
  exports.init = init;
605
615
  exports.log = log;
606
616
  exports.formatArgs = formatArgs;
@@ -769,7 +779,7 @@ var require_node = (0, import_chunk_WWAWV7DQ.__commonJS)({
769
779
  };
770
780
  }
771
781
  });
772
- var require_src = (0, import_chunk_WWAWV7DQ.__commonJS)({
782
+ var require_src = (0, import_chunk_2ESYSVXG.__commonJS)({
773
783
  "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports, module2) {
774
784
  "use strict";
775
785
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
@@ -26,26 +26,51 @@ 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_X6KW7BYP_exports = {};
30
- __export(chunk_X6KW7BYP_exports, {
29
+ var chunk_HIDSEBVV_exports = {};
30
+ __export(chunk_HIDSEBVV_exports, {
31
31
  MigrateReset: () => MigrateReset
32
32
  });
33
- module.exports = __toCommonJS(chunk_X6KW7BYP_exports);
34
- var import_chunk_V3ZMNXZC = require("./chunk-V3ZMNXZC.js");
35
- var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
36
- var import_chunk_KXMACMQC = require("./chunk-KXMACMQC.js");
33
+ module.exports = __toCommonJS(chunk_HIDSEBVV_exports);
37
34
  var import_chunk_3WC4XD74 = require("./chunk-3WC4XD74.js");
38
- var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
35
+ var import_chunk_5LKIRKDL = require("./chunk-5LKIRKDL.js");
36
+ var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
39
37
  var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
40
- var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
38
+ var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
39
+ var import_chunk_YSWLN2IJ = require("./chunk-YSWLN2IJ.js");
41
40
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
42
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
43
41
  var import_internals = require("@prisma/internals");
44
42
  var import_prompts = __toESM(require("prompts"));
45
- var _MigrateReset = class _MigrateReset2 {
43
+ var MigrateReset = class _MigrateReset {
46
44
  static new() {
47
- return new _MigrateReset2();
45
+ return new _MigrateReset();
48
46
  }
47
+ static help = (0, import_internals.format)(`
48
+ Reset your database and apply all migrations, all data will be lost
49
+
50
+ ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
51
+
52
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset [options]
53
+
54
+ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
55
+
56
+ -h, --help Display this help message
57
+ --config Custom path to your Prisma config file
58
+ --schema Custom path to your Prisma schema
59
+ --skip-generate Skip triggering generators (e.g. Prisma Client)
60
+ --skip-seed Skip triggering seed
61
+ -f, --force Skip the confirmation prompt
62
+
63
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
64
+
65
+ Reset your database and apply all migrations, all data will be lost
66
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset
67
+
68
+ Specify a schema
69
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --schema=./schema.prisma
70
+
71
+ Use --force to skip the confirmation prompt
72
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --force
73
+ `);
49
74
  async parse(argv, config) {
50
75
  const args = (0, import_internals.arg)(argv, {
51
76
  "--help": Boolean,
@@ -61,17 +86,24 @@ var _MigrateReset = class _MigrateReset2 {
61
86
  if ((0, import_internals.isError)(args)) {
62
87
  return this.help(args.message);
63
88
  }
64
- await (0, import_internals.checkUnsupportedDataProxy)("migrate reset", args, config.schema, true);
65
89
  if (args["--help"]) {
66
90
  return this.help();
67
91
  }
68
92
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
69
- const { schemaPath } = await (0, import_chunk_GKDFIHM2.getSchemaPathAndPrint)(args["--schema"], config.schema);
70
- const datasourceInfo = await (0, import_chunk_DJMFXNR4.getDatasourceInfo)({ schemaPath });
93
+ const schemaContext = await (0, import_internals.loadSchemaContext)({
94
+ schemaPathFromArg: args["--schema"],
95
+ schemaPathFromConfig: config.schema
96
+ });
97
+ const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext);
98
+ const datasourceInfo = (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource);
71
99
  (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo });
72
- const wasDbCreated = await (0, import_chunk_DJMFXNR4.ensureDatabaseExists)("create", schemaPath);
73
- if (wasDbCreated) {
74
- process.stdout.write("\n" + wasDbCreated + "\n");
100
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate reset", schemaContext });
101
+ const adapter = await config.migrate?.adapter(process.env);
102
+ if (!adapter) {
103
+ const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
104
+ if (wasDbCreated) {
105
+ process.stdout.write("\n" + wasDbCreated + "\n");
106
+ }
75
107
  }
76
108
  process.stdout.write("\n");
77
109
  if (!args["--force"]) {
@@ -89,7 +121,7 @@ var _MigrateReset = class _MigrateReset2 {
89
121
  process.exit(130);
90
122
  }
91
123
  }
92
- const migrate = new import_chunk_KXMACMQC.Migrate(schemaPath);
124
+ const migrate = await import_chunk_YSWLN2IJ.Migrate.setup({ adapter, migrationsDirPath, schemaContext });
93
125
  let migrationIds;
94
126
  try {
95
127
  await migrate.reset();
@@ -108,7 +140,7 @@ var _MigrateReset = class _MigrateReset2 {
108
140
 
109
141
  The following migration(s) have been applied:
110
142
 
111
- ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)("migrations", migrationIds, {
143
+ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)("migrations", migrationIds, {
112
144
  "migration.sql": ""
113
145
  })}
114
146
  `
@@ -118,10 +150,10 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)("migrations", migrationI
118
150
  await migrate.tryToRunGenerate(datasourceInfo);
119
151
  }
120
152
  if (!process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
121
- const seedCommandFromPkgJson = await (0, import_chunk_V3ZMNXZC.getSeedCommandFromPackageJson)(process.cwd());
153
+ const seedCommandFromPkgJson = await (0, import_chunk_5LKIRKDL.getSeedCommandFromPackageJson)(process.cwd());
122
154
  if (seedCommandFromPkgJson) {
123
155
  process.stdout.write("\n");
124
- const successfulSeeding = await (0, import_chunk_V3ZMNXZC.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
156
+ const successfulSeeding = await (0, import_chunk_5LKIRKDL.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
125
157
  if (successfulSeeding) {
126
158
  process.stdout.write(`
127
159
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
@@ -129,9 +161,6 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
129
161
  } else {
130
162
  process.exit(1);
131
163
  }
132
- } else {
133
- const { schemaPath: schemaPath2 } = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
134
- await (0, import_chunk_V3ZMNXZC.verifySeedConfigAndReturnMessage)(schemaPath2);
135
164
  }
136
165
  }
137
166
  return ``;
@@ -140,36 +169,8 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
140
169
  if (error) {
141
170
  return new import_internals.HelpError(`
142
171
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
143
- ${_MigrateReset2.help}`);
172
+ ${_MigrateReset.help}`);
144
173
  }
145
- return _MigrateReset2.help;
174
+ return _MigrateReset.help;
146
175
  }
147
176
  };
148
- (0, import_chunk_WWAWV7DQ.__publicField)(_MigrateReset, "help", (0, import_internals.format)(`
149
- Reset your database and apply all migrations, all data will be lost
150
-
151
- ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
152
-
153
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset [options]
154
-
155
- ${(0, import_chunk_SKRR5WT4.bold)("Options")}
156
-
157
- -h, --help Display this help message
158
- --config Custom path to your Prisma config file
159
- --schema Custom path to your Prisma schema
160
- --skip-generate Skip triggering generators (e.g. Prisma Client)
161
- --skip-seed Skip triggering seed
162
- -f, --force Skip the confirmation prompt
163
-
164
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
165
-
166
- Reset your database and apply all migrations, all data will be lost
167
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset
168
-
169
- Specify a schema
170
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --schema=./schema.prisma
171
-
172
- Use --force to skip the confirmation prompt
173
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset --force
174
- `));
175
- var MigrateReset = _MigrateReset;