drizzle-kit 1.0.0-beta.3-36e9b9e → 1.0.0-beta.3-d4ff358
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 +129 -28
- package/api-mysql.mjs +129 -28
- package/api-postgres.js +165 -56
- package/api-postgres.mjs +165 -56
- package/api-sqlite.js +129 -28
- package/api-sqlite.mjs +129 -28
- package/bin.cjs +274 -94
- 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
|
}
|
|
@@ -34302,6 +34303,9 @@ var init_utils_node = __esm({
|
|
|
34302
34303
|
case "gel":
|
|
34303
34304
|
throw Error("gel validator is not implemented yet");
|
|
34304
34305
|
// TODO
|
|
34306
|
+
case "duckdb":
|
|
34307
|
+
throw Error("duckdb validator is not implemented yet");
|
|
34308
|
+
// TODO
|
|
34305
34309
|
default:
|
|
34306
34310
|
assertUnreachable(dialect5);
|
|
34307
34311
|
}
|
|
@@ -164308,6 +164312,7 @@ __export(connections_exports, {
|
|
|
164308
164312
|
connectToSQLite: () => connectToSQLite,
|
|
164309
164313
|
connectToSingleStore: () => connectToSingleStore,
|
|
164310
164314
|
prepareCockroach: () => prepareCockroach,
|
|
164315
|
+
prepareDuckDb: () => prepareDuckDb,
|
|
164311
164316
|
prepareGelDB: () => prepareGelDB,
|
|
164312
164317
|
preparePostgresDB: () => preparePostgresDB
|
|
164313
164318
|
});
|
|
@@ -164324,7 +164329,7 @@ function parseMssqlUrl(url) {
|
|
|
164324
164329
|
}
|
|
164325
164330
|
};
|
|
164326
164331
|
}
|
|
164327
|
-
var import_net, ms, normalisePGliteUrl, preparePostgresDB, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
|
|
164332
|
+
var import_net, ms, normalisePGliteUrl, preparePostgresDB, prepareDuckDb, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
|
|
164328
164333
|
var init_connections = __esm({
|
|
164329
164334
|
"src/cli/connections.ts"() {
|
|
164330
164335
|
"use strict";
|
|
@@ -164460,7 +164465,13 @@ var init_connections = __esm({
|
|
|
164460
164465
|
}
|
|
164461
164466
|
return results;
|
|
164462
164467
|
};
|
|
164463
|
-
return {
|
|
164468
|
+
return {
|
|
164469
|
+
packageName: "pglite",
|
|
164470
|
+
query,
|
|
164471
|
+
proxy,
|
|
164472
|
+
transactionProxy,
|
|
164473
|
+
migrate: migrateFn
|
|
164474
|
+
};
|
|
164464
164475
|
}
|
|
164465
164476
|
assertUnreachable(driver2);
|
|
164466
164477
|
}
|
|
@@ -164701,7 +164712,13 @@ var init_connections = __esm({
|
|
|
164701
164712
|
}
|
|
164702
164713
|
return results;
|
|
164703
164714
|
};
|
|
164704
|
-
return {
|
|
164715
|
+
return {
|
|
164716
|
+
packageName: "postgres",
|
|
164717
|
+
query,
|
|
164718
|
+
proxy,
|
|
164719
|
+
transactionProxy,
|
|
164720
|
+
migrate: migrateFn
|
|
164721
|
+
};
|
|
164705
164722
|
}
|
|
164706
164723
|
if (await checkPackage("@vercel/postgres")) {
|
|
164707
164724
|
console.log(
|
|
@@ -164782,7 +164799,13 @@ var init_connections = __esm({
|
|
|
164782
164799
|
}
|
|
164783
164800
|
return results;
|
|
164784
164801
|
};
|
|
164785
|
-
return {
|
|
164802
|
+
return {
|
|
164803
|
+
packageName: "@vercel/postgres",
|
|
164804
|
+
query,
|
|
164805
|
+
proxy,
|
|
164806
|
+
transactionProxy,
|
|
164807
|
+
migrate: migrateFn
|
|
164808
|
+
};
|
|
164786
164809
|
}
|
|
164787
164810
|
if (await checkPackage("@neondatabase/serverless")) {
|
|
164788
164811
|
console.log(
|
|
@@ -164795,7 +164818,11 @@ var init_connections = __esm({
|
|
|
164795
164818
|
"'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
|
|
164796
164819
|
)
|
|
164797
164820
|
);
|
|
164798
|
-
const {
|
|
164821
|
+
const {
|
|
164822
|
+
Pool,
|
|
164823
|
+
neonConfig,
|
|
164824
|
+
types: pgTypes
|
|
164825
|
+
} = await import("@neondatabase/serverless");
|
|
164799
164826
|
const { drizzle } = await import("drizzle-orm/neon-serverless");
|
|
164800
164827
|
const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
|
|
164801
164828
|
const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
|
|
@@ -164865,7 +164892,13 @@ var init_connections = __esm({
|
|
|
164865
164892
|
}
|
|
164866
164893
|
return results;
|
|
164867
164894
|
};
|
|
164868
|
-
return {
|
|
164895
|
+
return {
|
|
164896
|
+
packageName: "@neondatabase/serverless",
|
|
164897
|
+
query,
|
|
164898
|
+
proxy,
|
|
164899
|
+
transactionProxy,
|
|
164900
|
+
migrate: migrateFn
|
|
164901
|
+
};
|
|
164869
164902
|
}
|
|
164870
164903
|
if (await checkPackage("bun")) {
|
|
164871
164904
|
console.log(withStyle.info(`Using 'bun' driver for database querying`));
|
|
@@ -164916,6 +164949,54 @@ var init_connections = __esm({
|
|
|
164916
164949
|
console.warn("For the 'bun' driver, run your script using: bun --bun");
|
|
164917
164950
|
process.exit(1);
|
|
164918
164951
|
};
|
|
164952
|
+
prepareDuckDb = async (credentials2) => {
|
|
164953
|
+
if (await checkPackage("@duckdb/node-api")) {
|
|
164954
|
+
console.log(
|
|
164955
|
+
withStyle.info(`Using '@duckdb/node-api' driver for database querying`)
|
|
164956
|
+
);
|
|
164957
|
+
const { DuckDBInstance } = await import("@duckdb/node-api");
|
|
164958
|
+
const instance = await DuckDBInstance.create(credentials2.url);
|
|
164959
|
+
const client = await instance.connect();
|
|
164960
|
+
const query = async (sql, params = []) => {
|
|
164961
|
+
const result2 = await client.run(sql, params);
|
|
164962
|
+
const rows = await result2.getRowObjectsJson();
|
|
164963
|
+
return rows;
|
|
164964
|
+
};
|
|
164965
|
+
const proxy = async (params) => {
|
|
164966
|
+
const result2 = await client.run(params.sql, params.params);
|
|
164967
|
+
return params.mode === "array" ? await result2.getRowsJson() : await result2.getRowObjectsJson();
|
|
164968
|
+
};
|
|
164969
|
+
const transactionProxy = async (queries) => {
|
|
164970
|
+
const results = [];
|
|
164971
|
+
try {
|
|
164972
|
+
await client.run("BEGIN");
|
|
164973
|
+
for (const query2 of queries) {
|
|
164974
|
+
const result2 = await client.run(query2.sql);
|
|
164975
|
+
results.push(await result2.getRowObjectsJson());
|
|
164976
|
+
}
|
|
164977
|
+
await client.run("COMMIT");
|
|
164978
|
+
} catch (error4) {
|
|
164979
|
+
await client.run("ROLLBACK");
|
|
164980
|
+
results.push(error4);
|
|
164981
|
+
}
|
|
164982
|
+
return results;
|
|
164983
|
+
};
|
|
164984
|
+
return {
|
|
164985
|
+
packageName: "@duckdb/node-api",
|
|
164986
|
+
query,
|
|
164987
|
+
proxy,
|
|
164988
|
+
transactionProxy,
|
|
164989
|
+
migrate: () => {
|
|
164990
|
+
throw new Error("DuckDB does not support migrations");
|
|
164991
|
+
}
|
|
164992
|
+
};
|
|
164993
|
+
}
|
|
164994
|
+
console.error(
|
|
164995
|
+
// "To connect to DuckDb database - please install either of 'duckdb', '@duckdb/node-api' drivers",
|
|
164996
|
+
"To connect to DuckDb database - please install '@duckdb/node-api' driver"
|
|
164997
|
+
);
|
|
164998
|
+
process.exit(1);
|
|
164999
|
+
};
|
|
164919
165000
|
prepareCockroach = async (credentials2) => {
|
|
164920
165001
|
if (await checkPackage("pg")) {
|
|
164921
165002
|
const { default: pg } = await import("pg");
|
|
@@ -164968,9 +165049,7 @@ var init_connections = __esm({
|
|
|
164968
165049
|
};
|
|
164969
165050
|
return { query, proxy, migrate: migrateFn };
|
|
164970
165051
|
}
|
|
164971
|
-
console.error(
|
|
164972
|
-
"To connect to Cockroach - please install 'pg' package"
|
|
164973
|
-
);
|
|
165052
|
+
console.error("To connect to Cockroach - please install 'pg' package");
|
|
164974
165053
|
process.exit(1);
|
|
164975
165054
|
};
|
|
164976
165055
|
prepareGelDB = async (credentials2) => {
|
|
@@ -165029,9 +165108,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
165029
165108
|
};
|
|
165030
165109
|
return { packageName: "gel", query, proxy, transactionProxy };
|
|
165031
165110
|
}
|
|
165032
|
-
console.error(
|
|
165033
|
-
"To connect to gel database - please install 'edgedb' driver"
|
|
165034
|
-
);
|
|
165111
|
+
console.error("To connect to gel database - please install 'edgedb' driver");
|
|
165035
165112
|
process.exit(1);
|
|
165036
165113
|
};
|
|
165037
165114
|
parseSingleStoreCredentials = (credentials2) => {
|
|
@@ -165483,9 +165560,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
165483
165560
|
migrate: migrateFn
|
|
165484
165561
|
};
|
|
165485
165562
|
}
|
|
165486
|
-
console.error(
|
|
165487
|
-
"To connect to MsSQL database - please install 'mssql' driver"
|
|
165488
|
-
);
|
|
165563
|
+
console.error("To connect to MsSQL database - please install 'mssql' driver");
|
|
165489
165564
|
process.exit(1);
|
|
165490
165565
|
};
|
|
165491
165566
|
prepareSqliteParams = (params, driver2) => {
|
|
@@ -165590,7 +165665,10 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
165590
165665
|
await remoteCallback(query2, [], "run");
|
|
165591
165666
|
};
|
|
165592
165667
|
const proxy = async (params) => {
|
|
165593
|
-
const preparedParams = prepareSqliteParams(
|
|
165668
|
+
const preparedParams = prepareSqliteParams(
|
|
165669
|
+
params.params || [],
|
|
165670
|
+
"d1-http"
|
|
165671
|
+
);
|
|
165594
165672
|
const result2 = await remoteCallback(
|
|
165595
165673
|
params.sql,
|
|
165596
165674
|
preparedParams,
|
|
@@ -165815,17 +165893,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
165815
165893
|
};
|
|
165816
165894
|
const transactionProxy = async (queries) => {
|
|
165817
165895
|
const results = [];
|
|
165818
|
-
const tx = sqlite.transaction(
|
|
165819
|
-
|
|
165820
|
-
|
|
165821
|
-
|
|
165822
|
-
|
|
165823
|
-
|
|
165824
|
-
|
|
165896
|
+
const tx = sqlite.transaction(
|
|
165897
|
+
(queries2) => {
|
|
165898
|
+
for (const query of queries2) {
|
|
165899
|
+
let result2 = [];
|
|
165900
|
+
if (query.method === "values" || query.method === "get" || query.method === "all") {
|
|
165901
|
+
result2 = sqlite.prepare(query.sql).all();
|
|
165902
|
+
} else {
|
|
165903
|
+
sqlite.prepare(query.sql).run();
|
|
165904
|
+
}
|
|
165905
|
+
results.push(result2);
|
|
165825
165906
|
}
|
|
165826
|
-
results.push(result2);
|
|
165827
165907
|
}
|
|
165828
|
-
|
|
165908
|
+
);
|
|
165829
165909
|
try {
|
|
165830
165910
|
tx(queries);
|
|
165831
165911
|
} catch (error4) {
|
|
@@ -165833,7 +165913,13 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
|
|
|
165833
165913
|
}
|
|
165834
165914
|
return results;
|
|
165835
165915
|
};
|
|
165836
|
-
return {
|
|
165916
|
+
return {
|
|
165917
|
+
...db,
|
|
165918
|
+
packageName: "better-sqlite3",
|
|
165919
|
+
proxy,
|
|
165920
|
+
transactionProxy,
|
|
165921
|
+
migrate: migrateFn
|
|
165922
|
+
};
|
|
165837
165923
|
}
|
|
165838
165924
|
if (await checkPackage("bun")) {
|
|
165839
165925
|
console.log(withStyle.info(`Using 'bun' driver for database querying`));
|
|
@@ -169608,7 +169694,7 @@ var init_introspect2 = __esm({
|
|
|
169608
169694
|
});
|
|
169609
169695
|
}
|
|
169610
169696
|
for (const seq of sequencesList) {
|
|
169611
|
-
const depend = dependList.find((it2) => it2.oid === seq.oid);
|
|
169697
|
+
const depend = dependList.find((it2) => Number(it2.oid) === Number(seq.oid));
|
|
169612
169698
|
if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
|
|
169613
169699
|
continue;
|
|
169614
169700
|
}
|
|
@@ -169672,22 +169758,22 @@ var init_introspect2 = __esm({
|
|
|
169672
169758
|
continue;
|
|
169673
169759
|
}
|
|
169674
169760
|
const expr = serialsList.find(
|
|
169675
|
-
(it2) => it2.tableId === column11.tableId && it2.ordinality === column11.ordinality
|
|
169761
|
+
(it2) => Number(it2.tableId) === Number(column11.tableId) && it2.ordinality === column11.ordinality
|
|
169676
169762
|
);
|
|
169677
169763
|
if (expr) {
|
|
169678
|
-
const table6 = tablesList.find((it2) => it2.oid === column11.tableId);
|
|
169764
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(column11.tableId));
|
|
169679
169765
|
const isSerial = isSerialExpression(expr.expression, table6.schema);
|
|
169680
169766
|
column11.type = isSerial ? type === "bigint" ? "bigserial" : type === "integer" ? "serial" : "smallserial" : type;
|
|
169681
169767
|
}
|
|
169682
169768
|
}
|
|
169683
169769
|
for (const column11 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
|
|
169684
|
-
const table6 = tablesList.find((it2) => it2.oid === column11.tableId);
|
|
169770
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(column11.tableId));
|
|
169685
169771
|
const enumType2 = column11.typeId in groupedEnums ? groupedEnums[column11.typeId] : column11.typeId in groupedArrEnums ? groupedArrEnums[column11.typeId] : null;
|
|
169686
169772
|
let columnTypeMapped = enumType2 ? enumType2.name : column11.type.replaceAll("[]", "");
|
|
169687
169773
|
columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char").replace("geometry(Point", "geometry(point");
|
|
169688
169774
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
|
169689
169775
|
const columnDefault = defaultsList.find(
|
|
169690
|
-
(it2) => it2.tableId === column11.tableId && it2.ordinality === column11.ordinality
|
|
169776
|
+
(it2) => Number(it2.tableId) === Number(column11.tableId) && it2.ordinality === column11.ordinality
|
|
169691
169777
|
);
|
|
169692
169778
|
const defaultValue = defaultForColumn(
|
|
169693
169779
|
columnTypeMapped,
|
|
@@ -169696,10 +169782,10 @@ var init_introspect2 = __esm({
|
|
|
169696
169782
|
Boolean(enumType2)
|
|
169697
169783
|
);
|
|
169698
169784
|
const unique = constraintsList.find((it2) => {
|
|
169699
|
-
return it2.type === "u" && it2.tableId === column11.tableId && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column11.ordinality);
|
|
169785
|
+
return it2.type === "u" && Number(it2.tableId) === Number(column11.tableId) && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column11.ordinality);
|
|
169700
169786
|
}) ?? null;
|
|
169701
169787
|
const pk = constraintsList.find((it2) => {
|
|
169702
|
-
return it2.type === "p" && it2.tableId === column11.tableId && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column11.ordinality);
|
|
169788
|
+
return it2.type === "p" && Number(it2.tableId) === Number(column11.tableId) && it2.columnsOrdinals.length === 1 && it2.columnsOrdinals.includes(column11.ordinality);
|
|
169703
169789
|
}) ?? null;
|
|
169704
169790
|
const metadata = column11.metadata;
|
|
169705
169791
|
if (column11.generatedType === "s" && (!metadata || !metadata.expression)) {
|
|
@@ -169714,7 +169800,7 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169714
169800
|
${JSON.stringify(column11.metadata)}`
|
|
169715
169801
|
);
|
|
169716
169802
|
}
|
|
169717
|
-
const sequence = (metadata == null ? void 0 : metadata.seqId) ? sequencesList.find((it2) => it2.oid === Number(metadata.seqId)) ?? null : null;
|
|
169803
|
+
const sequence = (metadata == null ? void 0 : metadata.seqId) ? sequencesList.find((it2) => Number(it2.oid) === Number(metadata.seqId)) ?? null : null;
|
|
169718
169804
|
columns.push({
|
|
169719
169805
|
entityType: "columns",
|
|
169720
169806
|
schema: table6.schema,
|
|
@@ -169744,10 +169830,12 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169744
169830
|
});
|
|
169745
169831
|
}
|
|
169746
169832
|
for (const unique of constraintsList.filter((it2) => it2.type === "u")) {
|
|
169747
|
-
const table6 = tablesList.find((it2) => it2.oid === unique.tableId);
|
|
169748
|
-
const schema5 = namespaces.find((it2) => it2.oid === unique.schemaId);
|
|
169833
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(unique.tableId));
|
|
169834
|
+
const schema5 = namespaces.find((it2) => Number(it2.oid) === Number(unique.schemaId));
|
|
169749
169835
|
const columns2 = unique.columnsOrdinals.map((it2) => {
|
|
169750
|
-
const column11 = columnsList.find(
|
|
169836
|
+
const column11 = columnsList.find(
|
|
169837
|
+
(column12) => Number(column12.tableId) === Number(unique.tableId) && column12.ordinality === it2
|
|
169838
|
+
);
|
|
169751
169839
|
return column11.name;
|
|
169752
169840
|
});
|
|
169753
169841
|
uniques.push({
|
|
@@ -169761,10 +169849,12 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169761
169849
|
});
|
|
169762
169850
|
}
|
|
169763
169851
|
for (const pk of constraintsList.filter((it2) => it2.type === "p")) {
|
|
169764
|
-
const table6 = tablesList.find((it2) => it2.oid === pk.tableId);
|
|
169765
|
-
const schema5 = namespaces.find((it2) => it2.oid === pk.schemaId);
|
|
169852
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(pk.tableId));
|
|
169853
|
+
const schema5 = namespaces.find((it2) => Number(it2.oid) === Number(pk.schemaId));
|
|
169766
169854
|
const columns2 = pk.columnsOrdinals.map((it2) => {
|
|
169767
|
-
const column11 = columnsList.find(
|
|
169855
|
+
const column11 = columnsList.find(
|
|
169856
|
+
(column12) => Number(column12.tableId) === Number(pk.tableId) && column12.ordinality === it2
|
|
169857
|
+
);
|
|
169768
169858
|
return column11.name;
|
|
169769
169859
|
});
|
|
169770
169860
|
pks.push({
|
|
@@ -169777,15 +169867,19 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169777
169867
|
});
|
|
169778
169868
|
}
|
|
169779
169869
|
for (const fk5 of constraintsList.filter((it2) => it2.type === "f")) {
|
|
169780
|
-
const table6 = tablesList.find((it2) => it2.oid === fk5.tableId);
|
|
169781
|
-
const schema5 = namespaces.find((it2) => it2.oid === fk5.schemaId);
|
|
169782
|
-
const tableTo = tablesList.find((it2) => it2.oid === fk5.tableToId);
|
|
169870
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(fk5.tableId));
|
|
169871
|
+
const schema5 = namespaces.find((it2) => Number(it2.oid) === Number(fk5.schemaId));
|
|
169872
|
+
const tableTo = tablesList.find((it2) => Number(it2.oid) === Number(fk5.tableToId));
|
|
169783
169873
|
const columns2 = fk5.columnsOrdinals.map((it2) => {
|
|
169784
|
-
const column11 = columnsList.find(
|
|
169874
|
+
const column11 = columnsList.find(
|
|
169875
|
+
(column12) => Number(column12.tableId) === Number(fk5.tableId) && column12.ordinality === it2
|
|
169876
|
+
);
|
|
169785
169877
|
return column11.name;
|
|
169786
169878
|
});
|
|
169787
169879
|
const columnsTo = fk5.columnsToOrdinals.map((it2) => {
|
|
169788
|
-
const column11 = columnsList.find(
|
|
169880
|
+
const column11 = columnsList.find(
|
|
169881
|
+
(column12) => Number(column12.tableId) === Number(fk5.tableToId) && column12.ordinality === it2
|
|
169882
|
+
);
|
|
169789
169883
|
return column11.name;
|
|
169790
169884
|
});
|
|
169791
169885
|
fks.push({
|
|
@@ -169803,8 +169897,8 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169803
169897
|
});
|
|
169804
169898
|
}
|
|
169805
169899
|
for (const check2 of constraintsList.filter((it2) => it2.type === "c")) {
|
|
169806
|
-
const table6 = tablesList.find((it2) => it2.oid === check2.tableId);
|
|
169807
|
-
const schema5 = namespaces.find((it2) => it2.oid === check2.schemaId);
|
|
169900
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(check2.tableId));
|
|
169901
|
+
const schema5 = namespaces.find((it2) => Number(it2.oid) === Number(check2.schemaId));
|
|
169808
169902
|
checks.push({
|
|
169809
169903
|
entityType: "checks",
|
|
169810
169904
|
schema: schema5.name,
|
|
@@ -169865,10 +169959,10 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169865
169959
|
});
|
|
169866
169960
|
for (const idx of idxs) {
|
|
169867
169961
|
const { metadata } = idx;
|
|
169868
|
-
const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && x6.indexId === idx.oid);
|
|
169869
|
-
const forPK = metadata.isPrimary && constraintsList.some((x6) => x6.type === "p" && x6.indexId === idx.oid);
|
|
169962
|
+
const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && Number(x6.indexId) === Number(idx.oid));
|
|
169963
|
+
const forPK = metadata.isPrimary && constraintsList.some((x6) => x6.type === "p" && Number(x6.indexId) === Number(idx.oid));
|
|
169870
169964
|
const expr = splitExpressions(metadata.expression);
|
|
169871
|
-
const table6 = tablesList.find((it2) => it2.oid === idx.metadata.tableId);
|
|
169965
|
+
const table6 = tablesList.find((it2) => Number(it2.oid) === Number(idx.metadata.tableId));
|
|
169872
169966
|
const nonColumnsCount = metadata.columnOrdinals.reduce((acc, it2) => {
|
|
169873
169967
|
if (it2 === 0) acc += 1;
|
|
169874
169968
|
return acc;
|
|
@@ -169900,7 +169994,7 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169900
169994
|
k5 += 1;
|
|
169901
169995
|
} else {
|
|
169902
169996
|
const column11 = columnsList.find((column12) => {
|
|
169903
|
-
return column12.tableId === metadata.tableId && column12.ordinality === ordinal;
|
|
169997
|
+
return Number(column12.tableId) === Number(metadata.tableId) && column12.ordinality === ordinal;
|
|
169904
169998
|
});
|
|
169905
169999
|
if (!column11) throw new Error(`missing column: ${metadata.tableId}:${ordinal}`);
|
|
169906
170000
|
const options = opts[i6];
|
|
@@ -169945,7 +170039,7 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169945
170039
|
});
|
|
169946
170040
|
}
|
|
169947
170041
|
for (const it2 of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
|
|
169948
|
-
const view5 = viewsList.find((x6) => x6.oid === it2.tableId);
|
|
170042
|
+
const view5 = viewsList.find((x6) => Number(x6.oid) === Number(it2.tableId));
|
|
169949
170043
|
const typeDimensions = it2.type.split("[]").length - 1;
|
|
169950
170044
|
const enumType2 = it2.typeId in groupedEnums ? groupedEnums[it2.typeId] : it2.typeId in groupedArrEnums ? groupedArrEnums[it2.typeId] : null;
|
|
169951
170045
|
let columnTypeMapped = enumType2 ? enumType2.name : it2.type.replace("[]", "");
|
|
@@ -169967,8 +170061,8 @@ ${JSON.stringify(column11.metadata)}`
|
|
|
169967
170061
|
});
|
|
169968
170062
|
}
|
|
169969
170063
|
for (const view5 of viewsList) {
|
|
169970
|
-
const accessMethod = view5.accessMethod === 0 ? null : ams.find((it2) => it2.oid === view5.accessMethod);
|
|
169971
|
-
const tablespace = view5.tablespaceid === 0 ? null : tablespaces.find((it2) => it2.oid === view5.tablespaceid).name;
|
|
170064
|
+
const accessMethod = Number(view5.accessMethod) === 0 ? null : ams.find((it2) => Number(it2.oid) === Number(view5.accessMethod));
|
|
170065
|
+
const tablespace = Number(view5.tablespaceid) === 0 ? null : tablespaces.find((it2) => Number(it2.oid) === Number(view5.tablespaceid)).name;
|
|
169972
170066
|
const definition = parseViewDefinition(view5.definition);
|
|
169973
170067
|
const withOpts = wrapRecord(
|
|
169974
170068
|
((_b = view5.options) == null ? void 0 : _b.reduce((acc, it2) => {
|
|
@@ -176980,6 +177074,7 @@ var init_cors = __esm({
|
|
|
176980
177074
|
// src/cli/commands/studio.ts
|
|
176981
177075
|
var studio_exports = {};
|
|
176982
177076
|
__export(studio_exports, {
|
|
177077
|
+
drizzleForDuckDb: () => drizzleForDuckDb,
|
|
176983
177078
|
drizzleForLibSQL: () => drizzleForLibSQL,
|
|
176984
177079
|
drizzleForMySQL: () => drizzleForMySQL,
|
|
176985
177080
|
drizzleForPostgres: () => drizzleForPostgres,
|
|
@@ -176993,7 +177088,7 @@ __export(studio_exports, {
|
|
|
176993
177088
|
prepareServer: () => prepareServer,
|
|
176994
177089
|
prepareSingleStoreSchema: () => prepareSingleStoreSchema
|
|
176995
177090
|
});
|
|
176996
|
-
var import_crypto11, import_drizzle_orm8, import_relations8, import_mssql_core3, import_mysql_core3, import_pg_core3, import_singlestore_core2, import_sqlite_core3, import_fs17, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, benchmarkProxySchema, defaultsSchema, schema4, jsonStringify, prepareServer;
|
|
177091
|
+
var import_crypto11, import_drizzle_orm8, import_relations8, import_mssql_core3, import_mysql_core3, import_pg_core3, import_singlestore_core2, import_sqlite_core3, import_fs17, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForDuckDb, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, benchmarkProxySchema, defaultsSchema, schema4, jsonStringify, prepareServer;
|
|
176997
177092
|
var init_studio = __esm({
|
|
176998
177093
|
"src/cli/commands/studio.ts"() {
|
|
176999
177094
|
"use strict";
|
|
@@ -177225,6 +177320,23 @@ var init_studio = __esm({
|
|
|
177225
177320
|
casing: casing2
|
|
177226
177321
|
};
|
|
177227
177322
|
};
|
|
177323
|
+
drizzleForDuckDb = async (credentials2) => {
|
|
177324
|
+
const { prepareDuckDb: prepareDuckDb2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
|
177325
|
+
const db = await prepareDuckDb2(credentials2);
|
|
177326
|
+
const dbUrl = `duckdb://${credentials2.url}`;
|
|
177327
|
+
const dbHash = (0, import_crypto11.createHash)("sha256").update(dbUrl).digest("hex");
|
|
177328
|
+
return {
|
|
177329
|
+
dbHash,
|
|
177330
|
+
dialect: "duckdb",
|
|
177331
|
+
driver: void 0,
|
|
177332
|
+
packageName: db.packageName,
|
|
177333
|
+
proxy: db.proxy,
|
|
177334
|
+
transactionProxy: db.transactionProxy,
|
|
177335
|
+
customDefaults: [],
|
|
177336
|
+
schema: {},
|
|
177337
|
+
relations: {}
|
|
177338
|
+
};
|
|
177339
|
+
};
|
|
177228
177340
|
drizzleForMySQL = async (credentials2, mysqlSchema, relations5, schemaFiles, casing2) => {
|
|
177229
177341
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
|
177230
177342
|
const { proxy, transactionProxy, benchmarkProxy, database, packageName } = await connectToMySQL2(credentials2);
|
|
@@ -179581,6 +179693,25 @@ var printConfigConnectionIssues = (options) => {
|
|
|
179581
179693
|
// src/cli/commands/utils.ts
|
|
179582
179694
|
init_common3();
|
|
179583
179695
|
|
|
179696
|
+
// src/cli/validations/duckdb.ts
|
|
179697
|
+
init_esm();
|
|
179698
|
+
init_views();
|
|
179699
|
+
init_common3();
|
|
179700
|
+
var duckdbCredentials = objectType({
|
|
179701
|
+
driver: undefinedType(),
|
|
179702
|
+
url: stringType().min(1)
|
|
179703
|
+
}).transform((o5) => {
|
|
179704
|
+
delete o5.driver;
|
|
179705
|
+
return o5;
|
|
179706
|
+
});
|
|
179707
|
+
var printConfigConnectionIssues2 = (options) => {
|
|
179708
|
+
const text = `Please provide required params:
|
|
179709
|
+
`;
|
|
179710
|
+
console.log(error2(text));
|
|
179711
|
+
console.log(wrapParam("url", options.url));
|
|
179712
|
+
process.exit(1);
|
|
179713
|
+
};
|
|
179714
|
+
|
|
179584
179715
|
// src/cli/validations/gel.ts
|
|
179585
179716
|
init_esm();
|
|
179586
179717
|
init_views();
|
|
@@ -179621,7 +179752,7 @@ var gelCredentials = unionType([
|
|
|
179621
179752
|
}).transform(() => {
|
|
179622
179753
|
})
|
|
179623
179754
|
]);
|
|
179624
|
-
var
|
|
179755
|
+
var printConfigConnectionIssues3 = (options) => {
|
|
179625
179756
|
if ("url" in options) {
|
|
179626
179757
|
let text = `Please provide required params for Gel driver:
|
|
179627
179758
|
`;
|
|
@@ -179657,7 +179788,7 @@ var libSQLCredentials = objectType({
|
|
|
179657
179788
|
url: stringType().min(1),
|
|
179658
179789
|
authToken: stringType().min(1).optional()
|
|
179659
179790
|
});
|
|
179660
|
-
var
|
|
179791
|
+
var printConfigConnectionIssues4 = (options, _command) => {
|
|
179661
179792
|
let text = `Please provide required params for 'turso' dialect:
|
|
179662
179793
|
`;
|
|
179663
179794
|
console.log(error2(text));
|
|
@@ -179687,7 +179818,7 @@ var mssqlCredentials = unionType([
|
|
|
179687
179818
|
url: stringType().min(1)
|
|
179688
179819
|
})
|
|
179689
179820
|
]);
|
|
179690
|
-
var
|
|
179821
|
+
var printConfigConnectionIssues5 = (options) => {
|
|
179691
179822
|
if ("url" in options) {
|
|
179692
179823
|
let text2 = `Please provide required params for MsSQL driver:
|
|
179693
179824
|
`;
|
|
@@ -179736,7 +179867,7 @@ var mysqlCredentials = unionType([
|
|
|
179736
179867
|
url: stringType().min(1)
|
|
179737
179868
|
})
|
|
179738
179869
|
]);
|
|
179739
|
-
var
|
|
179870
|
+
var printConfigConnectionIssues6 = (options) => {
|
|
179740
179871
|
if ("url" in options) {
|
|
179741
179872
|
let text2 = `Please provide required params for MySQL driver:
|
|
179742
179873
|
`;
|
|
@@ -179801,7 +179932,7 @@ var postgresCredentials = unionType([
|
|
|
179801
179932
|
url: stringType().min(1)
|
|
179802
179933
|
})
|
|
179803
179934
|
]);
|
|
179804
|
-
var
|
|
179935
|
+
var printConfigConnectionIssues7 = (options) => {
|
|
179805
179936
|
if (options.driver === "aws-data-api") {
|
|
179806
179937
|
let text = `Please provide required params for AWS Data API driver:
|
|
179807
179938
|
`;
|
|
@@ -179868,7 +179999,7 @@ var singlestoreCredentials = unionType([
|
|
|
179868
179999
|
url: stringType().min(1)
|
|
179869
180000
|
})
|
|
179870
180001
|
]);
|
|
179871
|
-
var
|
|
180002
|
+
var printConfigConnectionIssues8 = (options) => {
|
|
179872
180003
|
if ("url" in options) {
|
|
179873
180004
|
let text2 = `Please provide required params for SingleStore driver:
|
|
179874
180005
|
`;
|
|
@@ -179917,7 +180048,7 @@ var sqliteCredentials = unionType([
|
|
|
179917
180048
|
return o5;
|
|
179918
180049
|
})
|
|
179919
180050
|
]);
|
|
179920
|
-
var
|
|
180051
|
+
var printConfigConnectionIssues9 = (options, command2) => {
|
|
179921
180052
|
const parsedDriver = sqliteDriver.safeParse(options.driver);
|
|
179922
180053
|
const driver2 = parsedDriver.success ? parsedDriver.data : "";
|
|
179923
180054
|
if (driver2 === "expo") {
|
|
@@ -180121,7 +180252,7 @@ var preparePushConfig = async (options, from) => {
|
|
|
180121
180252
|
if (config.dialect === "postgresql") {
|
|
180122
180253
|
const parsed2 = postgresCredentials.safeParse(config);
|
|
180123
180254
|
if (!parsed2.success) {
|
|
180124
|
-
|
|
180255
|
+
printConfigConnectionIssues7(config);
|
|
180125
180256
|
process.exit(1);
|
|
180126
180257
|
}
|
|
180127
180258
|
return {
|
|
@@ -180138,7 +180269,7 @@ var preparePushConfig = async (options, from) => {
|
|
|
180138
180269
|
if (config.dialect === "mysql") {
|
|
180139
180270
|
const parsed2 = mysqlCredentials.safeParse(config);
|
|
180140
180271
|
if (!parsed2.success) {
|
|
180141
|
-
|
|
180272
|
+
printConfigConnectionIssues6(config);
|
|
180142
180273
|
process.exit(1);
|
|
180143
180274
|
}
|
|
180144
180275
|
return {
|
|
@@ -180155,7 +180286,7 @@ var preparePushConfig = async (options, from) => {
|
|
|
180155
180286
|
if (config.dialect === "singlestore") {
|
|
180156
180287
|
const parsed2 = singlestoreCredentials.safeParse(config);
|
|
180157
180288
|
if (!parsed2.success) {
|
|
180158
|
-
|
|
180289
|
+
printConfigConnectionIssues8(config);
|
|
180159
180290
|
process.exit(1);
|
|
180160
180291
|
}
|
|
180161
180292
|
return {
|
|
@@ -180171,7 +180302,7 @@ var preparePushConfig = async (options, from) => {
|
|
|
180171
180302
|
if (config.dialect === "sqlite") {
|
|
180172
180303
|
const parsed2 = sqliteCredentials.safeParse(config);
|
|
180173
180304
|
if (!parsed2.success) {
|
|
180174
|
-
|
|
180305
|
+
printConfigConnectionIssues9(config, "push");
|
|
180175
180306
|
process.exit(1);
|
|
180176
180307
|
}
|
|
180177
180308
|
return {
|
|
@@ -180188,7 +180319,7 @@ var preparePushConfig = async (options, from) => {
|
|
|
180188
180319
|
if (config.dialect === "turso") {
|
|
180189
180320
|
const parsed2 = libSQLCredentials.safeParse(config);
|
|
180190
180321
|
if (!parsed2.success) {
|
|
180191
|
-
|
|
180322
|
+
printConfigConnectionIssues9(config, "push");
|
|
180192
180323
|
process.exit(1);
|
|
180193
180324
|
}
|
|
180194
180325
|
return {
|
|
@@ -180243,6 +180374,14 @@ var preparePushConfig = async (options, from) => {
|
|
|
180243
180374
|
explain: false
|
|
180244
180375
|
};
|
|
180245
180376
|
}
|
|
180377
|
+
if (config.dialect === "duckdb") {
|
|
180378
|
+
console.log(
|
|
180379
|
+
error2(
|
|
180380
|
+
`You can't use 'push' command with DuckDb dialect`
|
|
180381
|
+
)
|
|
180382
|
+
);
|
|
180383
|
+
process.exit(1);
|
|
180384
|
+
}
|
|
180246
180385
|
assertUnreachable(config.dialect);
|
|
180247
180386
|
};
|
|
180248
180387
|
var preparePullConfig = async (options, from) => {
|
|
@@ -180268,7 +180407,7 @@ var preparePullConfig = async (options, from) => {
|
|
|
180268
180407
|
if (dialect5 === "postgresql") {
|
|
180269
180408
|
const parsed2 = postgresCredentials.safeParse(config);
|
|
180270
180409
|
if (!parsed2.success) {
|
|
180271
|
-
|
|
180410
|
+
printConfigConnectionIssues7(config);
|
|
180272
180411
|
process.exit(1);
|
|
180273
180412
|
}
|
|
180274
180413
|
return {
|
|
@@ -180287,7 +180426,7 @@ var preparePullConfig = async (options, from) => {
|
|
|
180287
180426
|
if (dialect5 === "mysql") {
|
|
180288
180427
|
const parsed2 = mysqlCredentials.safeParse(config);
|
|
180289
180428
|
if (!parsed2.success) {
|
|
180290
|
-
|
|
180429
|
+
printConfigConnectionIssues6(config);
|
|
180291
180430
|
process.exit(1);
|
|
180292
180431
|
}
|
|
180293
180432
|
return {
|
|
@@ -180306,7 +180445,7 @@ var preparePullConfig = async (options, from) => {
|
|
|
180306
180445
|
if (dialect5 === "singlestore") {
|
|
180307
180446
|
const parsed2 = singlestoreCredentials.safeParse(config);
|
|
180308
180447
|
if (!parsed2.success) {
|
|
180309
|
-
|
|
180448
|
+
printConfigConnectionIssues8(config);
|
|
180310
180449
|
process.exit(1);
|
|
180311
180450
|
}
|
|
180312
180451
|
return {
|
|
@@ -180325,7 +180464,7 @@ var preparePullConfig = async (options, from) => {
|
|
|
180325
180464
|
if (dialect5 === "sqlite") {
|
|
180326
180465
|
const parsed2 = sqliteCredentials.safeParse(config);
|
|
180327
180466
|
if (!parsed2.success) {
|
|
180328
|
-
|
|
180467
|
+
printConfigConnectionIssues9(config, "pull");
|
|
180329
180468
|
process.exit(1);
|
|
180330
180469
|
}
|
|
180331
180470
|
return {
|
|
@@ -180344,7 +180483,7 @@ var preparePullConfig = async (options, from) => {
|
|
|
180344
180483
|
if (dialect5 === "turso") {
|
|
180345
180484
|
const parsed2 = libSQLCredentials.safeParse(config);
|
|
180346
180485
|
if (!parsed2.success) {
|
|
180347
|
-
|
|
180486
|
+
printConfigConnectionIssues4(config, "pull");
|
|
180348
180487
|
process.exit(1);
|
|
180349
180488
|
}
|
|
180350
180489
|
return {
|
|
@@ -180363,7 +180502,7 @@ var preparePullConfig = async (options, from) => {
|
|
|
180363
180502
|
if (dialect5 === "gel") {
|
|
180364
180503
|
const parsed2 = gelCredentials.safeParse(config);
|
|
180365
180504
|
if (!parsed2.success) {
|
|
180366
|
-
|
|
180505
|
+
printConfigConnectionIssues3(config);
|
|
180367
180506
|
process.exit(1);
|
|
180368
180507
|
}
|
|
180369
180508
|
return {
|
|
@@ -180416,6 +180555,14 @@ var preparePullConfig = async (options, from) => {
|
|
|
180416
180555
|
migrationsTable: table6
|
|
180417
180556
|
};
|
|
180418
180557
|
}
|
|
180558
|
+
if (dialect5 === "duckdb") {
|
|
180559
|
+
console.log(
|
|
180560
|
+
error2(
|
|
180561
|
+
`You can't use 'pull' command with DuckDb dialect`
|
|
180562
|
+
)
|
|
180563
|
+
);
|
|
180564
|
+
process.exit(1);
|
|
180565
|
+
}
|
|
180419
180566
|
assertUnreachable(dialect5);
|
|
180420
180567
|
};
|
|
180421
180568
|
var prepareStudioConfig = async (options) => {
|
|
@@ -180438,7 +180585,7 @@ var prepareStudioConfig = async (options) => {
|
|
|
180438
180585
|
if (dialect5 === "postgresql") {
|
|
180439
180586
|
const parsed = postgresCredentials.safeParse(flattened);
|
|
180440
180587
|
if (!parsed.success) {
|
|
180441
|
-
|
|
180588
|
+
printConfigConnectionIssues7(flattened);
|
|
180442
180589
|
process.exit(1);
|
|
180443
180590
|
}
|
|
180444
180591
|
const credentials2 = parsed.data;
|
|
@@ -180454,7 +180601,7 @@ var prepareStudioConfig = async (options) => {
|
|
|
180454
180601
|
if (dialect5 === "mysql") {
|
|
180455
180602
|
const parsed = mysqlCredentials.safeParse(flattened);
|
|
180456
180603
|
if (!parsed.success) {
|
|
180457
|
-
|
|
180604
|
+
printConfigConnectionIssues6(flattened);
|
|
180458
180605
|
process.exit(1);
|
|
180459
180606
|
}
|
|
180460
180607
|
const credentials2 = parsed.data;
|
|
@@ -180470,7 +180617,7 @@ var prepareStudioConfig = async (options) => {
|
|
|
180470
180617
|
if (dialect5 === "singlestore") {
|
|
180471
180618
|
const parsed = singlestoreCredentials.safeParse(flattened);
|
|
180472
180619
|
if (!parsed.success) {
|
|
180473
|
-
|
|
180620
|
+
printConfigConnectionIssues8(flattened);
|
|
180474
180621
|
process.exit(1);
|
|
180475
180622
|
}
|
|
180476
180623
|
const credentials2 = parsed.data;
|
|
@@ -180486,7 +180633,7 @@ var prepareStudioConfig = async (options) => {
|
|
|
180486
180633
|
if (dialect5 === "sqlite") {
|
|
180487
180634
|
const parsed = sqliteCredentials.safeParse(flattened);
|
|
180488
180635
|
if (!parsed.success) {
|
|
180489
|
-
|
|
180636
|
+
printConfigConnectionIssues9(flattened, "studio");
|
|
180490
180637
|
process.exit(1);
|
|
180491
180638
|
}
|
|
180492
180639
|
const credentials2 = parsed.data;
|
|
@@ -180502,7 +180649,7 @@ var prepareStudioConfig = async (options) => {
|
|
|
180502
180649
|
if (dialect5 === "turso") {
|
|
180503
180650
|
const parsed = libSQLCredentials.safeParse(flattened);
|
|
180504
180651
|
if (!parsed.success) {
|
|
180505
|
-
|
|
180652
|
+
printConfigConnectionIssues4(flattened, "studio");
|
|
180506
180653
|
process.exit(1);
|
|
180507
180654
|
}
|
|
180508
180655
|
const credentials2 = parsed.data;
|
|
@@ -180536,6 +180683,21 @@ var prepareStudioConfig = async (options) => {
|
|
|
180536
180683
|
if (dialect5 === "mssql") {
|
|
180537
180684
|
throw new Error(`You can't use 'studio' command with MsSql dialect yet`);
|
|
180538
180685
|
}
|
|
180686
|
+
if (dialect5 === "duckdb") {
|
|
180687
|
+
const parsed = duckdbCredentials.safeParse(flattened);
|
|
180688
|
+
if (!parsed.success) {
|
|
180689
|
+
printConfigConnectionIssues2(flattened);
|
|
180690
|
+
process.exit(1);
|
|
180691
|
+
}
|
|
180692
|
+
const credentials2 = parsed.data;
|
|
180693
|
+
return {
|
|
180694
|
+
dialect: dialect5,
|
|
180695
|
+
schema: schema5,
|
|
180696
|
+
host,
|
|
180697
|
+
port,
|
|
180698
|
+
credentials: credentials2
|
|
180699
|
+
};
|
|
180700
|
+
}
|
|
180539
180701
|
assertUnreachable(dialect5);
|
|
180540
180702
|
};
|
|
180541
180703
|
var migrateConfig = objectType({
|
|
@@ -180557,7 +180719,7 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180557
180719
|
if (dialect5 === "postgresql") {
|
|
180558
180720
|
const parsed2 = postgresCredentials.safeParse(flattened);
|
|
180559
180721
|
if (!parsed2.success) {
|
|
180560
|
-
|
|
180722
|
+
printConfigConnectionIssues7(flattened);
|
|
180561
180723
|
process.exit(1);
|
|
180562
180724
|
}
|
|
180563
180725
|
const credentials2 = parsed2.data;
|
|
@@ -180572,7 +180734,7 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180572
180734
|
if (dialect5 === "mysql") {
|
|
180573
180735
|
const parsed2 = mysqlCredentials.safeParse(flattened);
|
|
180574
180736
|
if (!parsed2.success) {
|
|
180575
|
-
|
|
180737
|
+
printConfigConnectionIssues6(flattened);
|
|
180576
180738
|
process.exit(1);
|
|
180577
180739
|
}
|
|
180578
180740
|
const credentials2 = parsed2.data;
|
|
@@ -180587,7 +180749,7 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180587
180749
|
if (dialect5 === "singlestore") {
|
|
180588
180750
|
const parsed2 = singlestoreCredentials.safeParse(flattened);
|
|
180589
180751
|
if (!parsed2.success) {
|
|
180590
|
-
|
|
180752
|
+
printConfigConnectionIssues8(flattened);
|
|
180591
180753
|
process.exit(1);
|
|
180592
180754
|
}
|
|
180593
180755
|
const credentials2 = parsed2.data;
|
|
@@ -180602,7 +180764,7 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180602
180764
|
if (dialect5 === "sqlite") {
|
|
180603
180765
|
const parsed2 = sqliteCredentials.safeParse(flattened);
|
|
180604
180766
|
if (!parsed2.success) {
|
|
180605
|
-
|
|
180767
|
+
printConfigConnectionIssues9(flattened, "migrate");
|
|
180606
180768
|
process.exit(1);
|
|
180607
180769
|
}
|
|
180608
180770
|
const credentials2 = parsed2.data;
|
|
@@ -180617,7 +180779,7 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180617
180779
|
if (dialect5 === "turso") {
|
|
180618
180780
|
const parsed2 = libSQLCredentials.safeParse(flattened);
|
|
180619
180781
|
if (!parsed2.success) {
|
|
180620
|
-
|
|
180782
|
+
printConfigConnectionIssues4(flattened, "migrate");
|
|
180621
180783
|
process.exit(1);
|
|
180622
180784
|
}
|
|
180623
180785
|
const credentials2 = parsed2.data;
|
|
@@ -180640,7 +180802,7 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180640
180802
|
if (dialect5 === "mssql") {
|
|
180641
180803
|
const parsed2 = mssqlCredentials.safeParse(flattened);
|
|
180642
180804
|
if (!parsed2.success) {
|
|
180643
|
-
|
|
180805
|
+
printConfigConnectionIssues5(flattened);
|
|
180644
180806
|
process.exit(1);
|
|
180645
180807
|
}
|
|
180646
180808
|
const credentials2 = parsed2.data;
|
|
@@ -180667,6 +180829,14 @@ var prepareMigrateConfig = async (configPath) => {
|
|
|
180667
180829
|
table: table6
|
|
180668
180830
|
};
|
|
180669
180831
|
}
|
|
180832
|
+
if (dialect5 === "duckdb") {
|
|
180833
|
+
console.log(
|
|
180834
|
+
error2(
|
|
180835
|
+
`You can't use 'migrate' command with DuckDb dialect`
|
|
180836
|
+
)
|
|
180837
|
+
);
|
|
180838
|
+
process.exit(1);
|
|
180839
|
+
}
|
|
180670
180840
|
assertUnreachable(dialect5);
|
|
180671
180841
|
};
|
|
180672
180842
|
var drizzleConfigFromFile = async (configPath, isExport) => {
|
|
@@ -181539,10 +181709,9 @@ var updateUpToV62 = (json) => {
|
|
|
181539
181709
|
// src/cli/schema.ts
|
|
181540
181710
|
init_utils4();
|
|
181541
181711
|
init_common3();
|
|
181542
|
-
init_outputs();
|
|
181543
181712
|
init_views();
|
|
181544
181713
|
var optionDialect = string("dialect").enum(...dialects).desc(
|
|
181545
|
-
`Database dialect: 'gel', 'postgresql', 'mysql', 'sqlite', 'turso', 'singlestore' or 'mssql'`
|
|
181714
|
+
`Database dialect: 'gel', 'postgresql', 'mysql', 'sqlite', 'turso', 'singlestore', 'duckdb' or 'mssql'`
|
|
181546
181715
|
);
|
|
181547
181716
|
var optionOut = string().desc("Output folder, 'drizzle' by default");
|
|
181548
181717
|
var optionConfig = string().desc("Path to drizzle config file");
|
|
@@ -181603,6 +181772,13 @@ var generate = command({
|
|
|
181603
181772
|
} else if (dialect5 === "cockroach") {
|
|
181604
181773
|
const { handle: handle21 } = await Promise.resolve().then(() => (init_generate_cockroach(), generate_cockroach_exports));
|
|
181605
181774
|
await handle21(opts);
|
|
181775
|
+
} else if (dialect5 === "duckdb") {
|
|
181776
|
+
console.log(
|
|
181777
|
+
error2(
|
|
181778
|
+
`You can't use 'generate' command with DuckDb dialect`
|
|
181779
|
+
)
|
|
181780
|
+
);
|
|
181781
|
+
process.exit(1);
|
|
181606
181782
|
} else {
|
|
181607
181783
|
assertUnreachable(dialect5);
|
|
181608
181784
|
}
|
|
@@ -182069,7 +182245,8 @@ var studio = command({
|
|
|
182069
182245
|
drizzleForSQLite: drizzleForSQLite2,
|
|
182070
182246
|
prepareSingleStoreSchema: prepareSingleStoreSchema2,
|
|
182071
182247
|
drizzleForSingleStore: drizzleForSingleStore2,
|
|
182072
|
-
drizzleForLibSQL: drizzleForLibSQL2
|
|
182248
|
+
drizzleForLibSQL: drizzleForLibSQL2,
|
|
182249
|
+
drizzleForDuckDb: drizzleForDuckDb2
|
|
182073
182250
|
// drizzleForMsSQL,
|
|
182074
182251
|
} = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
182075
182252
|
let setup;
|
|
@@ -182114,6 +182291,8 @@ var studio = command({
|
|
|
182114
182291
|
files,
|
|
182115
182292
|
casing2
|
|
182116
182293
|
);
|
|
182294
|
+
} else if (dialect5 === "duckdb") {
|
|
182295
|
+
setup = await drizzleForDuckDb2(credentials2);
|
|
182117
182296
|
} else if (dialect5 === "cockroach") {
|
|
182118
182297
|
throw new Error(`You can't use 'studio' command with 'cockroach' dialect`);
|
|
182119
182298
|
} else {
|
|
@@ -182121,12 +182300,6 @@ var studio = command({
|
|
|
182121
182300
|
}
|
|
182122
182301
|
const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
182123
182302
|
const server = await prepareServer2(setup);
|
|
182124
|
-
console.log();
|
|
182125
|
-
console.log(
|
|
182126
|
-
withStyle.fullWarning(
|
|
182127
|
-
"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"
|
|
182128
|
-
)
|
|
182129
|
-
);
|
|
182130
182303
|
const { certs: certs2 } = await Promise.resolve().then(() => (init_certs(), certs_exports));
|
|
182131
182304
|
const { key, cert } = await certs2() || {};
|
|
182132
182305
|
server.start({
|
|
@@ -182199,6 +182372,13 @@ var exportRaw = command({
|
|
|
182199
182372
|
} else if (dialect5 === "cockroach") {
|
|
182200
182373
|
const { handleExport: handleExport7 } = await Promise.resolve().then(() => (init_generate_cockroach(), generate_cockroach_exports));
|
|
182201
182374
|
await handleExport7(opts);
|
|
182375
|
+
} else if (dialect5 === "duckdb") {
|
|
182376
|
+
console.log(
|
|
182377
|
+
error2(
|
|
182378
|
+
`You can't use 'export' command with DuckDb dialect`
|
|
182379
|
+
)
|
|
182380
|
+
);
|
|
182381
|
+
process.exit(1);
|
|
182202
182382
|
} else {
|
|
182203
182383
|
assertUnreachable(dialect5);
|
|
182204
182384
|
}
|