drizzle-kit 1.0.0-beta.2-4e5ecef → 1.0.0-beta.2-84ab15f

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/bin.cjs CHANGED
@@ -5892,8 +5892,7 @@ var init_schemaValidator = __esm({
5892
5892
  "singlestore",
5893
5893
  "gel",
5894
5894
  "mssql",
5895
- "cockroach",
5896
- "duckdb"
5895
+ "cockroach"
5897
5896
  ];
5898
5897
  dialect = enumType(dialects);
5899
5898
  }
@@ -22637,10 +22636,11 @@ var init_grammar2 = __esm({
22637
22636
  return {
22638
22637
  bool: (key) => {
22639
22638
  if (key in it2) {
22640
- if (it2[key] === "true") {
22639
+ const value = it2[key];
22640
+ if (value === "true" || value === "1" || value === "on" || value === "yes") {
22641
22641
  return true;
22642
22642
  }
22643
- if (it2[key] === "false") {
22643
+ if (value === "false" || value === "0" || value === "off" || value === "no") {
22644
22644
  return false;
22645
22645
  }
22646
22646
  throw new Error(`Invalid options boolean value for ${key}: ${it2[key]}`);
@@ -28624,41 +28624,41 @@ var require_ms = __commonJS({
28624
28624
  return void 0;
28625
28625
  }
28626
28626
  }
28627
- function fmtShort(ms) {
28628
- var msAbs = Math.abs(ms);
28627
+ function fmtShort(ms2) {
28628
+ var msAbs = Math.abs(ms2);
28629
28629
  if (msAbs >= d5) {
28630
- return Math.round(ms / d5) + "d";
28630
+ return Math.round(ms2 / d5) + "d";
28631
28631
  }
28632
28632
  if (msAbs >= h6) {
28633
- return Math.round(ms / h6) + "h";
28633
+ return Math.round(ms2 / h6) + "h";
28634
28634
  }
28635
28635
  if (msAbs >= m6) {
28636
- return Math.round(ms / m6) + "m";
28636
+ return Math.round(ms2 / m6) + "m";
28637
28637
  }
28638
28638
  if (msAbs >= s6) {
28639
- return Math.round(ms / s6) + "s";
28639
+ return Math.round(ms2 / s6) + "s";
28640
28640
  }
28641
- return ms + "ms";
28641
+ return ms2 + "ms";
28642
28642
  }
28643
- function fmtLong(ms) {
28644
- var msAbs = Math.abs(ms);
28643
+ function fmtLong(ms2) {
28644
+ var msAbs = Math.abs(ms2);
28645
28645
  if (msAbs >= d5) {
28646
- return plural2(ms, msAbs, d5, "day");
28646
+ return plural2(ms2, msAbs, d5, "day");
28647
28647
  }
28648
28648
  if (msAbs >= h6) {
28649
- return plural2(ms, msAbs, h6, "hour");
28649
+ return plural2(ms2, msAbs, h6, "hour");
28650
28650
  }
28651
28651
  if (msAbs >= m6) {
28652
- return plural2(ms, msAbs, m6, "minute");
28652
+ return plural2(ms2, msAbs, m6, "minute");
28653
28653
  }
28654
28654
  if (msAbs >= s6) {
28655
- return plural2(ms, msAbs, s6, "second");
28655
+ return plural2(ms2, msAbs, s6, "second");
28656
28656
  }
28657
- return ms + " ms";
28657
+ return ms2 + " ms";
28658
28658
  }
28659
- function plural2(ms, msAbs, n5, name) {
28659
+ function plural2(ms2, msAbs, n5, name) {
28660
28660
  var isPlural = msAbs >= n5 * 1.5;
28661
- return Math.round(ms / n5) + " " + name + (isPlural ? "s" : "");
28661
+ return Math.round(ms2 / n5) + " " + name + (isPlural ? "s" : "");
28662
28662
  }
28663
28663
  }
28664
28664
  });
@@ -28701,8 +28701,8 @@ var require_common2 = __commonJS({
28701
28701
  }
28702
28702
  const self2 = debug;
28703
28703
  const curr = Number(/* @__PURE__ */ new Date());
28704
- const ms = curr - (prevTime || curr);
28705
- self2.diff = ms;
28704
+ const ms2 = curr - (prevTime || curr);
28705
+ self2.diff = ms2;
28706
28706
  self2.prev = prevTime;
28707
28707
  self2.curr = curr;
28708
28708
  prevTime = curr;
@@ -34305,9 +34305,6 @@ var init_utils_node = __esm({
34305
34305
  case "gel":
34306
34306
  throw Error("gel validator is not implemented yet");
34307
34307
  // TODO
34308
- case "duckdb":
34309
- throw Error("duckdb validator is not implemented yet");
34310
- // TODO
34311
34308
  default:
34312
34309
  assertUnreachable(dialect6);
34313
34310
  }
@@ -35843,8 +35840,8 @@ ${sql}
35843
35840
  `;
35844
35841
  return content;
35845
35842
  };
35846
- prepareSnapshotFolderName = (ms) => {
35847
- const now = ms ? new Date(ms) : /* @__PURE__ */ new Date();
35843
+ prepareSnapshotFolderName = (ms2) => {
35844
+ const now = ms2 ? new Date(ms2) : /* @__PURE__ */ new Date();
35848
35845
  return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
35849
35846
  now.getUTCDate()
35850
35847
  )}${two(now.getUTCHours())}${two(now.getUTCMinutes())}${two(
@@ -55593,7 +55590,7 @@ var require_websocket = __commonJS({
55593
55590
  var EventEmitter = require("events");
55594
55591
  var https2 = require("https");
55595
55592
  var http3 = require("http");
55596
- var net = require("net");
55593
+ var net2 = require("net");
55597
55594
  var tls = require("tls");
55598
55595
  var { randomBytes, createHash: createHash2 } = require("crypto");
55599
55596
  var { Duplex, Readable: Readable2 } = require("stream");
@@ -56324,12 +56321,12 @@ var require_websocket = __commonJS({
56324
56321
  }
56325
56322
  function netConnect(options) {
56326
56323
  options.path = options.socketPath;
56327
- return net.connect(options);
56324
+ return net2.connect(options);
56328
56325
  }
56329
56326
  function tlsConnect(options) {
56330
56327
  options.path = void 0;
56331
56328
  if (!options.servername && options.servername !== "") {
56332
- options.servername = net.isIP(options.host) ? "" : options.host;
56329
+ options.servername = net2.isIP(options.host) ? "" : options.host;
56333
56330
  }
56334
56331
  return tls.connect(options);
56335
56332
  }
@@ -58620,7 +58617,7 @@ var require_dist_cjs14 = __commonJS({
58620
58617
  return transformedHeaders;
58621
58618
  };
58622
58619
  var timing = {
58623
- setTimeout: (cb, ms) => setTimeout(cb, ms),
58620
+ setTimeout: (cb, ms2) => setTimeout(cb, ms2),
58624
58621
  clearTimeout: (timeoutId) => clearTimeout(timeoutId)
58625
58622
  };
58626
58623
  var DEFER_EVENT_LISTENER_TIME$2 = 1e3;
@@ -61679,13 +61676,13 @@ var init_schema_date_utils = __esm({
61679
61676
  if (!matches) {
61680
61677
  throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);
61681
61678
  }
61682
- const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms, offsetStr] = matches;
61679
+ const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms2, offsetStr] = matches;
61683
61680
  range(monthStr, 1, 12);
61684
61681
  range(dayStr, 1, 31);
61685
61682
  range(hours, 0, 23);
61686
61683
  range(minutes, 0, 59);
61687
61684
  range(seconds, 0, 60);
61688
- const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms) ? Math.round(parseFloat(`0.${ms}`) * 1e3) : 0));
61685
+ const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms2) ? Math.round(parseFloat(`0.${ms2}`) * 1e3) : 0));
61689
61686
  date2.setUTCFullYear(Number(yearStr));
61690
61687
  if (offsetStr.toUpperCase() != "Z") {
61691
61688
  const [, sign, offsetH, offsetM] = /([+-])(\d\d):(\d\d)/.exec(offsetStr) || [void 0, "+", 0, 0];
@@ -81576,8 +81573,8 @@ var require_datetime2 = __commonJS({
81576
81573
  if (!(object instanceof Date)) {
81577
81574
  throw new errors_1.InvalidArgumentError(`a Date instance was expected, got "${object}"`);
81578
81575
  }
81579
- const ms = object.getTime() - TIMESHIFT;
81580
- const us = ms * 1e3;
81576
+ const ms2 = object.getTime() - TIMESHIFT;
81577
+ const us = ms2 * 1e3;
81581
81578
  buf.writeInt32(8);
81582
81579
  buf.writeInt64(us);
81583
81580
  }
@@ -81587,12 +81584,12 @@ var require_datetime2 = __commonJS({
81587
81584
  return ctx.postDecode(this, us2 + BI_TIMESHIFT_US);
81588
81585
  }
81589
81586
  const us = Number(buf.readBigInt64());
81590
- let ms = Math.round(us / 1e3);
81591
- if (Math.abs(us % 1e3) === 500 && Math.abs(ms) % 2 === 1) {
81592
- ms -= 1;
81587
+ let ms2 = Math.round(us / 1e3);
81588
+ if (Math.abs(us % 1e3) === 500 && Math.abs(ms2) % 2 === 1) {
81589
+ ms2 -= 1;
81593
81590
  }
81594
- ms += TIMESHIFT;
81595
- return new Date(ms);
81591
+ ms2 += TIMESHIFT;
81592
+ return new Date(ms2);
81596
81593
  }
81597
81594
  };
81598
81595
  exports2.DateTimeCodec = DateTimeCodec;
@@ -81613,8 +81610,8 @@ var require_datetime2 = __commonJS({
81613
81610
  if (!(object instanceof datetime_1.LocalDateTime)) {
81614
81611
  throw new errors_1.InvalidArgumentError(`a LocalDateTime instance was expected, got "${object}"`);
81615
81612
  }
81616
- const ms = BigInt(datetime_1.localDateInstances.get(object).getTime() - TIMESHIFT);
81617
- let us = ms * 1000n + BigInt(object.hour * 36e8 + object.minute * 6e7 + object.second * 1e6 + object.millisecond * 1e3 + object.microsecond);
81613
+ const ms2 = BigInt(datetime_1.localDateInstances.get(object).getTime() - TIMESHIFT);
81614
+ let us = ms2 * 1000n + BigInt(object.hour * 36e8 + object.minute * 6e7 + object.second * 1e6 + object.millisecond * 1e3 + object.microsecond);
81618
81615
  if (object.nanosecond === 500 && Math.abs(object.microsecond) % 2 === 1 || object.nanosecond > 500) {
81619
81616
  us += 1n;
81620
81617
  }
@@ -81628,13 +81625,13 @@ var require_datetime2 = __commonJS({
81628
81625
  }
81629
81626
  const bi_ms = bi_us / 1000n;
81630
81627
  let us = Number(bi_us - bi_ms * 1000n);
81631
- let ms = Number(bi_ms);
81628
+ let ms2 = Number(bi_ms);
81632
81629
  if (us < 0) {
81633
81630
  us += 1e3;
81634
- ms -= 1;
81631
+ ms2 -= 1;
81635
81632
  }
81636
- ms += TIMESHIFT;
81637
- const date2 = new Date(ms);
81633
+ ms2 += TIMESHIFT;
81634
+ const date2 = new Date(ms2);
81638
81635
  return new datetime_1.LocalDateTime(date2.getUTCFullYear(), date2.getUTCMonth() + 1, date2.getUTCDate(), date2.getUTCHours(), date2.getUTCMinutes(), date2.getUTCSeconds(), date2.getUTCMilliseconds(), us);
81639
81636
  }
81640
81637
  };
@@ -81696,13 +81693,13 @@ var require_datetime2 = __commonJS({
81696
81693
  }
81697
81694
  let us = Number(bius);
81698
81695
  let seconds = Math.floor(us / 1e6);
81699
- const ms = Math.floor(us % 1e6 / 1e3);
81700
- us = us % 1e6 - ms * 1e3;
81696
+ const ms2 = Math.floor(us % 1e6 / 1e3);
81697
+ us = us % 1e6 - ms2 * 1e3;
81701
81698
  let minutes = Math.floor(seconds / 60);
81702
81699
  seconds = Math.floor(seconds % 60);
81703
81700
  const hours = Math.floor(minutes / 60);
81704
81701
  minutes = Math.floor(minutes % 60);
81705
- return new datetime_1.LocalTime(hours, minutes, seconds, ms, us);
81702
+ return new datetime_1.LocalTime(hours, minutes, seconds, ms2, us);
81706
81703
  }
81707
81704
  };
81708
81705
  exports2.LocalTimeCodec = LocalTimeCodec;
@@ -81779,14 +81776,14 @@ var require_datetime2 = __commonJS({
81779
81776
  const biMillion = 1000000n;
81780
81777
  const biSeconds = bius / biMillion;
81781
81778
  let us = Number(bius - biSeconds * biMillion);
81782
- const ms = Math.floor(us / 1e3);
81779
+ const ms2 = Math.floor(us / 1e3);
81783
81780
  us = us % 1e3;
81784
81781
  let seconds = Number(biSeconds);
81785
81782
  let minutes = Math.floor(seconds / 60);
81786
81783
  seconds = Math.floor(seconds % 60);
81787
81784
  const hours = Math.floor(minutes / 60);
81788
81785
  minutes = Math.floor(minutes % 60);
81789
- return new datetime_1.Duration(0, 0, 0, 0, hours * sign, minutes * sign, seconds * sign, ms * sign, us * sign);
81786
+ return new datetime_1.Duration(0, 0, 0, 0, hours * sign, minutes * sign, seconds * sign, ms2 * sign, us * sign);
81790
81787
  }
81791
81788
  };
81792
81789
  exports2.DurationCodec = DurationCodec;
@@ -81832,7 +81829,7 @@ var require_datetime2 = __commonJS({
81832
81829
  const million = BigInt(1e6);
81833
81830
  const biSeconds = bius / million;
81834
81831
  let us = Number(bius - biSeconds * million);
81835
- const ms = Math.trunc(us / 1e3);
81832
+ const ms2 = Math.trunc(us / 1e3);
81836
81833
  us = us % 1e3;
81837
81834
  let seconds = Number(biSeconds);
81838
81835
  let minutes = Math.trunc(seconds / 60);
@@ -81843,7 +81840,7 @@ var require_datetime2 = __commonJS({
81843
81840
  days = Math.trunc(days % 7);
81844
81841
  const years = Math.trunc(months2 / 12);
81845
81842
  months2 = Math.trunc(months2 % 12);
81846
- return new datetime_1.RelativeDuration(years, months2, weeks, days, hours * sign, minutes * sign, seconds * sign, ms * sign, us * sign);
81843
+ return new datetime_1.RelativeDuration(years, months2, weeks, days, hours * sign, minutes * sign, seconds * sign, ms2 * sign, us * sign);
81847
81844
  }
81848
81845
  };
81849
81846
  exports2.RelativeDurationCodec = RelativeDurationCodec;
@@ -106330,11 +106327,11 @@ var require_TokenExpiredError = __commonJS({
106330
106327
  // ../node_modules/.pnpm/jsonwebtoken@9.0.2/node_modules/jsonwebtoken/lib/timespan.js
106331
106328
  var require_timespan = __commonJS({
106332
106329
  "../node_modules/.pnpm/jsonwebtoken@9.0.2/node_modules/jsonwebtoken/lib/timespan.js"(exports2, module2) {
106333
- var ms = require_ms();
106330
+ var ms2 = require_ms();
106334
106331
  module2.exports = function(time2, iat) {
106335
106332
  var timestamp = iat || Math.floor(Date.now() / 1e3);
106336
106333
  if (typeof time2 === "string") {
106337
- var milliseconds = ms(time2);
106334
+ var milliseconds = ms2(time2);
106338
106335
  if (typeof milliseconds === "undefined") {
106339
106336
  return;
106340
106337
  }
@@ -120921,7 +120918,7 @@ var require_dist = __commonJS({
120921
120918
  };
120922
120919
  Object.defineProperty(exports2, "__esModule", { value: true });
120923
120920
  exports2.Agent = void 0;
120924
- var net = __importStar2(require("net"));
120921
+ var net2 = __importStar2(require("net"));
120925
120922
  var http3 = __importStar2(require("http"));
120926
120923
  var https_1 = require("https");
120927
120924
  __exportStar2(require_helpers2(), exports2);
@@ -120961,7 +120958,7 @@ var require_dist = __commonJS({
120961
120958
  if (!this.sockets[name]) {
120962
120959
  this.sockets[name] = [];
120963
120960
  }
120964
- const fakeSocket = new net.Socket({ writable: false });
120961
+ const fakeSocket = new net2.Socket({ writable: false });
120965
120962
  this.sockets[name].push(fakeSocket);
120966
120963
  this.totalSocketCount++;
120967
120964
  return fakeSocket;
@@ -121173,7 +121170,7 @@ var require_dist2 = __commonJS({
121173
121170
  };
121174
121171
  Object.defineProperty(exports2, "__esModule", { value: true });
121175
121172
  exports2.HttpsProxyAgent = void 0;
121176
- var net = __importStar2(require("net"));
121173
+ var net2 = __importStar2(require("net"));
121177
121174
  var tls = __importStar2(require("tls"));
121178
121175
  var assert_1 = __importDefault2(require("assert"));
121179
121176
  var debug_1 = __importDefault2(require_src2());
@@ -121182,7 +121179,7 @@ var require_dist2 = __commonJS({
121182
121179
  var parse_proxy_response_1 = require_parse_proxy_response();
121183
121180
  var debug = (0, debug_1.default)("https-proxy-agent");
121184
121181
  var setServernameFromNonIpHost = (options) => {
121185
- if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
121182
+ if (options.servername === void 0 && options.host && !net2.isIP(options.host)) {
121186
121183
  return {
121187
121184
  ...options,
121188
121185
  servername: options.host
@@ -121222,10 +121219,10 @@ var require_dist2 = __commonJS({
121222
121219
  socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
121223
121220
  } else {
121224
121221
  debug("Creating `net.Socket`: %o", this.connectOpts);
121225
- socket = net.connect(this.connectOpts);
121222
+ socket = net2.connect(this.connectOpts);
121226
121223
  }
121227
121224
  const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
121228
- const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
121225
+ const host = net2.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
121229
121226
  let payload2 = `CONNECT ${host}:${opts.port} HTTP/1.1\r
121230
121227
  `;
121231
121228
  if (proxy.username || proxy.password) {
@@ -121258,7 +121255,7 @@ var require_dist2 = __commonJS({
121258
121255
  return socket;
121259
121256
  }
121260
121257
  socket.destroy();
121261
- const fakeSocket = new net.Socket({ writable: false });
121258
+ const fakeSocket = new net2.Socket({ writable: false });
121262
121259
  fakeSocket.readable = true;
121263
121260
  req.once("socket", (s6) => {
121264
121261
  debug("Replaying proxy buffer for failed request");
@@ -121323,7 +121320,7 @@ var require_dist3 = __commonJS({
121323
121320
  };
121324
121321
  Object.defineProperty(exports2, "__esModule", { value: true });
121325
121322
  exports2.HttpProxyAgent = void 0;
121326
- var net = __importStar2(require("net"));
121323
+ var net2 = __importStar2(require("net"));
121327
121324
  var tls = __importStar2(require("tls"));
121328
121325
  var debug_1 = __importDefault2(require_src2());
121329
121326
  var events_1 = require("events");
@@ -121396,7 +121393,7 @@ var require_dist3 = __commonJS({
121396
121393
  socket = tls.connect(this.connectOpts);
121397
121394
  } else {
121398
121395
  debug("Creating `net.Socket`: %o", this.connectOpts);
121399
- socket = net.connect(this.connectOpts);
121396
+ socket = net2.connect(this.connectOpts);
121400
121397
  }
121401
121398
  await (0, events_1.once)(socket, "connect");
121402
121399
  return socket;
@@ -160310,7 +160307,7 @@ var require_connection = __commonJS({
160310
160307
  var _crypto = _interopRequireDefault(require("crypto"));
160311
160308
  var _os = _interopRequireDefault(require("os"));
160312
160309
  var tls = _interopRequireWildcard(require("tls"));
160313
- var net = _interopRequireWildcard(require("net"));
160310
+ var net2 = _interopRequireWildcard(require("net"));
160314
160311
  var _dns = _interopRequireDefault(require("dns"));
160315
160312
  var _constants = _interopRequireDefault(require("constants"));
160316
160313
  var _stream = require("stream");
@@ -161359,7 +161356,7 @@ var require_connection = __commonJS({
161359
161356
  async wrapWithTls(socket, signal) {
161360
161357
  signal.throwIfAborted();
161361
161358
  const secureContext = tls.createSecureContext(this.secureContextOptions);
161362
- const serverName = !net.isIP(this.config.server) ? this.config.server : "";
161359
+ const serverName = !net2.isIP(this.config.server) ? this.config.server : "";
161363
161360
  const encryptOptions = {
161364
161361
  host: this.config.server,
161365
161362
  socket,
@@ -164270,7 +164267,6 @@ __export(connections_exports, {
164270
164267
  connectToSQLite: () => connectToSQLite,
164271
164268
  connectToSingleStore: () => connectToSingleStore,
164272
164269
  prepareCockroach: () => prepareCockroach,
164273
- prepareDuckDb: () => prepareDuckDb,
164274
164270
  prepareGelDB: () => prepareGelDB,
164275
164271
  preparePostgresDB: () => preparePostgresDB
164276
164272
  });
@@ -164287,10 +164283,11 @@ function parseMssqlUrl(url) {
164287
164283
  }
164288
164284
  };
164289
164285
  }
164290
- var normalisePGliteUrl, preparePostgresDB, prepareDuckDb, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
164286
+ var import_net, ms, normalisePGliteUrl, preparePostgresDB, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
164291
164287
  var init_connections = __esm({
164292
164288
  "src/cli/connections.ts"() {
164293
164289
  "use strict";
164290
+ import_net = __toESM(require("net"));
164294
164291
  init_src();
164295
164292
  init_wrapper();
164296
164293
  init_utils2();
@@ -164298,6 +164295,7 @@ var init_connections = __esm({
164298
164295
  init_when_json_met_bigint();
164299
164296
  init_utils4();
164300
164297
  init_outputs();
164298
+ ms = (a5, b5) => Number(b5 - a5) / 1e6;
164301
164299
  normalisePGliteUrl = (it2) => {
164302
164300
  if (it2.startsWith("file:")) {
164303
164301
  return it2.substring(5);
@@ -164421,13 +164419,7 @@ var init_connections = __esm({
164421
164419
  }
164422
164420
  return results;
164423
164421
  };
164424
- return {
164425
- packageName: "pglite",
164426
- query,
164427
- proxy,
164428
- transactionProxy,
164429
- migrate: migrateFn
164430
- };
164422
+ return { packageName: "pglite", query, proxy, transactionProxy, migrate: migrateFn };
164431
164423
  }
164432
164424
  assertUnreachable(driver2);
164433
164425
  }
@@ -164458,13 +164450,13 @@ var init_connections = __esm({
164458
164450
  return pg.types.getTypeParser(typeId, format2);
164459
164451
  }
164460
164452
  };
164461
- const client = "url" in credentials2 ? new pg.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.Pool({ ...credentials2, ssl, max: 1 });
164462
- const db = drizzle({ client });
164453
+ const pool = "url" in credentials2 ? new pg.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.Pool({ ...credentials2, ssl, max: 1 });
164454
+ const db = drizzle({ client: pool });
164463
164455
  const migrateFn = async (config) => {
164464
164456
  return migrate2(db, config);
164465
164457
  };
164466
164458
  const query = async (sql, params) => {
164467
- const result2 = await client.query({
164459
+ const result2 = await pool.query({
164468
164460
  text: sql,
164469
164461
  values: params ?? [],
164470
164462
  types: types3
@@ -164474,7 +164466,7 @@ var init_connections = __esm({
164474
164466
  return result2.rows;
164475
164467
  };
164476
164468
  const proxy = async (params) => {
164477
- const result2 = await client.query({
164469
+ const result2 = await pool.query({
164478
164470
  text: params.sql,
164479
164471
  values: params.params,
164480
164472
  ...params.mode === "array" && { rowMode: "array" },
@@ -164486,7 +164478,7 @@ var init_connections = __esm({
164486
164478
  };
164487
164479
  const transactionProxy = async (queries) => {
164488
164480
  const results = [];
164489
- const tx = await client.connect();
164481
+ const tx = await pool.connect();
164490
164482
  try {
164491
164483
  await tx.query("BEGIN");
164492
164484
  for (const query2 of queries) {
@@ -164505,13 +164497,119 @@ var init_connections = __esm({
164505
164497
  }
164506
164498
  return results;
164507
164499
  };
164508
- return {
164509
- packageName: "pg",
164510
- query,
164511
- proxy,
164512
- transactionProxy,
164513
- migrate: migrateFn
164500
+ const benchmarkQuery = async (client, sql, params) => {
164501
+ const explainResult = await pool.query({
164502
+ text: `EXPLAIN ANALYZE ${sql}`,
164503
+ values: params ?? [],
164504
+ types: types3
164505
+ });
164506
+ const stringifiedResult = JSON.stringify(explainResult.rows);
164507
+ const planningMatch = stringifiedResult.match(/Planning Time:\s*([\d.]+)\s*ms/i);
164508
+ const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
164509
+ let planningTime = Number(planningMatch[1]);
164510
+ let executionTime = Number(executionMatch[1]);
164511
+ let querySentAt = 0n;
164512
+ let firstDataAt = 0n;
164513
+ let lastDataAt = 0n;
164514
+ let lastRowParsedAt = 0n;
164515
+ let queryCompletedAt = 0n;
164516
+ let bytesReceived = 0;
164517
+ let rowCount = 0;
164518
+ let parseTime = 0;
164519
+ let lastParseTime = 0;
164520
+ const rowDescriptionListener = (data2) => {
164521
+ if (firstDataAt === 0n) {
164522
+ firstDataAt = process.hrtime.bigint();
164523
+ }
164524
+ bytesReceived += data2.length;
164525
+ };
164526
+ const originalRowListener = client.connection.listeners("dataRow")[0];
164527
+ const wrappedRowListener = (data2) => {
164528
+ rowCount += 1;
164529
+ const start = process.hrtime.bigint();
164530
+ lastDataAt = start;
164531
+ originalRowListener.apply(client.connection, [data2]);
164532
+ const end2 = process.hrtime.bigint();
164533
+ lastRowParsedAt = end2;
164534
+ lastParseTime = ms(start, end2);
164535
+ parseTime += lastParseTime;
164536
+ bytesReceived += data2.length;
164537
+ };
164538
+ client.connection.removeAllListeners("dataRow");
164539
+ client.connection.addListener("dataRow", wrappedRowListener);
164540
+ client.connection.prependListener("rowDescription", rowDescriptionListener);
164541
+ querySentAt = process.hrtime.bigint();
164542
+ await client.query({
164543
+ text: sql,
164544
+ values: params,
164545
+ types: types3
164546
+ });
164547
+ queryCompletedAt = process.hrtime.bigint();
164548
+ client.connection.removeListener("rowDescription", rowDescriptionListener);
164549
+ client.connection.removeAllListeners("dataRow");
164550
+ client.connection.addListener("dataRow", originalRowListener);
164551
+ let querySentTime = ms(querySentAt, firstDataAt) - executionTime - planningTime;
164552
+ if (querySentTime < 0) {
164553
+ const percent = 0.1;
164554
+ const overflow = -querySentTime;
164555
+ const keepForSent = overflow * percent;
164556
+ const adjustedOverflow = overflow * (1 + percent);
164557
+ const total2 = planningTime + executionTime;
164558
+ const ratioPlanning = planningTime / total2;
164559
+ const ratioExecution = executionTime / total2;
164560
+ planningTime -= adjustedOverflow * ratioPlanning;
164561
+ executionTime -= adjustedOverflow * ratioExecution;
164562
+ querySentTime = keepForSent;
164563
+ }
164564
+ const networkLatencyBefore = querySentTime / 2;
164565
+ const networkLatencyAfter = querySentTime / 2;
164566
+ const downloadTime = ms(firstDataAt, lastDataAt) - (rowCount > 1 ? parseTime - lastParseTime : 0);
164567
+ const total = ms(querySentAt, queryCompletedAt);
164568
+ const calculatedTotal = networkLatencyBefore + planningTime + executionTime + networkLatencyAfter + downloadTime + parseTime + ms(lastRowParsedAt, queryCompletedAt);
164569
+ const errorMargin = Math.abs(total - calculatedTotal);
164570
+ return {
164571
+ networkLatencyBefore,
164572
+ planning: planningTime,
164573
+ execution: executionTime,
164574
+ networkLatencyAfter,
164575
+ dataDownload: downloadTime,
164576
+ dataParse: parseTime,
164577
+ total,
164578
+ errorMargin,
164579
+ dataSize: bytesReceived
164580
+ };
164581
+ };
164582
+ const benchmarkProxy = async ({ sql, params }, repeats) => {
164583
+ let startAt = 0n;
164584
+ let tcpConnectedAt = 0n;
164585
+ let tlsConnectedAt = null;
164586
+ let dbReadyAt = 0n;
164587
+ const client = "url" in credentials2 ? new pg.Client({ connectionString: credentials2.url }) : new pg.Client({ ...credentials2, ssl });
164588
+ client.connection.once("connect", () => {
164589
+ tcpConnectedAt = process.hrtime.bigint();
164590
+ });
164591
+ client.connection.prependOnceListener("sslconnect", () => {
164592
+ tlsConnectedAt = process.hrtime.bigint();
164593
+ });
164594
+ client.connection.prependOnceListener("readyForQuery", () => {
164595
+ dbReadyAt = process.hrtime.bigint();
164596
+ });
164597
+ startAt = process.hrtime.bigint();
164598
+ await client.connect();
164599
+ const results = [];
164600
+ for (let i6 = 0; i6 < repeats; i6++) {
164601
+ const r6 = await benchmarkQuery(client, sql, params);
164602
+ results.push(r6);
164603
+ }
164604
+ await client.end();
164605
+ return {
164606
+ tcpHandshake: ms(startAt, tcpConnectedAt),
164607
+ tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
164608
+ dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
164609
+ queries: results
164610
+ };
164514
164611
  };
164612
+ return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
164515
164613
  }
164516
164614
  if (await checkPackage("postgres")) {
164517
164615
  console.log(
@@ -164562,13 +164660,7 @@ var init_connections = __esm({
164562
164660
  }
164563
164661
  return results;
164564
164662
  };
164565
- return {
164566
- packageName: "postgres",
164567
- query,
164568
- proxy,
164569
- transactionProxy,
164570
- migrate: migrateFn
164571
- };
164663
+ return { packageName: "postgres", query, proxy, transactionProxy, migrate: migrateFn };
164572
164664
  }
164573
164665
  if (await checkPackage("@vercel/postgres")) {
164574
164666
  console.log(
@@ -164649,13 +164741,7 @@ var init_connections = __esm({
164649
164741
  }
164650
164742
  return results;
164651
164743
  };
164652
- return {
164653
- packageName: "@vercel/postgres",
164654
- query,
164655
- proxy,
164656
- transactionProxy,
164657
- migrate: migrateFn
164658
- };
164744
+ return { packageName: "@vercel/postgres", query, proxy, transactionProxy, migrate: migrateFn };
164659
164745
  }
164660
164746
  if (await checkPackage("@neondatabase/serverless")) {
164661
164747
  console.log(
@@ -164668,11 +164754,7 @@ var init_connections = __esm({
164668
164754
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
164669
164755
  )
164670
164756
  );
164671
- const {
164672
- Pool,
164673
- neonConfig,
164674
- types: pgTypes
164675
- } = await import("@neondatabase/serverless");
164757
+ const { Pool, neonConfig, types: pgTypes } = await import("@neondatabase/serverless");
164676
164758
  const { drizzle } = await import("drizzle-orm/neon-serverless");
164677
164759
  const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
164678
164760
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
@@ -164742,13 +164824,7 @@ var init_connections = __esm({
164742
164824
  }
164743
164825
  return results;
164744
164826
  };
164745
- return {
164746
- packageName: "@neondatabase/serverless",
164747
- query,
164748
- proxy,
164749
- transactionProxy,
164750
- migrate: migrateFn
164751
- };
164827
+ return { packageName: "@neondatabase/serverless", query, proxy, transactionProxy, migrate: migrateFn };
164752
164828
  }
164753
164829
  if (await checkPackage("bun")) {
164754
164830
  console.log(withStyle.info(`Using 'bun' driver for database querying`));
@@ -164799,54 +164875,6 @@ var init_connections = __esm({
164799
164875
  console.warn("For the 'bun' driver, run your script using: bun --bun");
164800
164876
  process.exit(1);
164801
164877
  };
164802
- prepareDuckDb = async (credentials2) => {
164803
- if (await checkPackage("@duckdb/node-api")) {
164804
- console.log(
164805
- withStyle.info(`Using '@duckdb/node-api' driver for database querying`)
164806
- );
164807
- const { DuckDBInstance } = await import("@duckdb/node-api");
164808
- const instance = await DuckDBInstance.create(credentials2.url);
164809
- const client = await instance.connect();
164810
- const query = async (sql, params = []) => {
164811
- const result2 = await client.run(sql, params);
164812
- const rows = await result2.getRowObjectsJson();
164813
- return rows;
164814
- };
164815
- const proxy = async (params) => {
164816
- const result2 = await client.run(params.sql, params.params);
164817
- return params.mode === "array" ? await result2.getRowsJson() : await result2.getRowObjectsJson();
164818
- };
164819
- const transactionProxy = async (queries) => {
164820
- const results = [];
164821
- try {
164822
- await client.run("BEGIN");
164823
- for (const query2 of queries) {
164824
- const result2 = await client.run(query2.sql);
164825
- results.push(await result2.getRowObjectsJson());
164826
- }
164827
- await client.run("COMMIT");
164828
- } catch (error4) {
164829
- await client.run("ROLLBACK");
164830
- results.push(error4);
164831
- }
164832
- return results;
164833
- };
164834
- return {
164835
- packageName: "@duckdb/node-api",
164836
- query,
164837
- proxy,
164838
- transactionProxy,
164839
- migrate: () => {
164840
- throw new Error("DuckDB does not support migrations");
164841
- }
164842
- };
164843
- }
164844
- console.error(
164845
- // "To connect to DuckDb database - please install either of 'duckdb', '@duckdb/node-api' drivers",
164846
- "To connect to DuckDb database - please install '@duckdb/node-api' driver"
164847
- );
164848
- process.exit(1);
164849
- };
164850
164878
  prepareCockroach = async (credentials2) => {
164851
164879
  if (await checkPackage("pg")) {
164852
164880
  const { default: pg } = await import("pg");
@@ -164899,7 +164927,9 @@ var init_connections = __esm({
164899
164927
  };
164900
164928
  return { query, proxy, migrate: migrateFn };
164901
164929
  }
164902
- console.error("To connect to Cockroach - please install 'pg' package");
164930
+ console.error(
164931
+ "To connect to Cockroach - please install 'pg' package"
164932
+ );
164903
164933
  process.exit(1);
164904
164934
  };
164905
164935
  prepareGelDB = async (credentials2) => {
@@ -164958,7 +164988,9 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
164958
164988
  };
164959
164989
  return { packageName: "gel", query, proxy, transactionProxy };
164960
164990
  }
164961
- console.error("To connect to gel database - please install 'edgedb' driver");
164991
+ console.error(
164992
+ "To connect to gel database - please install 'edgedb' driver"
164993
+ );
164962
164994
  process.exit(1);
164963
164995
  };
164964
164996
  parseSingleStoreCredentials = (credentials2) => {
@@ -165072,7 +165104,6 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165072
165104
  }
165073
165105
  return next();
165074
165106
  };
165075
- await connection.connect();
165076
165107
  const query = async (sql, params) => {
165077
165108
  const res = await connection.execute({
165078
165109
  sql,
@@ -165112,11 +165143,156 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165112
165143
  }
165113
165144
  return results;
165114
165145
  };
165146
+ const benchmarkQuery = async (newConnection, sql, params) => {
165147
+ const explainResult = await connection.query({
165148
+ sql: `EXPLAIN ANALYZE ${sql}`,
165149
+ values: params ?? [],
165150
+ typeCast
165151
+ });
165152
+ const stringifiedResult = JSON.stringify(explainResult[0]);
165153
+ const timeMatch = stringifiedResult.match(
165154
+ /actual time=([0-9.eE+-]+)\.\.([0-9.eE+-]+)/
165155
+ );
165156
+ const lastRowTime = Number(timeMatch[2]);
165157
+ let executionTime = lastRowTime;
165158
+ let querySentAt = 0n;
165159
+ let firstDataAt = 0n;
165160
+ let lastDataAt = 0n;
165161
+ let lastRowParsedAt = 0n;
165162
+ let queryCompletedAt = 0n;
165163
+ let bytesReceived = 0;
165164
+ let rowCount = 0;
165165
+ let parseTime = 0;
165166
+ let lastParseTime = 0;
165167
+ querySentAt = process.hrtime.bigint();
165168
+ await new Promise((resolve3, reject) => {
165169
+ const query2 = newConnection.query({
165170
+ sql,
165171
+ values: params ?? [],
165172
+ typeCast
165173
+ });
165174
+ const originalRowHandler = query2.row;
165175
+ let packets = 0;
165176
+ const wrappedRowListener = (packet, connection2) => {
165177
+ packets += 1;
165178
+ if (firstDataAt === 0n) {
165179
+ firstDataAt = process.hrtime.bigint();
165180
+ bytesReceived += packet.start;
165181
+ }
165182
+ const start = process.hrtime.bigint();
165183
+ lastDataAt = start;
165184
+ const res = originalRowHandler.apply(query2, [packet, connection2]);
165185
+ const end2 = process.hrtime.bigint();
165186
+ lastRowParsedAt = end2;
165187
+ lastParseTime = ms(start, end2);
165188
+ parseTime += lastParseTime;
165189
+ bytesReceived += packet.length();
165190
+ if (!res || packet.isEOF()) {
165191
+ return res;
165192
+ }
165193
+ return wrappedRowListener;
165194
+ };
165195
+ query2.row = wrappedRowListener;
165196
+ query2.on("result", () => {
165197
+ rowCount += 1;
165198
+ });
165199
+ query2.on("error", (err2) => {
165200
+ reject(err2);
165201
+ });
165202
+ query2.on("end", () => {
165203
+ resolve3();
165204
+ });
165205
+ });
165206
+ queryCompletedAt = process.hrtime.bigint();
165207
+ let querySentTime = ms(querySentAt, firstDataAt) - executionTime;
165208
+ if (querySentTime < 0) {
165209
+ const percent = 0.1;
165210
+ const overflow = -querySentTime;
165211
+ const keepForSent = overflow * percent;
165212
+ const adjustedOverflow = overflow * (1 + percent);
165213
+ const total2 = executionTime;
165214
+ const ratioExecution = executionTime / total2;
165215
+ executionTime -= adjustedOverflow * ratioExecution;
165216
+ querySentTime = keepForSent;
165217
+ }
165218
+ const networkLatencyBefore = querySentTime / 2;
165219
+ const networkLatencyAfter = querySentTime / 2;
165220
+ const downloadTime = ms(firstDataAt, lastDataAt) - (rowCount > 1 ? parseTime - lastParseTime : 0);
165221
+ const total = ms(querySentAt, queryCompletedAt);
165222
+ const calculatedTotal = networkLatencyBefore + executionTime + networkLatencyAfter + downloadTime + parseTime + ms(lastRowParsedAt, queryCompletedAt);
165223
+ const errorMargin = Math.abs(total - calculatedTotal);
165224
+ return {
165225
+ networkLatencyBefore,
165226
+ planning: null,
165227
+ execution: executionTime,
165228
+ networkLatencyAfter,
165229
+ dataDownload: downloadTime,
165230
+ dataParse: parseTime,
165231
+ total,
165232
+ errorMargin,
165233
+ dataSize: bytesReceived
165234
+ };
165235
+ };
165236
+ const benchmarkProxy = async ({ sql, params }, repeats) => {
165237
+ const { createConnection: createConnection2 } = await import("mysql2");
165238
+ let startAt = 0n;
165239
+ let tcpConnectedAt = 0n;
165240
+ let tlsConnectedAt = null;
165241
+ const createStream = ({ config }) => {
165242
+ let stream;
165243
+ if (config.socketPath) {
165244
+ stream = import_net.default.connect(config.socketPath);
165245
+ } else {
165246
+ stream = import_net.default.connect(config.port, config.host);
165247
+ }
165248
+ if (config.enableKeepAlive) {
165249
+ stream.on("connect", () => {
165250
+ stream.setKeepAlive(true, config.keepAliveInitialDelay);
165251
+ });
165252
+ }
165253
+ stream.setNoDelay(true);
165254
+ stream.once("connect", () => {
165255
+ tcpConnectedAt = process.hrtime.bigint();
165256
+ });
165257
+ return stream;
165258
+ };
165259
+ startAt = process.hrtime.bigint();
165260
+ const connection2 = result2.url ? createConnection2({
165261
+ uri: result2.url,
165262
+ stream: createStream
165263
+ }) : createConnection2({
165264
+ ...result2.credentials,
165265
+ stream: createStream
165266
+ });
165267
+ await new Promise((resolve3, reject) => {
165268
+ connection2.connect((err2) => {
165269
+ tlsConnectedAt = process.hrtime.bigint();
165270
+ if (err2) {
165271
+ reject(err2);
165272
+ } else {
165273
+ resolve3();
165274
+ }
165275
+ });
165276
+ });
165277
+ const results = [];
165278
+ for (let i6 = 0; i6 < repeats; i6++) {
165279
+ const r6 = await benchmarkQuery(connection2, sql, params);
165280
+ results.push(r6);
165281
+ }
165282
+ connection2.end();
165283
+ return {
165284
+ tcpHandshake: ms(startAt, tcpConnectedAt),
165285
+ tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
165286
+ dbHandshake: null,
165287
+ queries: results
165288
+ };
165289
+ };
165115
165290
  return {
165116
165291
  db: { query },
165117
165292
  packageName: "mysql2",
165118
165293
  proxy,
165119
165294
  transactionProxy,
165295
+ benchmarkProxy,
165120
165296
  database: result2.database,
165121
165297
  migrate: migrateFn
165122
165298
  };
@@ -165266,7 +165442,9 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165266
165442
  migrate: migrateFn
165267
165443
  };
165268
165444
  }
165269
- console.error("To connect to MsSQL database - please install 'mssql' driver");
165445
+ console.error(
165446
+ "To connect to MsSQL database - please install 'mssql' driver"
165447
+ );
165270
165448
  process.exit(1);
165271
165449
  };
165272
165450
  prepareSqliteParams = (params, driver2) => {
@@ -165371,10 +165549,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165371
165549
  await remoteCallback(query2, [], "run");
165372
165550
  };
165373
165551
  const proxy = async (params) => {
165374
- const preparedParams = prepareSqliteParams(
165375
- params.params || [],
165376
- "d1-http"
165377
- );
165552
+ const preparedParams = prepareSqliteParams(params.params || [], "d1-http");
165378
165553
  const result2 = await remoteCallback(
165379
165554
  params.sql,
165380
165555
  preparedParams,
@@ -165599,19 +165774,17 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165599
165774
  };
165600
165775
  const transactionProxy = async (queries) => {
165601
165776
  const results = [];
165602
- const tx = sqlite.transaction(
165603
- (queries2) => {
165604
- for (const query of queries2) {
165605
- let result2 = [];
165606
- if (query.method === "values" || query.method === "get" || query.method === "all") {
165607
- result2 = sqlite.prepare(query.sql).all();
165608
- } else {
165609
- sqlite.prepare(query.sql).run();
165610
- }
165611
- results.push(result2);
165777
+ const tx = sqlite.transaction((queries2) => {
165778
+ for (const query of queries2) {
165779
+ let result2 = [];
165780
+ if (query.method === "values" || query.method === "get" || query.method === "all") {
165781
+ result2 = sqlite.prepare(query.sql).all();
165782
+ } else {
165783
+ sqlite.prepare(query.sql).run();
165612
165784
  }
165785
+ results.push(result2);
165613
165786
  }
165614
- );
165787
+ });
165615
165788
  try {
165616
165789
  tx(queries);
165617
165790
  } catch (error4) {
@@ -165619,13 +165792,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165619
165792
  }
165620
165793
  return results;
165621
165794
  };
165622
- return {
165623
- ...db,
165624
- packageName: "better-sqlite3",
165625
- proxy,
165626
- transactionProxy,
165627
- migrate: migrateFn
165628
- };
165795
+ return { ...db, packageName: "better-sqlite3", proxy, transactionProxy, migrate: migrateFn };
165629
165796
  }
165630
165797
  if (await checkPackage("bun")) {
165631
165798
  console.log(withStyle.info(`Using 'bun' driver for database querying`));
@@ -169393,7 +169560,7 @@ var init_introspect2 = __esm({
169393
169560
  let checksCount = 0;
169394
169561
  let viewsCount = 0;
169395
169562
  for (const seq of sequencesList) {
169396
- const depend = dependList.find((it2) => Number(it2.oid) === Number(seq.oid));
169563
+ const depend = dependList.find((it2) => it2.oid === seq.oid);
169397
169564
  if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
169398
169565
  continue;
169399
169566
  }
@@ -169459,22 +169626,22 @@ var init_introspect2 = __esm({
169459
169626
  continue;
169460
169627
  }
169461
169628
  const expr = serialsList.find(
169462
- (it2) => Number(it2.tableId) === Number(column12.tableId) && it2.ordinality === column12.ordinality
169629
+ (it2) => it2.tableId === column12.tableId && it2.ordinality === column12.ordinality
169463
169630
  );
169464
169631
  if (expr) {
169465
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(column12.tableId));
169632
+ const table7 = tablesList.find((it2) => it2.oid === column12.tableId);
169466
169633
  const isSerial = isSerialExpression(expr.expression, table7.schema);
169467
169634
  column12.type = isSerial ? type === "bigint" ? "bigserial" : type === "integer" ? "serial" : "smallserial" : type;
169468
169635
  }
169469
169636
  }
169470
169637
  for (const column12 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
169471
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(column12.tableId));
169638
+ const table7 = tablesList.find((it2) => it2.oid === column12.tableId);
169472
169639
  const enumType2 = column12.typeId in groupedEnums ? groupedEnums[column12.typeId] : column12.typeId in groupedArrEnums ? groupedArrEnums[column12.typeId] : null;
169473
169640
  let columnTypeMapped = enumType2 ? enumType2.name : column12.type.replaceAll("[]", "");
169474
169641
  columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char").replace("geometry(Point", "geometry(point");
169475
169642
  columnTypeMapped = trimChar(columnTypeMapped, '"');
169476
169643
  const columnDefault = defaultsList.find(
169477
- (it2) => Number(it2.tableId) === Number(column12.tableId) && it2.ordinality === column12.ordinality
169644
+ (it2) => it2.tableId === column12.tableId && it2.ordinality === column12.ordinality
169478
169645
  );
169479
169646
  const defaultValue = defaultForColumn(
169480
169647
  columnTypeMapped,
@@ -169483,10 +169650,10 @@ var init_introspect2 = __esm({
169483
169650
  Boolean(enumType2)
169484
169651
  );
169485
169652
  const unique = constraintsList.find((it2) => {
169486
- return it2.type === "u" && Number(it2.tableId) === Number(column12.tableId) && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column12.ordinality);
169653
+ return it2.type === "u" && it2.tableId === column12.tableId && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column12.ordinality);
169487
169654
  }) ?? null;
169488
169655
  const pk = constraintsList.find((it2) => {
169489
- return it2.type === "p" && Number(it2.tableId) === Number(column12.tableId) && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column12.ordinality);
169656
+ return it2.type === "p" && it2.tableId === column12.tableId && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column12.ordinality);
169490
169657
  }) ?? null;
169491
169658
  const metadata = column12.metadata;
169492
169659
  if (column12.generatedType === "s" && (!metadata || !metadata.expression)) {
@@ -169501,7 +169668,7 @@ ${JSON.stringify(column12.metadata)}`
169501
169668
  ${JSON.stringify(column12.metadata)}`
169502
169669
  );
169503
169670
  }
169504
- const sequence = (metadata == null ? void 0 : metadata.seqId) ? sequencesList.find((it2) => Number(it2.oid) === Number(metadata.seqId)) ?? null : null;
169671
+ const sequence = (metadata == null ? void 0 : metadata.seqId) ? sequencesList.find((it2) => it2.oid === Number(metadata.seqId)) ?? null : null;
169505
169672
  columns.push({
169506
169673
  entityType: "columns",
169507
169674
  schema: table7.schema,
@@ -169531,12 +169698,10 @@ ${JSON.stringify(column12.metadata)}`
169531
169698
  });
169532
169699
  }
169533
169700
  for (const unique of constraintsList.filter((it2) => it2.type === "u")) {
169534
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(unique.tableId));
169535
- const schema6 = namespaces.find((it2) => Number(it2.oid) === Number(unique.schemaId));
169701
+ const table7 = tablesList.find((it2) => it2.oid === unique.tableId);
169702
+ const schema6 = namespaces.find((it2) => it2.oid === unique.schemaId);
169536
169703
  const columns2 = unique.columnsOrdinals.map((it2) => {
169537
- const column12 = columnsList.find(
169538
- (column13) => Number(column13.tableId) === Number(unique.tableId) && column13.ordinality === it2
169539
- );
169704
+ const column12 = columnsList.find((column13) => column13.tableId === unique.tableId && column13.ordinality === it2);
169540
169705
  return column12.name;
169541
169706
  });
169542
169707
  uniques.push({
@@ -169550,12 +169715,10 @@ ${JSON.stringify(column12.metadata)}`
169550
169715
  });
169551
169716
  }
169552
169717
  for (const pk of constraintsList.filter((it2) => it2.type === "p")) {
169553
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(pk.tableId));
169554
- const schema6 = namespaces.find((it2) => Number(it2.oid) === Number(pk.schemaId));
169718
+ const table7 = tablesList.find((it2) => it2.oid === pk.tableId);
169719
+ const schema6 = namespaces.find((it2) => it2.oid === pk.schemaId);
169555
169720
  const columns2 = pk.columnsOrdinals.map((it2) => {
169556
- const column12 = columnsList.find(
169557
- (column13) => Number(column13.tableId) === Number(pk.tableId) && column13.ordinality === it2
169558
- );
169721
+ const column12 = columnsList.find((column13) => column13.tableId === pk.tableId && column13.ordinality === it2);
169559
169722
  return column12.name;
169560
169723
  });
169561
169724
  pks.push({
@@ -169568,19 +169731,15 @@ ${JSON.stringify(column12.metadata)}`
169568
169731
  });
169569
169732
  }
169570
169733
  for (const fk6 of constraintsList.filter((it2) => it2.type === "f")) {
169571
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(fk6.tableId));
169572
- const schema6 = namespaces.find((it2) => Number(it2.oid) === Number(fk6.schemaId));
169573
- const tableTo = tablesList.find((it2) => Number(it2.oid) === Number(fk6.tableToId));
169734
+ const table7 = tablesList.find((it2) => it2.oid === fk6.tableId);
169735
+ const schema6 = namespaces.find((it2) => it2.oid === fk6.schemaId);
169736
+ const tableTo = tablesList.find((it2) => it2.oid === fk6.tableToId);
169574
169737
  const columns2 = fk6.columnsOrdinals.map((it2) => {
169575
- const column12 = columnsList.find(
169576
- (column13) => Number(column13.tableId) === Number(fk6.tableId) && column13.ordinality === it2
169577
- );
169738
+ const column12 = columnsList.find((column13) => column13.tableId === fk6.tableId && column13.ordinality === it2);
169578
169739
  return column12.name;
169579
169740
  });
169580
169741
  const columnsTo = fk6.columnsToOrdinals.map((it2) => {
169581
- const column12 = columnsList.find(
169582
- (column13) => Number(column13.tableId) === Number(fk6.tableToId) && column13.ordinality === it2
169583
- );
169742
+ const column12 = columnsList.find((column13) => column13.tableId === fk6.tableToId && column13.ordinality === it2);
169584
169743
  return column12.name;
169585
169744
  });
169586
169745
  fks.push({
@@ -169598,8 +169757,8 @@ ${JSON.stringify(column12.metadata)}`
169598
169757
  });
169599
169758
  }
169600
169759
  for (const check2 of constraintsList.filter((it2) => it2.type === "c")) {
169601
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(check2.tableId));
169602
- const schema6 = namespaces.find((it2) => Number(it2.oid) === Number(check2.schemaId));
169760
+ const table7 = tablesList.find((it2) => it2.oid === check2.tableId);
169761
+ const schema6 = namespaces.find((it2) => it2.oid === check2.schemaId);
169603
169762
  checks.push({
169604
169763
  entityType: "checks",
169605
169764
  schema: schema6.name,
@@ -169660,10 +169819,10 @@ ${JSON.stringify(column12.metadata)}`
169660
169819
  });
169661
169820
  for (const idx of idxs) {
169662
169821
  const { metadata } = idx;
169663
- const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && Number(x6.indexId) === Number(idx.oid));
169664
- const forPK = metadata.isPrimary && constraintsList.some((x6) => x6.type === "p" && Number(x6.indexId) === Number(idx.oid));
169822
+ const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && x6.indexId === idx.oid);
169823
+ const forPK = metadata.isPrimary && constraintsList.some((x6) => x6.type === "p" && x6.indexId === idx.oid);
169665
169824
  const expr = splitExpressions(metadata.expression);
169666
- const table7 = tablesList.find((it2) => Number(it2.oid) === Number(idx.metadata.tableId));
169825
+ const table7 = tablesList.find((it2) => it2.oid === idx.metadata.tableId);
169667
169826
  const nonColumnsCount = metadata.columnOrdinals.reduce((acc, it2) => {
169668
169827
  if (it2 === 0) acc += 1;
169669
169828
  return acc;
@@ -169695,7 +169854,7 @@ ${JSON.stringify(column12.metadata)}`
169695
169854
  k5 += 1;
169696
169855
  } else {
169697
169856
  const column12 = columnsList.find((column13) => {
169698
- return Number(column13.tableId) === Number(metadata.tableId) && column13.ordinality === ordinal;
169857
+ return column13.tableId === metadata.tableId && column13.ordinality === ordinal;
169699
169858
  });
169700
169859
  if (!column12) throw new Error(`missing column: ${metadata.tableId}:${ordinal}`);
169701
169860
  const options = opts[i6];
@@ -169744,7 +169903,7 @@ ${JSON.stringify(column12.metadata)}`
169744
169903
  progressCallback("indexes", indexesCount, "fetching");
169745
169904
  progressCallback("tables", tableCount, "done");
169746
169905
  for (const it2 of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
169747
- const view6 = viewsList.find((x6) => Number(x6.oid) === Number(it2.tableId));
169906
+ const view6 = viewsList.find((x6) => x6.oid === it2.tableId);
169748
169907
  const typeDimensions = it2.type.split("[]").length - 1;
169749
169908
  const enumType2 = it2.typeId in groupedEnums ? groupedEnums[it2.typeId] : it2.typeId in groupedArrEnums ? groupedArrEnums[it2.typeId] : null;
169750
169909
  let columnTypeMapped = enumType2 ? enumType2.name : it2.type.replace("[]", "");
@@ -169767,8 +169926,8 @@ ${JSON.stringify(column12.metadata)}`
169767
169926
  }
169768
169927
  for (const view6 of viewsList) {
169769
169928
  tableCount += 1;
169770
- const accessMethod = Number(view6.accessMethod) === 0 ? null : ams.find((it2) => Number(it2.oid) === Number(view6.accessMethod));
169771
- const tablespace = Number(view6.tablespaceid) === 0 ? null : tablespaces.find((it2) => Number(it2.oid) === Number(view6.tablespaceid)).name;
169929
+ const accessMethod = view6.accessMethod === 0 ? null : ams.find((it2) => it2.oid === view6.accessMethod);
169930
+ const tablespace = view6.tablespaceid === 0 ? null : tablespaces.find((it2) => it2.oid === view6.tablespaceid).name;
169772
169931
  const definition = parseViewDefinition(view6.definition);
169773
169932
  const withOpts = wrapRecord(
169774
169933
  ((_b = view6.options) == null ? void 0 : _b.reduce((acc, it2) => {
@@ -176775,7 +176934,6 @@ var init_cors = __esm({
176775
176934
  // src/cli/commands/studio.ts
176776
176935
  var studio_exports = {};
176777
176936
  __export(studio_exports, {
176778
- drizzleForDuckDb: () => drizzleForDuckDb,
176779
176937
  drizzleForLibSQL: () => drizzleForLibSQL,
176780
176938
  drizzleForMySQL: () => drizzleForMySQL,
176781
176939
  drizzleForPostgres: () => drizzleForPostgres,
@@ -176789,7 +176947,7 @@ __export(studio_exports, {
176789
176947
  prepareServer: () => prepareServer,
176790
176948
  prepareSingleStoreSchema: () => prepareSingleStoreSchema
176791
176949
  });
176792
- var import_crypto11, import_drizzle_orm8, import_relations8, import_mssql_core3, import_mysql_core3, import_pg_core3, import_singlestore_core2, import_sqlite_core3, import_fs16, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForDuckDb, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
176950
+ var import_crypto11, import_drizzle_orm8, import_relations8, import_mssql_core3, import_mysql_core3, import_pg_core3, import_singlestore_core2, import_sqlite_core3, import_fs16, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, benchmarkProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
176793
176951
  var init_studio = __esm({
176794
176952
  "src/cli/commands/studio.ts"() {
176795
176953
  "use strict";
@@ -177013,6 +177171,7 @@ var init_studio = __esm({
177013
177171
  packageName: db.packageName,
177014
177172
  proxy: db.proxy,
177015
177173
  transactionProxy: db.transactionProxy,
177174
+ benchmarkProxy: db.benchmarkProxy,
177016
177175
  customDefaults,
177017
177176
  schema: pgSchema2,
177018
177177
  relations: relations5,
@@ -177020,26 +177179,9 @@ var init_studio = __esm({
177020
177179
  casing: casing2
177021
177180
  };
177022
177181
  };
177023
- drizzleForDuckDb = async (credentials2) => {
177024
- const { prepareDuckDb: prepareDuckDb2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
177025
- const db = await prepareDuckDb2(credentials2);
177026
- const dbUrl = `duckdb://${credentials2.url}`;
177027
- const dbHash = (0, import_crypto11.createHash)("sha256").update(dbUrl).digest("hex");
177028
- return {
177029
- dbHash,
177030
- dialect: "duckdb",
177031
- driver: void 0,
177032
- packageName: db.packageName,
177033
- proxy: db.proxy,
177034
- transactionProxy: db.transactionProxy,
177035
- customDefaults: [],
177036
- schema: {},
177037
- relations: {}
177038
- };
177039
- };
177040
177182
  drizzleForMySQL = async (credentials2, mysqlSchema, relations5, schemaFiles, casing2) => {
177041
177183
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
177042
- const { proxy, transactionProxy, database, packageName } = await connectToMySQL2(credentials2);
177184
+ const { proxy, transactionProxy, benchmarkProxy, database, packageName } = await connectToMySQL2(credentials2);
177043
177185
  const customDefaults = getCustomDefaults(mysqlSchema, casing2);
177044
177186
  let dbUrl;
177045
177187
  if ("url" in credentials2) {
@@ -177055,6 +177197,7 @@ var init_studio = __esm({
177055
177197
  databaseName: database,
177056
177198
  proxy,
177057
177199
  transactionProxy,
177200
+ benchmarkProxy,
177058
177201
  customDefaults,
177059
177202
  schema: mysqlSchema,
177060
177203
  relations: relations5,
@@ -177224,6 +177367,23 @@ var init_studio = __esm({
177224
177367
  ]).optional()
177225
177368
  }).array()
177226
177369
  });
177370
+ benchmarkProxySchema = external_exports.object({
177371
+ type: external_exports.literal("bproxy"),
177372
+ data: external_exports.object({
177373
+ query: external_exports.object({
177374
+ sql: external_exports.string(),
177375
+ params: external_exports.array(external_exports.any()).optional(),
177376
+ method: external_exports.union([
177377
+ external_exports.literal("values"),
177378
+ external_exports.literal("get"),
177379
+ external_exports.literal("all"),
177380
+ external_exports.literal("run"),
177381
+ external_exports.literal("execute")
177382
+ ]).optional()
177383
+ }),
177384
+ repeats: external_exports.number().min(1).optional()
177385
+ })
177386
+ });
177227
177387
  defaultsSchema = external_exports.object({
177228
177388
  type: external_exports.literal("defaults"),
177229
177389
  data: external_exports.array(
@@ -177238,6 +177398,7 @@ var init_studio = __esm({
177238
177398
  init,
177239
177399
  proxySchema,
177240
177400
  transactionProxySchema,
177401
+ benchmarkProxySchema,
177241
177402
  defaultsSchema
177242
177403
  ]);
177243
177404
  jsonStringify = (data2) => {
@@ -177260,6 +177421,7 @@ var init_studio = __esm({
177260
177421
  databaseName,
177261
177422
  proxy,
177262
177423
  transactionProxy,
177424
+ benchmarkProxy,
177263
177425
  customDefaults,
177264
177426
  schema: drizzleSchema,
177265
177427
  relations: relations5,
@@ -177323,7 +177485,7 @@ var init_studio = __esm({
177323
177485
  console.warn("Error message:", error4.message);
177324
177486
  }
177325
177487
  return c5.json({
177326
- version: "6.2",
177488
+ version: "6.3",
177327
177489
  dialect: dialect6,
177328
177490
  driver: driver2,
177329
177491
  packageName,
@@ -177361,6 +177523,21 @@ var init_studio = __esm({
177361
177523
  }
177362
177524
  );
177363
177525
  }
177526
+ if (type === "bproxy") {
177527
+ if (!benchmarkProxy) {
177528
+ throw new Error("Benchmark proxy is not configured for this database.");
177529
+ }
177530
+ const result2 = await benchmarkProxy(body.data.query, body.data.repeats || 1);
177531
+ const res = jsonStringify(result2);
177532
+ return c5.body(
177533
+ res,
177534
+ {
177535
+ headers: {
177536
+ "Content-Type": "application/json"
177537
+ }
177538
+ }
177539
+ );
177540
+ }
177364
177541
  if (type === "defaults") {
177365
177542
  const columns = body.data;
177366
177543
  const result2 = columns.map((column12) => {
@@ -179298,25 +179475,6 @@ var printConfigConnectionIssues = (options) => {
179298
179475
  // src/cli/commands/utils.ts
179299
179476
  init_common3();
179300
179477
 
179301
- // src/cli/validations/duckdb.ts
179302
- init_esm();
179303
- init_views();
179304
- init_common3();
179305
- var duckdbCredentials = objectType({
179306
- driver: undefinedType(),
179307
- url: stringType().min(1)
179308
- }).transform((o5) => {
179309
- delete o5.driver;
179310
- return o5;
179311
- });
179312
- var printConfigConnectionIssues2 = (options) => {
179313
- const text = `Please provide required params:
179314
- `;
179315
- console.log(error2(text));
179316
- console.log(wrapParam("url", options.url));
179317
- process.exit(1);
179318
- };
179319
-
179320
179478
  // src/cli/validations/gel.ts
179321
179479
  init_esm();
179322
179480
  init_views();
@@ -179357,7 +179515,7 @@ var gelCredentials = unionType([
179357
179515
  }).transform(() => {
179358
179516
  })
179359
179517
  ]);
179360
- var printConfigConnectionIssues3 = (options) => {
179518
+ var printConfigConnectionIssues2 = (options) => {
179361
179519
  if ("url" in options) {
179362
179520
  let text = `Please provide required params for Gel driver:
179363
179521
  `;
@@ -179393,7 +179551,7 @@ var libSQLCredentials = objectType({
179393
179551
  url: stringType().min(1),
179394
179552
  authToken: stringType().min(1).optional()
179395
179553
  });
179396
- var printConfigConnectionIssues4 = (options, _command) => {
179554
+ var printConfigConnectionIssues3 = (options, _command) => {
179397
179555
  let text = `Please provide required params for 'turso' dialect:
179398
179556
  `;
179399
179557
  console.log(error2(text));
@@ -179423,7 +179581,7 @@ var mssqlCredentials = unionType([
179423
179581
  url: stringType().min(1)
179424
179582
  })
179425
179583
  ]);
179426
- var printConfigConnectionIssues5 = (options) => {
179584
+ var printConfigConnectionIssues4 = (options) => {
179427
179585
  if ("url" in options) {
179428
179586
  let text2 = `Please provide required params for MsSQL driver:
179429
179587
  `;
@@ -179472,7 +179630,7 @@ var mysqlCredentials = unionType([
179472
179630
  url: stringType().min(1)
179473
179631
  })
179474
179632
  ]);
179475
- var printConfigConnectionIssues6 = (options) => {
179633
+ var printConfigConnectionIssues5 = (options) => {
179476
179634
  if ("url" in options) {
179477
179635
  let text2 = `Please provide required params for MySQL driver:
179478
179636
  `;
@@ -179537,7 +179695,7 @@ var postgresCredentials = unionType([
179537
179695
  url: stringType().min(1)
179538
179696
  })
179539
179697
  ]);
179540
- var printConfigConnectionIssues7 = (options) => {
179698
+ var printConfigConnectionIssues6 = (options) => {
179541
179699
  if (options.driver === "aws-data-api") {
179542
179700
  let text = `Please provide required params for AWS Data API driver:
179543
179701
  `;
@@ -179604,7 +179762,7 @@ var singlestoreCredentials = unionType([
179604
179762
  url: stringType().min(1)
179605
179763
  })
179606
179764
  ]);
179607
- var printConfigConnectionIssues8 = (options) => {
179765
+ var printConfigConnectionIssues7 = (options) => {
179608
179766
  if ("url" in options) {
179609
179767
  let text2 = `Please provide required params for SingleStore driver:
179610
179768
  `;
@@ -179653,7 +179811,7 @@ var sqliteCredentials = unionType([
179653
179811
  return o5;
179654
179812
  })
179655
179813
  ]);
179656
- var printConfigConnectionIssues9 = (options, command2) => {
179814
+ var printConfigConnectionIssues8 = (options, command2) => {
179657
179815
  const parsedDriver = sqliteDriver.safeParse(options.driver);
179658
179816
  const driver2 = parsedDriver.success ? parsedDriver.data : "";
179659
179817
  if (driver2 === "expo") {
@@ -179857,7 +180015,7 @@ var preparePushConfig = async (options, from) => {
179857
180015
  if (config.dialect === "postgresql") {
179858
180016
  const parsed2 = postgresCredentials.safeParse(config);
179859
180017
  if (!parsed2.success) {
179860
- printConfigConnectionIssues7(config);
180018
+ printConfigConnectionIssues6(config);
179861
180019
  process.exit(1);
179862
180020
  }
179863
180021
  return {
@@ -179874,7 +180032,7 @@ var preparePushConfig = async (options, from) => {
179874
180032
  if (config.dialect === "mysql") {
179875
180033
  const parsed2 = mysqlCredentials.safeParse(config);
179876
180034
  if (!parsed2.success) {
179877
- printConfigConnectionIssues6(config);
180035
+ printConfigConnectionIssues5(config);
179878
180036
  process.exit(1);
179879
180037
  }
179880
180038
  return {
@@ -179891,7 +180049,7 @@ var preparePushConfig = async (options, from) => {
179891
180049
  if (config.dialect === "singlestore") {
179892
180050
  const parsed2 = singlestoreCredentials.safeParse(config);
179893
180051
  if (!parsed2.success) {
179894
- printConfigConnectionIssues8(config);
180052
+ printConfigConnectionIssues7(config);
179895
180053
  process.exit(1);
179896
180054
  }
179897
180055
  return {
@@ -179907,7 +180065,7 @@ var preparePushConfig = async (options, from) => {
179907
180065
  if (config.dialect === "sqlite") {
179908
180066
  const parsed2 = sqliteCredentials.safeParse(config);
179909
180067
  if (!parsed2.success) {
179910
- printConfigConnectionIssues9(config, "push");
180068
+ printConfigConnectionIssues8(config, "push");
179911
180069
  process.exit(1);
179912
180070
  }
179913
180071
  return {
@@ -179924,7 +180082,7 @@ var preparePushConfig = async (options, from) => {
179924
180082
  if (config.dialect === "turso") {
179925
180083
  const parsed2 = libSQLCredentials.safeParse(config);
179926
180084
  if (!parsed2.success) {
179927
- printConfigConnectionIssues9(config, "push");
180085
+ printConfigConnectionIssues8(config, "push");
179928
180086
  process.exit(1);
179929
180087
  }
179930
180088
  return {
@@ -179979,14 +180137,6 @@ var preparePushConfig = async (options, from) => {
179979
180137
  explain: false
179980
180138
  };
179981
180139
  }
179982
- if (config.dialect === "duckdb") {
179983
- console.log(
179984
- error2(
179985
- `You can't use 'push' command with DuckDb dialect`
179986
- )
179987
- );
179988
- process.exit(1);
179989
- }
179990
180140
  assertUnreachable(config.dialect);
179991
180141
  };
179992
180142
  var preparePullConfig = async (options, from) => {
@@ -180012,7 +180162,7 @@ var preparePullConfig = async (options, from) => {
180012
180162
  if (dialect6 === "postgresql") {
180013
180163
  const parsed2 = postgresCredentials.safeParse(config);
180014
180164
  if (!parsed2.success) {
180015
- printConfigConnectionIssues7(config);
180165
+ printConfigConnectionIssues6(config);
180016
180166
  process.exit(1);
180017
180167
  }
180018
180168
  return {
@@ -180031,7 +180181,7 @@ var preparePullConfig = async (options, from) => {
180031
180181
  if (dialect6 === "mysql") {
180032
180182
  const parsed2 = mysqlCredentials.safeParse(config);
180033
180183
  if (!parsed2.success) {
180034
- printConfigConnectionIssues6(config);
180184
+ printConfigConnectionIssues5(config);
180035
180185
  process.exit(1);
180036
180186
  }
180037
180187
  return {
@@ -180050,7 +180200,7 @@ var preparePullConfig = async (options, from) => {
180050
180200
  if (dialect6 === "singlestore") {
180051
180201
  const parsed2 = singlestoreCredentials.safeParse(config);
180052
180202
  if (!parsed2.success) {
180053
- printConfigConnectionIssues8(config);
180203
+ printConfigConnectionIssues7(config);
180054
180204
  process.exit(1);
180055
180205
  }
180056
180206
  return {
@@ -180069,7 +180219,7 @@ var preparePullConfig = async (options, from) => {
180069
180219
  if (dialect6 === "sqlite") {
180070
180220
  const parsed2 = sqliteCredentials.safeParse(config);
180071
180221
  if (!parsed2.success) {
180072
- printConfigConnectionIssues9(config, "pull");
180222
+ printConfigConnectionIssues8(config, "pull");
180073
180223
  process.exit(1);
180074
180224
  }
180075
180225
  return {
@@ -180088,7 +180238,7 @@ var preparePullConfig = async (options, from) => {
180088
180238
  if (dialect6 === "turso") {
180089
180239
  const parsed2 = libSQLCredentials.safeParse(config);
180090
180240
  if (!parsed2.success) {
180091
- printConfigConnectionIssues4(config, "pull");
180241
+ printConfigConnectionIssues3(config, "pull");
180092
180242
  process.exit(1);
180093
180243
  }
180094
180244
  return {
@@ -180107,7 +180257,7 @@ var preparePullConfig = async (options, from) => {
180107
180257
  if (dialect6 === "gel") {
180108
180258
  const parsed2 = gelCredentials.safeParse(config);
180109
180259
  if (!parsed2.success) {
180110
- printConfigConnectionIssues3(config);
180260
+ printConfigConnectionIssues2(config);
180111
180261
  process.exit(1);
180112
180262
  }
180113
180263
  return {
@@ -180160,14 +180310,6 @@ var preparePullConfig = async (options, from) => {
180160
180310
  migrationsTable: table7
180161
180311
  };
180162
180312
  }
180163
- if (dialect6 === "duckdb") {
180164
- console.log(
180165
- error2(
180166
- `You can't use 'pull' command with DuckDb dialect`
180167
- )
180168
- );
180169
- process.exit(1);
180170
- }
180171
180313
  assertUnreachable(dialect6);
180172
180314
  };
180173
180315
  var prepareStudioConfig = async (options) => {
@@ -180190,7 +180332,7 @@ var prepareStudioConfig = async (options) => {
180190
180332
  if (dialect6 === "postgresql") {
180191
180333
  const parsed = postgresCredentials.safeParse(flattened);
180192
180334
  if (!parsed.success) {
180193
- printConfigConnectionIssues7(flattened);
180335
+ printConfigConnectionIssues6(flattened);
180194
180336
  process.exit(1);
180195
180337
  }
180196
180338
  const credentials2 = parsed.data;
@@ -180206,7 +180348,7 @@ var prepareStudioConfig = async (options) => {
180206
180348
  if (dialect6 === "mysql") {
180207
180349
  const parsed = mysqlCredentials.safeParse(flattened);
180208
180350
  if (!parsed.success) {
180209
- printConfigConnectionIssues6(flattened);
180351
+ printConfigConnectionIssues5(flattened);
180210
180352
  process.exit(1);
180211
180353
  }
180212
180354
  const credentials2 = parsed.data;
@@ -180222,7 +180364,7 @@ var prepareStudioConfig = async (options) => {
180222
180364
  if (dialect6 === "singlestore") {
180223
180365
  const parsed = singlestoreCredentials.safeParse(flattened);
180224
180366
  if (!parsed.success) {
180225
- printConfigConnectionIssues8(flattened);
180367
+ printConfigConnectionIssues7(flattened);
180226
180368
  process.exit(1);
180227
180369
  }
180228
180370
  const credentials2 = parsed.data;
@@ -180238,7 +180380,7 @@ var prepareStudioConfig = async (options) => {
180238
180380
  if (dialect6 === "sqlite") {
180239
180381
  const parsed = sqliteCredentials.safeParse(flattened);
180240
180382
  if (!parsed.success) {
180241
- printConfigConnectionIssues9(flattened, "studio");
180383
+ printConfigConnectionIssues8(flattened, "studio");
180242
180384
  process.exit(1);
180243
180385
  }
180244
180386
  const credentials2 = parsed.data;
@@ -180254,7 +180396,7 @@ var prepareStudioConfig = async (options) => {
180254
180396
  if (dialect6 === "turso") {
180255
180397
  const parsed = libSQLCredentials.safeParse(flattened);
180256
180398
  if (!parsed.success) {
180257
- printConfigConnectionIssues4(flattened, "studio");
180399
+ printConfigConnectionIssues3(flattened, "studio");
180258
180400
  process.exit(1);
180259
180401
  }
180260
180402
  const credentials2 = parsed.data;
@@ -180288,21 +180430,6 @@ var prepareStudioConfig = async (options) => {
180288
180430
  if (dialect6 === "mssql") {
180289
180431
  throw new Error(`You can't use 'studio' command with MsSql dialect yet`);
180290
180432
  }
180291
- if (dialect6 === "duckdb") {
180292
- const parsed = duckdbCredentials.safeParse(flattened);
180293
- if (!parsed.success) {
180294
- printConfigConnectionIssues2(flattened);
180295
- process.exit(1);
180296
- }
180297
- const credentials2 = parsed.data;
180298
- return {
180299
- dialect: dialect6,
180300
- schema: schema6,
180301
- host,
180302
- port,
180303
- credentials: credentials2
180304
- };
180305
- }
180306
180433
  assertUnreachable(dialect6);
180307
180434
  };
180308
180435
  var migrateConfig = objectType({
@@ -180324,7 +180451,7 @@ var prepareMigrateConfig = async (configPath) => {
180324
180451
  if (dialect6 === "postgresql") {
180325
180452
  const parsed2 = postgresCredentials.safeParse(flattened);
180326
180453
  if (!parsed2.success) {
180327
- printConfigConnectionIssues7(flattened);
180454
+ printConfigConnectionIssues6(flattened);
180328
180455
  process.exit(1);
180329
180456
  }
180330
180457
  const credentials2 = parsed2.data;
@@ -180339,7 +180466,7 @@ var prepareMigrateConfig = async (configPath) => {
180339
180466
  if (dialect6 === "mysql") {
180340
180467
  const parsed2 = mysqlCredentials.safeParse(flattened);
180341
180468
  if (!parsed2.success) {
180342
- printConfigConnectionIssues6(flattened);
180469
+ printConfigConnectionIssues5(flattened);
180343
180470
  process.exit(1);
180344
180471
  }
180345
180472
  const credentials2 = parsed2.data;
@@ -180354,7 +180481,7 @@ var prepareMigrateConfig = async (configPath) => {
180354
180481
  if (dialect6 === "singlestore") {
180355
180482
  const parsed2 = singlestoreCredentials.safeParse(flattened);
180356
180483
  if (!parsed2.success) {
180357
- printConfigConnectionIssues8(flattened);
180484
+ printConfigConnectionIssues7(flattened);
180358
180485
  process.exit(1);
180359
180486
  }
180360
180487
  const credentials2 = parsed2.data;
@@ -180369,7 +180496,7 @@ var prepareMigrateConfig = async (configPath) => {
180369
180496
  if (dialect6 === "sqlite") {
180370
180497
  const parsed2 = sqliteCredentials.safeParse(flattened);
180371
180498
  if (!parsed2.success) {
180372
- printConfigConnectionIssues9(flattened, "migrate");
180499
+ printConfigConnectionIssues8(flattened, "migrate");
180373
180500
  process.exit(1);
180374
180501
  }
180375
180502
  const credentials2 = parsed2.data;
@@ -180384,7 +180511,7 @@ var prepareMigrateConfig = async (configPath) => {
180384
180511
  if (dialect6 === "turso") {
180385
180512
  const parsed2 = libSQLCredentials.safeParse(flattened);
180386
180513
  if (!parsed2.success) {
180387
- printConfigConnectionIssues4(flattened, "migrate");
180514
+ printConfigConnectionIssues3(flattened, "migrate");
180388
180515
  process.exit(1);
180389
180516
  }
180390
180517
  const credentials2 = parsed2.data;
@@ -180407,7 +180534,7 @@ var prepareMigrateConfig = async (configPath) => {
180407
180534
  if (dialect6 === "mssql") {
180408
180535
  const parsed2 = mssqlCredentials.safeParse(flattened);
180409
180536
  if (!parsed2.success) {
180410
- printConfigConnectionIssues5(flattened);
180537
+ printConfigConnectionIssues4(flattened);
180411
180538
  process.exit(1);
180412
180539
  }
180413
180540
  const credentials2 = parsed2.data;
@@ -180434,14 +180561,6 @@ var prepareMigrateConfig = async (configPath) => {
180434
180561
  table: table7
180435
180562
  };
180436
180563
  }
180437
- if (dialect6 === "duckdb") {
180438
- console.log(
180439
- error2(
180440
- `You can't use 'migrate' command with DuckDb dialect`
180441
- )
180442
- );
180443
- process.exit(1);
180444
- }
180445
180564
  assertUnreachable(dialect6);
180446
180565
  };
180447
180566
  var drizzleConfigFromFile = async (configPath, isExport) => {
@@ -181314,9 +181433,10 @@ var updateUpToV62 = (json) => {
181314
181433
  // src/cli/schema.ts
181315
181434
  init_utils4();
181316
181435
  init_common3();
181436
+ init_outputs();
181317
181437
  init_views();
181318
181438
  var optionDialect = string("dialect").enum(...dialects).desc(
181319
- `Database dialect: 'gel', 'postgresql', 'mysql', 'sqlite', 'turso', 'singlestore', 'duckdb' or 'mssql'`
181439
+ `Database dialect: 'gel', 'postgresql', 'mysql', 'sqlite', 'turso', 'singlestore' or 'mssql'`
181320
181440
  );
181321
181441
  var optionOut = string().desc("Output folder, 'drizzle' by default");
181322
181442
  var optionConfig = string().desc("Path to drizzle config file");
@@ -181377,13 +181497,6 @@ var generate = command({
181377
181497
  } else if (dialect6 === "cockroach") {
181378
181498
  const { handle: handle21 } = await Promise.resolve().then(() => (init_generate_cockroach(), generate_cockroach_exports));
181379
181499
  await handle21(opts);
181380
- } else if (dialect6 === "duckdb") {
181381
- console.log(
181382
- error2(
181383
- `You can't use 'generate' command with DuckDb dialect`
181384
- )
181385
- );
181386
- process.exit(1);
181387
181500
  } else {
181388
181501
  assertUnreachable(dialect6);
181389
181502
  }
@@ -181847,8 +181960,7 @@ var studio = command({
181847
181960
  drizzleForSQLite: drizzleForSQLite2,
181848
181961
  prepareSingleStoreSchema: prepareSingleStoreSchema2,
181849
181962
  drizzleForSingleStore: drizzleForSingleStore2,
181850
- drizzleForLibSQL: drizzleForLibSQL2,
181851
- drizzleForDuckDb: drizzleForDuckDb2
181963
+ drizzleForLibSQL: drizzleForLibSQL2
181852
181964
  // drizzleForMsSQL,
181853
181965
  } = await Promise.resolve().then(() => (init_studio(), studio_exports));
181854
181966
  let setup;
@@ -181893,8 +182005,6 @@ var studio = command({
181893
182005
  files,
181894
182006
  casing2
181895
182007
  );
181896
- } else if (dialect6 === "duckdb") {
181897
- setup = await drizzleForDuckDb2(credentials2);
181898
182008
  } else if (dialect6 === "cockroach") {
181899
182009
  throw new Error(`You can't use 'studio' command with 'cockroach' dialect`);
181900
182010
  } else {
@@ -181902,6 +182012,12 @@ var studio = command({
181902
182012
  }
181903
182013
  const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
181904
182014
  const server = await prepareServer2(setup);
182015
+ console.log();
182016
+ console.log(
182017
+ withStyle.fullWarning(
182018
+ "Drizzle Studio is currently in Beta. If you find anything that is not working as expected or should be improved, feel free to create an issue on GitHub: https://github.com/drizzle-team/drizzle-kit-mirror/issues/new or write to us on Discord: https://discord.gg/WcRKz2FFxN"
182019
+ )
182020
+ );
181905
182021
  const { certs: certs2 } = await Promise.resolve().then(() => (init_certs(), certs_exports));
181906
182022
  const { key, cert } = await certs2() || {};
181907
182023
  server.start({
@@ -181974,13 +182090,6 @@ var exportRaw = command({
181974
182090
  } else if (dialect6 === "cockroach") {
181975
182091
  const { handleExport: handleExport7 } = await Promise.resolve().then(() => (init_generate_cockroach(), generate_cockroach_exports));
181976
182092
  await handleExport7(opts);
181977
- } else if (dialect6 === "duckdb") {
181978
- console.log(
181979
- error2(
181980
- `You can't use 'export' command with DuckDb dialect`
181981
- )
181982
- );
181983
- process.exit(1);
181984
182093
  } else {
181985
182094
  assertUnreachable(dialect6);
181986
182095
  }