drizzle-kit 0.22.0-3b0ba5f → 0.22.0-3c62a84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/utils-studio.js CHANGED
@@ -33,6 +33,516 @@ 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
+
36
546
  // node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
37
547
  var require_readline = __commonJS({
38
548
  "node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports2) {
@@ -545,7 +1055,7 @@ var require_hanji = __commonJS({
545
1055
  return;
546
1056
  }
547
1057
  exports2.render = render2;
548
- function renderWithTask2(view, task) {
1058
+ function renderWithTask3(view, task) {
549
1059
  return __awaiter(this, void 0, void 0, function* () {
550
1060
  const terminal = new TaskTerminal(view, process.stdout);
551
1061
  terminal.requestLayout();
@@ -554,7 +1064,7 @@ var require_hanji = __commonJS({
554
1064
  return result;
555
1065
  });
556
1066
  }
557
- exports2.renderWithTask = renderWithTask2;
1067
+ exports2.renderWithTask = renderWithTask3;
558
1068
  var terminateHandler;
559
1069
  function onTerminate(callback) {
560
1070
  terminateHandler = callback;
@@ -4338,7 +4848,7 @@ var init_lib = __esm({
4338
4848
  });
4339
4849
 
4340
4850
  // src/serializer/mysqlSchema.ts
4341
- var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, backwardCompatibleMysqlSchema, dryMySql;
4851
+ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql;
4342
4852
  var init_mysqlSchema = __esm({
4343
4853
  "src/serializer/mysqlSchema.ts"() {
4344
4854
  "use strict";
@@ -4408,7 +4918,16 @@ var init_mysqlSchema = __esm({
4408
4918
  objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
4409
4919
  )
4410
4920
  }).optional()
4411
- )
4921
+ ).optional(),
4922
+ indexes: recordType(
4923
+ stringType(),
4924
+ objectType({
4925
+ columns: recordType(
4926
+ stringType(),
4927
+ objectType({ isExpression: booleanType().optional() }).optional()
4928
+ )
4929
+ }).optional()
4930
+ ).optional()
4412
4931
  }).optional();
4413
4932
  dialect = literalType("mysql");
4414
4933
  schemaHash = objectType({
@@ -4480,6 +4999,7 @@ var init_mysqlSchema = __esm({
4480
4999
  }).strict();
4481
5000
  mysqlSchema = schema;
4482
5001
  mysqlSchemaV5 = schemaV5;
5002
+ mysqlSchemaSquashed = schemaSquashed;
4483
5003
  backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema]);
4484
5004
  dryMySql = mysqlSchema.parse({
4485
5005
  version: "5",
@@ -4827,7 +5347,7 @@ var init_pgSchema = __esm({
4827
5347
  });
4828
5348
 
4829
5349
  // src/serializer/sqliteSchema.ts
4830
- var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, backwardCompatibleSqliteSchema;
5350
+ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals3, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
4831
5351
  var init_sqliteSchema = __esm({
4832
5352
  "src/serializer/sqliteSchema.ts"() {
4833
5353
  "use strict";
@@ -4905,6 +5425,17 @@ var init_sqliteSchema = __esm({
4905
5425
  columns: recordType(stringType(), stringType())
4906
5426
  })
4907
5427
  }).strict();
5428
+ kitInternals3 = objectType({
5429
+ indexes: recordType(
5430
+ stringType(),
5431
+ objectType({
5432
+ columns: recordType(
5433
+ stringType(),
5434
+ objectType({ isExpression: booleanType().optional() }).optional()
5435
+ )
5436
+ }).optional()
5437
+ ).optional()
5438
+ }).optional();
4908
5439
  latestVersion = literalType("6");
4909
5440
  schemaInternal2 = objectType({
4910
5441
  version: latestVersion,
@@ -4914,7 +5445,8 @@ var init_sqliteSchema = __esm({
4914
5445
  _meta: objectType({
4915
5446
  tables: recordType(stringType(), stringType()),
4916
5447
  columns: recordType(stringType(), stringType())
4917
- })
5448
+ }),
5449
+ internal: kitInternals3
4918
5450
  }).strict();
4919
5451
  schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
4920
5452
  schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
@@ -4947,6 +5479,8 @@ var init_sqliteSchema = __esm({
4947
5479
  }
4948
5480
  });
4949
5481
  sqliteSchemaV5 = schemaV52;
5482
+ sqliteSchema = schema2;
5483
+ SQLiteSchemaSquashed = schemaSquashed2;
4950
5484
  backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
4951
5485
  }
4952
5486
  });
@@ -4964,12 +5498,49 @@ var init_utils = __esm({
4964
5498
  });
4965
5499
 
4966
5500
  // src/cli/views.ts
4967
- var import_hanji;
5501
+ var import_hanji, Spinner, ProgressView;
4968
5502
  var init_views = __esm({
4969
5503
  "src/cli/views.ts"() {
4970
5504
  "use strict";
5505
+ init_source();
4971
5506
  import_hanji = __toESM(require_hanji());
4972
5507
  init_utils();
5508
+ Spinner = class {
5509
+ constructor(frames) {
5510
+ this.frames = frames;
5511
+ this.offset = 0;
5512
+ this.tick = () => {
5513
+ this.iterator();
5514
+ };
5515
+ this.value = () => {
5516
+ return this.frames[this.offset];
5517
+ };
5518
+ this.iterator = () => {
5519
+ this.offset += 1;
5520
+ this.offset %= frames.length - 1;
5521
+ };
5522
+ }
5523
+ };
5524
+ ProgressView = class extends import_hanji.TaskView {
5525
+ constructor(progressText, successText) {
5526
+ super();
5527
+ this.progressText = progressText;
5528
+ this.successText = successText;
5529
+ this.spinner = new Spinner("\u28F7\u28EF\u28DF\u287F\u28BF\u28FB\u28FD\u28FE".split(""));
5530
+ this.timeout = setInterval(() => {
5531
+ this.spinner.tick();
5532
+ this.requestLayout();
5533
+ }, 128);
5534
+ this.on("detach", () => clearInterval(this.timeout));
5535
+ }
5536
+ render(status) {
5537
+ if (status === "pending") {
5538
+ const spin = this.spinner.value();
5539
+ return `[${spin}] ${this.progressText}`;
5540
+ }
5541
+ return `[${source_default.green("\u2713")}] ${this.successText}`;
5542
+ }
5543
+ };
4973
5544
  }
4974
5545
  });
4975
5546
 
@@ -4983,10 +5554,100 @@ var init_serializer = __esm({
4983
5554
  }
4984
5555
  });
4985
5556
 
5557
+ // src/schemaValidator.ts
5558
+ var dialect3, commonSquashedSchema, commonSchema;
5559
+ var init_schemaValidator = __esm({
5560
+ "src/schemaValidator.ts"() {
5561
+ "use strict";
5562
+ init_lib();
5563
+ init_mysqlSchema();
5564
+ init_pgSchema();
5565
+ init_sqliteSchema();
5566
+ dialect3 = enumType(["postgresql", "mysql", "sqlite"]);
5567
+ commonSquashedSchema = unionType([
5568
+ pgSchemaSquashed,
5569
+ mysqlSchemaSquashed,
5570
+ SQLiteSchemaSquashed
5571
+ ]);
5572
+ commonSchema = unionType([
5573
+ pgSchema2,
5574
+ mysqlSchema,
5575
+ sqliteSchema
5576
+ ]);
5577
+ }
5578
+ });
5579
+
5580
+ // src/cli/validations/common.ts
5581
+ var sqliteDriversLiterals, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
5582
+ var init_common = __esm({
5583
+ "src/cli/validations/common.ts"() {
5584
+ "use strict";
5585
+ init_outputs();
5586
+ init_lib();
5587
+ init_schemaValidator();
5588
+ sqliteDriversLiterals = [
5589
+ literalType("turso"),
5590
+ literalType("d1-http"),
5591
+ literalType("expo")
5592
+ ];
5593
+ sqliteDriver = unionType(sqliteDriversLiterals);
5594
+ postgresDriver = literalType("aws-data-api");
5595
+ mysqlDriver = literalType("mysql2");
5596
+ driver = unionType([sqliteDriver, postgresDriver, mysqlDriver]);
5597
+ configCommonSchema = objectType({
5598
+ dialect: dialect3,
5599
+ schema: unionType([stringType(), stringType().array()]).optional(),
5600
+ out: stringType().optional(),
5601
+ breakpoints: booleanType().optional().default(true),
5602
+ driver: driver.optional(),
5603
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5604
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
5605
+ });
5606
+ casing = unionType([literalType("camel"), literalType("preserve")]).default(
5607
+ "preserve"
5608
+ );
5609
+ introspectParams = objectType({
5610
+ schema: unionType([stringType(), stringType().array()]).optional(),
5611
+ out: stringType().optional().default("./drizzle"),
5612
+ breakpoints: booleanType().default(true),
5613
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5614
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5615
+ introspect: objectType({
5616
+ casing
5617
+ }).default({ casing: "camel" })
5618
+ });
5619
+ configIntrospectCliSchema = objectType({
5620
+ schema: unionType([stringType(), stringType().array()]).optional(),
5621
+ out: stringType().optional().default("./drizzle"),
5622
+ breakpoints: booleanType().default(true),
5623
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5624
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5625
+ introspectCasing: unionType([literalType("camel"), literalType("preserve")]).default(
5626
+ "camel"
5627
+ )
5628
+ });
5629
+ configGenerateSchema = objectType({
5630
+ schema: unionType([stringType(), stringType().array()]),
5631
+ out: stringType().optional().default("./drizzle"),
5632
+ breakpoints: booleanType().default(true)
5633
+ });
5634
+ configPushSchema = objectType({
5635
+ dialect: dialect3,
5636
+ schema: unionType([stringType(), stringType().array()]),
5637
+ tablesFilter: unionType([stringType(), stringType().array()]).optional(),
5638
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
5639
+ verbose: booleanType().default(false),
5640
+ strict: booleanType().default(false),
5641
+ out: stringType().optional()
5642
+ });
5643
+ }
5644
+ });
5645
+
4986
5646
  // src/cli/validations/outputs.ts
4987
5647
  var init_outputs = __esm({
4988
5648
  "src/cli/validations/outputs.ts"() {
4989
5649
  "use strict";
5650
+ init_common();
4990
5651
  }
4991
5652
  });
4992
5653
 
@@ -5032,7 +5693,7 @@ function mapSqlToSqliteType(sqlType) {
5032
5693
  return "numeric";
5033
5694
  }
5034
5695
  }
5035
- var import_drizzle_orm, import_sqlite_core2, dialect3, fromDatabase;
5696
+ var import_drizzle_orm, import_sqlite_core2, dialect4, fromDatabase;
5036
5697
  var init_sqliteSerializer = __esm({
5037
5698
  "src/serializer/sqliteSerializer.ts"() {
5038
5699
  "use strict";
@@ -5040,19 +5701,31 @@ var init_sqliteSerializer = __esm({
5040
5701
  import_sqlite_core2 = require("drizzle-orm/sqlite-core");
5041
5702
  init_serializer();
5042
5703
  init_outputs();
5043
- dialect3 = new import_sqlite_core2.SQLiteSyncDialect();
5704
+ dialect4 = new import_sqlite_core2.SQLiteSyncDialect();
5044
5705
  fromDatabase = async (db, tablesFilter = (table4) => true, progressCallback) => {
5045
5706
  const result = {};
5046
5707
  const columns = await db.query(
5047
5708
  `SELECT
5048
5709
  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
5049
5710
  FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
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';
5711
+ WHERE m.type = 'table'
5712
+ and m.tbl_name != 'sqlite_sequence'
5713
+ and m.tbl_name != 'sqlite_stat1'
5714
+ and m.tbl_name != '_litestream_seq'
5715
+ and m.tbl_name != '_litestream_lock'
5716
+ and m.tbl_name != 'libsql_wasm_func_table'
5717
+ and m.tbl_name != '__drizzle_migrations'
5718
+ and m.tbl_name != '_cf_KV';
5051
5719
  `
5052
5720
  );
5053
5721
  const tablesWithSeq = [];
5054
5722
  const seq = await db.query(
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[^'']*';`
5723
+ `SELECT * FROM sqlite_master WHERE name != 'sqlite_sequence'
5724
+ and name != 'sqlite_stat1'
5725
+ and name != '_litestream_seq'
5726
+ and name != '_litestream_lock'
5727
+ and tbl_name != '_cf_KV'
5728
+ and sql GLOB '*[ *' || CHAR(9) || CHAR(10) || CHAR(13) || ']AUTOINCREMENT[^'']*';`
5056
5729
  );
5057
5730
  for (const s of seq) {
5058
5731
  tablesWithSeq.push(s.name);
@@ -5137,7 +5810,8 @@ var init_sqliteSerializer = __esm({
5137
5810
  try {
5138
5811
  const fks = await db.query(
5139
5812
  `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"
5140
- FROM sqlite_master m, pragma_foreign_key_list(m.name) as f;`
5813
+ FROM sqlite_master m, pragma_foreign_key_list(m.name) as f
5814
+ where m.tbl_name != '_cf_KV';`
5141
5815
  );
5142
5816
  const fkByTableName = {};
5143
5817
  for (const fkRow of fks) {
@@ -5196,7 +5870,9 @@ FROM sqlite_master AS m,
5196
5870
  pragma_index_list(m.name) AS il,
5197
5871
  pragma_index_info(il.name) AS ii
5198
5872
  WHERE
5199
- m.type = 'table' and il.name NOT LIKE 'sqlite_autoindex_%';`
5873
+ m.type = 'table'
5874
+ and il.name NOT LIKE 'sqlite_autoindex_%'
5875
+ and m.tbl_name != '_cf_KV';`
5200
5876
  );
5201
5877
  for (const idxRow of idxs) {
5202
5878
  const tableName = idxRow.tableName;
@@ -5457,7 +6133,7 @@ var init_vector = __esm({
5457
6133
  });
5458
6134
 
5459
6135
  // src/serializer/pgSerializer.ts
5460
- var import_pg_core2, import_pg_core3, import_drizzle_orm2, dialect4, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
6136
+ var import_pg_core2, import_pg_core3, import_drizzle_orm2, dialect5, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
5461
6137
  var init_pgSerializer = __esm({
5462
6138
  "src/serializer/pgSerializer.ts"() {
5463
6139
  "use strict";
@@ -5467,7 +6143,7 @@ var init_pgSerializer = __esm({
5467
6143
  init_serializer();
5468
6144
  init_outputs();
5469
6145
  init_vector();
5470
- dialect4 = new import_pg_core2.PgDialect();
6146
+ dialect5 = new import_pg_core2.PgDialect();
5471
6147
  trimChar = (str, char) => {
5472
6148
  let start = 0;
5473
6149
  let end = str.length;
@@ -5730,7 +6406,7 @@ var init_pgSerializer = __esm({
5730
6406
  name: columnName,
5731
6407
  type: (
5732
6408
  // filter vectors, but in future we should filter any extension that was installed by user
5733
- columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
6409
+ columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType3) ? enumType3 : columnTypeMapped
5734
6410
  ),
5735
6411
  typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
5736
6412
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
@@ -5896,6 +6572,7 @@ var init_pgSerializer = __esm({
5896
6572
  "time without time zone": "::time without time zone",
5897
6573
  // "timestamp with time zone": "::timestamp with time zone",
5898
6574
  "timestamp without time zone": "::timestamp without time zone",
6575
+ "timestamp(": "::timestamp without time zone",
5899
6576
  // date: "::date",
5900
6577
  // interval: "::interval",
5901
6578
  // character: "::bpchar",
@@ -5908,15 +6585,15 @@ var init_pgSerializer = __esm({
5908
6585
  "character(": "::bpchar"
5909
6586
  };
5910
6587
  defaultForColumn = (column4) => {
6588
+ if (column4.column_default === null) {
6589
+ return void 0;
6590
+ }
5911
6591
  if (column4.data_type === "serial" || column4.data_type === "smallserial" || column4.data_type === "bigserial") {
5912
6592
  return void 0;
5913
6593
  }
5914
6594
  const hasDifferentDefaultCast = Object.keys(columnToDefault).find(
5915
6595
  (it) => column4.data_type.startsWith(it)
5916
6596
  );
5917
- if (column4.column_default === null) {
5918
- return void 0;
5919
- }
5920
6597
  const columnDefaultAsString = column4.column_default.toString();
5921
6598
  if (columnDefaultAsString.endsWith(
5922
6599
  hasDifferentDefaultCast ? columnToDefault[hasDifferentDefaultCast] : column4.data_type
@@ -7281,7 +7958,14 @@ var sqlitePushIntrospect = async (db, filters) => {
7281
7958
  }
7282
7959
  return false;
7283
7960
  };
7284
- const res = await fromDatabase(db, filter2);
7961
+ const progress = new ProgressView(
7962
+ "Pulling schema from database...",
7963
+ "Pulling schema from database..."
7964
+ );
7965
+ const res = await (0, import_hanji2.renderWithTask)(
7966
+ progress,
7967
+ fromDatabase(db, filter2)
7968
+ );
7285
7969
  const schema3 = { id: originUUID, prevId: "", ...res };
7286
7970
  return { schema: schema3 };
7287
7971
  };
@@ -7289,6 +7973,8 @@ var sqlitePushIntrospect = async (db, filters) => {
7289
7973
  // src/cli/commands/pgIntrospect.ts
7290
7974
  init_pgSerializer();
7291
7975
  init_global();
7976
+ init_views();
7977
+ var import_hanji3 = __toESM(require_hanji());
7292
7978
  var pgPushIntrospect = async (db, filters, schemaFilters) => {
7293
7979
  const matchers = filters.map((it) => {
7294
7980
  return new Minimatch(it);
@@ -7303,7 +7989,14 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
7303
7989
  }
7304
7990
  return false;
7305
7991
  };
7306
- const res = await fromDatabase2(db, filter2, schemaFilters);
7992
+ const progress = new ProgressView(
7993
+ "Pulling schema from database...",
7994
+ "Pulling schema from database..."
7995
+ );
7996
+ const res = await (0, import_hanji3.renderWithTask)(
7997
+ progress,
7998
+ fromDatabase2(db, filter2, schemaFilters)
7999
+ );
7307
8000
  const schema3 = { id: originUUID, prevId: "", ...res };
7308
8001
  const { internal, ...schemaWithoutInternals } = schema3;
7309
8002
  return { schema: schemaWithoutInternals };