@prisma/migrate 6.5.0-dev.4 → 6.5.0-dev.41

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.
package/dist/bin.js CHANGED
@@ -27,7 +27,7 @@ var import_chunk_4JQIX6O7 = require("./chunk-4JQIX6O7.js");
27
27
  var import_chunk_RQFGRXJI = require("./chunk-RQFGRXJI.js");
28
28
  var import_chunk_TM3ETZES = require("./chunk-TM3ETZES.js");
29
29
  var import_chunk_I4EY55DC = require("./chunk-I4EY55DC.js");
30
- var import_chunk_4EV2RVXY = require("./chunk-4EV2RVXY.js");
30
+ var import_chunk_TPQ5YBLK = require("./chunk-TPQ5YBLK.js");
31
31
  var import_chunk_WLPX3672 = require("./chunk-WLPX3672.js");
32
32
  var import_chunk_DIAO4W7O = require("./chunk-DIAO4W7O.js");
33
33
  var import_chunk_RTGQXNX6 = require("./chunk-RTGQXNX6.js");
@@ -43,14 +43,14 @@ var import_chunk_J5FHVALZ = require("./chunk-J5FHVALZ.js");
43
43
  var import_chunk_FRTPDRF2 = require("./chunk-FRTPDRF2.js");
44
44
  var import_chunk_WNH2ACJS = require("./chunk-WNH2ACJS.js");
45
45
  var import_chunk_LVLRGTYH = require("./chunk-LVLRGTYH.js");
46
- var import_chunk_PSYS5XVH = require("./chunk-PSYS5XVH.js");
46
+ var import_chunk_ANZ73E67 = require("./chunk-ANZ73E67.js");
47
47
  var import_chunk_OCQGHQED = require("./chunk-OCQGHQED.js");
48
48
  var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
49
49
  var import_chunk_V3ZMNXZC = require("./chunk-V3ZMNXZC.js");
50
50
  var import_chunk_255BRND3 = require("./chunk-255BRND3.js");
51
51
  var import_chunk_UP6FVCDK = require("./chunk-UP6FVCDK.js");
52
52
  var import_chunk_LKTTJWFT = require("./chunk-LKTTJWFT.js");
53
- var import_chunk_U5JDTUOW = require("./chunk-U5JDTUOW.js");
53
+ var import_chunk_EMWYOLT4 = require("./chunk-EMWYOLT4.js");
54
54
  var import_chunk_A6PMXMMT = require("./chunk-A6PMXMMT.js");
55
55
  var import_chunk_XRTNIFND = require("./chunk-XRTNIFND.js");
56
56
  var import_chunk_CTPONE6G = require("./chunk-CTPONE6G.js");
@@ -72,7 +72,7 @@ var import_config = require("@prisma/config");
72
72
  var import_debug = __toESM(require("@prisma/debug"));
73
73
  var import_engines_version = require("@prisma/engines-version");
74
74
  var import_internals = require("@prisma/internals");
75
- var version = "6.5.0-dev.4";
75
+ var version = "6.5.0-dev.41";
76
76
  process.on("uncaughtException", (e) => {
77
77
  console.log(e);
78
78
  });
@@ -94,15 +94,15 @@ var args = (0, import_internals.arg)(
94
94
  async function main() {
95
95
  const cli = import_chunk_QTAIWPLH.CLI.new({
96
96
  migrate: import_chunk_WNH2ACJS.MigrateCommand.new({
97
- dev: import_chunk_PSYS5XVH.MigrateDev.new(),
97
+ dev: import_chunk_ANZ73E67.MigrateDev.new(),
98
98
  status: import_chunk_I4EY55DC.MigrateStatus.new(),
99
99
  resolve: import_chunk_TM3ETZES.MigrateResolve.new(),
100
100
  reset: import_chunk_RQFGRXJI.MigrateReset.new(),
101
101
  deploy: import_chunk_LVLRGTYH.MigrateDeploy.new(),
102
- diff: import_chunk_U5JDTUOW.MigrateDiff.new()
102
+ diff: import_chunk_EMWYOLT4.MigrateDiff.new()
103
103
  }),
104
104
  db: import_chunk_HIFVDK2U.DbCommand.new({
105
- execute: import_chunk_4EV2RVXY.DbExecute.new(),
105
+ execute: import_chunk_TPQ5YBLK.DbExecute.new(),
106
106
  pull: import_chunk_WLPX3672.DbPull.new(),
107
107
  push: import_chunk_J5FHVALZ.DbPush.new(),
108
108
  // drop: DbDrop.new(),
@@ -114,7 +114,7 @@ async function main() {
114
114
  console.error(`Failed to load config file: ${error._tag}`);
115
115
  return 1;
116
116
  }
117
- const result = await cli.parse(commandArray, { ...(0, import_config.defaultConfig)(), ...config });
117
+ const result = await cli.parse(commandArray, config);
118
118
  if (result instanceof import_internals.HelpError) {
119
119
  console.error(result);
120
120
  return 1;
@@ -16,12 +16,12 @@ 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_J77IRNPE_exports = {};
20
- __export(chunk_J77IRNPE_exports, {
19
+ var chunk_5VDXAE53_exports = {};
20
+ __export(chunk_5VDXAE53_exports, {
21
21
  require_ms: () => require_ms,
22
22
  require_src: () => require_src
23
23
  });
24
- module.exports = __toCommonJS(chunk_J77IRNPE_exports);
24
+ module.exports = __toCommonJS(chunk_5VDXAE53_exports);
25
25
  var import_chunk_RM5LJIEV = require("./chunk-RM5LJIEV.js");
26
26
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
27
27
  var require_ms = (0, import_chunk_WWAWV7DQ.__commonJS)({
@@ -140,7 +140,7 @@ var require_ms = (0, import_chunk_WWAWV7DQ.__commonJS)({
140
140
  }
141
141
  });
142
142
  var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
143
- "../../node_modules/.pnpm/debug@4.3.7/node_modules/debug/src/common.js"(exports, module2) {
143
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/common.js"(exports, module2) {
144
144
  "use strict";
145
145
  function setup(env) {
146
146
  createDebug.debug = createDebug;
@@ -242,50 +242,64 @@ var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
242
242
  createDebug.namespaces = namespaces;
243
243
  createDebug.names = [];
244
244
  createDebug.skips = [];
245
- let i;
246
- const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
247
- const len = split.length;
248
- for (i = 0; i < len; i++) {
249
- if (!split[i]) {
250
- continue;
245
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
246
+ for (const ns of split) {
247
+ if (ns[0] === "-") {
248
+ createDebug.skips.push(ns.slice(1));
249
+ } else {
250
+ createDebug.names.push(ns);
251
251
  }
252
- namespaces = split[i].replace(/\*/g, ".*?");
253
- if (namespaces[0] === "-") {
254
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
252
+ }
253
+ }
254
+ function matchesTemplate(search, template) {
255
+ let searchIndex = 0;
256
+ let templateIndex = 0;
257
+ let starIndex = -1;
258
+ let matchIndex = 0;
259
+ while (searchIndex < search.length) {
260
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
261
+ if (template[templateIndex] === "*") {
262
+ starIndex = templateIndex;
263
+ matchIndex = searchIndex;
264
+ templateIndex++;
265
+ } else {
266
+ searchIndex++;
267
+ templateIndex++;
268
+ }
269
+ } else if (starIndex !== -1) {
270
+ templateIndex = starIndex + 1;
271
+ matchIndex++;
272
+ searchIndex = matchIndex;
255
273
  } else {
256
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
274
+ return false;
257
275
  }
258
276
  }
277
+ while (templateIndex < template.length && template[templateIndex] === "*") {
278
+ templateIndex++;
279
+ }
280
+ return templateIndex === template.length;
259
281
  }
260
282
  function disable() {
261
283
  const namespaces = [
262
- ...createDebug.names.map(toNamespace),
263
- ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
284
+ ...createDebug.names,
285
+ ...createDebug.skips.map((namespace) => "-" + namespace)
264
286
  ].join(",");
265
287
  createDebug.enable("");
266
288
  return namespaces;
267
289
  }
268
290
  function enabled(name) {
269
- if (name[name.length - 1] === "*") {
270
- return true;
271
- }
272
- let i;
273
- let len;
274
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
275
- if (createDebug.skips[i].test(name)) {
291
+ for (const skip of createDebug.skips) {
292
+ if (matchesTemplate(name, skip)) {
276
293
  return false;
277
294
  }
278
295
  }
279
- for (i = 0, len = createDebug.names.length; i < len; i++) {
280
- if (createDebug.names[i].test(name)) {
296
+ for (const ns of createDebug.names) {
297
+ if (matchesTemplate(name, ns)) {
281
298
  return true;
282
299
  }
283
300
  }
284
301
  return false;
285
302
  }
286
- function toNamespace(regexp) {
287
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
288
- }
289
303
  function coerce(val) {
290
304
  if (val instanceof Error) {
291
305
  return val.stack || val.message;
@@ -302,7 +316,7 @@ var require_common = (0, import_chunk_WWAWV7DQ.__commonJS)({
302
316
  }
303
317
  });
304
318
  var require_browser = (0, import_chunk_WWAWV7DQ.__commonJS)({
305
- "../../node_modules/.pnpm/debug@4.3.7/node_modules/debug/src/browser.js"(exports, module2) {
319
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/browser.js"(exports, module2) {
306
320
  "use strict";
307
321
  exports.formatArgs = formatArgs;
308
322
  exports.save = save;
@@ -583,7 +597,7 @@ var require_supports_color = (0, import_chunk_WWAWV7DQ.__commonJS)({
583
597
  }
584
598
  });
585
599
  var require_node = (0, import_chunk_WWAWV7DQ.__commonJS)({
586
- "../../node_modules/.pnpm/debug@4.3.7/node_modules/debug/src/node.js"(exports, module2) {
600
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/node.js"(exports, module2) {
587
601
  "use strict";
588
602
  var tty = (0, import_chunk_WWAWV7DQ.__require)("tty");
589
603
  var util = (0, import_chunk_WWAWV7DQ.__require)("util");
@@ -756,7 +770,7 @@ var require_node = (0, import_chunk_WWAWV7DQ.__commonJS)({
756
770
  }
757
771
  });
758
772
  var require_src = (0, import_chunk_WWAWV7DQ.__commonJS)({
759
- "../../node_modules/.pnpm/debug@4.3.7/node_modules/debug/src/index.js"(exports, module2) {
773
+ "../../node_modules/.pnpm/debug@4.4.0/node_modules/debug/src/index.js"(exports, module2) {
760
774
  "use strict";
761
775
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
762
776
  module2.exports = require_browser();
@@ -26,11 +26,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_PSYS5XVH_exports = {};
30
- __export(chunk_PSYS5XVH_exports, {
29
+ var chunk_ANZ73E67_exports = {};
30
+ __export(chunk_ANZ73E67_exports, {
31
31
  MigrateDev: () => MigrateDev
32
32
  });
33
- module.exports = __toCommonJS(chunk_PSYS5XVH_exports);
33
+ module.exports = __toCommonJS(chunk_ANZ73E67_exports);
34
34
  var import_chunk_OCQGHQED = require("./chunk-OCQGHQED.js");
35
35
  var import_chunk_7CQBDP4H = require("./chunk-7CQBDP4H.js");
36
36
  var import_chunk_V3ZMNXZC = require("./chunk-V3ZMNXZC.js");
@@ -63,8 +63,7 @@ var _MigrateDev = class _MigrateDev2 {
63
63
  "--config": String,
64
64
  "--skip-generate": Boolean,
65
65
  "--skip-seed": Boolean,
66
- "--telemetry-information": String,
67
- "--allow-reset": Boolean
66
+ "--telemetry-information": String
68
67
  });
69
68
  if ((0, import_internals.isError)(args)) {
70
69
  return this.help(args.message);
@@ -104,22 +103,14 @@ var _MigrateDev = class _MigrateDev2 {
104
103
  datasourceInfo,
105
104
  reason: devDiagnostic.action.reason
106
105
  });
107
- if (!args["--allow-reset"]) {
108
- process.stdout.write(
109
- `
110
- You may use --allow-reset to drop the database. ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will be lost."))}
106
+ process.stdout.write(
107
+ `
108
+ You may use ${(0, import_chunk_SKRR5WT4.red)("prisma migrate reset")} to drop the development database.
109
+ ${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("All data will be lost."))}
111
110
  `
112
- );
113
- migrate.stop();
114
- process.exit(130);
115
- }
116
- process.stdout.write("\nReceived --allow-reset, dropping the database. All data is lost.\n\n");
117
- try {
118
- await migrate.reset();
119
- } catch (e) {
120
- migrate.stop();
121
- throw e;
122
- }
111
+ );
112
+ migrate.stop();
113
+ process.exit(130);
123
114
  }
124
115
  try {
125
116
  const { appliedMigrationNames } = await migrate.applyMigrations();
@@ -160,10 +151,6 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
160
151
  throw new Error(unexecutableStepsError);
161
152
  }
162
153
  if (evaluateDataLossResult.warnings && evaluateDataLossResult.warnings.length > 0) {
163
- if (!(0, import_internals.canPrompt)()) {
164
- migrate.stop();
165
- throw new import_chunk_3WC4XD74.MigrateDevEnvNonInteractiveError();
166
- }
167
154
  process.stdout.write((0, import_chunk_SKRR5WT4.bold)(`
168
155
  \u26A0\uFE0F Warnings for the current datasource:
169
156
 
@@ -174,6 +161,10 @@ ${(0, import_chunk_255BRND3.printFilesFromMigrationIds)(
174
161
  }
175
162
  process.stdout.write("\n");
176
163
  if (!args["--force"]) {
164
+ if (!(0, import_internals.canPrompt)()) {
165
+ migrate.stop();
166
+ throw new import_chunk_3WC4XD74.MigrateDevEnvNonInteractiveError();
167
+ }
177
168
  const message = args["--create-only"] ? "Are you sure you want to create this migration?" : "Are you sure you want to create and apply this migration?";
178
169
  const confirmation = await (0, import_prompts.default)({
179
170
  type: "confirm",
@@ -250,7 +241,7 @@ ${(0, import_chunk_SKRR5WT4.green)("Your database is now in sync with your schem
250
241
  await migrate.tryToRunGenerate(datasourceInfo);
251
242
  process.stdout.write("\n");
252
243
  }
253
- if ((wasDbCreated || devDiagnostic.action.tag === "reset") && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
244
+ if (wasDbCreated && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
254
245
  try {
255
246
  const seedCommandFromPkgJson = await (0, import_chunk_V3ZMNXZC.getSeedCommandFromPackageJson)(process.cwd());
256
247
  if (seedCommandFromPkgJson) {
@@ -319,7 +310,6 @@ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
319
310
  The migration will be empty if there are no changes in Prisma schema
320
311
  --skip-generate Skip triggering generators (e.g. Prisma Client)
321
312
  --skip-seed Skip triggering seed
322
- --allow-reset Allow resetting the database on incompatible schema change (accept data loss)
323
313
 
324
314
  ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
325
315