@prisma/migrate 6.6.0-dev.2 → 6.6.0-dev.21
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/Migrate.js +3 -4
- package/dist/bin.js +25 -28
- package/dist/{chunk-X6KW7BYP.js → chunk-2VSCT73F.js} +9 -9
- package/dist/{chunk-EX2UWGES.js → chunk-3OQIC7NW.js} +6 -6
- package/dist/chunk-3VFKYWQZ.js +486 -0
- package/dist/chunk-4ZFVT4RS.js +2590 -0
- package/dist/{chunk-5VDXAE53.js → chunk-5PSO7BDO.js} +15 -5
- package/dist/{chunk-AYOOPD2C.js → chunk-B3XQ3BCN.js} +10 -10
- package/dist/{chunk-Q7M5ANIE.js → chunk-CLANLLK4.js} +9 -9
- package/dist/{chunk-ZQ3OWSVS.js → chunk-DAYMMAJB.js} +5 -5
- package/dist/{chunk-A4BCLP6K.js → chunk-DNOOU7FC.js} +9 -9
- package/dist/{chunk-X5N72JHI.js → chunk-IY67YUOD.js} +5 -5
- package/dist/{chunk-E7OXHCDR.js → chunk-MREGRQDD.js} +5 -5
- package/dist/chunk-N5UBDQRA.js +846 -0
- package/dist/{chunk-LZOZZRHB.js → chunk-NAXFX7K7.js} +5 -5
- package/dist/{chunk-TPJISPJ5.js → chunk-PW3LNSDM.js} +5 -5
- package/dist/{chunk-G2XUUMKH.js → chunk-UKVQP5ES.js} +7 -7
- package/dist/{chunk-V3ZMNXZC.js → chunk-WG2SP5KE.js} +248 -6
- package/dist/commands/DbExecute.js +4 -5
- package/dist/commands/DbPull.js +4 -7
- package/dist/commands/DbPush.js +4 -5
- package/dist/commands/DbSeed.js +3 -4
- package/dist/commands/MigrateDeploy.js +4 -5
- package/dist/commands/MigrateDev.js +5 -6
- package/dist/commands/MigrateDiff.js +4 -5
- package/dist/commands/MigrateReset.js +5 -6
- package/dist/commands/MigrateResolve.js +4 -5
- package/dist/commands/MigrateStatus.js +4 -5
- package/dist/index.js +25 -28
- package/dist/utils/seed.js +5 -6
- package/dist/utils/setupMSSQL.js +123 -21
- package/dist/utils/setupMongo.js +3 -4
- package/dist/utils/spinner.js +3 -6
- package/package.json +10 -10
- package/dist/chunk-6C7ESGWY.js +0 -1184
- package/dist/chunk-DIAO4W7O.js +0 -5774
- package/dist/chunk-J46BJQHT.js +0 -268
- package/dist/chunk-KXMACMQC.js +0 -660
- package/dist/chunk-RM5LJIEV.js +0 -35
- package/dist/chunk-YUCPBDWV.js +0 -131
|
@@ -0,0 +1,846 @@
|
|
|
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 __export2 = (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_N5UBDQRA_exports = {};
|
|
30
|
+
__export2(chunk_N5UBDQRA_exports, {
|
|
31
|
+
Migrate: () => Migrate
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(chunk_N5UBDQRA_exports);
|
|
34
|
+
var import_chunk_3VFKYWQZ = require("./chunk-3VFKYWQZ.js");
|
|
35
|
+
var import_chunk_ZOEKRXDP = require("./chunk-ZOEKRXDP.js");
|
|
36
|
+
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
|
|
37
|
+
var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
|
|
38
|
+
var import_engines_version = require("@prisma/engines-version");
|
|
39
|
+
var import_internals = require("@prisma/internals");
|
|
40
|
+
var import_node_process = __toESM(require("node:process"));
|
|
41
|
+
var import_node_process2 = __toESM(require("node:process"));
|
|
42
|
+
var import_path = __toESM(require("path"));
|
|
43
|
+
var base_exports = {};
|
|
44
|
+
(0, import_chunk_WWAWV7DQ.__export)(base_exports, {
|
|
45
|
+
beep: () => beep,
|
|
46
|
+
clearScreen: () => clearScreen,
|
|
47
|
+
clearTerminal: () => clearTerminal,
|
|
48
|
+
cursorBackward: () => cursorBackward,
|
|
49
|
+
cursorDown: () => cursorDown,
|
|
50
|
+
cursorForward: () => cursorForward,
|
|
51
|
+
cursorGetPosition: () => cursorGetPosition,
|
|
52
|
+
cursorHide: () => cursorHide,
|
|
53
|
+
cursorLeft: () => cursorLeft,
|
|
54
|
+
cursorMove: () => cursorMove,
|
|
55
|
+
cursorNextLine: () => cursorNextLine,
|
|
56
|
+
cursorPrevLine: () => cursorPrevLine,
|
|
57
|
+
cursorRestorePosition: () => cursorRestorePosition,
|
|
58
|
+
cursorSavePosition: () => cursorSavePosition,
|
|
59
|
+
cursorShow: () => cursorShow,
|
|
60
|
+
cursorTo: () => cursorTo,
|
|
61
|
+
cursorUp: () => cursorUp,
|
|
62
|
+
enterAlternativeScreen: () => enterAlternativeScreen,
|
|
63
|
+
eraseDown: () => eraseDown,
|
|
64
|
+
eraseEndLine: () => eraseEndLine,
|
|
65
|
+
eraseLine: () => eraseLine,
|
|
66
|
+
eraseLines: () => eraseLines,
|
|
67
|
+
eraseScreen: () => eraseScreen,
|
|
68
|
+
eraseStartLine: () => eraseStartLine,
|
|
69
|
+
eraseUp: () => eraseUp,
|
|
70
|
+
exitAlternativeScreen: () => exitAlternativeScreen,
|
|
71
|
+
iTerm: () => iTerm,
|
|
72
|
+
image: () => image,
|
|
73
|
+
link: () => link,
|
|
74
|
+
scrollDown: () => scrollDown,
|
|
75
|
+
scrollUp: () => scrollUp
|
|
76
|
+
});
|
|
77
|
+
var isBrowser = globalThis.window?.document !== void 0;
|
|
78
|
+
var isNode = globalThis.process?.versions?.node !== void 0;
|
|
79
|
+
var isBun = globalThis.process?.versions?.bun !== void 0;
|
|
80
|
+
var isDeno = globalThis.Deno?.version?.deno !== void 0;
|
|
81
|
+
var isElectron = globalThis.process?.versions?.electron !== void 0;
|
|
82
|
+
var isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
|
|
83
|
+
var isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
84
|
+
var isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
85
|
+
var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
86
|
+
var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
87
|
+
var platform = globalThis.navigator?.userAgentData?.platform;
|
|
88
|
+
var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
|
|
89
|
+
var isWindows = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
|
|
90
|
+
var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
|
|
91
|
+
var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
92
|
+
var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
93
|
+
var ESC = "\x1B[";
|
|
94
|
+
var OSC = "\x1B]";
|
|
95
|
+
var BEL = "\x07";
|
|
96
|
+
var SEP = ";";
|
|
97
|
+
var isTerminalApp = !isBrowser && import_node_process2.default.env.TERM_PROGRAM === "Apple_Terminal";
|
|
98
|
+
var isWindows2 = !isBrowser && import_node_process2.default.platform === "win32";
|
|
99
|
+
var cwdFunction = isBrowser ? () => {
|
|
100
|
+
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
101
|
+
} : import_node_process2.default.cwd;
|
|
102
|
+
var cursorTo = (x, y) => {
|
|
103
|
+
if (typeof x !== "number") {
|
|
104
|
+
throw new TypeError("The `x` argument is required");
|
|
105
|
+
}
|
|
106
|
+
if (typeof y !== "number") {
|
|
107
|
+
return ESC + (x + 1) + "G";
|
|
108
|
+
}
|
|
109
|
+
return ESC + (y + 1) + SEP + (x + 1) + "H";
|
|
110
|
+
};
|
|
111
|
+
var cursorMove = (x, y) => {
|
|
112
|
+
if (typeof x !== "number") {
|
|
113
|
+
throw new TypeError("The `x` argument is required");
|
|
114
|
+
}
|
|
115
|
+
let returnValue = "";
|
|
116
|
+
if (x < 0) {
|
|
117
|
+
returnValue += ESC + -x + "D";
|
|
118
|
+
} else if (x > 0) {
|
|
119
|
+
returnValue += ESC + x + "C";
|
|
120
|
+
}
|
|
121
|
+
if (y < 0) {
|
|
122
|
+
returnValue += ESC + -y + "A";
|
|
123
|
+
} else if (y > 0) {
|
|
124
|
+
returnValue += ESC + y + "B";
|
|
125
|
+
}
|
|
126
|
+
return returnValue;
|
|
127
|
+
};
|
|
128
|
+
var cursorUp = (count = 1) => ESC + count + "A";
|
|
129
|
+
var cursorDown = (count = 1) => ESC + count + "B";
|
|
130
|
+
var cursorForward = (count = 1) => ESC + count + "C";
|
|
131
|
+
var cursorBackward = (count = 1) => ESC + count + "D";
|
|
132
|
+
var cursorLeft = ESC + "G";
|
|
133
|
+
var cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
134
|
+
var cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
135
|
+
var cursorGetPosition = ESC + "6n";
|
|
136
|
+
var cursorNextLine = ESC + "E";
|
|
137
|
+
var cursorPrevLine = ESC + "F";
|
|
138
|
+
var cursorHide = ESC + "?25l";
|
|
139
|
+
var cursorShow = ESC + "?25h";
|
|
140
|
+
var eraseLines = (count) => {
|
|
141
|
+
let clear = "";
|
|
142
|
+
for (let i = 0; i < count; i++) {
|
|
143
|
+
clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
144
|
+
}
|
|
145
|
+
if (count) {
|
|
146
|
+
clear += cursorLeft;
|
|
147
|
+
}
|
|
148
|
+
return clear;
|
|
149
|
+
};
|
|
150
|
+
var eraseEndLine = ESC + "K";
|
|
151
|
+
var eraseStartLine = ESC + "1K";
|
|
152
|
+
var eraseLine = ESC + "2K";
|
|
153
|
+
var eraseDown = ESC + "J";
|
|
154
|
+
var eraseUp = ESC + "1J";
|
|
155
|
+
var eraseScreen = ESC + "2J";
|
|
156
|
+
var scrollUp = ESC + "S";
|
|
157
|
+
var scrollDown = ESC + "T";
|
|
158
|
+
var clearScreen = "\x1Bc";
|
|
159
|
+
var clearTerminal = isWindows2 ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
|
|
160
|
+
var enterAlternativeScreen = ESC + "?1049h";
|
|
161
|
+
var exitAlternativeScreen = ESC + "?1049l";
|
|
162
|
+
var beep = BEL;
|
|
163
|
+
var link = (text, url) => [
|
|
164
|
+
OSC,
|
|
165
|
+
"8",
|
|
166
|
+
SEP,
|
|
167
|
+
SEP,
|
|
168
|
+
url,
|
|
169
|
+
BEL,
|
|
170
|
+
text,
|
|
171
|
+
OSC,
|
|
172
|
+
"8",
|
|
173
|
+
SEP,
|
|
174
|
+
SEP,
|
|
175
|
+
BEL
|
|
176
|
+
].join("");
|
|
177
|
+
var image = (data, options = {}) => {
|
|
178
|
+
let returnValue = `${OSC}1337;File=inline=1`;
|
|
179
|
+
if (options.width) {
|
|
180
|
+
returnValue += `;width=${options.width}`;
|
|
181
|
+
}
|
|
182
|
+
if (options.height) {
|
|
183
|
+
returnValue += `;height=${options.height}`;
|
|
184
|
+
}
|
|
185
|
+
if (options.preserveAspectRatio === false) {
|
|
186
|
+
returnValue += ";preserveAspectRatio=0";
|
|
187
|
+
}
|
|
188
|
+
return returnValue + ":" + Buffer.from(data).toString("base64") + BEL;
|
|
189
|
+
};
|
|
190
|
+
var iTerm = {
|
|
191
|
+
setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
192
|
+
annotation(message, options = {}) {
|
|
193
|
+
let returnValue = `${OSC}1337;`;
|
|
194
|
+
const hasX = options.x !== void 0;
|
|
195
|
+
const hasY = options.y !== void 0;
|
|
196
|
+
if ((hasX || hasY) && !(hasX && hasY && options.length !== void 0)) {
|
|
197
|
+
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
|
|
198
|
+
}
|
|
199
|
+
message = message.replaceAll("|", "");
|
|
200
|
+
returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
|
|
201
|
+
if (options.length > 0) {
|
|
202
|
+
returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
|
|
203
|
+
} else {
|
|
204
|
+
returnValue += message;
|
|
205
|
+
}
|
|
206
|
+
return returnValue + BEL;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
210
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
211
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
212
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
213
|
+
var styles = {
|
|
214
|
+
modifier: {
|
|
215
|
+
reset: [0, 0],
|
|
216
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
217
|
+
bold: [1, 22],
|
|
218
|
+
dim: [2, 22],
|
|
219
|
+
italic: [3, 23],
|
|
220
|
+
underline: [4, 24],
|
|
221
|
+
overline: [53, 55],
|
|
222
|
+
inverse: [7, 27],
|
|
223
|
+
hidden: [8, 28],
|
|
224
|
+
strikethrough: [9, 29]
|
|
225
|
+
},
|
|
226
|
+
color: {
|
|
227
|
+
black: [30, 39],
|
|
228
|
+
red: [31, 39],
|
|
229
|
+
green: [32, 39],
|
|
230
|
+
yellow: [33, 39],
|
|
231
|
+
blue: [34, 39],
|
|
232
|
+
magenta: [35, 39],
|
|
233
|
+
cyan: [36, 39],
|
|
234
|
+
white: [37, 39],
|
|
235
|
+
// Bright color
|
|
236
|
+
blackBright: [90, 39],
|
|
237
|
+
gray: [90, 39],
|
|
238
|
+
// Alias of `blackBright`
|
|
239
|
+
grey: [90, 39],
|
|
240
|
+
// Alias of `blackBright`
|
|
241
|
+
redBright: [91, 39],
|
|
242
|
+
greenBright: [92, 39],
|
|
243
|
+
yellowBright: [93, 39],
|
|
244
|
+
blueBright: [94, 39],
|
|
245
|
+
magentaBright: [95, 39],
|
|
246
|
+
cyanBright: [96, 39],
|
|
247
|
+
whiteBright: [97, 39]
|
|
248
|
+
},
|
|
249
|
+
bgColor: {
|
|
250
|
+
bgBlack: [40, 49],
|
|
251
|
+
bgRed: [41, 49],
|
|
252
|
+
bgGreen: [42, 49],
|
|
253
|
+
bgYellow: [43, 49],
|
|
254
|
+
bgBlue: [44, 49],
|
|
255
|
+
bgMagenta: [45, 49],
|
|
256
|
+
bgCyan: [46, 49],
|
|
257
|
+
bgWhite: [47, 49],
|
|
258
|
+
// Bright color
|
|
259
|
+
bgBlackBright: [100, 49],
|
|
260
|
+
bgGray: [100, 49],
|
|
261
|
+
// Alias of `bgBlackBright`
|
|
262
|
+
bgGrey: [100, 49],
|
|
263
|
+
// Alias of `bgBlackBright`
|
|
264
|
+
bgRedBright: [101, 49],
|
|
265
|
+
bgGreenBright: [102, 49],
|
|
266
|
+
bgYellowBright: [103, 49],
|
|
267
|
+
bgBlueBright: [104, 49],
|
|
268
|
+
bgMagentaBright: [105, 49],
|
|
269
|
+
bgCyanBright: [106, 49],
|
|
270
|
+
bgWhiteBright: [107, 49]
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
274
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
275
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
276
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
277
|
+
function assembleStyles() {
|
|
278
|
+
const codes = /* @__PURE__ */ new Map();
|
|
279
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
280
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
281
|
+
styles[styleName] = {
|
|
282
|
+
open: `\x1B[${style[0]}m`,
|
|
283
|
+
close: `\x1B[${style[1]}m`
|
|
284
|
+
};
|
|
285
|
+
group[styleName] = styles[styleName];
|
|
286
|
+
codes.set(style[0], style[1]);
|
|
287
|
+
}
|
|
288
|
+
Object.defineProperty(styles, groupName, {
|
|
289
|
+
value: group,
|
|
290
|
+
enumerable: false
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
Object.defineProperty(styles, "codes", {
|
|
294
|
+
value: codes,
|
|
295
|
+
enumerable: false
|
|
296
|
+
});
|
|
297
|
+
styles.color.close = "\x1B[39m";
|
|
298
|
+
styles.bgColor.close = "\x1B[49m";
|
|
299
|
+
styles.color.ansi = wrapAnsi16();
|
|
300
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
301
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
302
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
303
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
304
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
305
|
+
Object.defineProperties(styles, {
|
|
306
|
+
rgbToAnsi256: {
|
|
307
|
+
value: (red, green, blue) => {
|
|
308
|
+
if (red === green && green === blue) {
|
|
309
|
+
if (red < 8) {
|
|
310
|
+
return 16;
|
|
311
|
+
}
|
|
312
|
+
if (red > 248) {
|
|
313
|
+
return 231;
|
|
314
|
+
}
|
|
315
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
316
|
+
}
|
|
317
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
318
|
+
},
|
|
319
|
+
enumerable: false
|
|
320
|
+
},
|
|
321
|
+
hexToRgb: {
|
|
322
|
+
value: (hex) => {
|
|
323
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
324
|
+
if (!matches) {
|
|
325
|
+
return [0, 0, 0];
|
|
326
|
+
}
|
|
327
|
+
let [colorString] = matches;
|
|
328
|
+
if (colorString.length === 3) {
|
|
329
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
330
|
+
}
|
|
331
|
+
const integer = Number.parseInt(colorString, 16);
|
|
332
|
+
return [
|
|
333
|
+
/* eslint-disable no-bitwise */
|
|
334
|
+
integer >> 16 & 255,
|
|
335
|
+
integer >> 8 & 255,
|
|
336
|
+
integer & 255
|
|
337
|
+
/* eslint-enable no-bitwise */
|
|
338
|
+
];
|
|
339
|
+
},
|
|
340
|
+
enumerable: false
|
|
341
|
+
},
|
|
342
|
+
hexToAnsi256: {
|
|
343
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
344
|
+
enumerable: false
|
|
345
|
+
},
|
|
346
|
+
ansi256ToAnsi: {
|
|
347
|
+
value: (code) => {
|
|
348
|
+
if (code < 8) {
|
|
349
|
+
return 30 + code;
|
|
350
|
+
}
|
|
351
|
+
if (code < 16) {
|
|
352
|
+
return 90 + (code - 8);
|
|
353
|
+
}
|
|
354
|
+
let red;
|
|
355
|
+
let green;
|
|
356
|
+
let blue;
|
|
357
|
+
if (code >= 232) {
|
|
358
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
359
|
+
green = red;
|
|
360
|
+
blue = red;
|
|
361
|
+
} else {
|
|
362
|
+
code -= 16;
|
|
363
|
+
const remainder = code % 36;
|
|
364
|
+
red = Math.floor(code / 36) / 5;
|
|
365
|
+
green = Math.floor(remainder / 6) / 5;
|
|
366
|
+
blue = remainder % 6 / 5;
|
|
367
|
+
}
|
|
368
|
+
const value = Math.max(red, green, blue) * 2;
|
|
369
|
+
if (value === 0) {
|
|
370
|
+
return 30;
|
|
371
|
+
}
|
|
372
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
373
|
+
if (value === 2) {
|
|
374
|
+
result += 60;
|
|
375
|
+
}
|
|
376
|
+
return result;
|
|
377
|
+
},
|
|
378
|
+
enumerable: false
|
|
379
|
+
},
|
|
380
|
+
rgbToAnsi: {
|
|
381
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
382
|
+
enumerable: false
|
|
383
|
+
},
|
|
384
|
+
hexToAnsi: {
|
|
385
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
386
|
+
enumerable: false
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
return styles;
|
|
390
|
+
}
|
|
391
|
+
var ansiStyles = assembleStyles();
|
|
392
|
+
var ansi_styles_default = ansiStyles;
|
|
393
|
+
var ESCAPES = /* @__PURE__ */ new Set([
|
|
394
|
+
"\x1B",
|
|
395
|
+
"\x9B"
|
|
396
|
+
]);
|
|
397
|
+
var END_CODE = 39;
|
|
398
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
399
|
+
var ANSI_CSI = "[";
|
|
400
|
+
var ANSI_OSC = "]";
|
|
401
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
402
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
403
|
+
var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
404
|
+
var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
405
|
+
var wordLengths = (string) => string.split(" ").map((character) => (0, import_chunk_3VFKYWQZ.stringWidth)(character));
|
|
406
|
+
var wrapWord = (rows, word, columns) => {
|
|
407
|
+
const characters = [...word];
|
|
408
|
+
let isInsideEscape = false;
|
|
409
|
+
let isInsideLinkEscape = false;
|
|
410
|
+
let visible = (0, import_chunk_3VFKYWQZ.stringWidth)((0, import_chunk_3VFKYWQZ.stripAnsi)(rows.at(-1)));
|
|
411
|
+
for (const [index, character] of characters.entries()) {
|
|
412
|
+
const characterLength = (0, import_chunk_3VFKYWQZ.stringWidth)(character);
|
|
413
|
+
if (visible + characterLength <= columns) {
|
|
414
|
+
rows[rows.length - 1] += character;
|
|
415
|
+
} else {
|
|
416
|
+
rows.push(character);
|
|
417
|
+
visible = 0;
|
|
418
|
+
}
|
|
419
|
+
if (ESCAPES.has(character)) {
|
|
420
|
+
isInsideEscape = true;
|
|
421
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
|
|
422
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
|
423
|
+
}
|
|
424
|
+
if (isInsideEscape) {
|
|
425
|
+
if (isInsideLinkEscape) {
|
|
426
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
427
|
+
isInsideEscape = false;
|
|
428
|
+
isInsideLinkEscape = false;
|
|
429
|
+
}
|
|
430
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
431
|
+
isInsideEscape = false;
|
|
432
|
+
}
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
visible += characterLength;
|
|
436
|
+
if (visible === columns && index < characters.length - 1) {
|
|
437
|
+
rows.push("");
|
|
438
|
+
visible = 0;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
|
442
|
+
rows[rows.length - 2] += rows.pop();
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
446
|
+
const words = string.split(" ");
|
|
447
|
+
let last = words.length;
|
|
448
|
+
while (last > 0) {
|
|
449
|
+
if ((0, import_chunk_3VFKYWQZ.stringWidth)(words[last - 1]) > 0) {
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
last--;
|
|
453
|
+
}
|
|
454
|
+
if (last === words.length) {
|
|
455
|
+
return string;
|
|
456
|
+
}
|
|
457
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
458
|
+
};
|
|
459
|
+
var exec = (string, columns, options = {}) => {
|
|
460
|
+
if (options.trim !== false && string.trim() === "") {
|
|
461
|
+
return "";
|
|
462
|
+
}
|
|
463
|
+
let returnValue = "";
|
|
464
|
+
let escapeCode;
|
|
465
|
+
let escapeUrl;
|
|
466
|
+
const lengths = wordLengths(string);
|
|
467
|
+
let rows = [""];
|
|
468
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
469
|
+
if (options.trim !== false) {
|
|
470
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
471
|
+
}
|
|
472
|
+
let rowLength = (0, import_chunk_3VFKYWQZ.stringWidth)(rows.at(-1));
|
|
473
|
+
if (index !== 0) {
|
|
474
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
475
|
+
rows.push("");
|
|
476
|
+
rowLength = 0;
|
|
477
|
+
}
|
|
478
|
+
if (rowLength > 0 || options.trim === false) {
|
|
479
|
+
rows[rows.length - 1] += " ";
|
|
480
|
+
rowLength++;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (options.hard && lengths[index] > columns) {
|
|
484
|
+
const remainingColumns = columns - rowLength;
|
|
485
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
486
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
487
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
488
|
+
rows.push("");
|
|
489
|
+
}
|
|
490
|
+
wrapWord(rows, word, columns);
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
494
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
495
|
+
wrapWord(rows, word, columns);
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
rows.push("");
|
|
499
|
+
}
|
|
500
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
501
|
+
wrapWord(rows, word, columns);
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
rows[rows.length - 1] += word;
|
|
505
|
+
}
|
|
506
|
+
if (options.trim !== false) {
|
|
507
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
508
|
+
}
|
|
509
|
+
const preString = rows.join("\n");
|
|
510
|
+
const pre = [...preString];
|
|
511
|
+
let preStringIndex = 0;
|
|
512
|
+
for (const [index, character] of pre.entries()) {
|
|
513
|
+
returnValue += character;
|
|
514
|
+
if (ESCAPES.has(character)) {
|
|
515
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
516
|
+
if (groups.code !== void 0) {
|
|
517
|
+
const code2 = Number.parseFloat(groups.code);
|
|
518
|
+
escapeCode = code2 === END_CODE ? void 0 : code2;
|
|
519
|
+
} else if (groups.uri !== void 0) {
|
|
520
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
524
|
+
if (pre[index + 1] === "\n") {
|
|
525
|
+
if (escapeUrl) {
|
|
526
|
+
returnValue += wrapAnsiHyperlink("");
|
|
527
|
+
}
|
|
528
|
+
if (escapeCode && code) {
|
|
529
|
+
returnValue += wrapAnsiCode(code);
|
|
530
|
+
}
|
|
531
|
+
} else if (character === "\n") {
|
|
532
|
+
if (escapeCode && code) {
|
|
533
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
534
|
+
}
|
|
535
|
+
if (escapeUrl) {
|
|
536
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
preStringIndex += character.length;
|
|
540
|
+
}
|
|
541
|
+
return returnValue;
|
|
542
|
+
};
|
|
543
|
+
function wrapAnsi(string, columns, options) {
|
|
544
|
+
return String(string).normalize().replaceAll("\r\n", "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
545
|
+
}
|
|
546
|
+
function isFullwidthCodePoint(codePoint) {
|
|
547
|
+
if (!Number.isInteger(codePoint)) {
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
return (0, import_chunk_3VFKYWQZ.eastAsianWidth)(codePoint) === 2;
|
|
551
|
+
}
|
|
552
|
+
var ESCAPES2 = /* @__PURE__ */ new Set([27, 155]);
|
|
553
|
+
var CODE_POINT_0 = "0".codePointAt(0);
|
|
554
|
+
var CODE_POINT_9 = "9".codePointAt(0);
|
|
555
|
+
var endCodesSet = /* @__PURE__ */ new Set();
|
|
556
|
+
var endCodesMap = /* @__PURE__ */ new Map();
|
|
557
|
+
for (const [start, end] of ansi_styles_default.codes) {
|
|
558
|
+
endCodesSet.add(ansi_styles_default.color.ansi(end));
|
|
559
|
+
endCodesMap.set(ansi_styles_default.color.ansi(start), ansi_styles_default.color.ansi(end));
|
|
560
|
+
}
|
|
561
|
+
function getEndCode(code) {
|
|
562
|
+
if (endCodesSet.has(code)) {
|
|
563
|
+
return code;
|
|
564
|
+
}
|
|
565
|
+
if (endCodesMap.has(code)) {
|
|
566
|
+
return endCodesMap.get(code);
|
|
567
|
+
}
|
|
568
|
+
code = code.slice(2);
|
|
569
|
+
if (code.includes(";")) {
|
|
570
|
+
code = code[0] + "0";
|
|
571
|
+
}
|
|
572
|
+
const returnValue = ansi_styles_default.codes.get(Number.parseInt(code, 10));
|
|
573
|
+
if (returnValue) {
|
|
574
|
+
return ansi_styles_default.color.ansi(returnValue);
|
|
575
|
+
}
|
|
576
|
+
return ansi_styles_default.reset.open;
|
|
577
|
+
}
|
|
578
|
+
function findNumberIndex(string) {
|
|
579
|
+
for (let index = 0; index < string.length; index++) {
|
|
580
|
+
const codePoint = string.codePointAt(index);
|
|
581
|
+
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) {
|
|
582
|
+
return index;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return -1;
|
|
586
|
+
}
|
|
587
|
+
function parseAnsiCode(string, offset) {
|
|
588
|
+
string = string.slice(offset, offset + 19);
|
|
589
|
+
const startIndex = findNumberIndex(string);
|
|
590
|
+
if (startIndex !== -1) {
|
|
591
|
+
let endIndex = string.indexOf("m", startIndex);
|
|
592
|
+
if (endIndex === -1) {
|
|
593
|
+
endIndex = string.length;
|
|
594
|
+
}
|
|
595
|
+
return string.slice(0, endIndex + 1);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
599
|
+
const returnValue = [];
|
|
600
|
+
let index = 0;
|
|
601
|
+
let visibleCount = 0;
|
|
602
|
+
while (index < string.length) {
|
|
603
|
+
const codePoint = string.codePointAt(index);
|
|
604
|
+
if (ESCAPES2.has(codePoint)) {
|
|
605
|
+
const code = parseAnsiCode(string, index);
|
|
606
|
+
if (code) {
|
|
607
|
+
returnValue.push({
|
|
608
|
+
type: "ansi",
|
|
609
|
+
code,
|
|
610
|
+
endCode: getEndCode(code)
|
|
611
|
+
});
|
|
612
|
+
index += code.length;
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
const isFullWidth = isFullwidthCodePoint(codePoint);
|
|
617
|
+
const character = String.fromCodePoint(codePoint);
|
|
618
|
+
returnValue.push({
|
|
619
|
+
type: "character",
|
|
620
|
+
value: character,
|
|
621
|
+
isFullWidth
|
|
622
|
+
});
|
|
623
|
+
index += character.length;
|
|
624
|
+
visibleCount += isFullWidth ? 2 : character.length;
|
|
625
|
+
if (visibleCount >= endCharacter) {
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return returnValue;
|
|
630
|
+
}
|
|
631
|
+
function reduceAnsiCodes(codes) {
|
|
632
|
+
let returnValue = [];
|
|
633
|
+
for (const code of codes) {
|
|
634
|
+
if (code.code === ansi_styles_default.reset.open) {
|
|
635
|
+
returnValue = [];
|
|
636
|
+
} else if (endCodesSet.has(code.code)) {
|
|
637
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
638
|
+
} else {
|
|
639
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
640
|
+
returnValue.push(code);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return returnValue;
|
|
644
|
+
}
|
|
645
|
+
function undoAnsiCodes(codes) {
|
|
646
|
+
const reduced = reduceAnsiCodes(codes);
|
|
647
|
+
const endCodes = reduced.map(({ endCode }) => endCode);
|
|
648
|
+
return endCodes.reverse().join("");
|
|
649
|
+
}
|
|
650
|
+
function sliceAnsi(string, start, end) {
|
|
651
|
+
const tokens = tokenize(string, end);
|
|
652
|
+
let activeCodes = [];
|
|
653
|
+
let position = 0;
|
|
654
|
+
let returnValue = "";
|
|
655
|
+
let include = false;
|
|
656
|
+
for (const token of tokens) {
|
|
657
|
+
if (end !== void 0 && position >= end) {
|
|
658
|
+
break;
|
|
659
|
+
}
|
|
660
|
+
if (token.type === "ansi") {
|
|
661
|
+
activeCodes.push(token);
|
|
662
|
+
if (include) {
|
|
663
|
+
returnValue += token.code;
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
if (!include && position >= start) {
|
|
667
|
+
include = true;
|
|
668
|
+
activeCodes = reduceAnsiCodes(activeCodes);
|
|
669
|
+
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
670
|
+
}
|
|
671
|
+
if (include) {
|
|
672
|
+
returnValue += token.value;
|
|
673
|
+
}
|
|
674
|
+
position += token.isFullWidth ? 2 : token.value.length;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
returnValue += undoAnsiCodes(activeCodes);
|
|
678
|
+
return returnValue;
|
|
679
|
+
}
|
|
680
|
+
var defaultTerminalHeight = 24;
|
|
681
|
+
var getWidth = ({ columns = 80 }) => columns;
|
|
682
|
+
var fitToTerminalHeight = (stream, text) => {
|
|
683
|
+
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
684
|
+
const lines = text.split("\n");
|
|
685
|
+
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
686
|
+
return toRemove ? sliceAnsi(text, (0, import_chunk_3VFKYWQZ.stripAnsi)(lines.slice(0, toRemove).join("\n")).length + 1) : text;
|
|
687
|
+
};
|
|
688
|
+
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
689
|
+
let previousLineCount = 0;
|
|
690
|
+
let previousWidth = getWidth(stream);
|
|
691
|
+
let previousOutput = "";
|
|
692
|
+
const reset = () => {
|
|
693
|
+
previousOutput = "";
|
|
694
|
+
previousWidth = getWidth(stream);
|
|
695
|
+
previousLineCount = 0;
|
|
696
|
+
};
|
|
697
|
+
const render = (...arguments_) => {
|
|
698
|
+
if (!showCursor) {
|
|
699
|
+
import_chunk_3VFKYWQZ.cli_cursor_default.hide();
|
|
700
|
+
}
|
|
701
|
+
let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
|
|
702
|
+
const width = getWidth(stream);
|
|
703
|
+
if (output === previousOutput && previousWidth === width) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
previousOutput = output;
|
|
707
|
+
previousWidth = width;
|
|
708
|
+
output = wrapAnsi(output, width, { trim: false, hard: true, wordWrap: false });
|
|
709
|
+
stream.write(base_exports.eraseLines(previousLineCount) + output);
|
|
710
|
+
previousLineCount = output.split("\n").length;
|
|
711
|
+
};
|
|
712
|
+
render.clear = () => {
|
|
713
|
+
stream.write(base_exports.eraseLines(previousLineCount));
|
|
714
|
+
reset();
|
|
715
|
+
};
|
|
716
|
+
render.done = () => {
|
|
717
|
+
reset();
|
|
718
|
+
if (!showCursor) {
|
|
719
|
+
import_chunk_3VFKYWQZ.cli_cursor_default.show();
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
return render;
|
|
723
|
+
}
|
|
724
|
+
var logUpdate = createLogUpdate(import_node_process.default.stdout);
|
|
725
|
+
var log_update_default = logUpdate;
|
|
726
|
+
var logUpdateStderr = createLogUpdate(import_node_process.default.stderr);
|
|
727
|
+
var packageJson = eval(`require('../package.json')`);
|
|
728
|
+
var Migrate = class {
|
|
729
|
+
constructor(schemaPath, enabledPreviewFeatures) {
|
|
730
|
+
(0, import_chunk_WWAWV7DQ.__publicField)(this, "engine");
|
|
731
|
+
(0, import_chunk_WWAWV7DQ.__publicField)(this, "schemaPath");
|
|
732
|
+
(0, import_chunk_WWAWV7DQ.__publicField)(this, "migrationsDirectoryPath");
|
|
733
|
+
if (schemaPath) {
|
|
734
|
+
this.schemaPath = import_path.default.resolve(process.cwd(), schemaPath);
|
|
735
|
+
this.migrationsDirectoryPath = import_path.default.join(import_path.default.dirname(this.schemaPath), "migrations");
|
|
736
|
+
this.engine = new import_chunk_ZOEKRXDP.SchemaEngine({
|
|
737
|
+
schemaPath: this.schemaPath,
|
|
738
|
+
enabledPreviewFeatures
|
|
739
|
+
});
|
|
740
|
+
} else {
|
|
741
|
+
this.engine = new import_chunk_ZOEKRXDP.SchemaEngine({
|
|
742
|
+
enabledPreviewFeatures
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
stop() {
|
|
747
|
+
this.engine.stop();
|
|
748
|
+
}
|
|
749
|
+
getPrismaSchema() {
|
|
750
|
+
if (!this.schemaPath) throw new Error("this.schemaPath is undefined");
|
|
751
|
+
return (0, import_internals.getSchemaWithPath)(this.schemaPath);
|
|
752
|
+
}
|
|
753
|
+
reset() {
|
|
754
|
+
return this.engine.reset();
|
|
755
|
+
}
|
|
756
|
+
createMigration(params) {
|
|
757
|
+
return this.engine.createMigration(params);
|
|
758
|
+
}
|
|
759
|
+
diagnoseMigrationHistory({
|
|
760
|
+
optInToShadowDatabase
|
|
761
|
+
}) {
|
|
762
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
763
|
+
return this.engine.diagnoseMigrationHistory({
|
|
764
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath,
|
|
765
|
+
optInToShadowDatabase
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
listMigrationDirectories() {
|
|
769
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
770
|
+
return this.engine.listMigrationDirectories({
|
|
771
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
devDiagnostic() {
|
|
775
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
776
|
+
return this.engine.devDiagnostic({
|
|
777
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
async markMigrationApplied({ migrationId }) {
|
|
781
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
782
|
+
return await this.engine.markMigrationApplied({
|
|
783
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath,
|
|
784
|
+
migrationName: migrationId
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
markMigrationRolledBack({ migrationId }) {
|
|
788
|
+
return this.engine.markMigrationRolledBack({
|
|
789
|
+
migrationName: migrationId
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
applyMigrations() {
|
|
793
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
794
|
+
return this.engine.applyMigrations({
|
|
795
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
async evaluateDataLoss() {
|
|
799
|
+
if (!this.migrationsDirectoryPath) throw new Error("this.migrationsDirectoryPath is undefined");
|
|
800
|
+
const schema = (0, import_internals.toSchemasContainer)((await this.getPrismaSchema()).schemas);
|
|
801
|
+
return this.engine.evaluateDataLoss({
|
|
802
|
+
migrationsDirectoryPath: this.migrationsDirectoryPath,
|
|
803
|
+
schema
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
async push({ force = false }) {
|
|
807
|
+
const schema = (0, import_internals.toSchemasContainer)((await this.getPrismaSchema()).schemas);
|
|
808
|
+
const { warnings, unexecutable, executedSteps } = await this.engine.schemaPush({
|
|
809
|
+
force,
|
|
810
|
+
schema
|
|
811
|
+
});
|
|
812
|
+
return {
|
|
813
|
+
executedSteps,
|
|
814
|
+
warnings,
|
|
815
|
+
unexecutable
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
async tryToRunGenerate(datasourceInfo) {
|
|
819
|
+
if (!this.schemaPath) throw new Error("this.schemaPath is undefined");
|
|
820
|
+
const skipEngines = (0, import_internals.isPrismaPostgres)(datasourceInfo.url);
|
|
821
|
+
const message = [];
|
|
822
|
+
process.stdout.write("\n");
|
|
823
|
+
log_update_default(`Running generate... ${(0, import_chunk_SKRR5WT4.dim)("(Use --skip-generate to skip the generators)")}`);
|
|
824
|
+
const generators = await (0, import_internals.getGenerators)({
|
|
825
|
+
schemaPath: this.schemaPath,
|
|
826
|
+
printDownloadProgress: true,
|
|
827
|
+
version: import_engines_version.enginesVersion,
|
|
828
|
+
cliVersion: packageJson.version,
|
|
829
|
+
noEngine: skipEngines
|
|
830
|
+
});
|
|
831
|
+
for (const generator of generators) {
|
|
832
|
+
log_update_default(`Running generate... - ${generator.getPrettyName()}`);
|
|
833
|
+
const before = Math.round(performance.now());
|
|
834
|
+
try {
|
|
835
|
+
await generator.generate();
|
|
836
|
+
const after = Math.round(performance.now());
|
|
837
|
+
message.push((0, import_internals.getGeneratorSuccessMessage)(generator, after - before));
|
|
838
|
+
generator.stop();
|
|
839
|
+
} catch (e) {
|
|
840
|
+
message.push(`${e.message}`);
|
|
841
|
+
generator.stop();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
log_update_default(message.join("\n"));
|
|
845
|
+
}
|
|
846
|
+
};
|