drizzle-kit 0.21.4 → 0.22.0-3b0ba5f
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +11337 -17514
- package/index.d.mts +1 -9
- package/index.d.ts +1 -9
- package/package.json +3 -4
- package/payload.d.mts +96 -10
- package/payload.d.ts +96 -10
- package/payload.js +1738 -1304
- package/payload.mjs +1723 -1289
- package/utils-studio.js +187 -614
- package/utils-studio.mjs +187 -614
- package/utils.js +90 -8
- package/utils.mjs +90 -8
package/utils-studio.js
CHANGED
@@ -33,516 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
33
33
|
));
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
35
35
|
|
36
|
-
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
37
|
-
function assembleStyles() {
|
38
|
-
const codes = /* @__PURE__ */ new Map();
|
39
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
40
|
-
for (const [styleName, style] of Object.entries(group)) {
|
41
|
-
styles[styleName] = {
|
42
|
-
open: `\x1B[${style[0]}m`,
|
43
|
-
close: `\x1B[${style[1]}m`
|
44
|
-
};
|
45
|
-
group[styleName] = styles[styleName];
|
46
|
-
codes.set(style[0], style[1]);
|
47
|
-
}
|
48
|
-
Object.defineProperty(styles, groupName, {
|
49
|
-
value: group,
|
50
|
-
enumerable: false
|
51
|
-
});
|
52
|
-
}
|
53
|
-
Object.defineProperty(styles, "codes", {
|
54
|
-
value: codes,
|
55
|
-
enumerable: false
|
56
|
-
});
|
57
|
-
styles.color.close = "\x1B[39m";
|
58
|
-
styles.bgColor.close = "\x1B[49m";
|
59
|
-
styles.color.ansi = wrapAnsi16();
|
60
|
-
styles.color.ansi256 = wrapAnsi256();
|
61
|
-
styles.color.ansi16m = wrapAnsi16m();
|
62
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
63
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
64
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
65
|
-
Object.defineProperties(styles, {
|
66
|
-
rgbToAnsi256: {
|
67
|
-
value(red, green, blue) {
|
68
|
-
if (red === green && green === blue) {
|
69
|
-
if (red < 8) {
|
70
|
-
return 16;
|
71
|
-
}
|
72
|
-
if (red > 248) {
|
73
|
-
return 231;
|
74
|
-
}
|
75
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
76
|
-
}
|
77
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
78
|
-
},
|
79
|
-
enumerable: false
|
80
|
-
},
|
81
|
-
hexToRgb: {
|
82
|
-
value(hex) {
|
83
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
84
|
-
if (!matches) {
|
85
|
-
return [0, 0, 0];
|
86
|
-
}
|
87
|
-
let [colorString] = matches;
|
88
|
-
if (colorString.length === 3) {
|
89
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
90
|
-
}
|
91
|
-
const integer = Number.parseInt(colorString, 16);
|
92
|
-
return [
|
93
|
-
/* eslint-disable no-bitwise */
|
94
|
-
integer >> 16 & 255,
|
95
|
-
integer >> 8 & 255,
|
96
|
-
integer & 255
|
97
|
-
/* eslint-enable no-bitwise */
|
98
|
-
];
|
99
|
-
},
|
100
|
-
enumerable: false
|
101
|
-
},
|
102
|
-
hexToAnsi256: {
|
103
|
-
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
104
|
-
enumerable: false
|
105
|
-
},
|
106
|
-
ansi256ToAnsi: {
|
107
|
-
value(code) {
|
108
|
-
if (code < 8) {
|
109
|
-
return 30 + code;
|
110
|
-
}
|
111
|
-
if (code < 16) {
|
112
|
-
return 90 + (code - 8);
|
113
|
-
}
|
114
|
-
let red;
|
115
|
-
let green;
|
116
|
-
let blue;
|
117
|
-
if (code >= 232) {
|
118
|
-
red = ((code - 232) * 10 + 8) / 255;
|
119
|
-
green = red;
|
120
|
-
blue = red;
|
121
|
-
} else {
|
122
|
-
code -= 16;
|
123
|
-
const remainder = code % 36;
|
124
|
-
red = Math.floor(code / 36) / 5;
|
125
|
-
green = Math.floor(remainder / 6) / 5;
|
126
|
-
blue = remainder % 6 / 5;
|
127
|
-
}
|
128
|
-
const value = Math.max(red, green, blue) * 2;
|
129
|
-
if (value === 0) {
|
130
|
-
return 30;
|
131
|
-
}
|
132
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
133
|
-
if (value === 2) {
|
134
|
-
result += 60;
|
135
|
-
}
|
136
|
-
return result;
|
137
|
-
},
|
138
|
-
enumerable: false
|
139
|
-
},
|
140
|
-
rgbToAnsi: {
|
141
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
142
|
-
enumerable: false
|
143
|
-
},
|
144
|
-
hexToAnsi: {
|
145
|
-
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
146
|
-
enumerable: false
|
147
|
-
}
|
148
|
-
});
|
149
|
-
return styles;
|
150
|
-
}
|
151
|
-
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
152
|
-
var init_ansi_styles = __esm({
|
153
|
-
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
154
|
-
ANSI_BACKGROUND_OFFSET = 10;
|
155
|
-
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
156
|
-
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
157
|
-
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
158
|
-
styles = {
|
159
|
-
modifier: {
|
160
|
-
reset: [0, 0],
|
161
|
-
// 21 isn't widely supported and 22 does the same thing
|
162
|
-
bold: [1, 22],
|
163
|
-
dim: [2, 22],
|
164
|
-
italic: [3, 23],
|
165
|
-
underline: [4, 24],
|
166
|
-
overline: [53, 55],
|
167
|
-
inverse: [7, 27],
|
168
|
-
hidden: [8, 28],
|
169
|
-
strikethrough: [9, 29]
|
170
|
-
},
|
171
|
-
color: {
|
172
|
-
black: [30, 39],
|
173
|
-
red: [31, 39],
|
174
|
-
green: [32, 39],
|
175
|
-
yellow: [33, 39],
|
176
|
-
blue: [34, 39],
|
177
|
-
magenta: [35, 39],
|
178
|
-
cyan: [36, 39],
|
179
|
-
white: [37, 39],
|
180
|
-
// Bright color
|
181
|
-
blackBright: [90, 39],
|
182
|
-
gray: [90, 39],
|
183
|
-
// Alias of `blackBright`
|
184
|
-
grey: [90, 39],
|
185
|
-
// Alias of `blackBright`
|
186
|
-
redBright: [91, 39],
|
187
|
-
greenBright: [92, 39],
|
188
|
-
yellowBright: [93, 39],
|
189
|
-
blueBright: [94, 39],
|
190
|
-
magentaBright: [95, 39],
|
191
|
-
cyanBright: [96, 39],
|
192
|
-
whiteBright: [97, 39]
|
193
|
-
},
|
194
|
-
bgColor: {
|
195
|
-
bgBlack: [40, 49],
|
196
|
-
bgRed: [41, 49],
|
197
|
-
bgGreen: [42, 49],
|
198
|
-
bgYellow: [43, 49],
|
199
|
-
bgBlue: [44, 49],
|
200
|
-
bgMagenta: [45, 49],
|
201
|
-
bgCyan: [46, 49],
|
202
|
-
bgWhite: [47, 49],
|
203
|
-
// Bright color
|
204
|
-
bgBlackBright: [100, 49],
|
205
|
-
bgGray: [100, 49],
|
206
|
-
// Alias of `bgBlackBright`
|
207
|
-
bgGrey: [100, 49],
|
208
|
-
// Alias of `bgBlackBright`
|
209
|
-
bgRedBright: [101, 49],
|
210
|
-
bgGreenBright: [102, 49],
|
211
|
-
bgYellowBright: [103, 49],
|
212
|
-
bgBlueBright: [104, 49],
|
213
|
-
bgMagentaBright: [105, 49],
|
214
|
-
bgCyanBright: [106, 49],
|
215
|
-
bgWhiteBright: [107, 49]
|
216
|
-
}
|
217
|
-
};
|
218
|
-
modifierNames = Object.keys(styles.modifier);
|
219
|
-
foregroundColorNames = Object.keys(styles.color);
|
220
|
-
backgroundColorNames = Object.keys(styles.bgColor);
|
221
|
-
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
222
|
-
ansiStyles = assembleStyles();
|
223
|
-
ansi_styles_default = ansiStyles;
|
224
|
-
}
|
225
|
-
});
|
226
|
-
|
227
|
-
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
228
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
229
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
230
|
-
const position = argv.indexOf(prefix + flag);
|
231
|
-
const terminatorPosition = argv.indexOf("--");
|
232
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
233
|
-
}
|
234
|
-
function envForceColor() {
|
235
|
-
if ("FORCE_COLOR" in env) {
|
236
|
-
if (env.FORCE_COLOR === "true") {
|
237
|
-
return 1;
|
238
|
-
}
|
239
|
-
if (env.FORCE_COLOR === "false") {
|
240
|
-
return 0;
|
241
|
-
}
|
242
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
243
|
-
}
|
244
|
-
}
|
245
|
-
function translateLevel(level) {
|
246
|
-
if (level === 0) {
|
247
|
-
return false;
|
248
|
-
}
|
249
|
-
return {
|
250
|
-
level,
|
251
|
-
hasBasic: true,
|
252
|
-
has256: level >= 2,
|
253
|
-
has16m: level >= 3
|
254
|
-
};
|
255
|
-
}
|
256
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
257
|
-
const noFlagForceColor = envForceColor();
|
258
|
-
if (noFlagForceColor !== void 0) {
|
259
|
-
flagForceColor = noFlagForceColor;
|
260
|
-
}
|
261
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
262
|
-
if (forceColor === 0) {
|
263
|
-
return 0;
|
264
|
-
}
|
265
|
-
if (sniffFlags) {
|
266
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
267
|
-
return 3;
|
268
|
-
}
|
269
|
-
if (hasFlag("color=256")) {
|
270
|
-
return 2;
|
271
|
-
}
|
272
|
-
}
|
273
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
274
|
-
return 1;
|
275
|
-
}
|
276
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
277
|
-
return 0;
|
278
|
-
}
|
279
|
-
const min = forceColor || 0;
|
280
|
-
if (env.TERM === "dumb") {
|
281
|
-
return min;
|
282
|
-
}
|
283
|
-
if (import_node_process.default.platform === "win32") {
|
284
|
-
const osRelease = import_node_os.default.release().split(".");
|
285
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
286
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
287
|
-
}
|
288
|
-
return 1;
|
289
|
-
}
|
290
|
-
if ("CI" in env) {
|
291
|
-
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
292
|
-
return 3;
|
293
|
-
}
|
294
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
295
|
-
return 1;
|
296
|
-
}
|
297
|
-
return min;
|
298
|
-
}
|
299
|
-
if ("TEAMCITY_VERSION" in env) {
|
300
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
301
|
-
}
|
302
|
-
if (env.COLORTERM === "truecolor") {
|
303
|
-
return 3;
|
304
|
-
}
|
305
|
-
if (env.TERM === "xterm-kitty") {
|
306
|
-
return 3;
|
307
|
-
}
|
308
|
-
if ("TERM_PROGRAM" in env) {
|
309
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
310
|
-
switch (env.TERM_PROGRAM) {
|
311
|
-
case "iTerm.app": {
|
312
|
-
return version >= 3 ? 3 : 2;
|
313
|
-
}
|
314
|
-
case "Apple_Terminal": {
|
315
|
-
return 2;
|
316
|
-
}
|
317
|
-
}
|
318
|
-
}
|
319
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
320
|
-
return 2;
|
321
|
-
}
|
322
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
323
|
-
return 1;
|
324
|
-
}
|
325
|
-
if ("COLORTERM" in env) {
|
326
|
-
return 1;
|
327
|
-
}
|
328
|
-
return min;
|
329
|
-
}
|
330
|
-
function createSupportsColor(stream, options = {}) {
|
331
|
-
const level = _supportsColor(stream, {
|
332
|
-
streamIsTTY: stream && stream.isTTY,
|
333
|
-
...options
|
334
|
-
});
|
335
|
-
return translateLevel(level);
|
336
|
-
}
|
337
|
-
var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
|
338
|
-
var init_supports_color = __esm({
|
339
|
-
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
340
|
-
import_node_process = __toESM(require("node:process"), 1);
|
341
|
-
import_node_os = __toESM(require("node:os"), 1);
|
342
|
-
import_node_tty = __toESM(require("node:tty"), 1);
|
343
|
-
({ env } = import_node_process.default);
|
344
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
345
|
-
flagForceColor = 0;
|
346
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
347
|
-
flagForceColor = 1;
|
348
|
-
}
|
349
|
-
supportsColor = {
|
350
|
-
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
|
351
|
-
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
|
352
|
-
};
|
353
|
-
supports_color_default = supportsColor;
|
354
|
-
}
|
355
|
-
});
|
356
|
-
|
357
|
-
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
358
|
-
function stringReplaceAll(string, substring, replacer) {
|
359
|
-
let index4 = string.indexOf(substring);
|
360
|
-
if (index4 === -1) {
|
361
|
-
return string;
|
362
|
-
}
|
363
|
-
const substringLength = substring.length;
|
364
|
-
let endIndex = 0;
|
365
|
-
let returnValue = "";
|
366
|
-
do {
|
367
|
-
returnValue += string.slice(endIndex, index4) + substring + replacer;
|
368
|
-
endIndex = index4 + substringLength;
|
369
|
-
index4 = string.indexOf(substring, endIndex);
|
370
|
-
} while (index4 !== -1);
|
371
|
-
returnValue += string.slice(endIndex);
|
372
|
-
return returnValue;
|
373
|
-
}
|
374
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
|
375
|
-
let endIndex = 0;
|
376
|
-
let returnValue = "";
|
377
|
-
do {
|
378
|
-
const gotCR = string[index4 - 1] === "\r";
|
379
|
-
returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
380
|
-
endIndex = index4 + 1;
|
381
|
-
index4 = string.indexOf("\n", endIndex);
|
382
|
-
} while (index4 !== -1);
|
383
|
-
returnValue += string.slice(endIndex);
|
384
|
-
return returnValue;
|
385
|
-
}
|
386
|
-
var init_utilities = __esm({
|
387
|
-
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
388
|
-
}
|
389
|
-
});
|
390
|
-
|
391
|
-
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
392
|
-
function createChalk(options) {
|
393
|
-
return chalkFactory(options);
|
394
|
-
}
|
395
|
-
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
396
|
-
var init_source = __esm({
|
397
|
-
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
398
|
-
init_ansi_styles();
|
399
|
-
init_supports_color();
|
400
|
-
init_utilities();
|
401
|
-
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
402
|
-
GENERATOR = Symbol("GENERATOR");
|
403
|
-
STYLER = Symbol("STYLER");
|
404
|
-
IS_EMPTY = Symbol("IS_EMPTY");
|
405
|
-
levelMapping = [
|
406
|
-
"ansi",
|
407
|
-
"ansi",
|
408
|
-
"ansi256",
|
409
|
-
"ansi16m"
|
410
|
-
];
|
411
|
-
styles2 = /* @__PURE__ */ Object.create(null);
|
412
|
-
applyOptions = (object, options = {}) => {
|
413
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
414
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
415
|
-
}
|
416
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
417
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
418
|
-
};
|
419
|
-
chalkFactory = (options) => {
|
420
|
-
const chalk2 = (...strings) => strings.join(" ");
|
421
|
-
applyOptions(chalk2, options);
|
422
|
-
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
423
|
-
return chalk2;
|
424
|
-
};
|
425
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
426
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
427
|
-
styles2[styleName] = {
|
428
|
-
get() {
|
429
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
430
|
-
Object.defineProperty(this, styleName, { value: builder });
|
431
|
-
return builder;
|
432
|
-
}
|
433
|
-
};
|
434
|
-
}
|
435
|
-
styles2.visible = {
|
436
|
-
get() {
|
437
|
-
const builder = createBuilder(this, this[STYLER], true);
|
438
|
-
Object.defineProperty(this, "visible", { value: builder });
|
439
|
-
return builder;
|
440
|
-
}
|
441
|
-
};
|
442
|
-
getModelAnsi = (model, level, type, ...arguments_) => {
|
443
|
-
if (model === "rgb") {
|
444
|
-
if (level === "ansi16m") {
|
445
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
446
|
-
}
|
447
|
-
if (level === "ansi256") {
|
448
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
449
|
-
}
|
450
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
451
|
-
}
|
452
|
-
if (model === "hex") {
|
453
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
454
|
-
}
|
455
|
-
return ansi_styles_default[type][model](...arguments_);
|
456
|
-
};
|
457
|
-
usedModels = ["rgb", "hex", "ansi256"];
|
458
|
-
for (const model of usedModels) {
|
459
|
-
styles2[model] = {
|
460
|
-
get() {
|
461
|
-
const { level } = this;
|
462
|
-
return function(...arguments_) {
|
463
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
464
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
465
|
-
};
|
466
|
-
}
|
467
|
-
};
|
468
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
469
|
-
styles2[bgModel] = {
|
470
|
-
get() {
|
471
|
-
const { level } = this;
|
472
|
-
return function(...arguments_) {
|
473
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
474
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
475
|
-
};
|
476
|
-
}
|
477
|
-
};
|
478
|
-
}
|
479
|
-
proto = Object.defineProperties(() => {
|
480
|
-
}, {
|
481
|
-
...styles2,
|
482
|
-
level: {
|
483
|
-
enumerable: true,
|
484
|
-
get() {
|
485
|
-
return this[GENERATOR].level;
|
486
|
-
},
|
487
|
-
set(level) {
|
488
|
-
this[GENERATOR].level = level;
|
489
|
-
}
|
490
|
-
}
|
491
|
-
});
|
492
|
-
createStyler = (open, close, parent) => {
|
493
|
-
let openAll;
|
494
|
-
let closeAll;
|
495
|
-
if (parent === void 0) {
|
496
|
-
openAll = open;
|
497
|
-
closeAll = close;
|
498
|
-
} else {
|
499
|
-
openAll = parent.openAll + open;
|
500
|
-
closeAll = close + parent.closeAll;
|
501
|
-
}
|
502
|
-
return {
|
503
|
-
open,
|
504
|
-
close,
|
505
|
-
openAll,
|
506
|
-
closeAll,
|
507
|
-
parent
|
508
|
-
};
|
509
|
-
};
|
510
|
-
createBuilder = (self2, _styler, _isEmpty) => {
|
511
|
-
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
512
|
-
Object.setPrototypeOf(builder, proto);
|
513
|
-
builder[GENERATOR] = self2;
|
514
|
-
builder[STYLER] = _styler;
|
515
|
-
builder[IS_EMPTY] = _isEmpty;
|
516
|
-
return builder;
|
517
|
-
};
|
518
|
-
applyStyle = (self2, string) => {
|
519
|
-
if (self2.level <= 0 || !string) {
|
520
|
-
return self2[IS_EMPTY] ? "" : string;
|
521
|
-
}
|
522
|
-
let styler = self2[STYLER];
|
523
|
-
if (styler === void 0) {
|
524
|
-
return string;
|
525
|
-
}
|
526
|
-
const { openAll, closeAll } = styler;
|
527
|
-
if (string.includes("\x1B")) {
|
528
|
-
while (styler !== void 0) {
|
529
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
530
|
-
styler = styler.parent;
|
531
|
-
}
|
532
|
-
}
|
533
|
-
const lfIndex = string.indexOf("\n");
|
534
|
-
if (lfIndex !== -1) {
|
535
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
536
|
-
}
|
537
|
-
return openAll + string + closeAll;
|
538
|
-
};
|
539
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
540
|
-
chalk = createChalk();
|
541
|
-
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
542
|
-
source_default = chalk;
|
543
|
-
}
|
544
|
-
});
|
545
|
-
|
546
36
|
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
|
547
37
|
var require_readline = __commonJS({
|
548
38
|
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports2) {
|
@@ -1055,7 +545,7 @@ var require_hanji = __commonJS({
|
|
1055
545
|
return;
|
1056
546
|
}
|
1057
547
|
exports2.render = render2;
|
1058
|
-
function
|
548
|
+
function renderWithTask2(view, task) {
|
1059
549
|
return __awaiter(this, void 0, void 0, function* () {
|
1060
550
|
const terminal = new TaskTerminal(view, process.stdout);
|
1061
551
|
terminal.requestLayout();
|
@@ -1064,7 +554,7 @@ var require_hanji = __commonJS({
|
|
1064
554
|
return result;
|
1065
555
|
});
|
1066
556
|
}
|
1067
|
-
exports2.renderWithTask =
|
557
|
+
exports2.renderWithTask = renderWithTask2;
|
1068
558
|
var terminateHandler;
|
1069
559
|
function onTerminate(callback) {
|
1070
560
|
terminateHandler = callback;
|
@@ -1079,7 +569,7 @@ var init_global = __esm({
|
|
1079
569
|
"src/global.ts"() {
|
1080
570
|
"use strict";
|
1081
571
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
1082
|
-
snapshotVersion = "
|
572
|
+
snapshotVersion = "7";
|
1083
573
|
}
|
1084
574
|
});
|
1085
575
|
|
@@ -5008,7 +4498,7 @@ var init_mysqlSchema = __esm({
|
|
5008
4498
|
});
|
5009
4499
|
|
5010
4500
|
// src/serializer/pgSchema.ts
|
5011
|
-
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;
|
4501
|
+
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV6, tableV5, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchema2, backwardCompatiblePgSchema, dryPg;
|
5012
4502
|
var init_pgSchema = __esm({
|
5013
4503
|
"src/serializer/pgSchema.ts"() {
|
5014
4504
|
"use strict";
|
@@ -5076,10 +4566,48 @@ var init_pgSchema = __esm({
|
|
5076
4566
|
tables: recordType(stringType(), tableV1),
|
5077
4567
|
enums: recordType(stringType(), enumSchemaV1)
|
5078
4568
|
}).strict();
|
4569
|
+
indexColumn = objectType({
|
4570
|
+
expression: stringType(),
|
4571
|
+
isExpression: booleanType(),
|
4572
|
+
asc: booleanType(),
|
4573
|
+
nulls: stringType().optional(),
|
4574
|
+
opclass: stringType().optional()
|
4575
|
+
});
|
5079
4576
|
index2 = objectType({
|
4577
|
+
name: stringType(),
|
4578
|
+
columns: indexColumn.array(),
|
4579
|
+
isUnique: booleanType(),
|
4580
|
+
with: recordType(stringType(), anyType()).optional(),
|
4581
|
+
method: stringType().default("btree"),
|
4582
|
+
where: stringType().optional(),
|
4583
|
+
concurrently: booleanType().default(false)
|
4584
|
+
}).strict();
|
4585
|
+
indexV4 = objectType({
|
5080
4586
|
name: stringType(),
|
5081
4587
|
columns: stringType().array(),
|
5082
|
-
isUnique: booleanType()
|
4588
|
+
isUnique: booleanType(),
|
4589
|
+
with: recordType(stringType(), stringType()).optional(),
|
4590
|
+
method: stringType().default("btree"),
|
4591
|
+
where: stringType().optional(),
|
4592
|
+
concurrently: booleanType().default(false)
|
4593
|
+
}).strict();
|
4594
|
+
indexV5 = objectType({
|
4595
|
+
name: stringType(),
|
4596
|
+
columns: stringType().array(),
|
4597
|
+
isUnique: booleanType(),
|
4598
|
+
with: recordType(stringType(), stringType()).optional(),
|
4599
|
+
method: stringType().default("btree"),
|
4600
|
+
where: stringType().optional(),
|
4601
|
+
concurrently: booleanType().default(false)
|
4602
|
+
}).strict();
|
4603
|
+
indexV6 = objectType({
|
4604
|
+
name: stringType(),
|
4605
|
+
columns: stringType().array(),
|
4606
|
+
isUnique: booleanType(),
|
4607
|
+
with: recordType(stringType(), stringType()).optional(),
|
4608
|
+
method: stringType().default("btree"),
|
4609
|
+
where: stringType().optional(),
|
4610
|
+
concurrently: booleanType().default(false)
|
5083
4611
|
}).strict();
|
5084
4612
|
fk2 = objectType({
|
5085
4613
|
name: stringType(),
|
@@ -5121,9 +4649,27 @@ var init_pgSchema = __esm({
|
|
5121
4649
|
name: stringType(),
|
5122
4650
|
schema: stringType(),
|
5123
4651
|
columns: recordType(stringType(), column2),
|
5124
|
-
indexes: recordType(stringType(),
|
4652
|
+
indexes: recordType(stringType(), indexV4),
|
5125
4653
|
foreignKeys: recordType(stringType(), fk2)
|
5126
4654
|
}).strict();
|
4655
|
+
tableV6 = objectType({
|
4656
|
+
name: stringType(),
|
4657
|
+
schema: stringType(),
|
4658
|
+
columns: recordType(stringType(), column2),
|
4659
|
+
indexes: recordType(stringType(), indexV6),
|
4660
|
+
foreignKeys: recordType(stringType(), fk2),
|
4661
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
4662
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
4663
|
+
}).strict();
|
4664
|
+
tableV5 = objectType({
|
4665
|
+
name: stringType(),
|
4666
|
+
schema: stringType(),
|
4667
|
+
columns: recordType(stringType(), column2),
|
4668
|
+
indexes: recordType(stringType(), indexV5),
|
4669
|
+
foreignKeys: recordType(stringType(), fk2),
|
4670
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
4671
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
4672
|
+
}).strict();
|
5127
4673
|
table2 = objectType({
|
5128
4674
|
name: stringType(),
|
5129
4675
|
schema: stringType(),
|
@@ -5168,7 +4714,7 @@ var init_pgSchema = __esm({
|
|
5168
4714
|
pgSchemaInternalV5 = objectType({
|
5169
4715
|
version: literalType("5"),
|
5170
4716
|
dialect: literalType("pg"),
|
5171
|
-
tables: recordType(stringType(),
|
4717
|
+
tables: recordType(stringType(), tableV5),
|
5172
4718
|
enums: recordType(stringType(), enumSchemaV1),
|
5173
4719
|
schemas: recordType(stringType(), stringType()),
|
5174
4720
|
_meta: objectType({
|
@@ -5178,6 +4724,19 @@ var init_pgSchema = __esm({
|
|
5178
4724
|
}),
|
5179
4725
|
internal: kitInternals2
|
5180
4726
|
}).strict();
|
4727
|
+
pgSchemaInternalV6 = objectType({
|
4728
|
+
version: literalType("6"),
|
4729
|
+
dialect: literalType("postgresql"),
|
4730
|
+
tables: recordType(stringType(), tableV6),
|
4731
|
+
enums: recordType(stringType(), enumSchema),
|
4732
|
+
schemas: recordType(stringType(), stringType()),
|
4733
|
+
_meta: objectType({
|
4734
|
+
schemas: recordType(stringType(), stringType()),
|
4735
|
+
tables: recordType(stringType(), stringType()),
|
4736
|
+
columns: recordType(stringType(), stringType())
|
4737
|
+
}),
|
4738
|
+
internal: kitInternals2
|
4739
|
+
}).strict();
|
5181
4740
|
pgSchemaExternal = objectType({
|
5182
4741
|
version: literalType("5"),
|
5183
4742
|
dialect: literalType("pg"),
|
@@ -5191,7 +4750,7 @@ var init_pgSchema = __esm({
|
|
5191
4750
|
})
|
5192
4751
|
}).strict();
|
5193
4752
|
pgSchemaInternal = objectType({
|
5194
|
-
version: literalType("
|
4753
|
+
version: literalType("7"),
|
5195
4754
|
dialect: literalType("postgresql"),
|
5196
4755
|
tables: recordType(stringType(), table2),
|
5197
4756
|
enums: recordType(stringType(), enumSchema),
|
@@ -5226,18 +4785,30 @@ var init_pgSchema = __esm({
|
|
5226
4785
|
enums: recordType(stringType(), enumSchemaV1),
|
5227
4786
|
schemas: recordType(stringType(), stringType())
|
5228
4787
|
}).strict();
|
5229
|
-
|
4788
|
+
pgSchemaSquashedV6 = objectType({
|
5230
4789
|
version: literalType("6"),
|
5231
4790
|
dialect: literalType("postgresql"),
|
5232
4791
|
tables: recordType(stringType(), tableSquashed2),
|
5233
4792
|
enums: recordType(stringType(), enumSchema),
|
5234
4793
|
schemas: recordType(stringType(), stringType())
|
5235
4794
|
}).strict();
|
4795
|
+
pgSchemaSquashed = objectType({
|
4796
|
+
version: literalType("7"),
|
4797
|
+
dialect: literalType("postgresql"),
|
4798
|
+
tables: recordType(stringType(), tableSquashed2),
|
4799
|
+
enums: recordType(stringType(), enumSchema),
|
4800
|
+
schemas: recordType(stringType(), stringType())
|
4801
|
+
}).strict();
|
5236
4802
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5237
4803
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
5238
4804
|
pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
4805
|
+
pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
|
5239
4806
|
pgSchema2 = pgSchemaInternal.merge(schemaHash2);
|
5240
|
-
backwardCompatiblePgSchema = unionType([
|
4807
|
+
backwardCompatiblePgSchema = unionType([
|
4808
|
+
pgSchemaV5,
|
4809
|
+
pgSchemaV6,
|
4810
|
+
pgSchema2
|
4811
|
+
]);
|
5241
4812
|
dryPg = pgSchema2.parse({
|
5242
4813
|
version: snapshotVersion,
|
5243
4814
|
dialect: "postgresql",
|
@@ -5393,49 +4964,12 @@ var init_utils = __esm({
|
|
5393
4964
|
});
|
5394
4965
|
|
5395
4966
|
// src/cli/views.ts
|
5396
|
-
var import_hanji
|
4967
|
+
var import_hanji;
|
5397
4968
|
var init_views = __esm({
|
5398
4969
|
"src/cli/views.ts"() {
|
5399
4970
|
"use strict";
|
5400
|
-
init_source();
|
5401
4971
|
import_hanji = __toESM(require_hanji());
|
5402
4972
|
init_utils();
|
5403
|
-
Spinner = class {
|
5404
|
-
constructor(frames) {
|
5405
|
-
this.frames = frames;
|
5406
|
-
this.offset = 0;
|
5407
|
-
this.tick = () => {
|
5408
|
-
this.iterator();
|
5409
|
-
};
|
5410
|
-
this.value = () => {
|
5411
|
-
return this.frames[this.offset];
|
5412
|
-
};
|
5413
|
-
this.iterator = () => {
|
5414
|
-
this.offset += 1;
|
5415
|
-
this.offset %= frames.length - 1;
|
5416
|
-
};
|
5417
|
-
}
|
5418
|
-
};
|
5419
|
-
ProgressView = class extends import_hanji.TaskView {
|
5420
|
-
constructor(progressText, successText) {
|
5421
|
-
super();
|
5422
|
-
this.progressText = progressText;
|
5423
|
-
this.successText = successText;
|
5424
|
-
this.spinner = new Spinner("\u28F7\u28EF\u28DF\u287F\u28BF\u28FB\u28FD\u28FE".split(""));
|
5425
|
-
this.timeout = setInterval(() => {
|
5426
|
-
this.spinner.tick();
|
5427
|
-
this.requestLayout();
|
5428
|
-
}, 128);
|
5429
|
-
this.on("detach", () => clearInterval(this.timeout));
|
5430
|
-
}
|
5431
|
-
render(status) {
|
5432
|
-
if (status === "pending") {
|
5433
|
-
const spin = this.spinner.value();
|
5434
|
-
return `[${spin}] ${this.progressText}`;
|
5435
|
-
}
|
5436
|
-
return `[${source_default.green("\u2713")}] ${this.successText}`;
|
5437
|
-
}
|
5438
|
-
};
|
5439
4973
|
}
|
5440
4974
|
});
|
5441
4975
|
|
@@ -5513,24 +5047,12 @@ var init_sqliteSerializer = __esm({
|
|
5513
5047
|
`SELECT
|
5514
5048
|
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
|
5515
5049
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
5516
|
-
WHERE m.type = 'table'
|
5517
|
-
and m.tbl_name != 'sqlite_sequence'
|
5518
|
-
and m.tbl_name != 'sqlite_stat1'
|
5519
|
-
and m.tbl_name != '_litestream_seq'
|
5520
|
-
and m.tbl_name != '_litestream_lock'
|
5521
|
-
and m.tbl_name != 'libsql_wasm_func_table'
|
5522
|
-
and m.tbl_name != '__drizzle_migrations'
|
5523
|
-
and m.tbl_name != '_cf_KV';
|
5050
|
+
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table' and m.tbl_name != '__drizzle_migrations';
|
5524
5051
|
`
|
5525
5052
|
);
|
5526
5053
|
const tablesWithSeq = [];
|
5527
5054
|
const seq = await db.query(
|
5528
|
-
`SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
|
5529
|
-
and name != 'sqlite_stat1'
|
5530
|
-
and name != '_litestream_seq'
|
5531
|
-
and name != '_litestream_lock'
|
5532
|
-
and tbl_name != '_cf_KV'
|
5533
|
-
and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
|
5055
|
+
`SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock' and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
|
5534
5056
|
);
|
5535
5057
|
for (const s of seq) {
|
5536
5058
|
tablesWithSeq.push(s.name);
|
@@ -5615,8 +5137,7 @@ var init_sqliteSerializer = __esm({
|
|
5615
5137
|
try {
|
5616
5138
|
const fks = await db.query(
|
5617
5139
|
`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"
|
5618
|
-
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
|
5619
|
-
where m.tbl_name != '_cf_KV';`
|
5140
|
+
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f;`
|
5620
5141
|
);
|
5621
5142
|
const fkByTableName = {};
|
5622
5143
|
for (const fkRow of fks) {
|
@@ -5675,9 +5196,7 @@ FROM sqlite_master AS m,
|
|
5675
5196
|
pragma_index_list(m.name) AS il,
|
5676
5197
|
pragma_index_info(il.name) AS ii
|
5677
5198
|
WHERE
|
5678
|
-
m.type = 'table'
|
5679
|
-
and il.name NOT LIKE 'sqlite_autoindex_%'
|
5680
|
-
and m.tbl_name != '_cf_KV';`
|
5199
|
+
m.type = 'table' and il.name NOT LIKE 'sqlite_autoindex_%';`
|
5681
5200
|
);
|
5682
5201
|
for (const idxRow of idxs) {
|
5683
5202
|
const tableName = idxRow.tableName;
|
@@ -5930,6 +5449,13 @@ var require_brace_expansion = __commonJS({
|
|
5930
5449
|
}
|
5931
5450
|
});
|
5932
5451
|
|
5452
|
+
// src/extensions/vector.ts
|
5453
|
+
var init_vector = __esm({
|
5454
|
+
"src/extensions/vector.ts"() {
|
5455
|
+
"use strict";
|
5456
|
+
}
|
5457
|
+
});
|
5458
|
+
|
5933
5459
|
// src/serializer/pgSerializer.ts
|
5934
5460
|
var import_pg_core2, import_pg_core3, import_drizzle_orm2, dialect4, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
5935
5461
|
var init_pgSerializer = __esm({
|
@@ -5940,6 +5466,7 @@ var init_pgSerializer = __esm({
|
|
5940
5466
|
import_drizzle_orm2 = require("drizzle-orm");
|
5941
5467
|
init_serializer();
|
5942
5468
|
init_outputs();
|
5469
|
+
init_vector();
|
5943
5470
|
dialect4 = new import_pg_core2.PgDialect();
|
5944
5471
|
trimChar = (str, char) => {
|
5945
5472
|
let start = 0;
|
@@ -6201,7 +5728,10 @@ var init_pgSerializer = __esm({
|
|
6201
5728
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
6202
5729
|
columnToReturn[columnName] = {
|
6203
5730
|
name: columnName,
|
6204
|
-
type:
|
5731
|
+
type: (
|
5732
|
+
// filter vectors, but in future we should filter any extension that was installed by user
|
5733
|
+
columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
|
5734
|
+
),
|
6205
5735
|
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
6206
5736
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
6207
5737
|
// default: isSerial ? undefined : defaultValue,
|
@@ -6212,15 +5742,42 @@ var init_pgSerializer = __esm({
|
|
6212
5742
|
}
|
6213
5743
|
}
|
6214
5744
|
const dbIndexes = await db.query(
|
6215
|
-
`SELECT t.relname
|
6216
|
-
|
6217
|
-
|
6218
|
-
|
6219
|
-
|
6220
|
-
|
6221
|
-
|
6222
|
-
|
6223
|
-
|
5745
|
+
`SELECT DISTINCT ON (t.relname, ic.relname, k.i) t.relname as table_name, ic.relname AS indexname,
|
5746
|
+
k.i AS index_order,
|
5747
|
+
i.indisunique as is_unique,
|
5748
|
+
am.amname as method,
|
5749
|
+
ic.reloptions as with,
|
5750
|
+
coalesce(a.attname,
|
5751
|
+
(('{' || pg_get_expr(
|
5752
|
+
i.indexprs,
|
5753
|
+
i.indrelid
|
5754
|
+
)
|
5755
|
+
|| '}')::text[]
|
5756
|
+
)[k.i]
|
5757
|
+
) AS column_name,
|
5758
|
+
CASE
|
5759
|
+
WHEN pg_get_expr(i.indexprs, i.indrelid) IS NOT NULL THEN 1
|
5760
|
+
ELSE 0
|
5761
|
+
END AS is_expression,
|
5762
|
+
i.indoption[k.i-1] & 1 = 1 AS descending,
|
5763
|
+
i.indoption[k.i-1] & 2 = 2 AS nulls_first,
|
5764
|
+
pg_get_expr(
|
5765
|
+
i.indpred,
|
5766
|
+
i.indrelid
|
5767
|
+
) as where,
|
5768
|
+
opc.opcname
|
5769
|
+
FROM pg_class t
|
5770
|
+
LEFT JOIN pg_index i ON t.oid = i.indrelid
|
5771
|
+
LEFT JOIN pg_class ic ON ic.oid = i.indexrelid
|
5772
|
+
CROSS JOIN LATERAL (SELECT unnest(i.indkey), generate_subscripts(i.indkey, 1) + 1) AS k(attnum, i)
|
5773
|
+
LEFT JOIN pg_attribute AS a
|
5774
|
+
ON i.indrelid = a.attrelid AND k.attnum = a.attnum
|
5775
|
+
JOIN pg_namespace c on c.oid = t.relnamespace
|
5776
|
+
LEFT JOIN pg_am AS am ON ic.relam = am.oid
|
5777
|
+
JOIN pg_opclass opc ON opc.oid = ANY(i.indclass)
|
5778
|
+
WHERE
|
5779
|
+
c.nspname = '${tableSchema}' AND
|
5780
|
+
t.relname = '${tableName}';`
|
6224
5781
|
);
|
6225
5782
|
const dbIndexFromConstraint = await db.query(
|
6226
5783
|
`SELECT
|
@@ -6237,18 +5794,51 @@ var init_pgSerializer = __esm({
|
|
6237
5794
|
);
|
6238
5795
|
const idxsInConsteraint = dbIndexFromConstraint.filter((it) => it.generated_by_constraint === 1).map((it) => it.index_name);
|
6239
5796
|
for (const dbIndex of dbIndexes) {
|
6240
|
-
const indexName = dbIndex.
|
5797
|
+
const indexName = dbIndex.indexname;
|
6241
5798
|
const indexColumnName = dbIndex.column_name;
|
6242
5799
|
const indexIsUnique = dbIndex.is_unique;
|
5800
|
+
const indexMethod = dbIndex.method;
|
5801
|
+
const indexWith = dbIndex.with;
|
5802
|
+
const indexWhere = dbIndex.where;
|
5803
|
+
const opclass = dbIndex.opcname;
|
5804
|
+
const isExpression = dbIndex.is_expression === 1;
|
5805
|
+
const desc = dbIndex.descending;
|
5806
|
+
const nullsFirst = dbIndex.nulls_first;
|
5807
|
+
const mappedWith = {};
|
5808
|
+
if (indexWith !== null) {
|
5809
|
+
indexWith.forEach((it) => {
|
5810
|
+
const splitted = it.split("=");
|
5811
|
+
mappedWith[splitted[0]] = splitted[1];
|
5812
|
+
});
|
5813
|
+
}
|
6243
5814
|
if (idxsInConsteraint.includes(indexName))
|
6244
5815
|
continue;
|
6245
5816
|
if (typeof indexToReturn[indexName] !== "undefined") {
|
6246
|
-
indexToReturn[indexName].columns.push(
|
5817
|
+
indexToReturn[indexName].columns.push({
|
5818
|
+
expression: indexColumnName,
|
5819
|
+
asc: !desc,
|
5820
|
+
nulls: nullsFirst ? "first" : "last",
|
5821
|
+
opclass,
|
5822
|
+
isExpression
|
5823
|
+
});
|
6247
5824
|
} else {
|
6248
5825
|
indexToReturn[indexName] = {
|
6249
5826
|
name: indexName,
|
6250
|
-
columns: [
|
6251
|
-
|
5827
|
+
columns: [
|
5828
|
+
{
|
5829
|
+
expression: indexColumnName,
|
5830
|
+
asc: !desc,
|
5831
|
+
nulls: nullsFirst ? "first" : "last",
|
5832
|
+
opclass,
|
5833
|
+
isExpression
|
5834
|
+
}
|
5835
|
+
],
|
5836
|
+
isUnique: indexIsUnique,
|
5837
|
+
// should not be a part of diff detecs
|
5838
|
+
concurrently: false,
|
5839
|
+
method: indexMethod,
|
5840
|
+
where: indexWhere === null ? void 0 : indexWhere,
|
5841
|
+
with: mappedWith
|
6252
5842
|
};
|
6253
5843
|
}
|
6254
5844
|
}
|
@@ -6284,7 +5874,7 @@ var init_pgSerializer = __esm({
|
|
6284
5874
|
}
|
6285
5875
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
6286
5876
|
return {
|
6287
|
-
version: "
|
5877
|
+
version: "7",
|
6288
5878
|
dialect: "postgresql",
|
6289
5879
|
tables: result,
|
6290
5880
|
enums: enumsToReturn,
|
@@ -6306,7 +5896,6 @@ var init_pgSerializer = __esm({
|
|
6306
5896
|
"time without time zone": "::time without time zone",
|
6307
5897
|
// "timestamp with time zone": "::timestamp with time zone",
|
6308
5898
|
"timestamp without time zone": "::timestamp without time zone",
|
6309
|
-
"timestamp(": "::timestamp without time zone",
|
6310
5899
|
// date: "::date",
|
6311
5900
|
// interval: "::interval",
|
6312
5901
|
// character: "::bpchar",
|
@@ -6319,15 +5908,15 @@ var init_pgSerializer = __esm({
|
|
6319
5908
|
"character(": "::bpchar"
|
6320
5909
|
};
|
6321
5910
|
defaultForColumn = (column4) => {
|
6322
|
-
if (column4.column_default === null) {
|
6323
|
-
return void 0;
|
6324
|
-
}
|
6325
5911
|
if (column4.data_type === "serial" || column4.data_type === "smallserial" || column4.data_type === "bigserial") {
|
6326
5912
|
return void 0;
|
6327
5913
|
}
|
6328
5914
|
const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
|
6329
5915
|
(it) => column4.data_type.startsWith(it)
|
6330
5916
|
);
|
5917
|
+
if (column4.column_default === null) {
|
5918
|
+
return void 0;
|
5919
|
+
}
|
6331
5920
|
const columnDefaultAsString = column4.column_default.toString();
|
6332
5921
|
if (columnDefaultAsString.endsWith(
|
6333
5922
|
hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column4.data_type
|
@@ -7692,14 +7281,7 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7692
7281
|
}
|
7693
7282
|
return false;
|
7694
7283
|
};
|
7695
|
-
const
|
7696
|
-
"Pulling schema from database...",
|
7697
|
-
"Pulling schema from database..."
|
7698
|
-
);
|
7699
|
-
const res = await (0, import_hanji2.renderWithTask)(
|
7700
|
-
progress,
|
7701
|
-
fromDatabase(db, filter2)
|
7702
|
-
);
|
7284
|
+
const res = await fromDatabase(db, filter2);
|
7703
7285
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7704
7286
|
return { schema: schema3 };
|
7705
7287
|
};
|
@@ -7707,8 +7289,6 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7707
7289
|
// src/cli/commands/pgIntrospect.ts
|
7708
7290
|
init_pgSerializer();
|
7709
7291
|
init_global();
|
7710
|
-
init_views();
|
7711
|
-
var import_hanji3 = __toESM(require_hanji());
|
7712
7292
|
var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
7713
7293
|
const matchers = filters.map((it) => {
|
7714
7294
|
return new Minimatch(it);
|
@@ -7723,14 +7303,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
|
7723
7303
|
}
|
7724
7304
|
return false;
|
7725
7305
|
};
|
7726
|
-
const
|
7727
|
-
"Pulling schema from database...",
|
7728
|
-
"Pulling schema from database..."
|
7729
|
-
);
|
7730
|
-
const res = await (0, import_hanji3.renderWithTask)(
|
7731
|
-
progress,
|
7732
|
-
fromDatabase2(db, filter2, schemaFilters)
|
7733
|
-
);
|
7306
|
+
const res = await fromDatabase2(db, filter2, schemaFilters);
|
7734
7307
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7735
7308
|
const { internal, ...schemaWithoutInternals } = schema3;
|
7736
7309
|
return { schema: schemaWithoutInternals };
|