drizzle-kit 0.21.2-f3756f2 → 0.21.3
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +17662 -11484
- package/index.d.mts +9 -1
- package/index.d.ts +9 -1
- package/package.json +4 -3
- package/payload.d.mts +10 -96
- package/payload.d.ts +10 -96
- package/payload.js +1307 -1732
- package/payload.mjs +1294 -1719
- package/utils-studio.js +614 -187
- package/utils-studio.mjs +614 -187
- package/utils.js +8 -90
- package/utils.mjs +8 -90
package/utils-studio.mjs
CHANGED
@@ -34,6 +34,516 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
34
34
|
mod
|
35
35
|
));
|
36
36
|
|
37
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
38
|
+
function assembleStyles() {
|
39
|
+
const codes = /* @__PURE__ */ new Map();
|
40
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
41
|
+
for (const [styleName, style] of Object.entries(group)) {
|
42
|
+
styles[styleName] = {
|
43
|
+
open: `\x1B[${style[0]}m`,
|
44
|
+
close: `\x1B[${style[1]}m`
|
45
|
+
};
|
46
|
+
group[styleName] = styles[styleName];
|
47
|
+
codes.set(style[0], style[1]);
|
48
|
+
}
|
49
|
+
Object.defineProperty(styles, groupName, {
|
50
|
+
value: group,
|
51
|
+
enumerable: false
|
52
|
+
});
|
53
|
+
}
|
54
|
+
Object.defineProperty(styles, "codes", {
|
55
|
+
value: codes,
|
56
|
+
enumerable: false
|
57
|
+
});
|
58
|
+
styles.color.close = "\x1B[39m";
|
59
|
+
styles.bgColor.close = "\x1B[49m";
|
60
|
+
styles.color.ansi = wrapAnsi16();
|
61
|
+
styles.color.ansi256 = wrapAnsi256();
|
62
|
+
styles.color.ansi16m = wrapAnsi16m();
|
63
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
64
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
65
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
66
|
+
Object.defineProperties(styles, {
|
67
|
+
rgbToAnsi256: {
|
68
|
+
value(red, green, blue) {
|
69
|
+
if (red === green && green === blue) {
|
70
|
+
if (red < 8) {
|
71
|
+
return 16;
|
72
|
+
}
|
73
|
+
if (red > 248) {
|
74
|
+
return 231;
|
75
|
+
}
|
76
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
77
|
+
}
|
78
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
79
|
+
},
|
80
|
+
enumerable: false
|
81
|
+
},
|
82
|
+
hexToRgb: {
|
83
|
+
value(hex) {
|
84
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
85
|
+
if (!matches) {
|
86
|
+
return [0, 0, 0];
|
87
|
+
}
|
88
|
+
let [colorString] = matches;
|
89
|
+
if (colorString.length === 3) {
|
90
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
91
|
+
}
|
92
|
+
const integer = Number.parseInt(colorString, 16);
|
93
|
+
return [
|
94
|
+
/* eslint-disable no-bitwise */
|
95
|
+
integer >> 16 & 255,
|
96
|
+
integer >> 8 & 255,
|
97
|
+
integer & 255
|
98
|
+
/* eslint-enable no-bitwise */
|
99
|
+
];
|
100
|
+
},
|
101
|
+
enumerable: false
|
102
|
+
},
|
103
|
+
hexToAnsi256: {
|
104
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
105
|
+
enumerable: false
|
106
|
+
},
|
107
|
+
ansi256ToAnsi: {
|
108
|
+
value(code) {
|
109
|
+
if (code < 8) {
|
110
|
+
return 30 + code;
|
111
|
+
}
|
112
|
+
if (code < 16) {
|
113
|
+
return 90 + (code - 8);
|
114
|
+
}
|
115
|
+
let red;
|
116
|
+
let green;
|
117
|
+
let blue;
|
118
|
+
if (code >= 232) {
|
119
|
+
red = ((code - 232) * 10 + 8) / 255;
|
120
|
+
green = red;
|
121
|
+
blue = red;
|
122
|
+
} else {
|
123
|
+
code -= 16;
|
124
|
+
const remainder = code % 36;
|
125
|
+
red = Math.floor(code / 36) / 5;
|
126
|
+
green = Math.floor(remainder / 6) / 5;
|
127
|
+
blue = remainder % 6 / 5;
|
128
|
+
}
|
129
|
+
const value = Math.max(red, green, blue) * 2;
|
130
|
+
if (value === 0) {
|
131
|
+
return 30;
|
132
|
+
}
|
133
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
134
|
+
if (value === 2) {
|
135
|
+
result += 60;
|
136
|
+
}
|
137
|
+
return result;
|
138
|
+
},
|
139
|
+
enumerable: false
|
140
|
+
},
|
141
|
+
rgbToAnsi: {
|
142
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
143
|
+
enumerable: false
|
144
|
+
},
|
145
|
+
hexToAnsi: {
|
146
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
147
|
+
enumerable: false
|
148
|
+
}
|
149
|
+
});
|
150
|
+
return styles;
|
151
|
+
}
|
152
|
+
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
153
|
+
var init_ansi_styles = __esm({
|
154
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
155
|
+
ANSI_BACKGROUND_OFFSET = 10;
|
156
|
+
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
157
|
+
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
158
|
+
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
159
|
+
styles = {
|
160
|
+
modifier: {
|
161
|
+
reset: [0, 0],
|
162
|
+
// 21 isn't widely supported and 22 does the same thing
|
163
|
+
bold: [1, 22],
|
164
|
+
dim: [2, 22],
|
165
|
+
italic: [3, 23],
|
166
|
+
underline: [4, 24],
|
167
|
+
overline: [53, 55],
|
168
|
+
inverse: [7, 27],
|
169
|
+
hidden: [8, 28],
|
170
|
+
strikethrough: [9, 29]
|
171
|
+
},
|
172
|
+
color: {
|
173
|
+
black: [30, 39],
|
174
|
+
red: [31, 39],
|
175
|
+
green: [32, 39],
|
176
|
+
yellow: [33, 39],
|
177
|
+
blue: [34, 39],
|
178
|
+
magenta: [35, 39],
|
179
|
+
cyan: [36, 39],
|
180
|
+
white: [37, 39],
|
181
|
+
// Bright color
|
182
|
+
blackBright: [90, 39],
|
183
|
+
gray: [90, 39],
|
184
|
+
// Alias of `blackBright`
|
185
|
+
grey: [90, 39],
|
186
|
+
// Alias of `blackBright`
|
187
|
+
redBright: [91, 39],
|
188
|
+
greenBright: [92, 39],
|
189
|
+
yellowBright: [93, 39],
|
190
|
+
blueBright: [94, 39],
|
191
|
+
magentaBright: [95, 39],
|
192
|
+
cyanBright: [96, 39],
|
193
|
+
whiteBright: [97, 39]
|
194
|
+
},
|
195
|
+
bgColor: {
|
196
|
+
bgBlack: [40, 49],
|
197
|
+
bgRed: [41, 49],
|
198
|
+
bgGreen: [42, 49],
|
199
|
+
bgYellow: [43, 49],
|
200
|
+
bgBlue: [44, 49],
|
201
|
+
bgMagenta: [45, 49],
|
202
|
+
bgCyan: [46, 49],
|
203
|
+
bgWhite: [47, 49],
|
204
|
+
// Bright color
|
205
|
+
bgBlackBright: [100, 49],
|
206
|
+
bgGray: [100, 49],
|
207
|
+
// Alias of `bgBlackBright`
|
208
|
+
bgGrey: [100, 49],
|
209
|
+
// Alias of `bgBlackBright`
|
210
|
+
bgRedBright: [101, 49],
|
211
|
+
bgGreenBright: [102, 49],
|
212
|
+
bgYellowBright: [103, 49],
|
213
|
+
bgBlueBright: [104, 49],
|
214
|
+
bgMagentaBright: [105, 49],
|
215
|
+
bgCyanBright: [106, 49],
|
216
|
+
bgWhiteBright: [107, 49]
|
217
|
+
}
|
218
|
+
};
|
219
|
+
modifierNames = Object.keys(styles.modifier);
|
220
|
+
foregroundColorNames = Object.keys(styles.color);
|
221
|
+
backgroundColorNames = Object.keys(styles.bgColor);
|
222
|
+
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
223
|
+
ansiStyles = assembleStyles();
|
224
|
+
ansi_styles_default = ansiStyles;
|
225
|
+
}
|
226
|
+
});
|
227
|
+
|
228
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
229
|
+
import process2 from "node:process";
|
230
|
+
import os from "node:os";
|
231
|
+
import tty from "node:tty";
|
232
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
233
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
234
|
+
const position = argv.indexOf(prefix + flag);
|
235
|
+
const terminatorPosition = argv.indexOf("--");
|
236
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
237
|
+
}
|
238
|
+
function envForceColor() {
|
239
|
+
if ("FORCE_COLOR" in env) {
|
240
|
+
if (env.FORCE_COLOR === "true") {
|
241
|
+
return 1;
|
242
|
+
}
|
243
|
+
if (env.FORCE_COLOR === "false") {
|
244
|
+
return 0;
|
245
|
+
}
|
246
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
function translateLevel(level) {
|
250
|
+
if (level === 0) {
|
251
|
+
return false;
|
252
|
+
}
|
253
|
+
return {
|
254
|
+
level,
|
255
|
+
hasBasic: true,
|
256
|
+
has256: level >= 2,
|
257
|
+
has16m: level >= 3
|
258
|
+
};
|
259
|
+
}
|
260
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
261
|
+
const noFlagForceColor = envForceColor();
|
262
|
+
if (noFlagForceColor !== void 0) {
|
263
|
+
flagForceColor = noFlagForceColor;
|
264
|
+
}
|
265
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
266
|
+
if (forceColor === 0) {
|
267
|
+
return 0;
|
268
|
+
}
|
269
|
+
if (sniffFlags) {
|
270
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
271
|
+
return 3;
|
272
|
+
}
|
273
|
+
if (hasFlag("color=256")) {
|
274
|
+
return 2;
|
275
|
+
}
|
276
|
+
}
|
277
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
278
|
+
return 1;
|
279
|
+
}
|
280
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
281
|
+
return 0;
|
282
|
+
}
|
283
|
+
const min = forceColor || 0;
|
284
|
+
if (env.TERM === "dumb") {
|
285
|
+
return min;
|
286
|
+
}
|
287
|
+
if (process2.platform === "win32") {
|
288
|
+
const osRelease = os.release().split(".");
|
289
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
290
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
291
|
+
}
|
292
|
+
return 1;
|
293
|
+
}
|
294
|
+
if ("CI" in env) {
|
295
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
296
|
+
return 3;
|
297
|
+
}
|
298
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
299
|
+
return 1;
|
300
|
+
}
|
301
|
+
return min;
|
302
|
+
}
|
303
|
+
if ("TEAMCITY_VERSION" in env) {
|
304
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
305
|
+
}
|
306
|
+
if (env.COLORTERM === "truecolor") {
|
307
|
+
return 3;
|
308
|
+
}
|
309
|
+
if (env.TERM === "xterm-kitty") {
|
310
|
+
return 3;
|
311
|
+
}
|
312
|
+
if ("TERM_PROGRAM" in env) {
|
313
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
314
|
+
switch (env.TERM_PROGRAM) {
|
315
|
+
case "iTerm.app": {
|
316
|
+
return version >= 3 ? 3 : 2;
|
317
|
+
}
|
318
|
+
case "Apple_Terminal": {
|
319
|
+
return 2;
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
324
|
+
return 2;
|
325
|
+
}
|
326
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
327
|
+
return 1;
|
328
|
+
}
|
329
|
+
if ("COLORTERM" in env) {
|
330
|
+
return 1;
|
331
|
+
}
|
332
|
+
return min;
|
333
|
+
}
|
334
|
+
function createSupportsColor(stream, options = {}) {
|
335
|
+
const level = _supportsColor(stream, {
|
336
|
+
streamIsTTY: stream && stream.isTTY,
|
337
|
+
...options
|
338
|
+
});
|
339
|
+
return translateLevel(level);
|
340
|
+
}
|
341
|
+
var env, flagForceColor, supportsColor, supports_color_default;
|
342
|
+
var init_supports_color = __esm({
|
343
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
344
|
+
({ env } = process2);
|
345
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
346
|
+
flagForceColor = 0;
|
347
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
348
|
+
flagForceColor = 1;
|
349
|
+
}
|
350
|
+
supportsColor = {
|
351
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
352
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
353
|
+
};
|
354
|
+
supports_color_default = supportsColor;
|
355
|
+
}
|
356
|
+
});
|
357
|
+
|
358
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
359
|
+
function stringReplaceAll(string, substring, replacer) {
|
360
|
+
let index4 = string.indexOf(substring);
|
361
|
+
if (index4 === -1) {
|
362
|
+
return string;
|
363
|
+
}
|
364
|
+
const substringLength = substring.length;
|
365
|
+
let endIndex = 0;
|
366
|
+
let returnValue = "";
|
367
|
+
do {
|
368
|
+
returnValue += string.slice(endIndex, index4) + substring + replacer;
|
369
|
+
endIndex = index4 + substringLength;
|
370
|
+
index4 = string.indexOf(substring, endIndex);
|
371
|
+
} while (index4 !== -1);
|
372
|
+
returnValue += string.slice(endIndex);
|
373
|
+
return returnValue;
|
374
|
+
}
|
375
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
|
376
|
+
let endIndex = 0;
|
377
|
+
let returnValue = "";
|
378
|
+
do {
|
379
|
+
const gotCR = string[index4 - 1] === "\r";
|
380
|
+
returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
381
|
+
endIndex = index4 + 1;
|
382
|
+
index4 = string.indexOf("\n", endIndex);
|
383
|
+
} while (index4 !== -1);
|
384
|
+
returnValue += string.slice(endIndex);
|
385
|
+
return returnValue;
|
386
|
+
}
|
387
|
+
var init_utilities = __esm({
|
388
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
389
|
+
}
|
390
|
+
});
|
391
|
+
|
392
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
393
|
+
function createChalk(options) {
|
394
|
+
return chalkFactory(options);
|
395
|
+
}
|
396
|
+
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
397
|
+
var init_source = __esm({
|
398
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
399
|
+
init_ansi_styles();
|
400
|
+
init_supports_color();
|
401
|
+
init_utilities();
|
402
|
+
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
403
|
+
GENERATOR = Symbol("GENERATOR");
|
404
|
+
STYLER = Symbol("STYLER");
|
405
|
+
IS_EMPTY = Symbol("IS_EMPTY");
|
406
|
+
levelMapping = [
|
407
|
+
"ansi",
|
408
|
+
"ansi",
|
409
|
+
"ansi256",
|
410
|
+
"ansi16m"
|
411
|
+
];
|
412
|
+
styles2 = /* @__PURE__ */ Object.create(null);
|
413
|
+
applyOptions = (object, options = {}) => {
|
414
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
415
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
416
|
+
}
|
417
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
418
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
419
|
+
};
|
420
|
+
chalkFactory = (options) => {
|
421
|
+
const chalk2 = (...strings) => strings.join(" ");
|
422
|
+
applyOptions(chalk2, options);
|
423
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
424
|
+
return chalk2;
|
425
|
+
};
|
426
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
427
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
428
|
+
styles2[styleName] = {
|
429
|
+
get() {
|
430
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
431
|
+
Object.defineProperty(this, styleName, { value: builder });
|
432
|
+
return builder;
|
433
|
+
}
|
434
|
+
};
|
435
|
+
}
|
436
|
+
styles2.visible = {
|
437
|
+
get() {
|
438
|
+
const builder = createBuilder(this, this[STYLER], true);
|
439
|
+
Object.defineProperty(this, "visible", { value: builder });
|
440
|
+
return builder;
|
441
|
+
}
|
442
|
+
};
|
443
|
+
getModelAnsi = (model, level, type, ...arguments_) => {
|
444
|
+
if (model === "rgb") {
|
445
|
+
if (level === "ansi16m") {
|
446
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
447
|
+
}
|
448
|
+
if (level === "ansi256") {
|
449
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
450
|
+
}
|
451
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
452
|
+
}
|
453
|
+
if (model === "hex") {
|
454
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
455
|
+
}
|
456
|
+
return ansi_styles_default[type][model](...arguments_);
|
457
|
+
};
|
458
|
+
usedModels = ["rgb", "hex", "ansi256"];
|
459
|
+
for (const model of usedModels) {
|
460
|
+
styles2[model] = {
|
461
|
+
get() {
|
462
|
+
const { level } = this;
|
463
|
+
return function(...arguments_) {
|
464
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
465
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
466
|
+
};
|
467
|
+
}
|
468
|
+
};
|
469
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
470
|
+
styles2[bgModel] = {
|
471
|
+
get() {
|
472
|
+
const { level } = this;
|
473
|
+
return function(...arguments_) {
|
474
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
475
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
476
|
+
};
|
477
|
+
}
|
478
|
+
};
|
479
|
+
}
|
480
|
+
proto = Object.defineProperties(() => {
|
481
|
+
}, {
|
482
|
+
...styles2,
|
483
|
+
level: {
|
484
|
+
enumerable: true,
|
485
|
+
get() {
|
486
|
+
return this[GENERATOR].level;
|
487
|
+
},
|
488
|
+
set(level) {
|
489
|
+
this[GENERATOR].level = level;
|
490
|
+
}
|
491
|
+
}
|
492
|
+
});
|
493
|
+
createStyler = (open, close, parent) => {
|
494
|
+
let openAll;
|
495
|
+
let closeAll;
|
496
|
+
if (parent === void 0) {
|
497
|
+
openAll = open;
|
498
|
+
closeAll = close;
|
499
|
+
} else {
|
500
|
+
openAll = parent.openAll + open;
|
501
|
+
closeAll = close + parent.closeAll;
|
502
|
+
}
|
503
|
+
return {
|
504
|
+
open,
|
505
|
+
close,
|
506
|
+
openAll,
|
507
|
+
closeAll,
|
508
|
+
parent
|
509
|
+
};
|
510
|
+
};
|
511
|
+
createBuilder = (self2, _styler, _isEmpty) => {
|
512
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
513
|
+
Object.setPrototypeOf(builder, proto);
|
514
|
+
builder[GENERATOR] = self2;
|
515
|
+
builder[STYLER] = _styler;
|
516
|
+
builder[IS_EMPTY] = _isEmpty;
|
517
|
+
return builder;
|
518
|
+
};
|
519
|
+
applyStyle = (self2, string) => {
|
520
|
+
if (self2.level <= 0 || !string) {
|
521
|
+
return self2[IS_EMPTY] ? "" : string;
|
522
|
+
}
|
523
|
+
let styler = self2[STYLER];
|
524
|
+
if (styler === void 0) {
|
525
|
+
return string;
|
526
|
+
}
|
527
|
+
const { openAll, closeAll } = styler;
|
528
|
+
if (string.includes("\x1B")) {
|
529
|
+
while (styler !== void 0) {
|
530
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
531
|
+
styler = styler.parent;
|
532
|
+
}
|
533
|
+
}
|
534
|
+
const lfIndex = string.indexOf("\n");
|
535
|
+
if (lfIndex !== -1) {
|
536
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
537
|
+
}
|
538
|
+
return openAll + string + closeAll;
|
539
|
+
};
|
540
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
541
|
+
chalk = createChalk();
|
542
|
+
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
543
|
+
source_default = chalk;
|
544
|
+
}
|
545
|
+
});
|
546
|
+
|
37
547
|
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
|
38
548
|
var require_readline = __commonJS({
|
39
549
|
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
|
@@ -546,7 +1056,7 @@ var require_hanji = __commonJS({
|
|
546
1056
|
return;
|
547
1057
|
}
|
548
1058
|
exports.render = render2;
|
549
|
-
function
|
1059
|
+
function renderWithTask3(view, task) {
|
550
1060
|
return __awaiter(this, void 0, void 0, function* () {
|
551
1061
|
const terminal = new TaskTerminal(view, process.stdout);
|
552
1062
|
terminal.requestLayout();
|
@@ -555,7 +1065,7 @@ var require_hanji = __commonJS({
|
|
555
1065
|
return result;
|
556
1066
|
});
|
557
1067
|
}
|
558
|
-
exports.renderWithTask =
|
1068
|
+
exports.renderWithTask = renderWithTask3;
|
559
1069
|
var terminateHandler;
|
560
1070
|
function onTerminate(callback) {
|
561
1071
|
terminateHandler = callback;
|
@@ -570,7 +1080,7 @@ var init_global = __esm({
|
|
570
1080
|
"src/global.ts"() {
|
571
1081
|
"use strict";
|
572
1082
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
573
|
-
snapshotVersion = "
|
1083
|
+
snapshotVersion = "6";
|
574
1084
|
}
|
575
1085
|
});
|
576
1086
|
|
@@ -4499,7 +5009,7 @@ var init_mysqlSchema = __esm({
|
|
4499
5009
|
});
|
4500
5010
|
|
4501
5011
|
// src/serializer/pgSchema.ts
|
4502
|
-
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1,
|
5012
|
+
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchema2, backwardCompatiblePgSchema, dryPg;
|
4503
5013
|
var init_pgSchema = __esm({
|
4504
5014
|
"src/serializer/pgSchema.ts"() {
|
4505
5015
|
"use strict";
|
@@ -4567,48 +5077,10 @@ var init_pgSchema = __esm({
|
|
4567
5077
|
tables: recordType(stringType(), tableV1),
|
4568
5078
|
enums: recordType(stringType(), enumSchemaV1)
|
4569
5079
|
}).strict();
|
4570
|
-
indexColumn = objectType({
|
4571
|
-
expression: stringType(),
|
4572
|
-
isExpression: booleanType(),
|
4573
|
-
asc: booleanType(),
|
4574
|
-
nulls: stringType().optional(),
|
4575
|
-
opclass: stringType().optional()
|
4576
|
-
});
|
4577
5080
|
index2 = objectType({
|
4578
|
-
name: stringType(),
|
4579
|
-
columns: indexColumn.array(),
|
4580
|
-
isUnique: booleanType(),
|
4581
|
-
with: recordType(stringType(), anyType()).optional(),
|
4582
|
-
method: stringType().default("btree"),
|
4583
|
-
where: stringType().optional(),
|
4584
|
-
concurrently: booleanType().default(false)
|
4585
|
-
}).strict();
|
4586
|
-
indexV4 = objectType({
|
4587
5081
|
name: stringType(),
|
4588
5082
|
columns: stringType().array(),
|
4589
|
-
isUnique: booleanType()
|
4590
|
-
with: recordType(stringType(), stringType()).optional(),
|
4591
|
-
method: stringType().default("btree"),
|
4592
|
-
where: stringType().optional(),
|
4593
|
-
concurrently: booleanType().default(false)
|
4594
|
-
}).strict();
|
4595
|
-
indexV5 = objectType({
|
4596
|
-
name: stringType(),
|
4597
|
-
columns: stringType().array(),
|
4598
|
-
isUnique: booleanType(),
|
4599
|
-
with: recordType(stringType(), stringType()).optional(),
|
4600
|
-
method: stringType().default("btree"),
|
4601
|
-
where: stringType().optional(),
|
4602
|
-
concurrently: booleanType().default(false)
|
4603
|
-
}).strict();
|
4604
|
-
indexV6 = objectType({
|
4605
|
-
name: stringType(),
|
4606
|
-
columns: stringType().array(),
|
4607
|
-
isUnique: booleanType(),
|
4608
|
-
with: recordType(stringType(), stringType()).optional(),
|
4609
|
-
method: stringType().default("btree"),
|
4610
|
-
where: stringType().optional(),
|
4611
|
-
concurrently: booleanType().default(false)
|
5083
|
+
isUnique: booleanType()
|
4612
5084
|
}).strict();
|
4613
5085
|
fk2 = objectType({
|
4614
5086
|
name: stringType(),
|
@@ -4650,27 +5122,9 @@ var init_pgSchema = __esm({
|
|
4650
5122
|
name: stringType(),
|
4651
5123
|
schema: stringType(),
|
4652
5124
|
columns: recordType(stringType(), column2),
|
4653
|
-
indexes: recordType(stringType(),
|
5125
|
+
indexes: recordType(stringType(), index2),
|
4654
5126
|
foreignKeys: recordType(stringType(), fk2)
|
4655
5127
|
}).strict();
|
4656
|
-
tableV6 = objectType({
|
4657
|
-
name: stringType(),
|
4658
|
-
schema: stringType(),
|
4659
|
-
columns: recordType(stringType(), column2),
|
4660
|
-
indexes: recordType(stringType(), indexV6),
|
4661
|
-
foreignKeys: recordType(stringType(), fk2),
|
4662
|
-
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
4663
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
4664
|
-
}).strict();
|
4665
|
-
tableV5 = objectType({
|
4666
|
-
name: stringType(),
|
4667
|
-
schema: stringType(),
|
4668
|
-
columns: recordType(stringType(), column2),
|
4669
|
-
indexes: recordType(stringType(), indexV5),
|
4670
|
-
foreignKeys: recordType(stringType(), fk2),
|
4671
|
-
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
4672
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
4673
|
-
}).strict();
|
4674
5128
|
table2 = objectType({
|
4675
5129
|
name: stringType(),
|
4676
5130
|
schema: stringType(),
|
@@ -4715,7 +5169,7 @@ var init_pgSchema = __esm({
|
|
4715
5169
|
pgSchemaInternalV5 = objectType({
|
4716
5170
|
version: literalType("5"),
|
4717
5171
|
dialect: literalType("pg"),
|
4718
|
-
tables: recordType(stringType(),
|
5172
|
+
tables: recordType(stringType(), table2),
|
4719
5173
|
enums: recordType(stringType(), enumSchemaV1),
|
4720
5174
|
schemas: recordType(stringType(), stringType()),
|
4721
5175
|
_meta: objectType({
|
@@ -4725,19 +5179,6 @@ var init_pgSchema = __esm({
|
|
4725
5179
|
}),
|
4726
5180
|
internal: kitInternals2
|
4727
5181
|
}).strict();
|
4728
|
-
pgSchemaInternalV6 = objectType({
|
4729
|
-
version: literalType("6"),
|
4730
|
-
dialect: literalType("postgresql"),
|
4731
|
-
tables: recordType(stringType(), tableV6),
|
4732
|
-
enums: recordType(stringType(), enumSchema),
|
4733
|
-
schemas: recordType(stringType(), stringType()),
|
4734
|
-
_meta: objectType({
|
4735
|
-
schemas: recordType(stringType(), stringType()),
|
4736
|
-
tables: recordType(stringType(), stringType()),
|
4737
|
-
columns: recordType(stringType(), stringType())
|
4738
|
-
}),
|
4739
|
-
internal: kitInternals2
|
4740
|
-
}).strict();
|
4741
5182
|
pgSchemaExternal = objectType({
|
4742
5183
|
version: literalType("5"),
|
4743
5184
|
dialect: literalType("pg"),
|
@@ -4751,7 +5192,7 @@ var init_pgSchema = __esm({
|
|
4751
5192
|
})
|
4752
5193
|
}).strict();
|
4753
5194
|
pgSchemaInternal = objectType({
|
4754
|
-
version: literalType("
|
5195
|
+
version: literalType("6"),
|
4755
5196
|
dialect: literalType("postgresql"),
|
4756
5197
|
tables: recordType(stringType(), table2),
|
4757
5198
|
enums: recordType(stringType(), enumSchema),
|
@@ -4786,15 +5227,8 @@ var init_pgSchema = __esm({
|
|
4786
5227
|
enums: recordType(stringType(), enumSchemaV1),
|
4787
5228
|
schemas: recordType(stringType(), stringType())
|
4788
5229
|
}).strict();
|
4789
|
-
pgSchemaSquashedV6 = objectType({
|
4790
|
-
version: literalType("6"),
|
4791
|
-
dialect: literalType("postgresql"),
|
4792
|
-
tables: recordType(stringType(), tableSquashed2),
|
4793
|
-
enums: recordType(stringType(), enumSchema),
|
4794
|
-
schemas: recordType(stringType(), stringType())
|
4795
|
-
}).strict();
|
4796
5230
|
pgSchemaSquashed = objectType({
|
4797
|
-
version: literalType("
|
5231
|
+
version: literalType("6"),
|
4798
5232
|
dialect: literalType("postgresql"),
|
4799
5233
|
tables: recordType(stringType(), tableSquashed2),
|
4800
5234
|
enums: recordType(stringType(), enumSchema),
|
@@ -4803,13 +5237,8 @@ var init_pgSchema = __esm({
|
|
4803
5237
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
4804
5238
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
4805
5239
|
pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
4806
|
-
pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
|
4807
5240
|
pgSchema2 = pgSchemaInternal.merge(schemaHash2);
|
4808
|
-
backwardCompatiblePgSchema = unionType([
|
4809
|
-
pgSchemaV5,
|
4810
|
-
pgSchemaV6,
|
4811
|
-
pgSchema2
|
4812
|
-
]);
|
5241
|
+
backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema2]);
|
4813
5242
|
dryPg = pgSchema2.parse({
|
4814
5243
|
version: snapshotVersion,
|
4815
5244
|
dialect: "postgresql",
|
@@ -4965,12 +5394,49 @@ var init_utils = __esm({
|
|
4965
5394
|
});
|
4966
5395
|
|
4967
5396
|
// src/cli/views.ts
|
4968
|
-
var import_hanji;
|
5397
|
+
var import_hanji, Spinner, ProgressView;
|
4969
5398
|
var init_views = __esm({
|
4970
5399
|
"src/cli/views.ts"() {
|
4971
5400
|
"use strict";
|
5401
|
+
init_source();
|
4972
5402
|
import_hanji = __toESM(require_hanji());
|
4973
5403
|
init_utils();
|
5404
|
+
Spinner = class {
|
5405
|
+
constructor(frames) {
|
5406
|
+
this.frames = frames;
|
5407
|
+
this.offset = 0;
|
5408
|
+
this.tick = () => {
|
5409
|
+
this.iterator();
|
5410
|
+
};
|
5411
|
+
this.value = () => {
|
5412
|
+
return this.frames[this.offset];
|
5413
|
+
};
|
5414
|
+
this.iterator = () => {
|
5415
|
+
this.offset += 1;
|
5416
|
+
this.offset %= frames.length - 1;
|
5417
|
+
};
|
5418
|
+
}
|
5419
|
+
};
|
5420
|
+
ProgressView = class extends import_hanji.TaskView {
|
5421
|
+
constructor(progressText, successText) {
|
5422
|
+
super();
|
5423
|
+
this.progressText = progressText;
|
5424
|
+
this.successText = successText;
|
5425
|
+
this.spinner = new Spinner("\u28F7\u28EF\u28DF\u287F\u28BF\u28FB\u28FD\u28FE".split(""));
|
5426
|
+
this.timeout = setInterval(() => {
|
5427
|
+
this.spinner.tick();
|
5428
|
+
this.requestLayout();
|
5429
|
+
}, 128);
|
5430
|
+
this.on("detach", () => clearInterval(this.timeout));
|
5431
|
+
}
|
5432
|
+
render(status) {
|
5433
|
+
if (status === "pending") {
|
5434
|
+
const spin = this.spinner.value();
|
5435
|
+
return `[${spin}] ${this.progressText}`;
|
5436
|
+
}
|
5437
|
+
return `[${source_default.green("\u2713")}] ${this.successText}`;
|
5438
|
+
}
|
5439
|
+
};
|
4974
5440
|
}
|
4975
5441
|
});
|
4976
5442
|
|
@@ -5052,12 +5518,24 @@ var init_sqliteSerializer = __esm({
|
|
5052
5518
|
`SELECT
|
5053
5519
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
5054
5520
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
5055
|
-
WHERE m.type = 'table'
|
5521
|
+
WHERE m.type = 'table'
|
5522
|
+
and m.tbl_name != 'sqlite_sequence'
|
5523
|
+
and m.tbl_name != 'sqlite_stat1'
|
5524
|
+
and m.tbl_name != '_litestream_seq'
|
5525
|
+
and m.tbl_name != '_litestream_lock'
|
5526
|
+
and m.tbl_name != 'libsql_wasm_func_table'
|
5527
|
+
and m.tbl_name != '__drizzle_migrations'
|
5528
|
+
and m.tbl_name != '_cf_KV';
|
5056
5529
|
`
|
5057
5530
|
);
|
5058
5531
|
const tablesWithSeq = [];
|
5059
5532
|
const seq = await db.query(
|
5060
|
-
`SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
|
5533
|
+
`SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
|
5534
|
+
and name != 'sqlite_stat1'
|
5535
|
+
and name != '_litestream_seq'
|
5536
|
+
and name != '_litestream_lock'
|
5537
|
+
and tbl_name != '_cf_KV'
|
5538
|
+
and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
|
5061
5539
|
);
|
5062
5540
|
for (const s of seq) {
|
5063
5541
|
tablesWithSeq.push(s.name);
|
@@ -5142,7 +5620,8 @@ var init_sqliteSerializer = __esm({
|
|
5142
5620
|
try {
|
5143
5621
|
const fks = await db.query(
|
5144
5622
|
`SELECT m.name as "tableFrom", f.id as "id", f."table" as "tableTo", f."from", f."to", f."on_update" as "onUpdate", f."on_delete" as "onDelete", f.seq as "seq"
|
5145
|
-
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
|
5623
|
+
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
|
5624
|
+
where m.tbl_name != '_cf_KV';`
|
5146
5625
|
);
|
5147
5626
|
const fkByTableName = {};
|
5148
5627
|
for (const fkRow of fks) {
|
@@ -5201,7 +5680,9 @@ FROM sqlite_master AS m,
|
|
5201
5680
|
pragma_index_list(m.name) AS il,
|
5202
5681
|
pragma_index_info(il.name) AS ii
|
5203
5682
|
WHERE
|
5204
|
-
m.type = 'table'
|
5683
|
+
m.type = 'table'
|
5684
|
+
and il.name NOT LIKE 'sqlite_autoindex_%'
|
5685
|
+
and m.tbl_name != '_cf_KV';`
|
5205
5686
|
);
|
5206
5687
|
for (const idxRow of idxs) {
|
5207
5688
|
const tableName = idxRow.tableName;
|
@@ -5454,13 +5935,6 @@ var require_brace_expansion = __commonJS({
|
|
5454
5935
|
}
|
5455
5936
|
});
|
5456
5937
|
|
5457
|
-
// src/extensions/vector.ts
|
5458
|
-
var init_vector = __esm({
|
5459
|
-
"src/extensions/vector.ts"() {
|
5460
|
-
"use strict";
|
5461
|
-
}
|
5462
|
-
});
|
5463
|
-
|
5464
5938
|
// src/serializer/pgSerializer.ts
|
5465
5939
|
import {
|
5466
5940
|
PgDialect,
|
@@ -5475,7 +5949,6 @@ var init_pgSerializer = __esm({
|
|
5475
5949
|
"use strict";
|
5476
5950
|
init_serializer();
|
5477
5951
|
init_outputs();
|
5478
|
-
init_vector();
|
5479
5952
|
dialect4 = new PgDialect();
|
5480
5953
|
trimChar = (str, char) => {
|
5481
5954
|
let start = 0;
|
@@ -5737,10 +6210,7 @@ var init_pgSerializer = __esm({
|
|
5737
6210
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
5738
6211
|
columnToReturn[columnName] = {
|
5739
6212
|
name: columnName,
|
5740
|
-
type:
|
5741
|
-
// filter vectors, but in future we should filter any extension that was installed by user
|
5742
|
-
columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
|
5743
|
-
),
|
6213
|
+
type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
|
5744
6214
|
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
5745
6215
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
5746
6216
|
// default: isSerial ? undefined : defaultValue,
|
@@ -5751,42 +6221,15 @@ var init_pgSerializer = __esm({
|
|
5751
6221
|
}
|
5752
6222
|
}
|
5753
6223
|
const dbIndexes = await db.query(
|
5754
|
-
`SELECT
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5758
|
-
|
5759
|
-
|
5760
|
-
|
5761
|
-
|
5762
|
-
|
5763
|
-
)
|
5764
|
-
|| '}')::text[]
|
5765
|
-
)[k.i]
|
5766
|
-
) AS column_name,
|
5767
|
-
CASE
|
5768
|
-
WHEN pg_get_expr(i.indexprs, i.indrelid) IS NOT NULL THEN 1
|
5769
|
-
ELSE 0
|
5770
|
-
END AS is_expression,
|
5771
|
-
i.indoption[k.i-1] & 1 = 1 AS descending,
|
5772
|
-
i.indoption[k.i-1] & 2 = 2 AS nulls_first,
|
5773
|
-
pg_get_expr(
|
5774
|
-
i.indpred,
|
5775
|
-
i.indrelid
|
5776
|
-
) as where,
|
5777
|
-
opc.opcname
|
5778
|
-
FROM pg_class t
|
5779
|
-
LEFT JOIN pg_index i ON t.oid = i.indrelid
|
5780
|
-
LEFT JOIN pg_class ic ON ic.oid = i.indexrelid
|
5781
|
-
CROSS JOIN LATERAL (SELECT unnest(i.indkey), generate_subscripts(i.indkey, 1) + 1) AS k(attnum, i)
|
5782
|
-
LEFT JOIN pg_attribute AS a
|
5783
|
-
ON i.indrelid = a.attrelid AND k.attnum = a.attnum
|
5784
|
-
JOIN pg_namespace c on c.oid = t.relnamespace
|
5785
|
-
LEFT JOIN pg_am AS am ON ic.relam = am.oid
|
5786
|
-
JOIN pg_opclass opc ON opc.oid = ANY(i.indclass)
|
5787
|
-
WHERE
|
5788
|
-
c.nspname = '${tableSchema}' AND
|
5789
|
-
t.relname = '${tableName}';`
|
6224
|
+
`SELECT t.relname as table_name, i.relname AS index_name, ix.indisunique AS is_unique, a.attname AS column_name
|
6225
|
+
FROM pg_class t
|
6226
|
+
JOIN pg_index ix ON t.oid = ix.indrelid
|
6227
|
+
JOIN pg_class i ON i.oid = ix.indexrelid
|
6228
|
+
JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = ANY(ix.indkey)
|
6229
|
+
JOIN pg_namespace ns ON ns.oid = t.relnamespace
|
6230
|
+
WHERE ns.nspname = '${tableSchema}'
|
6231
|
+
AND t.relname = '${tableName}'
|
6232
|
+
and ix.indisprimary = false;`
|
5790
6233
|
);
|
5791
6234
|
const dbIndexFromConstraint = await db.query(
|
5792
6235
|
`SELECT
|
@@ -5803,51 +6246,18 @@ var init_pgSerializer = __esm({
|
|
5803
6246
|
);
|
5804
6247
|
const idxsInConsteraint = dbIndexFromConstraint.filter((it) => it.generated_by_constraint === 1).map((it) => it.index_name);
|
5805
6248
|
for (const dbIndex of dbIndexes) {
|
5806
|
-
const indexName = dbIndex.
|
6249
|
+
const indexName = dbIndex.index_name;
|
5807
6250
|
const indexColumnName = dbIndex.column_name;
|
5808
6251
|
const indexIsUnique = dbIndex.is_unique;
|
5809
|
-
const indexMethod = dbIndex.method;
|
5810
|
-
const indexWith = dbIndex.with;
|
5811
|
-
const indexWhere = dbIndex.where;
|
5812
|
-
const opclass = dbIndex.opcname;
|
5813
|
-
const isExpression = dbIndex.is_expression === 1;
|
5814
|
-
const desc = dbIndex.descending;
|
5815
|
-
const nullsFirst = dbIndex.nulls_first;
|
5816
|
-
const mappedWith = {};
|
5817
|
-
if (indexWith !== null) {
|
5818
|
-
indexWith.forEach((it) => {
|
5819
|
-
const splitted = it.split("=");
|
5820
|
-
mappedWith[splitted[0]] = splitted[1];
|
5821
|
-
});
|
5822
|
-
}
|
5823
6252
|
if (idxsInConsteraint.includes(indexName))
|
5824
6253
|
continue;
|
5825
6254
|
if (typeof indexToReturn[indexName] !== "undefined") {
|
5826
|
-
indexToReturn[indexName].columns.push(
|
5827
|
-
expression: indexColumnName,
|
5828
|
-
asc: !desc,
|
5829
|
-
nulls: nullsFirst ? "first" : "last",
|
5830
|
-
opclass,
|
5831
|
-
isExpression
|
5832
|
-
});
|
6255
|
+
indexToReturn[indexName].columns.push(indexColumnName);
|
5833
6256
|
} else {
|
5834
6257
|
indexToReturn[indexName] = {
|
5835
6258
|
name: indexName,
|
5836
|
-
columns: [
|
5837
|
-
|
5838
|
-
expression: indexColumnName,
|
5839
|
-
asc: !desc,
|
5840
|
-
nulls: nullsFirst ? "first" : "last",
|
5841
|
-
opclass,
|
5842
|
-
isExpression
|
5843
|
-
}
|
5844
|
-
],
|
5845
|
-
isUnique: indexIsUnique,
|
5846
|
-
// should not be a part of diff detecs
|
5847
|
-
concurrently: false,
|
5848
|
-
method: indexMethod,
|
5849
|
-
where: indexWhere === null ? void 0 : indexWhere,
|
5850
|
-
with: mappedWith
|
6259
|
+
columns: [indexColumnName],
|
6260
|
+
isUnique: indexIsUnique
|
5851
6261
|
};
|
5852
6262
|
}
|
5853
6263
|
}
|
@@ -5883,7 +6293,7 @@ var init_pgSerializer = __esm({
|
|
5883
6293
|
}
|
5884
6294
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
5885
6295
|
return {
|
5886
|
-
version: "
|
6296
|
+
version: "6",
|
5887
6297
|
dialect: "postgresql",
|
5888
6298
|
tables: result,
|
5889
6299
|
enums: enumsToReturn,
|
@@ -5905,6 +6315,7 @@ var init_pgSerializer = __esm({
|
|
5905
6315
|
"time without time zone": "::time without time zone",
|
5906
6316
|
// "timestamp with time zone": "::timestamp with time zone",
|
5907
6317
|
"timestamp without time zone": "::timestamp without time zone",
|
6318
|
+
"timestamp(": "::timestamp without time zone",
|
5908
6319
|
// date: "::date",
|
5909
6320
|
// interval: "::interval",
|
5910
6321
|
// character: "::bpchar",
|
@@ -5917,15 +6328,15 @@ var init_pgSerializer = __esm({
|
|
5917
6328
|
"character(": "::bpchar"
|
5918
6329
|
};
|
5919
6330
|
defaultForColumn = (column4) => {
|
6331
|
+
if (column4.column_default === null) {
|
6332
|
+
return void 0;
|
6333
|
+
}
|
5920
6334
|
if (column4.data_type === "serial" || column4.data_type === "smallserial" || column4.data_type === "bigserial") {
|
5921
6335
|
return void 0;
|
5922
6336
|
}
|
5923
6337
|
const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
|
5924
6338
|
(it) => column4.data_type.startsWith(it)
|
5925
6339
|
);
|
5926
|
-
if (column4.column_default === null) {
|
5927
|
-
return void 0;
|
5928
|
-
}
|
5929
6340
|
const columnDefaultAsString = column4.column_default.toString();
|
5930
6341
|
if (columnDefaultAsString.endsWith(
|
5931
6342
|
hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column4.data_type
|
@@ -7317,7 +7728,14 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7317
7728
|
}
|
7318
7729
|
return false;
|
7319
7730
|
};
|
7320
|
-
const
|
7731
|
+
const progress = new ProgressView(
|
7732
|
+
"Pulling schema from database...",
|
7733
|
+
"Pulling schema from database..."
|
7734
|
+
);
|
7735
|
+
const res = await (0, import_hanji2.renderWithTask)(
|
7736
|
+
progress,
|
7737
|
+
fromDatabase(db, filter2)
|
7738
|
+
);
|
7321
7739
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7322
7740
|
return { schema: schema3 };
|
7323
7741
|
};
|
@@ -7325,6 +7743,8 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7325
7743
|
// src/cli/commands/pgIntrospect.ts
|
7326
7744
|
init_pgSerializer();
|
7327
7745
|
init_global();
|
7746
|
+
init_views();
|
7747
|
+
var import_hanji3 = __toESM(require_hanji());
|
7328
7748
|
var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
7329
7749
|
const matchers = filters.map((it) => {
|
7330
7750
|
return new Minimatch(it);
|
@@ -7339,7 +7759,14 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
|
7339
7759
|
}
|
7340
7760
|
return false;
|
7341
7761
|
};
|
7342
|
-
const
|
7762
|
+
const progress = new ProgressView(
|
7763
|
+
"Pulling schema from database...",
|
7764
|
+
"Pulling schema from database..."
|
7765
|
+
);
|
7766
|
+
const res = await (0, import_hanji3.renderWithTask)(
|
7767
|
+
progress,
|
7768
|
+
fromDatabase2(db, filter2, schemaFilters)
|
7769
|
+
);
|
7343
7770
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7344
7771
|
const { internal, ...schemaWithoutInternals } = schema3;
|
7345
7772
|
return { schema: schemaWithoutInternals };
|