@prisma/migrate 6.6.0-dev.5 → 6.6.0-dev.50

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 (140) hide show
  1. package/dist/CLI.js +3 -3
  2. package/dist/Migrate.js +8 -6
  3. package/dist/SchemaEngine.js +5 -5
  4. package/dist/bin.js +47 -46
  5. package/dist/chunk-23DZXSTI.js +62 -0
  6. package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
  7. package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
  8. package/dist/chunk-33LPBNDX.js +1399 -0
  9. package/dist/{chunk-GG54LOYV.js → chunk-3PIR4R46.js} +45 -44
  10. package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  11. package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
  12. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  13. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  14. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  15. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  16. package/dist/{chunk-Q3ZLC44N.js → chunk-CKRN45WP.js} +57 -66
  17. package/dist/{chunk-ZOEKRXDP.js → chunk-D2DGSPW6.js} +29 -55
  18. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  19. package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
  20. package/dist/{chunk-N3KYWSX2.js → chunk-GAKKKF5T.js} +55 -49
  21. package/dist/{chunk-N4XTKFY6.js → chunk-GKHRL6AR.js} +39 -38
  22. package/dist/{chunk-CQZFVAXC.js → chunk-HHVLUI3H.js} +42 -41
  23. package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
  24. package/dist/{chunk-HCBZB4XC.js → chunk-KN2W5IP7.js} +53 -52
  25. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  26. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  27. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  28. package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
  29. package/dist/{chunk-KS7IEA6Z.js → chunk-O723A5JE.js} +50 -52
  30. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  31. package/dist/chunk-PDCXVUV3.js +883 -0
  32. package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
  33. package/dist/{chunk-UG7FMNDT.js → chunk-SA6K55XE.js} +366 -438
  34. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  35. package/dist/chunk-URKH6SE2.js +479 -0
  36. package/dist/chunk-V6PVGSDJ.js +76 -0
  37. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  38. package/dist/{chunk-XE57D2AO.js → chunk-VHHIONLT.js} +367 -439
  39. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  40. package/dist/{chunk-A6PMXMMT.js → chunk-ZB5NPOJW.js} +13 -13
  41. package/dist/{chunk-WI2A2TQE.js → chunk-ZJ4IDCRR.js} +90 -91
  42. package/dist/commands/DbCommand.js +3 -3
  43. package/dist/commands/DbDrop.js +4 -5
  44. package/dist/commands/DbExecute.js +9 -7
  45. package/dist/commands/DbPull.js +11 -10
  46. package/dist/commands/DbPush.js +10 -9
  47. package/dist/commands/DbSeed.js +4 -5
  48. package/dist/commands/MigrateCommand.js +3 -3
  49. package/dist/commands/MigrateDeploy.js +12 -11
  50. package/dist/commands/MigrateDev.js +14 -13
  51. package/dist/commands/MigrateDiff.js +12 -10
  52. package/dist/commands/MigrateReset.js +13 -12
  53. package/dist/commands/MigrateResolve.js +10 -9
  54. package/dist/commands/MigrateStatus.js +10 -9
  55. package/dist/index.js +50 -51
  56. package/dist/internals/src/Generator.d.ts +1 -1
  57. package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
  58. package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
  59. package/dist/internals/src/cli/getSchema.d.ts +3 -28
  60. package/dist/internals/src/cli/hashes.d.ts +1 -2
  61. package/dist/internals/src/cli/schemaContext.d.ts +59 -0
  62. package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
  63. package/dist/internals/src/convertCredentials.d.ts +1 -1
  64. package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
  65. package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
  66. package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
  67. package/dist/internals/src/errorReporting.d.ts +0 -1
  68. package/dist/internals/src/get-generators/getGenerators.d.ts +8 -4
  69. package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
  70. package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
  71. package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
  72. package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
  73. package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
  74. package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
  75. package/dist/internals/src/index.d.ts +5 -3
  76. package/dist/internals/src/migrateTypes.d.ts +63 -0
  77. package/dist/internals/src/panic.d.ts +1 -4
  78. package/dist/internals/src/types.d.ts +1 -1
  79. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  80. package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
  81. package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
  82. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  83. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  84. package/dist/migrate/src/Migrate.d.ts +7 -5
  85. package/dist/migrate/src/SchemaEngine.d.ts +5 -9
  86. package/dist/migrate/src/index.d.ts +0 -1
  87. package/dist/migrate/src/types.d.ts +14 -10
  88. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  89. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  90. package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
  91. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  92. package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
  93. package/dist/migrate/src/utils/seed.d.ts +0 -2
  94. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  95. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  96. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  97. package/dist/types.js +1 -1
  98. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  99. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  100. package/dist/utils/byline.js +1 -1
  101. package/dist/utils/captureStdout.js +3 -3
  102. package/dist/utils/countModelsAndTypes.js +1 -1
  103. package/dist/utils/{getSchemaPathAndPrint.js → createMigration.js} +8 -8
  104. package/dist/utils/customColors.js +1 -1
  105. package/dist/utils/ensureDatabaseExists.js +7 -7
  106. package/dist/utils/errors.js +1 -1
  107. package/dist/utils/flagErrors.js +1 -1
  108. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  109. package/dist/utils/handleEvaluateDataloss.js +1 -1
  110. package/dist/utils/introspectSql.js +5 -5
  111. package/dist/utils/isSchemaEmpty.js +1 -1
  112. package/dist/utils/listMigrations.js +25 -0
  113. package/dist/utils/now.js +1 -1
  114. package/dist/utils/printDatasource.js +1 -1
  115. package/dist/utils/printDatasources.js +5 -5
  116. package/dist/utils/printFiles.js +5 -5
  117. package/dist/utils/printIntrospectedSchema.js +1 -1
  118. package/dist/utils/printMigrationId.js +1 -1
  119. package/dist/utils/promptForMigrationName.js +3 -3
  120. package/dist/utils/removeSchemaFiles.js +1 -1
  121. package/dist/utils/replaceOrAddDatasource.js +1 -1
  122. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  123. package/dist/utils/saveSchemaFiles.js +1 -1
  124. package/dist/utils/seed.js +4 -7
  125. package/dist/utils/setupCockroach.js +3 -3
  126. package/dist/utils/setupMSSQL.js +759 -675
  127. package/dist/utils/setupMongo.js +552 -552
  128. package/dist/utils/setupMysql.js +508 -563
  129. package/dist/utils/setupPostgres.js +3 -3
  130. package/dist/utils/spinner.js +4 -3
  131. package/dist/utils/test-handlePanic.js +1 -30
  132. package/dist/utils/unixSocket.js +1 -1
  133. package/dist/views/handleViewsIO.js +3 -3
  134. package/package.json +10 -11
  135. package/dist/chunk-GKDFIHM2.js +0 -45
  136. package/dist/chunk-J46BJQHT.js +0 -268
  137. package/dist/chunk-KOF4LGTS.js +0 -1817
  138. package/dist/chunk-YYPMC5FN.js +0 -1407
  139. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
  140. package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
@@ -26,14 +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_N3KYWSX2_exports = {};
30
- __export(chunk_N3KYWSX2_exports, {
29
+ var chunk_GAKKKF5T_exports = {};
30
+ __export(chunk_GAKKKF5T_exports, {
31
31
  DbExecute: () => DbExecute
32
32
  });
33
- module.exports = __toCommonJS(chunk_N3KYWSX2_exports);
34
- var import_chunk_KOF4LGTS = require("./chunk-KOF4LGTS.js");
33
+ module.exports = __toCommonJS(chunk_GAKKKF5T_exports);
34
+ var import_chunk_PDCXVUV3 = require("./chunk-PDCXVUV3.js");
35
35
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
36
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
37
36
  var import_internals = require("@prisma/internals");
38
37
  var import_fs = __toESM(require("fs"));
39
38
  var import_path = __toESM(require("path"));
@@ -82,10 +81,48 @@ ${(0, import_chunk_SKRR5WT4.bold)("Flags")}
82
81
 
83
82
  --stdin Use the terminal standard input as the script to be executed`
84
83
  );
85
- var _DbExecute = class _DbExecute2 {
84
+ var DbExecute = class _DbExecute {
86
85
  static new() {
87
- return new _DbExecute2();
86
+ return new _DbExecute();
88
87
  }
88
+ // TODO: This command needs to get proper support for `prisma.config.ts` eventually. Not just taking the schema path
89
+ // from prisma.config.ts but likely to support driver adapters, too?
90
+ // See https://linear.app/prisma-company/issue/ORM-639/prisma-db-execute-support-prismaconfigts-and-driver-adapters
91
+ static help = (0, import_internals.format)(`
92
+ ${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
93
+
94
+ This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
95
+ `--stdin`
96
+ )} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
97
+ The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
98
+
99
+ The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
100
+
101
+ On SQL databases, this command takes as input a SQL script.
102
+ The whole script will be sent as a single command to the database.
103
+
104
+ ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
105
+
106
+ ${helpOptions}
107
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
108
+
109
+ Execute the content of a SQL script file to the datasource URL taken from the schema
110
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
111
+ --file ./script.sql \\
112
+ --schema schema.prisma
113
+
114
+ Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
115
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
116
+ prisma db execute \\
117
+ --stdin \\
118
+ --url="$DATABASE_URL"
119
+
120
+ Like previous example, but exposing the datasource url credentials to your terminal history
121
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
122
+ prisma db execute \\
123
+ --stdin \\
124
+ --url="mysql://root:root@localhost/mydb"
125
+ `);
89
126
  async parse(argv, config) {
90
127
  const args = (0, import_internals.arg)(
91
128
  argv,
@@ -104,7 +141,6 @@ var _DbExecute = class _DbExecute2 {
104
141
  if ((0, import_internals.isError)(args)) {
105
142
  return this.help(args.message);
106
143
  }
107
- await (0, import_internals.checkUnsupportedDataProxy)("db execute", args, config.schema, !args["--url"]);
108
144
  if (args["--help"]) {
109
145
  return this.help();
110
146
  }
@@ -149,19 +185,25 @@ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExec
149
185
  }
150
186
  let datasourceType;
151
187
  if (args["--url"]) {
188
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd: "db execute", urls: [args["--url"]] });
152
189
  datasourceType = {
153
190
  tag: "url",
154
191
  url: args["--url"]
155
192
  };
156
193
  } else {
157
- const schemaWithPath = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
158
- const engineConfig = await (0, import_internals.getConfig)({ datamodel: schemaWithPath.schemas });
194
+ const schemaContext = await (0, import_internals.loadSchemaContext)({
195
+ schemaPathFromArg: args["--schema"],
196
+ schemaPathFromConfig: config.schema,
197
+ printLoadMessage: false
198
+ });
199
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd: "db execute", schemaContext });
159
200
  datasourceType = {
160
201
  tag: "schema",
161
- ...(0, import_internals.toSchemasWithConfigDir)(schemaWithPath, engineConfig)
202
+ ...(0, import_internals.toSchemasContainer)(schemaContext.schemaFiles),
203
+ configDir: schemaContext.primaryDatasourceDirectory
162
204
  };
163
205
  }
164
- const migrate = new import_chunk_KOF4LGTS.Migrate();
206
+ const migrate = new import_chunk_PDCXVUV3.Migrate();
165
207
  try {
166
208
  await migrate.engine.dbExecute({
167
209
  script,
@@ -179,42 +221,6 @@ ${error}
179
221
 
180
222
  ${helpOptions}`);
181
223
  }
182
- return _DbExecute2.help;
224
+ return _DbExecute.help;
183
225
  }
184
226
  };
185
- (0, import_chunk_WWAWV7DQ.__publicField)(_DbExecute, "help", (0, import_internals.format)(`
186
- ${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
187
-
188
- This command takes as input a datasource, using ${(0, import_chunk_SKRR5WT4.green)(`--url`)} or ${(0, import_chunk_SKRR5WT4.green)(`--schema`)} and a script, using ${(0, import_chunk_SKRR5WT4.green)(
189
- `--stdin`
190
- )} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
191
- The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
192
-
193
- The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
194
-
195
- On SQL databases, this command takes as input a SQL script.
196
- The whole script will be sent as a single command to the database.
197
-
198
- ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
199
-
200
- ${helpOptions}
201
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
202
-
203
- Execute the content of a SQL script file to the datasource URL taken from the schema
204
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
205
- --file ./script.sql \\
206
- --schema schema.prisma
207
-
208
- Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
209
- ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
210
- prisma db execute \\
211
- --stdin \\
212
- --url="$DATABASE_URL"
213
-
214
- Like previous example, but exposing the datasource url credentials to your terminal history
215
- ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
216
- prisma db execute \\
217
- --stdin \\
218
- --url="mysql://root:root@localhost/mydb"
219
- `));
220
- var DbExecute = _DbExecute;
@@ -26,24 +26,43 @@ 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_N4XTKFY6_exports = {};
30
- __export(chunk_N4XTKFY6_exports, {
29
+ var chunk_GKHRL6AR_exports = {};
30
+ __export(chunk_GKHRL6AR_exports, {
31
31
  MigrateStatus: () => MigrateStatus
32
32
  });
33
- module.exports = __toCommonJS(chunk_N4XTKFY6_exports);
34
- var import_chunk_KOF4LGTS = require("./chunk-KOF4LGTS.js");
35
- var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
33
+ module.exports = __toCommonJS(chunk_GKHRL6AR_exports);
34
+ var import_chunk_PDCXVUV3 = require("./chunk-PDCXVUV3.js");
36
35
  var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
37
- var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
36
+ var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.js");
38
37
  var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
39
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
40
38
  var import_debug = __toESM(require("@prisma/debug"));
41
39
  var import_internals = require("@prisma/internals");
42
40
  var debug = (0, import_debug.default)("prisma:migrate:status");
43
- var _MigrateStatus = class _MigrateStatus2 {
41
+ var MigrateStatus = class _MigrateStatus {
44
42
  static new() {
45
- return new _MigrateStatus2();
43
+ return new _MigrateStatus();
46
44
  }
45
+ static help = (0, import_internals.format)(`
46
+ Check the status of your database migrations
47
+
48
+ ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
49
+
50
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status [options]
51
+
52
+ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
53
+
54
+ -h, --help Display this help message
55
+ --config Custom path to your Prisma config file
56
+ --schema Custom path to your Prisma schema
57
+
58
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
59
+
60
+ Check the status of your database migrations
61
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status
62
+
63
+ Specify a schema
64
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status --schema=./schema.prisma
65
+ `);
47
66
  async parse(argv, config) {
48
67
  const args = (0, import_internals.arg)(
49
68
  argv,
@@ -59,15 +78,19 @@ var _MigrateStatus = class _MigrateStatus2 {
59
78
  if ((0, import_internals.isError)(args)) {
60
79
  return this.help(args.message);
61
80
  }
62
- await (0, import_internals.checkUnsupportedDataProxy)("migrate status", args, config.schema, true);
63
81
  if (args["--help"]) {
64
82
  return this.help();
65
83
  }
66
84
  await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: true, config });
67
- const { schemaPath } = await (0, import_chunk_GKDFIHM2.getSchemaPathAndPrint)(args["--schema"], config.schema);
68
- (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: await (0, import_chunk_DJMFXNR4.getDatasourceInfo)({ schemaPath }) });
69
- const migrate = new import_chunk_KOF4LGTS.Migrate(schemaPath);
70
- await (0, import_chunk_DJMFXNR4.ensureCanConnectToDatabase)(schemaPath);
85
+ const schemaContext = await (0, import_internals.loadSchemaContext)({
86
+ schemaPathFromArg: args["--schema"],
87
+ schemaPathFromConfig: config.schema
88
+ });
89
+ const { migrationsDirPath } = (0, import_internals.inferDirectoryConfig)(schemaContext);
90
+ (0, import_internals.checkUnsupportedDataProxy)({ cmd: "migrate status", schemaContext });
91
+ (0, import_chunk_QOPTDDIH.printDatasource)({ datasourceInfo: (0, import_chunk_74LUB4XX.parseDatasourceInfo)(schemaContext.primaryDatasource) });
92
+ const migrate = new import_chunk_PDCXVUV3.Migrate(schemaContext, migrationsDirPath);
93
+ await (0, import_chunk_74LUB4XX.ensureCanConnectToDatabase)(schemaContext.primaryDatasource);
71
94
  let diagnoseResult;
72
95
  let listMigrationDirectoriesResult;
73
96
  try {
@@ -167,30 +190,8 @@ ${(0, import_internals.link)("https://pris.ly/d/migrate-resolve")}`);
167
190
  if (error) {
168
191
  return new import_internals.HelpError(`
169
192
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
170
- ${_MigrateStatus2.help}`);
193
+ ${_MigrateStatus.help}`);
171
194
  }
172
- return _MigrateStatus2.help;
195
+ return _MigrateStatus.help;
173
196
  }
174
197
  };
175
- (0, import_chunk_WWAWV7DQ.__publicField)(_MigrateStatus, "help", (0, import_internals.format)(`
176
- Check the status of your database migrations
177
-
178
- ${(0, import_chunk_SKRR5WT4.bold)("Usage")}
179
-
180
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status [options]
181
-
182
- ${(0, import_chunk_SKRR5WT4.bold)("Options")}
183
-
184
- -h, --help Display this help message
185
- --config Custom path to your Prisma config file
186
- --schema Custom path to your Prisma schema
187
-
188
- ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
189
-
190
- Check the status of your database migrations
191
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status
192
-
193
- Specify a schema
194
- ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status --schema=./schema.prisma
195
- `));
196
- var MigrateStatus = _MigrateStatus;
@@ -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_CQZFVAXC_exports = {};
30
- __export(chunk_CQZFVAXC_exports, {
29
+ var chunk_HHVLUI3H_exports = {};
30
+ __export(chunk_HHVLUI3H_exports, {
31
31
  MigrateDeploy: () => MigrateDeploy
32
32
  });
33
- module.exports = __toCommonJS(chunk_CQZFVAXC_exports);
34
- var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
35
- var import_chunk_KOF4LGTS = require("./chunk-KOF4LGTS.js");
36
- var import_chunk_GKDFIHM2 = require("./chunk-GKDFIHM2.js");
33
+ module.exports = __toCommonJS(chunk_HHVLUI3H_exports);
34
+ var import_chunk_KRQEFTDT = require("./chunk-KRQEFTDT.js");
35
+ var import_chunk_PDCXVUV3 = require("./chunk-PDCXVUV3.js");
37
36
  var import_chunk_QOPTDDIH = require("./chunk-QOPTDDIH.js");
38
- var import_chunk_DJMFXNR4 = require("./chunk-DJMFXNR4.js");
37
+ var import_chunk_74LUB4XX = require("./chunk-74LUB4XX.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,16 +80,20 @@ 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_KOF4LGTS.Migrate(schemaPath);
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 migrate = new import_chunk_PDCXVUV3.Migrate(schemaContext, migrationsDirPath);
71
95
  try {
72
- const wasDbCreated = await (0, import_chunk_DJMFXNR4.ensureDatabaseExists)("apply", schemaPath);
96
+ const wasDbCreated = await (0, import_chunk_74LUB4XX.ensureDatabaseExists)(schemaContext.primaryDatasource);
73
97
  if (wasDbCreated) {
74
98
  process.stdout.write("\n" + wasDbCreated + "\n");
75
99
  }
@@ -104,7 +128,7 @@ var _MigrateDeploy = class _MigrateDeploy2 {
104
128
  } else {
105
129
  return `The following migration(s) have been applied:
106
130
 
107
- ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
131
+ ${(0, import_chunk_KRQEFTDT.printFilesFromMigrationIds)(
108
132
  "migrations",
109
133
  migrationIds,
110
134
  {
@@ -119,31 +143,8 @@ ${(0, import_chunk_SKRR5WT4.green)("All migrations have been successfully applie
119
143
  if (error) {
120
144
  return new import_internals.HelpError(`
121
145
  ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
122
- ${_MigrateDeploy2.help}`);
146
+ ${_MigrateDeploy.help}`);
123
147
  }
124
- return _MigrateDeploy2.help;
148
+ return _MigrateDeploy.help;
125
149
  }
126
150
  };
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;