@prisma/migrate 6.5.0-dev.1 → 6.5.0-dev.10

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 (110) hide show
  1. package/dist/CLI.js +3 -4
  2. package/dist/Migrate.js +6 -7
  3. package/dist/SchemaEngine.js +6 -7
  4. package/dist/bin.js +116 -146
  5. package/dist/{chunk-WOOPRG54.js → chunk-255BRND3.js} +7 -14
  6. package/dist/{chunk-75EIHNAH.js → chunk-2NMFKGXM.js} +5 -6
  7. package/dist/chunk-3WC4XD74.js +98 -0
  8. package/dist/chunk-4EV2RVXY.js +226 -0
  9. package/dist/{chunk-YWWOSXMY.js → chunk-4JQIX6O7.js} +7 -15
  10. package/dist/{chunk-J77IRNPE.js → chunk-5VDXAE53.js} +45 -31
  11. package/dist/{chunk-M5YNQ2NP.js → chunk-6DFJIBJX.js} +5 -12
  12. package/dist/{chunk-SGCF5OHF.js → chunk-7CQBDP4H.js} +6 -13
  13. package/dist/{chunk-7IT2ZO3D.js → chunk-AHJ2N6BJ.js} +3 -9
  14. package/dist/chunk-CTPONE6G.js +65 -0
  15. package/dist/{chunk-DUCG3NRP.js → chunk-D74DU52C.js} +633 -806
  16. package/dist/{chunk-UVNSK22K.js → chunk-DDHPSYC4.js} +122 -130
  17. package/dist/{chunk-CUDKD32S.js → chunk-DIAO4W7O.js} +11 -17
  18. package/dist/{chunk-XJQP3B4W.js → chunk-DJMFXNR4.js} +7 -15
  19. package/dist/{chunk-YD7GG4WS.js → chunk-FRTPDRF2.js} +66 -74
  20. package/dist/chunk-HIFVDK2U.js +96 -0
  21. package/dist/chunk-I4EY55DC.js +195 -0
  22. package/dist/{chunk-WLJHGKMK.js → chunk-IHDN3L3R.js} +7 -8
  23. package/dist/chunk-J5FHVALZ.js +230 -0
  24. package/dist/{chunk-INC2OACE.js → chunk-JFKDSUIE.js} +3 -9
  25. package/dist/{chunk-V7DE6JTG.js → chunk-JZ75RIMZ.js} +3 -9
  26. package/dist/{chunk-AAATUOV6.js → chunk-L6KOIJJ5.js} +53 -59
  27. package/dist/{chunk-GN5BY5N2.js → chunk-LGYRZ6CV.js} +4 -10
  28. package/dist/chunk-LVLRGTYH.js +148 -0
  29. package/dist/{chunk-CQQQ436N.js → chunk-MATFO4ZW.js} +186 -200
  30. package/dist/{chunk-V5LEZ5BX.js → chunk-NB4NJGMY.js} +634 -807
  31. package/dist/{chunk-IFCV5MY4.js → chunk-OCQGHQED.js} +5 -11
  32. package/dist/chunk-ORL3LJOT.js +470 -0
  33. package/dist/chunk-PSYS5XVH.js +335 -0
  34. package/dist/{chunk-Q7ACZDDT.js → chunk-QOPTDDIH.js} +5 -12
  35. package/dist/chunk-QTAIWPLH.js +78 -0
  36. package/dist/{chunk-35LAJN5S.js → chunk-RP2N6UXA.js} +23 -29
  37. package/dist/chunk-RQFGRXJI.js +174 -0
  38. package/dist/{chunk-QBK5XTJE.js → chunk-RR6BKMNO.js} +3 -9
  39. package/dist/{chunk-ILJRJJ3S.js → chunk-RTGQXNX6.js} +3 -9
  40. package/dist/chunk-SKRR5WT4.js +76 -0
  41. package/dist/chunk-TM3ETZES.js +153 -0
  42. package/dist/{chunk-KPUNMK5W.js → chunk-TWPTG4XS.js} +5 -12
  43. package/dist/{chunk-6QFE3AWR.js → chunk-UP6FVCDK.js} +6 -13
  44. package/dist/{chunk-YKUZUAXA.js → chunk-V3ZMNXZC.js} +16 -23
  45. package/dist/chunk-WLPX3672.js +365 -0
  46. package/dist/chunk-WNH2ACJS.js +122 -0
  47. package/dist/{chunk-X6XGFLEF.js → chunk-YZVZCC3I.js} +25 -30
  48. package/dist/commands/DbCommand.js +3 -4
  49. package/dist/commands/DbDrop.js +9 -9
  50. package/dist/commands/DbExecute.js +7 -8
  51. package/dist/commands/DbPull.js +18 -19
  52. package/dist/commands/DbPush.js +12 -13
  53. package/dist/commands/DbSeed.js +4 -5
  54. package/dist/commands/MigrateCommand.js +3 -4
  55. package/dist/commands/MigrateDeploy.js +13 -14
  56. package/dist/commands/MigrateDev.js +17 -18
  57. package/dist/commands/MigrateDiff.js +8 -9
  58. package/dist/commands/MigrateReset.js +15 -16
  59. package/dist/commands/MigrateResolve.js +11 -12
  60. package/dist/commands/MigrateStatus.js +11 -12
  61. package/dist/index.js +60 -77
  62. package/dist/internals/src/index.d.ts +3 -0
  63. package/dist/internals/src/utils/isInContainer.d.ts +5 -0
  64. package/dist/internals/src/utils/isInNpmLifecycleHook.d.ts +4 -0
  65. package/dist/internals/src/utils/maybeInGitHook.d.ts +9 -0
  66. package/dist/migrate/src/commands/MigrateDev.d.ts +1 -1
  67. package/dist/{multipart-parser-73VM3J4A.js → multipart-parser-NDLECNMN.js} +527 -561
  68. package/dist/utils/byline.js +5 -6
  69. package/dist/utils/captureStdout.js +2 -3
  70. package/dist/utils/countModelsAndTypes.js +2 -3
  71. package/dist/utils/ensureDatabaseExists.js +8 -9
  72. package/dist/utils/errors.js +8 -9
  73. package/dist/utils/flagErrors.js +5 -5
  74. package/dist/utils/getDatabaseVersionSafe.js +6 -7
  75. package/dist/utils/getSchemaPathAndPrint.js +4 -5
  76. package/dist/utils/handleEvaluateDataloss.js +3 -4
  77. package/dist/utils/introspectSql.js +6 -6
  78. package/dist/utils/isSchemaEmpty.js +2 -3
  79. package/dist/utils/printDatasource.js +3 -4
  80. package/dist/utils/printDatasources.js +3 -4
  81. package/dist/utils/printFiles.js +5 -6
  82. package/dist/utils/printIntrospectedSchema.js +2 -3
  83. package/dist/utils/printMigrationId.js +4 -5
  84. package/dist/utils/promptForMigrationName.js +2 -3
  85. package/dist/utils/removeSchemaFiles.js +2 -3
  86. package/dist/utils/replaceOrAddDatasource.js +2 -3
  87. package/dist/utils/replaceOrAddDatasource.test.js +7 -8
  88. package/dist/utils/saveSchemaFiles.js +2 -3
  89. package/dist/utils/seed.js +6 -7
  90. package/dist/utils/setupMSSQL.js +13 -13
  91. package/dist/utils/setupMongo.js +3 -3
  92. package/dist/utils/spinner.js +2 -3
  93. package/dist/utils/unixSocket.js +2 -3
  94. package/dist/views/handleViewsIO.js +2 -3
  95. package/package.json +7 -7
  96. package/dist/chunk-26XQQ4AG.js +0 -386
  97. package/dist/chunk-2RSEPJFX.js +0 -165
  98. package/dist/chunk-4B2LXK4R.js +0 -207
  99. package/dist/chunk-4UJBOCZJ.js +0 -130
  100. package/dist/chunk-5HZLCY6X.js +0 -161
  101. package/dist/chunk-6TE2RIPN.js +0 -80
  102. package/dist/chunk-7S3Q4MCN.js +0 -480
  103. package/dist/chunk-AOX7CJAS.js +0 -234
  104. package/dist/chunk-FF3526PX.js +0 -279
  105. package/dist/chunk-FUSFURVP.js +0 -86
  106. package/dist/chunk-GCTCQLOF.js +0 -365
  107. package/dist/chunk-K44VNAFW.js +0 -189
  108. package/dist/chunk-O4BT6W33.js +0 -104
  109. package/dist/chunk-TKAGMA5K.js +0 -72
  110. package/dist/chunk-U374EXYQ.js +0 -106
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var chunk_4EV2RVXY_exports = {};
30
+ __export(chunk_4EV2RVXY_exports, {
31
+ DbExecute: () => DbExecute
32
+ });
33
+ module.exports = __toCommonJS(chunk_4EV2RVXY_exports);
34
+ var import_chunk_DDHPSYC4 = require("./chunk-DDHPSYC4.js");
35
+ var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
36
+ var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
37
+ var import_internals = require("@prisma/internals");
38
+ var import_fs = __toESM(require("fs"));
39
+ var import_path = __toESM(require("path"));
40
+ var require_get_stdin = (0, import_chunk_WWAWV7DQ.__commonJS)({
41
+ "../../node_modules/.pnpm/get-stdin@8.0.0/node_modules/get-stdin/index.js"(exports, module2) {
42
+ "use strict";
43
+ var { stdin } = process;
44
+ module2.exports = async () => {
45
+ let result = "";
46
+ if (stdin.isTTY) {
47
+ return result;
48
+ }
49
+ stdin.setEncoding("utf8");
50
+ for await (const chunk of stdin) {
51
+ result += chunk;
52
+ }
53
+ return result;
54
+ };
55
+ module2.exports.buffer = async () => {
56
+ const result = [];
57
+ let length = 0;
58
+ if (stdin.isTTY) {
59
+ return Buffer.concat([]);
60
+ }
61
+ for await (const chunk of stdin) {
62
+ result.push(chunk);
63
+ length += chunk.length;
64
+ }
65
+ return Buffer.concat(result, length);
66
+ };
67
+ }
68
+ });
69
+ var import_get_stdin = (0, import_chunk_WWAWV7DQ.__toESM)(require_get_stdin());
70
+ var helpOptions = (0, import_internals.format)(
71
+ `${(0, import_chunk_SKRR5WT4.bold)("Usage")}
72
+
73
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute [options]
74
+
75
+ ${(0, import_chunk_SKRR5WT4.bold)("Options")}
76
+
77
+ -h, --help Display this help message
78
+ --config Custom path to your Prisma config file
79
+
80
+ ${(0, import_chunk_SKRR5WT4.italic)("Datasource input, only 1 must be provided:")}
81
+ --url URL of the datasource to run the command on
82
+ --schema Path to your Prisma schema file to take the datasource URL from
83
+
84
+ ${(0, import_chunk_SKRR5WT4.italic)("Script input, only 1 must be provided:")}
85
+ --file Path to a file. The content will be sent as the script to be executed
86
+
87
+ ${(0, import_chunk_SKRR5WT4.bold)("Flags")}
88
+
89
+ --stdin Use the terminal standard input as the script to be executed`
90
+ );
91
+ var _DbExecute = class _DbExecute2 {
92
+ static new() {
93
+ return new _DbExecute2();
94
+ }
95
+ async parse(argv, config) {
96
+ const args = (0, import_internals.arg)(
97
+ argv,
98
+ {
99
+ "--help": Boolean,
100
+ "-h": "--help",
101
+ "--config": String,
102
+ "--stdin": Boolean,
103
+ "--file": String,
104
+ "--schema": String,
105
+ "--url": String,
106
+ "--telemetry-information": String
107
+ },
108
+ false
109
+ );
110
+ if ((0, import_internals.isError)(args)) {
111
+ return this.help(args.message);
112
+ }
113
+ await (0, import_internals.checkUnsupportedDataProxy)("db execute", args, config.schema, !args["--url"]);
114
+ if (args["--help"]) {
115
+ return this.help();
116
+ }
117
+ await (0, import_internals.loadEnvFile)({ schemaPath: args["--schema"], printMessage: false, config });
118
+ if (args["--stdin"] && args["--file"]) {
119
+ throw new Error(
120
+ `--stdin and --file cannot be used at the same time. Only 1 must be provided.
121
+ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
122
+ );
123
+ } else if (!args["--stdin"] && !args["--file"]) {
124
+ throw new Error(
125
+ `Either --stdin or --file must be provided.
126
+ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
127
+ );
128
+ }
129
+ if (args["--url"] && args["--schema"]) {
130
+ throw new Error(
131
+ `--url and --schema cannot be used at the same time. Only 1 must be provided.
132
+ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
133
+ );
134
+ } else if (!args["--url"] && !args["--schema"]) {
135
+ throw new Error(
136
+ `Either --url or --schema must be provided.
137
+ See \`${(0, import_chunk_SKRR5WT4.green)((0, import_internals.getCommandWithExecutor)("prisma db execute -h"))}\``
138
+ );
139
+ }
140
+ let script = "";
141
+ if (args["--file"]) {
142
+ try {
143
+ script = import_fs.default.readFileSync(import_path.default.resolve(args["--file"]), "utf-8");
144
+ } catch (e) {
145
+ if (e.code === "ENOENT") {
146
+ throw new Error(`Provided --file at ${args["--file"]} doesn't exist.`);
147
+ } else {
148
+ console.error(`An error occurred while reading the provided --file at ${args["--file"]}`);
149
+ throw e;
150
+ }
151
+ }
152
+ }
153
+ if (args["--stdin"]) {
154
+ script = await (0, import_get_stdin.default)();
155
+ }
156
+ let datasourceType;
157
+ if (args["--url"]) {
158
+ datasourceType = {
159
+ tag: "url",
160
+ url: args["--url"]
161
+ };
162
+ } else {
163
+ const schemaWithPath = await (0, import_internals.getSchemaWithPath)(args["--schema"], config.schema);
164
+ const engineConfig = await (0, import_internals.getConfig)({ datamodel: schemaWithPath.schemas });
165
+ datasourceType = {
166
+ tag: "schema",
167
+ ...(0, import_internals.toSchemasWithConfigDir)(schemaWithPath, engineConfig)
168
+ };
169
+ }
170
+ const migrate = new import_chunk_DDHPSYC4.Migrate();
171
+ try {
172
+ await migrate.engine.dbExecute({
173
+ script,
174
+ datasourceType
175
+ });
176
+ } finally {
177
+ migrate.stop();
178
+ }
179
+ return `Script executed successfully.`;
180
+ }
181
+ help(error) {
182
+ if (error) {
183
+ throw new import_internals.HelpError(`
184
+ ${error}
185
+
186
+ ${helpOptions}`);
187
+ }
188
+ return _DbExecute2.help;
189
+ }
190
+ };
191
+ _DbExecute.help = (0, import_internals.format)(`
192
+ ${process.platform === "win32" ? "" : "\u{1F4DD} "}Execute native commands to your database
193
+
194
+ 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)(
195
+ `--stdin`
196
+ )} or ${(0, import_chunk_SKRR5WT4.green)(`--file`)}.
197
+ The input parameters are mutually exclusive, only 1 of each (datasource & script) must be provided.
198
+
199
+ The output of the command is connector-specific, and is not meant for returning data, but only to report success or failure.
200
+
201
+ On SQL databases, this command takes as input a SQL script.
202
+ The whole script will be sent as a single command to the database.
203
+
204
+ ${(0, import_chunk_SKRR5WT4.italic)(`This command is currently not supported on MongoDB.`)}
205
+
206
+ ${helpOptions}
207
+ ${(0, import_chunk_SKRR5WT4.bold)("Examples")}
208
+
209
+ Execute the content of a SQL script file to the datasource URL taken from the schema
210
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma db execute
211
+ --file ./script.sql \\
212
+ --schema schema.prisma
213
+
214
+ Execute the SQL script from stdin to the datasource URL specified via the \`DATABASE_URL\` environment variable
215
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
216
+ prisma db execute \\
217
+ --stdin \\
218
+ --url="$DATABASE_URL"
219
+
220
+ Like previous example, but exposing the datasource url credentials to your terminal history
221
+ ${(0, import_chunk_SKRR5WT4.dim)("$")} echo 'TRUNCATE TABLE dev;' | \\
222
+ prisma db execute \\
223
+ --stdin \\
224
+ --url="mysql://root:root@localhost/mydb"
225
+ `);
226
+ var DbExecute = _DbExecute;
@@ -26,20 +26,19 @@ 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_YWWOSXMY_exports = {};
30
- __export(chunk_YWWOSXMY_exports, {
31
- getDatabaseVersionSafe: () => getDatabaseVersionSafe,
32
- init_getDatabaseVersionSafe: () => init_getDatabaseVersionSafe
29
+ var chunk_4JQIX6O7_exports = {};
30
+ __export(chunk_4JQIX6O7_exports, {
31
+ getDatabaseVersionSafe: () => getDatabaseVersionSafe
33
32
  });
34
- module.exports = __toCommonJS(chunk_YWWOSXMY_exports);
35
- var import_chunk_7S3Q4MCN = require("./chunk-7S3Q4MCN.js");
36
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
33
+ module.exports = __toCommonJS(chunk_4JQIX6O7_exports);
34
+ var import_chunk_ORL3LJOT = require("./chunk-ORL3LJOT.js");
37
35
  var import_debug = __toESM(require("@prisma/debug"));
36
+ var debug = (0, import_debug.default)("prisma:cli");
38
37
  async function getDatabaseVersionSafe(args) {
39
38
  let engine;
40
39
  let dbVersion;
41
40
  try {
42
- engine = new import_chunk_7S3Q4MCN.SchemaEngine({});
41
+ engine = new import_chunk_ORL3LJOT.SchemaEngine({});
43
42
  dbVersion = await engine.getDatabaseVersion(args);
44
43
  } catch (e) {
45
44
  debug(e);
@@ -50,10 +49,3 @@ async function getDatabaseVersionSafe(args) {
50
49
  }
51
50
  return dbVersion;
52
51
  }
53
- var debug;
54
- var init_getDatabaseVersionSafe = (0, import_chunk_WWAWV7DQ.__esm)({
55
- "src/utils/getDatabaseVersionSafe.ts"() {
56
- (0, import_chunk_7S3Q4MCN.init_SchemaEngine)();
57
- debug = (0, import_debug.default)("prisma:cli");
58
- }
59
- });
@@ -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,15 +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_M5YNQ2NP_exports = {};
30
- __export(chunk_M5YNQ2NP_exports, {
29
+ var chunk_6DFJIBJX_exports = {};
30
+ __export(chunk_6DFJIBJX_exports, {
31
31
  getSchemaPathAndPrint: () => getSchemaPathAndPrint,
32
- init_getSchemaPathAndPrint: () => init_getSchemaPathAndPrint,
33
32
  printSchemaLoadedMessage: () => printSchemaLoadedMessage
34
33
  });
35
- module.exports = __toCommonJS(chunk_M5YNQ2NP_exports);
36
- var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
37
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
34
+ module.exports = __toCommonJS(chunk_6DFJIBJX_exports);
35
+ var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
38
36
  var import_internals = require("@prisma/internals");
39
37
  var import_path = __toESM(require("path"));
40
38
  async function getSchemaPathAndPrint(schemaPathProvided, schemaPathFromConfig, options) {
@@ -43,10 +41,5 @@ async function getSchemaPathAndPrint(schemaPathProvided, schemaPathFromConfig, o
43
41
  return schemaPathResult;
44
42
  }
45
43
  function printSchemaLoadedMessage(schemaPath) {
46
- process.stdout.write((0, import_chunk_6TE2RIPN.dim)(`Prisma schema loaded from ${import_path.default.relative(process.cwd(), schemaPath)}`) + "\n");
44
+ process.stdout.write((0, import_chunk_SKRR5WT4.dim)(`Prisma schema loaded from ${import_path.default.relative(process.cwd(), schemaPath)}`) + "\n");
47
45
  }
48
- var init_getSchemaPathAndPrint = (0, import_chunk_WWAWV7DQ.__esm)({
49
- "src/utils/getSchemaPathAndPrint.ts"() {
50
- (0, import_chunk_6TE2RIPN.init_colors)();
51
- }
52
- });
@@ -16,19 +16,17 @@ 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_SGCF5OHF_exports = {};
20
- __export(chunk_SGCF5OHF_exports, {
21
- handleUnexecutableSteps: () => handleUnexecutableSteps,
22
- init_handleEvaluateDataloss: () => init_handleEvaluateDataloss
19
+ var chunk_7CQBDP4H_exports = {};
20
+ __export(chunk_7CQBDP4H_exports, {
21
+ handleUnexecutableSteps: () => handleUnexecutableSteps
23
22
  });
24
- module.exports = __toCommonJS(chunk_SGCF5OHF_exports);
25
- var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
26
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
23
+ module.exports = __toCommonJS(chunk_7CQBDP4H_exports);
24
+ var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
27
25
  var import_internals = require("@prisma/internals");
28
26
  function handleUnexecutableSteps(unexecutableSteps, createOnly = false) {
29
27
  if (unexecutableSteps && unexecutableSteps.length > 0) {
30
28
  const messages = [];
31
- messages.push(`${(0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.red)("\n\u26A0\uFE0F We found changes that cannot be executed:\n"))}`);
29
+ messages.push(`${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)("\n\u26A0\uFE0F We found changes that cannot be executed:\n"))}`);
32
30
  for (const item of unexecutableSteps) {
33
31
  messages.push(`${` \u2022 Step ${item.stepIndex} ${item.message}`}`);
34
32
  }
@@ -49,8 +47,3 @@ Then run ${(0, import_internals.getCommandWithExecutor)("prisma migrate dev")} t
49
47
  }
50
48
  return void 0;
51
49
  }
52
- var init_handleEvaluateDataloss = (0, import_chunk_WWAWV7DQ.__esm)({
53
- "src/utils/handleEvaluateDataloss.ts"() {
54
- (0, import_chunk_6TE2RIPN.init_colors)();
55
- }
56
- });
@@ -26,13 +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_7IT2ZO3D_exports = {};
30
- __export(chunk_7IT2ZO3D_exports, {
31
- init_printIntrospectedSchema: () => init_printIntrospectedSchema,
29
+ var chunk_AHJ2N6BJ_exports = {};
30
+ __export(chunk_AHJ2N6BJ_exports, {
32
31
  printIntrospectedSchema: () => printIntrospectedSchema
33
32
  });
34
- module.exports = __toCommonJS(chunk_7IT2ZO3D_exports);
35
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
33
+ module.exports = __toCommonJS(chunk_AHJ2N6BJ_exports);
36
34
  var import_path = __toESM(require("path"));
37
35
  function printIntrospectedSchema(schema, out) {
38
36
  if (schema.files.length === 1) {
@@ -47,7 +45,3 @@ ${file.content}
47
45
  `);
48
46
  }
49
47
  }
50
- var init_printIntrospectedSchema = (0, import_chunk_WWAWV7DQ.__esm)({
51
- "src/utils/printIntrospectedSchema.ts"() {
52
- }
53
- });
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var chunk_CTPONE6G_exports = {};
20
+ __export(chunk_CTPONE6G_exports, {
21
+ CaptureStdout: () => CaptureStdout
22
+ });
23
+ module.exports = __toCommonJS(chunk_CTPONE6G_exports);
24
+ var CaptureStdout = class {
25
+ constructor() {
26
+ this._capturedText = [];
27
+ this._orig_stdout_write = null;
28
+ }
29
+ /**
30
+ * Starts capturing the writes to process.stdout
31
+ */
32
+ startCapture() {
33
+ this._orig_stdout_write = process.stdout.write;
34
+ process.stdout.write = this._writeCapture.bind(this);
35
+ }
36
+ /**
37
+ * Stops capturing the writes to process.stdout.
38
+ */
39
+ stopCapture() {
40
+ if (this._orig_stdout_write) {
41
+ process.stdout.write = this._orig_stdout_write;
42
+ }
43
+ }
44
+ /**
45
+ * Private method that is used as the replacement write function for process.stdout
46
+ * @param string
47
+ * @private
48
+ */
49
+ _writeCapture(string) {
50
+ this._capturedText.push(string);
51
+ }
52
+ /**
53
+ * Retrieve the text that has been captured since creation or since the last clear call
54
+ * @returns {Array} of Strings
55
+ */
56
+ getCapturedText() {
57
+ return this._capturedText;
58
+ }
59
+ /**
60
+ * Clears all of the captured text
61
+ */
62
+ clearCaptureText() {
63
+ this._capturedText = [];
64
+ }
65
+ };