drizzle-kit 0.21.2-dec02d3 → 0.21.2-f3756f2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +11326 -17511
- 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 +1726 -1301
- package/payload.mjs +1711 -1286
- 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.mjs
CHANGED
@@ -34,516 +34,6 @@ 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
|
-
|
547
37
|
// node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
|
548
38
|
var require_readline = __commonJS({
|
549
39
|
"node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
|
@@ -1056,7 +546,7 @@ var require_hanji = __commonJS({
|
|
1056
546
|
return;
|
1057
547
|
}
|
1058
548
|
exports.render = render2;
|
1059
|
-
function
|
549
|
+
function renderWithTask2(view, task) {
|
1060
550
|
return __awaiter(this, void 0, void 0, function* () {
|
1061
551
|
const terminal = new TaskTerminal(view, process.stdout);
|
1062
552
|
terminal.requestLayout();
|
@@ -1065,7 +555,7 @@ var require_hanji = __commonJS({
|
|
1065
555
|
return result;
|
1066
556
|
});
|
1067
557
|
}
|
1068
|
-
exports.renderWithTask =
|
558
|
+
exports.renderWithTask = renderWithTask2;
|
1069
559
|
var terminateHandler;
|
1070
560
|
function onTerminate(callback) {
|
1071
561
|
terminateHandler = callback;
|
@@ -1080,7 +570,7 @@ var init_global = __esm({
|
|
1080
570
|
"src/global.ts"() {
|
1081
571
|
"use strict";
|
1082
572
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
1083
|
-
snapshotVersion = "
|
573
|
+
snapshotVersion = "7";
|
1084
574
|
}
|
1085
575
|
});
|
1086
576
|
|
@@ -5009,7 +4499,7 @@ var init_mysqlSchema = __esm({
|
|
5009
4499
|
});
|
5010
4500
|
|
5011
4501
|
// src/serializer/pgSchema.ts
|
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;
|
4502
|
+
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;
|
5013
4503
|
var init_pgSchema = __esm({
|
5014
4504
|
"src/serializer/pgSchema.ts"() {
|
5015
4505
|
"use strict";
|
@@ -5077,10 +4567,48 @@ var init_pgSchema = __esm({
|
|
5077
4567
|
tables: recordType(stringType(), tableV1),
|
5078
4568
|
enums: recordType(stringType(), enumSchemaV1)
|
5079
4569
|
}).strict();
|
4570
|
+
indexColumn = objectType({
|
4571
|
+
expression: stringType(),
|
4572
|
+
isExpression: booleanType(),
|
4573
|
+
asc: booleanType(),
|
4574
|
+
nulls: stringType().optional(),
|
4575
|
+
opclass: stringType().optional()
|
4576
|
+
});
|
5080
4577
|
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({
|
5081
4587
|
name: stringType(),
|
5082
4588
|
columns: stringType().array(),
|
5083
|
-
isUnique: booleanType()
|
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)
|
5084
4612
|
}).strict();
|
5085
4613
|
fk2 = objectType({
|
5086
4614
|
name: stringType(),
|
@@ -5122,9 +4650,27 @@ var init_pgSchema = __esm({
|
|
5122
4650
|
name: stringType(),
|
5123
4651
|
schema: stringType(),
|
5124
4652
|
columns: recordType(stringType(), column2),
|
5125
|
-
indexes: recordType(stringType(),
|
4653
|
+
indexes: recordType(stringType(), indexV4),
|
5126
4654
|
foreignKeys: recordType(stringType(), fk2)
|
5127
4655
|
}).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();
|
5128
4674
|
table2 = objectType({
|
5129
4675
|
name: stringType(),
|
5130
4676
|
schema: stringType(),
|
@@ -5169,7 +4715,7 @@ var init_pgSchema = __esm({
|
|
5169
4715
|
pgSchemaInternalV5 = objectType({
|
5170
4716
|
version: literalType("5"),
|
5171
4717
|
dialect: literalType("pg"),
|
5172
|
-
tables: recordType(stringType(),
|
4718
|
+
tables: recordType(stringType(), tableV5),
|
5173
4719
|
enums: recordType(stringType(), enumSchemaV1),
|
5174
4720
|
schemas: recordType(stringType(), stringType()),
|
5175
4721
|
_meta: objectType({
|
@@ -5179,6 +4725,19 @@ var init_pgSchema = __esm({
|
|
5179
4725
|
}),
|
5180
4726
|
internal: kitInternals2
|
5181
4727
|
}).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();
|
5182
4741
|
pgSchemaExternal = objectType({
|
5183
4742
|
version: literalType("5"),
|
5184
4743
|
dialect: literalType("pg"),
|
@@ -5192,7 +4751,7 @@ var init_pgSchema = __esm({
|
|
5192
4751
|
})
|
5193
4752
|
}).strict();
|
5194
4753
|
pgSchemaInternal = objectType({
|
5195
|
-
version: literalType("
|
4754
|
+
version: literalType("7"),
|
5196
4755
|
dialect: literalType("postgresql"),
|
5197
4756
|
tables: recordType(stringType(), table2),
|
5198
4757
|
enums: recordType(stringType(), enumSchema),
|
@@ -5227,18 +4786,30 @@ var init_pgSchema = __esm({
|
|
5227
4786
|
enums: recordType(stringType(), enumSchemaV1),
|
5228
4787
|
schemas: recordType(stringType(), stringType())
|
5229
4788
|
}).strict();
|
5230
|
-
|
4789
|
+
pgSchemaSquashedV6 = objectType({
|
5231
4790
|
version: literalType("6"),
|
5232
4791
|
dialect: literalType("postgresql"),
|
5233
4792
|
tables: recordType(stringType(), tableSquashed2),
|
5234
4793
|
enums: recordType(stringType(), enumSchema),
|
5235
4794
|
schemas: recordType(stringType(), stringType())
|
5236
4795
|
}).strict();
|
4796
|
+
pgSchemaSquashed = objectType({
|
4797
|
+
version: literalType("7"),
|
4798
|
+
dialect: literalType("postgresql"),
|
4799
|
+
tables: recordType(stringType(), tableSquashed2),
|
4800
|
+
enums: recordType(stringType(), enumSchema),
|
4801
|
+
schemas: recordType(stringType(), stringType())
|
4802
|
+
}).strict();
|
5237
4803
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5238
4804
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
5239
4805
|
pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
4806
|
+
pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
|
5240
4807
|
pgSchema2 = pgSchemaInternal.merge(schemaHash2);
|
5241
|
-
backwardCompatiblePgSchema = unionType([
|
4808
|
+
backwardCompatiblePgSchema = unionType([
|
4809
|
+
pgSchemaV5,
|
4810
|
+
pgSchemaV6,
|
4811
|
+
pgSchema2
|
4812
|
+
]);
|
5242
4813
|
dryPg = pgSchema2.parse({
|
5243
4814
|
version: snapshotVersion,
|
5244
4815
|
dialect: "postgresql",
|
@@ -5394,49 +4965,12 @@ var init_utils = __esm({
|
|
5394
4965
|
});
|
5395
4966
|
|
5396
4967
|
// src/cli/views.ts
|
5397
|
-
var import_hanji
|
4968
|
+
var import_hanji;
|
5398
4969
|
var init_views = __esm({
|
5399
4970
|
"src/cli/views.ts"() {
|
5400
4971
|
"use strict";
|
5401
|
-
init_source();
|
5402
4972
|
import_hanji = __toESM(require_hanji());
|
5403
4973
|
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
|
-
};
|
5440
4974
|
}
|
5441
4975
|
});
|
5442
4976
|
|
@@ -5518,24 +5052,12 @@ var init_sqliteSerializer = __esm({
|
|
5518
5052
|
`SELECT
|
5519
5053
|
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
|
5520
5054
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
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';
|
5055
|
+
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';
|
5529
5056
|
`
|
5530
5057
|
);
|
5531
5058
|
const tablesWithSeq = [];
|
5532
5059
|
const seq = await db.query(
|
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[^'']*';`
|
5060
|
+
`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[^'']*';`
|
5539
5061
|
);
|
5540
5062
|
for (const s of seq) {
|
5541
5063
|
tablesWithSeq.push(s.name);
|
@@ -5620,8 +5142,7 @@ var init_sqliteSerializer = __esm({
|
|
5620
5142
|
try {
|
5621
5143
|
const fks = await db.query(
|
5622
5144
|
`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"
|
5623
|
-
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
|
5624
|
-
where m.tbl_name != '_cf_KV';`
|
5145
|
+
FROM sqlite_master m, pragma_foreign_key_list(m.name) as f;`
|
5625
5146
|
);
|
5626
5147
|
const fkByTableName = {};
|
5627
5148
|
for (const fkRow of fks) {
|
@@ -5680,9 +5201,7 @@ FROM sqlite_master AS m,
|
|
5680
5201
|
pragma_index_list(m.name) AS il,
|
5681
5202
|
pragma_index_info(il.name) AS ii
|
5682
5203
|
WHERE
|
5683
|
-
m.type = 'table'
|
5684
|
-
and il.name NOT LIKE 'sqlite_autoindex_%'
|
5685
|
-
and m.tbl_name != '_cf_KV';`
|
5204
|
+
m.type = 'table' and il.name NOT LIKE 'sqlite_autoindex_%';`
|
5686
5205
|
);
|
5687
5206
|
for (const idxRow of idxs) {
|
5688
5207
|
const tableName = idxRow.tableName;
|
@@ -5935,6 +5454,13 @@ var require_brace_expansion = __commonJS({
|
|
5935
5454
|
}
|
5936
5455
|
});
|
5937
5456
|
|
5457
|
+
// src/extensions/vector.ts
|
5458
|
+
var init_vector = __esm({
|
5459
|
+
"src/extensions/vector.ts"() {
|
5460
|
+
"use strict";
|
5461
|
+
}
|
5462
|
+
});
|
5463
|
+
|
5938
5464
|
// src/serializer/pgSerializer.ts
|
5939
5465
|
import {
|
5940
5466
|
PgDialect,
|
@@ -5949,6 +5475,7 @@ var init_pgSerializer = __esm({
|
|
5949
5475
|
"use strict";
|
5950
5476
|
init_serializer();
|
5951
5477
|
init_outputs();
|
5478
|
+
init_vector();
|
5952
5479
|
dialect4 = new PgDialect();
|
5953
5480
|
trimChar = (str, char) => {
|
5954
5481
|
let start = 0;
|
@@ -6210,7 +5737,10 @@ var init_pgSerializer = __esm({
|
|
6210
5737
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
6211
5738
|
columnToReturn[columnName] = {
|
6212
5739
|
name: columnName,
|
6213
|
-
type:
|
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
|
+
),
|
6214
5744
|
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
6215
5745
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
6216
5746
|
// default: isSerial ? undefined : defaultValue,
|
@@ -6221,15 +5751,42 @@ var init_pgSerializer = __esm({
|
|
6221
5751
|
}
|
6222
5752
|
}
|
6223
5753
|
const dbIndexes = await db.query(
|
6224
|
-
`SELECT t.relname
|
6225
|
-
|
6226
|
-
|
6227
|
-
|
6228
|
-
|
6229
|
-
|
6230
|
-
|
6231
|
-
|
6232
|
-
|
5754
|
+
`SELECT DISTINCT ON (t.relname, ic.relname, k.i) t.relname as table_name, ic.relname AS indexname,
|
5755
|
+
k.i AS index_order,
|
5756
|
+
i.indisunique as is_unique,
|
5757
|
+
am.amname as method,
|
5758
|
+
ic.reloptions as with,
|
5759
|
+
coalesce(a.attname,
|
5760
|
+
(('{' || pg_get_expr(
|
5761
|
+
i.indexprs,
|
5762
|
+
i.indrelid
|
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}';`
|
6233
5790
|
);
|
6234
5791
|
const dbIndexFromConstraint = await db.query(
|
6235
5792
|
`SELECT
|
@@ -6246,18 +5803,51 @@ var init_pgSerializer = __esm({
|
|
6246
5803
|
);
|
6247
5804
|
const idxsInConsteraint = dbIndexFromConstraint.filter((it) => it.generated_by_constraint === 1).map((it) => it.index_name);
|
6248
5805
|
for (const dbIndex of dbIndexes) {
|
6249
|
-
const indexName = dbIndex.
|
5806
|
+
const indexName = dbIndex.indexname;
|
6250
5807
|
const indexColumnName = dbIndex.column_name;
|
6251
5808
|
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
|
+
}
|
6252
5823
|
if (idxsInConsteraint.includes(indexName))
|
6253
5824
|
continue;
|
6254
5825
|
if (typeof indexToReturn[indexName] !== "undefined") {
|
6255
|
-
indexToReturn[indexName].columns.push(
|
5826
|
+
indexToReturn[indexName].columns.push({
|
5827
|
+
expression: indexColumnName,
|
5828
|
+
asc: !desc,
|
5829
|
+
nulls: nullsFirst ? "first" : "last",
|
5830
|
+
opclass,
|
5831
|
+
isExpression
|
5832
|
+
});
|
6256
5833
|
} else {
|
6257
5834
|
indexToReturn[indexName] = {
|
6258
5835
|
name: indexName,
|
6259
|
-
columns: [
|
6260
|
-
|
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
|
6261
5851
|
};
|
6262
5852
|
}
|
6263
5853
|
}
|
@@ -6293,7 +5883,7 @@ var init_pgSerializer = __esm({
|
|
6293
5883
|
}
|
6294
5884
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
6295
5885
|
return {
|
6296
|
-
version: "
|
5886
|
+
version: "7",
|
6297
5887
|
dialect: "postgresql",
|
6298
5888
|
tables: result,
|
6299
5889
|
enums: enumsToReturn,
|
@@ -6315,7 +5905,6 @@ var init_pgSerializer = __esm({
|
|
6315
5905
|
"time without time zone": "::time without time zone",
|
6316
5906
|
// "timestamp with time zone": "::timestamp with time zone",
|
6317
5907
|
"timestamp without time zone": "::timestamp without time zone",
|
6318
|
-
"timestamp(": "::timestamp without time zone",
|
6319
5908
|
// date: "::date",
|
6320
5909
|
// interval: "::interval",
|
6321
5910
|
// character: "::bpchar",
|
@@ -6328,15 +5917,15 @@ var init_pgSerializer = __esm({
|
|
6328
5917
|
"character(": "::bpchar"
|
6329
5918
|
};
|
6330
5919
|
defaultForColumn = (column4) => {
|
6331
|
-
if (column4.column_default === null) {
|
6332
|
-
return void 0;
|
6333
|
-
}
|
6334
5920
|
if (column4.data_type === "serial" || column4.data_type === "smallserial" || column4.data_type === "bigserial") {
|
6335
5921
|
return void 0;
|
6336
5922
|
}
|
6337
5923
|
const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
|
6338
5924
|
(it) => column4.data_type.startsWith(it)
|
6339
5925
|
);
|
5926
|
+
if (column4.column_default === null) {
|
5927
|
+
return void 0;
|
5928
|
+
}
|
6340
5929
|
const columnDefaultAsString = column4.column_default.toString();
|
6341
5930
|
if (columnDefaultAsString.endsWith(
|
6342
5931
|
hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column4.data_type
|
@@ -7728,14 +7317,7 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7728
7317
|
}
|
7729
7318
|
return false;
|
7730
7319
|
};
|
7731
|
-
const
|
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
|
-
);
|
7320
|
+
const res = await fromDatabase(db, filter2);
|
7739
7321
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7740
7322
|
return { schema: schema3 };
|
7741
7323
|
};
|
@@ -7743,8 +7325,6 @@ var sqlitePushIntrospect = async (db, filters) => {
|
|
7743
7325
|
// src/cli/commands/pgIntrospect.ts
|
7744
7326
|
init_pgSerializer();
|
7745
7327
|
init_global();
|
7746
|
-
init_views();
|
7747
|
-
var import_hanji3 = __toESM(require_hanji());
|
7748
7328
|
var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
7749
7329
|
const matchers = filters.map((it) => {
|
7750
7330
|
return new Minimatch(it);
|
@@ -7759,14 +7339,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
|
|
7759
7339
|
}
|
7760
7340
|
return false;
|
7761
7341
|
};
|
7762
|
-
const
|
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
|
-
);
|
7342
|
+
const res = await fromDatabase2(db, filter2, schemaFilters);
|
7770
7343
|
const schema3 = { id: originUUID, prevId: "", ...res };
|
7771
7344
|
const { internal, ...schemaWithoutInternals } = schema3;
|
7772
7345
|
return { schema: schemaWithoutInternals };
|