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