drizzle-kit 1.0.0-beta.3-7648fde → 1.0.0-beta.3-702eadc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin.cjs CHANGED
@@ -5892,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
  }
@@ -9498,7 +9499,6 @@ var init_stringify = __esm({
9498
9499
  case `number`:
9499
9500
  return Number.isFinite(value) ? value.toString() : `null`;
9500
9501
  case `boolean`:
9501
- return value.toString();
9502
9502
  case `bigint`:
9503
9503
  return n5 ? `${value.toString()}n` : value.toString();
9504
9504
  case `object`: {
@@ -21141,7 +21141,7 @@ function formatTime(date2) {
21141
21141
  const iso = instant.toString({ timeZone: "UTC" });
21142
21142
  return iso;
21143
21143
  }
21144
- var SmallInt2, Int2, BigInt3, Numeric, Real2, Double2, Boolean3, Char2, Varchar2, Text2, toDefaultArray, Json2, Jsonb, Time2, TimeTz, DateType, Timestamp2, TimestampTz, Uuid, Interval2, Inet, Cidr, MacAddr, MacAddr8, Vector, HalfVec, SparseVec, Bit, Point, Line, GeometryPoint, Enum2, Serial2, BigSerial, SmallSerial, Custom2, typeFor2, splitSqlType, vectorOps, indexName, isSerialExpression, parseOnType, systemNamespaceNames, isSystemNamespace, wrapRecord, parseViewDefinition, defaultNameForIdentitySequence, defaultNameForPK, defaultNameForFK2, defaultNameForUnique, defaultNameForIndex, trimDefaultValueSuffix, defaultForColumn, defaultToSQL, isDefaultAction, isSerialType, mapSerialToInt, defaultsCommutative, defaults;
21144
+ var SmallInt2, Int2, BigInt3, Numeric, Real2, Double2, Boolean3, Char2, Varchar2, Text2, toDefaultArray, Json2, Jsonb, Time2, TimeTz, DateType, Timestamp2, TimestampTz, Uuid, Interval2, Inet, Cidr, MacAddr, MacAddr8, Vector, HalfVec, SparseVec, Bit, Point, Line, GeometryPoint, Enum2, Serial2, BigSerial, SmallSerial, Custom2, typeFor2, splitSqlType, vectorOps, indexName, isSerialExpression, parseOnType, systemNamespaceNames, isSystemNamespace, wrapRecord, parseViewDefinition, defaultNameForIdentitySequence, defaultNameForPK, defaultNameForFK2, defaultNameForUnique, defaultNameForIndex, trimDefaultValueSuffix, defaultForColumn, defaultToSQL, isDefaultAction, isSerialType, defaultsCommutative, defaults;
21145
21145
  var init_grammar2 = __esm({
21146
21146
  "src/dialects/postgres/grammar.ts"() {
21147
21147
  "use strict";
@@ -22733,18 +22733,6 @@ var init_grammar2 = __esm({
22733
22733
  isSerialType = (type) => {
22734
22734
  return /^(?:serial|bigserial|smallserial)$/i.test(type);
22735
22735
  };
22736
- mapSerialToInt = (type) => {
22737
- switch (type) {
22738
- case "smallserial":
22739
- return "smallint";
22740
- case "serial":
22741
- return "int";
22742
- case "bigserial":
22743
- return "bigint";
22744
- default:
22745
- throw new Error(`Unsupported type: ${type}`);
22746
- }
22747
- };
22748
22736
  defaultsCommutative = (diffDef, type, dimensions) => {
22749
22737
  if (!diffDef) return false;
22750
22738
  let from = diffDef.from;
@@ -34315,6 +34303,9 @@ var init_utils_node = __esm({
34315
34303
  case "gel":
34316
34304
  throw Error("gel validator is not implemented yet");
34317
34305
  // TODO
34306
+ case "duckdb":
34307
+ throw Error("duckdb validator is not implemented yet");
34308
+ // TODO
34318
34309
  default:
34319
34310
  assertUnreachable(dialect5);
34320
34311
  }
@@ -38995,7 +38986,7 @@ var init_convertor = __esm({
38995
38986
  });
38996
38987
  alterColumnConvertor = convertor("alter_column", (st2) => {
38997
38988
  var _a5;
38998
- const { diff: diff2, to: column11, isEnum, wasEnum, wasSerial, toSerial } = st2;
38989
+ const { diff: diff2, to: column11, isEnum, wasEnum, wasSerial } = st2;
38999
38990
  const statements = [];
39000
38991
  const key = column11.schema !== "public" ? `"${column11.schema}"."${column11.table}"` : `"${column11.table}"`;
39001
38992
  const recreateDefault = diff2.type && (isEnum || wasEnum) && diff2.$left.default;
@@ -39005,21 +38996,17 @@ var init_convertor = __esm({
39005
38996
  if (diff2.type) {
39006
38997
  const typeSchema = column11.typeSchema && column11.typeSchema !== "public" ? `"${column11.typeSchema}".` : "";
39007
38998
  const textProxy = wasEnum && isEnum ? "text::" : "";
39008
- const suffix = isEnum ? ` USING "${column11.name}"::${textProxy}${typeSchema}"${column11.type}"${"[]".repeat(column11.dimensions)}` : ` USING "${column11.name}"::${toSerial ? mapSerialToInt(column11.type) : column11.type}${"[]".repeat(column11.dimensions)}`;
39009
- const type = ((_a5 = diff2.typeSchema) == null ? void 0 : _a5.to) && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : toSerial ? mapSerialToInt(diff2.type.to) : diff2.type.to;
39010
- if (wasSerial) {
39011
- statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column11.name}" DROP DEFAULT;`);
39012
- const sequenceKey = column11.schema !== "public" ? `"${column11.schema}"."${column11.table}_${column11.name}_seq"` : `"${column11.table}_${column11.name}_seq"`;
39013
- statements.push(`DROP SEQUENCE ${sequenceKey};`);
38999
+ const suffix = isEnum ? ` USING "${column11.name}"::${textProxy}${typeSchema}"${column11.type}"${"[]".repeat(column11.dimensions)}` : ` USING "${column11.name}"::${column11.type}${"[]".repeat(column11.dimensions)}`;
39000
+ let type;
39001
+ if (diff2.type) {
39002
+ type = ((_a5 = diff2.typeSchema) == null ? void 0 : _a5.to) && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : diff2.type.to;
39003
+ } else {
39004
+ type = `${typeSchema}${column11.typeSchema ? `"${column11.type}"` : column11.type}`;
39014
39005
  }
39015
- if (toSerial) {
39006
+ if (wasSerial) {
39007
+ statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column11.name}" DROP DEFAULT`);
39016
39008
  const sequenceKey = column11.schema !== "public" ? `"${column11.schema}"."${column11.table}_${column11.name}_seq"` : `"${column11.table}_${column11.name}_seq"`;
39017
- const sequenceName = column11.schema !== "public" ? `${column11.schema}.${column11.table}_${column11.name}_seq` : `${column11.table}_${column11.name}_seq`;
39018
- statements.push(`CREATE SEQUENCE ${sequenceKey};`);
39019
- statements.push(
39020
- `ALTER TABLE ${key} ALTER COLUMN "${column11.name}" SET DEFAULT nextval('${sequenceName}')`
39021
- );
39022
- statements.push(`ALTER SEQUENCE ${sequenceKey} OWNED BY "${column11.schema}"."${column11.table}"."${column11.name}";`);
39009
+ statements.push(`DROP SEQUENCE ${sequenceKey}`);
39023
39010
  }
39024
39011
  statements.push(
39025
39012
  `ALTER TABLE ${key} ALTER COLUMN "${column11.name}" SET DATA TYPE ${type}${"[]".repeat(column11.dimensions)}${suffix};`
@@ -40325,7 +40312,6 @@ var init_diff = __esm({
40325
40312
  }).map((it2) => {
40326
40313
  const column11 = it2.$right;
40327
40314
  const wasSerial = isSerialType(it2.$left.type);
40328
- const toSerial = !isSerialType(it2.$left.type) && isSerialType(it2.$right.type);
40329
40315
  const isEnum = ddl22.enums.one({ schema: column11.typeSchema ?? "public", name: column11.type }) !== null;
40330
40316
  const wasEnum = (it2.type && ddl1.enums.one({ schema: column11.typeSchema ?? "public", name: it2.type.from }) !== null) ?? false;
40331
40317
  return prepareStatement("alter_column", {
@@ -40333,8 +40319,7 @@ var init_diff = __esm({
40333
40319
  to: column11,
40334
40320
  isEnum,
40335
40321
  wasEnum,
40336
- wasSerial,
40337
- toSerial
40322
+ wasSerial
40338
40323
  });
40339
40324
  });
40340
40325
  const createSequences = createdSequences.map((it2) => prepareStatement("create_sequence", { sequence: it2 }));
@@ -41591,15 +41576,6 @@ var init_diff2 = __esm({
41591
41576
  });
41592
41577
  for (const pk of alters.filter((x6) => x6.entityType === "pks")) {
41593
41578
  if (pk.columns) {
41594
- const fks = ddl22.fks.list({ tableTo: pk.table });
41595
- const fksFound = fks.filter((fk5) => {
41596
- if (fk5.columnsTo.length !== pk.$left.columns.length) return false;
41597
- return fk5.columnsTo.every((fkCol) => pk.$left.columns.includes(fkCol));
41598
- });
41599
- for (const fk5 of fksFound) {
41600
- dropFKStatements.push({ type: "drop_constraint", table: fk5.table, constraint: fk5.name, dropAutoIndex: false });
41601
- createFKsStatements.push({ type: "create_fk", fk: fk5, cause: "alter_pk" });
41602
- }
41603
41579
  dropPKStatements.push({ type: "drop_pk", pk: pk.$left });
41604
41580
  createPKStatements.push({ type: "create_pk", pk: pk.$right });
41605
41581
  }
@@ -41612,28 +41588,26 @@ var init_diff2 = __esm({
41612
41588
  }
41613
41589
  }
41614
41590
  const statements = [
41615
- .../* @__PURE__ */ new Set([
41616
- ...createTableStatements,
41617
- ...dropFKStatements,
41618
- ...dropTableStatements,
41619
- ...renameTableStatements,
41620
- ...renameColumnsStatement,
41621
- ...dropViewStatements,
41622
- ...renameViewStatements,
41623
- ...alterViewStatements,
41624
- ...dropCheckStatements,
41625
- ...dropIndexeStatements,
41626
- ...dropPKStatements,
41627
- ...columnAlterStatements,
41628
- ...columnRecreateStatatements,
41629
- ...addColumnsStatemets,
41630
- ...createPKStatements,
41631
- ...createIndexesStatements,
41632
- ...createFKsStatements,
41633
- ...createCheckStatements,
41634
- ...dropColumnStatements,
41635
- ...createViewStatements
41636
- ])
41591
+ ...createTableStatements,
41592
+ ...dropFKStatements,
41593
+ ...dropTableStatements,
41594
+ ...renameTableStatements,
41595
+ ...renameColumnsStatement,
41596
+ ...dropViewStatements,
41597
+ ...renameViewStatements,
41598
+ ...alterViewStatements,
41599
+ ...dropCheckStatements,
41600
+ ...dropIndexeStatements,
41601
+ ...dropPKStatements,
41602
+ ...columnAlterStatements,
41603
+ ...columnRecreateStatatements,
41604
+ ...addColumnsStatemets,
41605
+ ...createPKStatements,
41606
+ ...createIndexesStatements,
41607
+ ...createFKsStatements,
41608
+ ...createCheckStatements,
41609
+ ...dropColumnStatements,
41610
+ ...createViewStatements
41637
41611
  ];
41638
41612
  const res = fromJson2(statements);
41639
41613
  return {
@@ -41650,10 +41624,9 @@ var init_diff2 = __esm({
41650
41624
  var generate_mysql_exports = {};
41651
41625
  __export(generate_mysql_exports, {
41652
41626
  handle: () => handle2,
41653
- handleExport: () => handleExport2,
41654
- suggestions: () => suggestions
41627
+ handleExport: () => handleExport2
41655
41628
  });
41656
- var suggestions, handle2, handleExport2;
41629
+ var handle2, handleExport2;
41657
41630
  var init_generate_mysql = __esm({
41658
41631
  "src/cli/commands/generate-mysql.ts"() {
41659
41632
  "use strict";
@@ -41663,57 +41636,8 @@ var init_generate_mysql = __esm({
41663
41636
  init_ddl();
41664
41637
  init_diff2();
41665
41638
  init_prompts();
41666
- init_outputs();
41667
41639
  init_views();
41668
41640
  init_generate_common();
41669
- suggestions = (jsonStatements, ddl22) => {
41670
- const grouped = { errors: [], hints: [] };
41671
- for (const statement of jsonStatements) {
41672
- if (statement.type === "create_fk" && statement.cause !== "alter_pk") {
41673
- const { columnsTo, table: table6, tableTo, columns } = statement.fk;
41674
- const indexes = ddl22.indexes.list({ isUnique: true, table: tableTo });
41675
- const pk = ddl22.pks.one({ table: tableTo });
41676
- const columnsToSet = new Set(columnsTo);
41677
- const isUniqueFound = indexes.some((index6) => {
41678
- if (index6.columns.length !== columnsToSet.size) {
41679
- return false;
41680
- }
41681
- return index6.columns.every((col) => columnsToSet.has(col.value));
41682
- });
41683
- const isPkFound = pk && pk.columns.length === columnsToSet.size && pk.columns.every((col) => columnsToSet.has(col));
41684
- if (isPkFound || isUniqueFound) continue;
41685
- let composite = columnsTo.length > 1 ? "composite " : "";
41686
- grouped.errors.push(
41687
- `\xB7 You are trying to add reference from "${table6}" ("${columns.join('", ')}") to "${tableTo}" ("${columnsTo.join(
41688
- '", '
41689
- )}"). The referenced columns are not guaranteed to be unique together. A foreign key must point to a PRIMARY KEY or a set of columns with a UNIQUE constraint. You should add a ${composite}unique constraint to the referenced columns`
41690
- );
41691
- continue;
41692
- }
41693
- if (statement.type === "drop_pk") {
41694
- const { table: table6, columns } = statement.pk;
41695
- const fks = ddl22.fks.list({ tableTo: table6 });
41696
- const indexes = ddl22.indexes.list({ table: table6 });
41697
- const fkFound = fks.filter((fk5) => {
41698
- if (fk5.columnsTo.length !== columns.length) return false;
41699
- return fk5.columnsTo.every((fkCol) => columns.includes(fkCol));
41700
- });
41701
- if (fkFound.length === 0) continue;
41702
- const indexesFound = indexes.some((index6) => {
41703
- if (index6.columns.length !== columns.length) {
41704
- return false;
41705
- }
41706
- return index6.columns.every((col) => columns.includes(col.value));
41707
- });
41708
- if (indexesFound) continue;
41709
- grouped.errors.push(
41710
- `\xB7 You are trying to drop primary key from "${table6}" ("${columns.join('", ')}"), but there is an existing reference on this column. You must either add a UNIQUE constraint to ("${columns.join('", ')}") or drop the foreign key constraint that references this column.`
41711
- );
41712
- continue;
41713
- }
41714
- }
41715
- return grouped;
41716
- };
41717
41641
  handle2 = async (config) => {
41718
41642
  const outFolder = config.out;
41719
41643
  const schemaPath = config.schema;
@@ -41734,7 +41658,7 @@ var init_generate_mysql = __esm({
41734
41658
  });
41735
41659
  return;
41736
41660
  }
41737
- const { sqlStatements, renames, groupedStatements, statements } = await ddlDiff2(
41661
+ const { sqlStatements, renames, groupedStatements } = await ddlDiff2(
41738
41662
  ddlPrev,
41739
41663
  ddlCur,
41740
41664
  resolver("table"),
@@ -41742,11 +41666,6 @@ var init_generate_mysql = __esm({
41742
41666
  resolver("view"),
41743
41667
  "default"
41744
41668
  );
41745
- const { errors } = suggestions(statements, ddlCur);
41746
- if (errors.length) {
41747
- console.log(errors.map((err2) => withStyle.errorWarning(err2)).join("\n\n"));
41748
- process.exit(1);
41749
- }
41750
41669
  const explainMessage = explain("mysql", groupedStatements, false, []);
41751
41670
  if (explainMessage) console.log(explainMessage);
41752
41671
  writeResult({
@@ -43280,7 +43199,7 @@ WITH`;
43280
43199
  if (viewMetadata) options.push(`VIEW_METADATA`);
43281
43200
  statement += ` ${options.join(", ")}`;
43282
43201
  }
43283
- statement += ` AS ${definition}`;
43202
+ statement += ` AS (${definition})`;
43284
43203
  statement += checkOption ? `
43285
43204
  WITH CHECK OPTION` : "";
43286
43205
  statement += ";";
@@ -43309,7 +43228,7 @@ WITH`;
43309
43228
  if (viewMetadata) options.push(`VIEW_METADATA`);
43310
43229
  statement += ` ${options.join(", ")}`;
43311
43230
  }
43312
- statement += ` AS ${definition}`;
43231
+ statement += ` AS (${definition})`;
43313
43232
  statement += checkOption ? `
43314
43233
  WITH CHECK OPTION` : "";
43315
43234
  statement += ";";
@@ -164393,6 +164312,7 @@ __export(connections_exports, {
164393
164312
  connectToSQLite: () => connectToSQLite,
164394
164313
  connectToSingleStore: () => connectToSingleStore,
164395
164314
  prepareCockroach: () => prepareCockroach,
164315
+ prepareDuckDb: () => prepareDuckDb,
164396
164316
  prepareGelDB: () => prepareGelDB,
164397
164317
  preparePostgresDB: () => preparePostgresDB
164398
164318
  });
@@ -164409,7 +164329,7 @@ function parseMssqlUrl(url) {
164409
164329
  }
164410
164330
  };
164411
164331
  }
164412
- 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;
164413
164333
  var init_connections = __esm({
164414
164334
  "src/cli/connections.ts"() {
164415
164335
  "use strict";
@@ -164545,7 +164465,13 @@ var init_connections = __esm({
164545
164465
  }
164546
164466
  return results;
164547
164467
  };
164548
- return { packageName: "pglite", query, proxy, transactionProxy, migrate: migrateFn };
164468
+ return {
164469
+ packageName: "pglite",
164470
+ query,
164471
+ proxy,
164472
+ transactionProxy,
164473
+ migrate: migrateFn
164474
+ };
164549
164475
  }
164550
164476
  assertUnreachable(driver2);
164551
164477
  }
@@ -164786,7 +164712,13 @@ var init_connections = __esm({
164786
164712
  }
164787
164713
  return results;
164788
164714
  };
164789
- return { packageName: "postgres", query, proxy, transactionProxy, migrate: migrateFn };
164715
+ return {
164716
+ packageName: "postgres",
164717
+ query,
164718
+ proxy,
164719
+ transactionProxy,
164720
+ migrate: migrateFn
164721
+ };
164790
164722
  }
164791
164723
  if (await checkPackage("@vercel/postgres")) {
164792
164724
  console.log(
@@ -164867,7 +164799,13 @@ var init_connections = __esm({
164867
164799
  }
164868
164800
  return results;
164869
164801
  };
164870
- return { packageName: "@vercel/postgres", query, proxy, transactionProxy, migrate: migrateFn };
164802
+ return {
164803
+ packageName: "@vercel/postgres",
164804
+ query,
164805
+ proxy,
164806
+ transactionProxy,
164807
+ migrate: migrateFn
164808
+ };
164871
164809
  }
164872
164810
  if (await checkPackage("@neondatabase/serverless")) {
164873
164811
  console.log(
@@ -164880,7 +164818,11 @@ var init_connections = __esm({
164880
164818
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
164881
164819
  )
164882
164820
  );
164883
- const { Pool, neonConfig, types: pgTypes } = await import("@neondatabase/serverless");
164821
+ const {
164822
+ Pool,
164823
+ neonConfig,
164824
+ types: pgTypes
164825
+ } = await import("@neondatabase/serverless");
164884
164826
  const { drizzle } = await import("drizzle-orm/neon-serverless");
164885
164827
  const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
164886
164828
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
@@ -164950,7 +164892,13 @@ var init_connections = __esm({
164950
164892
  }
164951
164893
  return results;
164952
164894
  };
164953
- return { packageName: "@neondatabase/serverless", query, proxy, transactionProxy, migrate: migrateFn };
164895
+ return {
164896
+ packageName: "@neondatabase/serverless",
164897
+ query,
164898
+ proxy,
164899
+ transactionProxy,
164900
+ migrate: migrateFn
164901
+ };
164954
164902
  }
164955
164903
  if (await checkPackage("bun")) {
164956
164904
  console.log(withStyle.info(`Using 'bun' driver for database querying`));
@@ -165001,6 +164949,54 @@ var init_connections = __esm({
165001
164949
  console.warn("For the 'bun' driver, run your script using: bun --bun");
165002
164950
  process.exit(1);
165003
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
+ };
165004
165000
  prepareCockroach = async (credentials2) => {
165005
165001
  if (await checkPackage("pg")) {
165006
165002
  const { default: pg } = await import("pg");
@@ -165053,9 +165049,7 @@ var init_connections = __esm({
165053
165049
  };
165054
165050
  return { query, proxy, migrate: migrateFn };
165055
165051
  }
165056
- console.error(
165057
- "To connect to Cockroach - please install 'pg' package"
165058
- );
165052
+ console.error("To connect to Cockroach - please install 'pg' package");
165059
165053
  process.exit(1);
165060
165054
  };
165061
165055
  prepareGelDB = async (credentials2) => {
@@ -165114,9 +165108,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165114
165108
  };
165115
165109
  return { packageName: "gel", query, proxy, transactionProxy };
165116
165110
  }
165117
- console.error(
165118
- "To connect to gel database - please install 'edgedb' driver"
165119
- );
165111
+ console.error("To connect to gel database - please install 'edgedb' driver");
165120
165112
  process.exit(1);
165121
165113
  };
165122
165114
  parseSingleStoreCredentials = (credentials2) => {
@@ -165568,9 +165560,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165568
165560
  migrate: migrateFn
165569
165561
  };
165570
165562
  }
165571
- console.error(
165572
- "To connect to MsSQL database - please install 'mssql' driver"
165573
- );
165563
+ console.error("To connect to MsSQL database - please install 'mssql' driver");
165574
165564
  process.exit(1);
165575
165565
  };
165576
165566
  prepareSqliteParams = (params, driver2) => {
@@ -165675,7 +165665,10 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165675
165665
  await remoteCallback(query2, [], "run");
165676
165666
  };
165677
165667
  const proxy = async (params) => {
165678
- const preparedParams = prepareSqliteParams(params.params || [], "d1-http");
165668
+ const preparedParams = prepareSqliteParams(
165669
+ params.params || [],
165670
+ "d1-http"
165671
+ );
165679
165672
  const result2 = await remoteCallback(
165680
165673
  params.sql,
165681
165674
  preparedParams,
@@ -165900,17 +165893,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165900
165893
  };
165901
165894
  const transactionProxy = async (queries) => {
165902
165895
  const results = [];
165903
- const tx = sqlite.transaction((queries2) => {
165904
- for (const query of queries2) {
165905
- let result2 = [];
165906
- if (query.method === "values" || query.method === "get" || query.method === "all") {
165907
- result2 = sqlite.prepare(query.sql).all();
165908
- } else {
165909
- sqlite.prepare(query.sql).run();
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);
165910
165906
  }
165911
- results.push(result2);
165912
165907
  }
165913
- });
165908
+ );
165914
165909
  try {
165915
165910
  tx(queries);
165916
165911
  } catch (error4) {
@@ -165918,7 +165913,13 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165918
165913
  }
165919
165914
  return results;
165920
165915
  };
165921
- return { ...db, packageName: "better-sqlite3", proxy, transactionProxy, migrate: migrateFn };
165916
+ return {
165917
+ ...db,
165918
+ packageName: "better-sqlite3",
165919
+ proxy,
165920
+ transactionProxy,
165921
+ migrate: migrateFn
165922
+ };
165922
165923
  }
165923
165924
  if (await checkPackage("bun")) {
165924
165925
  console.log(withStyle.info(`Using 'bun' driver for database querying`));
@@ -169126,9 +169127,9 @@ var init_pull_mysql = __esm({
169126
169127
  var push_mysql_exports = {};
169127
169128
  __export(push_mysql_exports, {
169128
169129
  handle: () => handle8,
169129
- suggestions: () => suggestions2
169130
+ suggestions: () => suggestions
169130
169131
  });
169131
- var import_hanji8, handle8, identifier, suggestions2;
169132
+ var import_hanji8, handle8, identifier, suggestions;
169132
169133
  var init_push_mysql = __esm({
169133
169134
  "src/cli/commands/push-mysql.ts"() {
169134
169135
  "use strict";
@@ -169175,7 +169176,7 @@ ${filenames.join("\n")}
169175
169176
  if (filteredStatements.length === 0) {
169176
169177
  (0, import_hanji8.render)(`[${source_default.blue("i")}] No changes detected`);
169177
169178
  }
169178
- const hints = await suggestions2(db, filteredStatements, ddl22);
169179
+ const hints = await suggestions(db, filteredStatements);
169179
169180
  const explainMessage = explain("mysql", groupedStatements, explainFlag, hints);
169180
169181
  if (explainMessage) console.log(explainMessage);
169181
169182
  if (explainFlag) return;
@@ -169200,7 +169201,7 @@ ${filenames.join("\n")}
169200
169201
  identifier = ({ table: table6, column: column11 }) => {
169201
169202
  return [table6, column11].filter(Boolean).map((t6) => `\`${t6}\``).join(".");
169202
169203
  };
169203
- suggestions2 = async (db, jsonStatements, ddl22) => {
169204
+ suggestions = async (db, jsonStatements) => {
169204
169205
  const grouped = [];
169205
169206
  const filtered = jsonStatements.filter((it2) => {
169206
169207
  if (it2.type === "alter_column" && it2.diff.generated) return false;
@@ -169224,32 +169225,14 @@ ${filenames.join("\n")}
169224
169225
  continue;
169225
169226
  }
169226
169227
  if (statement.type === "drop_pk") {
169227
- const { table: table6, columns } = statement.pk;
169228
+ const table6 = statement.pk.table;
169228
169229
  const id = identifier({ table: table6 });
169229
169230
  const res = await db.query(
169230
169231
  `select 1 from ${id} limit 1`
169231
169232
  );
169232
- if (res.length > 0) {
169233
- const hint = `\xB7 You're about to drop ${source_default.underline(table6)} primary key, this statements may fail and your table may loose primary key`;
169234
- grouped.push({ hint });
169235
- }
169236
- const fks = ddl22.fks.list({ tableTo: table6 });
169237
- const indexes = ddl22.indexes.list({ isUnique: true, table: table6 });
169238
- const fkFound = fks.filter((fk5) => {
169239
- if (fk5.columnsTo.length !== columns.length) return false;
169240
- return fk5.columnsTo.every((fkCol) => columns.includes(fkCol));
169241
- });
169242
- if (fkFound.length === 0) continue;
169243
- const indexesFound = indexes.some((index6) => {
169244
- if (index6.columns.length !== columns.length) {
169245
- return false;
169246
- }
169247
- return index6.columns.every((col) => columns.includes(col.value));
169248
- });
169249
- if (indexesFound) continue;
169250
- grouped.push({
169251
- hint: `\xB7 You are trying to drop primary key from "${table6}" ("${columns.join('", ')}"), but there is an existing reference on this column. You must either add a UNIQUE constraint to ("${columns.join('", ')}") or drop the foreign key constraint that references this column.`
169252
- });
169233
+ if (res.length === 0) continue;
169234
+ const hint = `\xB7 You're about to drop ${source_default.underline(table6)} primary key, this statements may fail and your table may loose primary key`;
169235
+ grouped.push({ hint });
169253
169236
  continue;
169254
169237
  }
169255
169238
  if (statement.type === "add_column" && statement.column.notNull && statement.column.default === null && !statement.column.generated) {
@@ -169292,27 +169275,6 @@ ${filenames.join("\n")}
169292
169275
  });
169293
169276
  continue;
169294
169277
  }
169295
- if (statement.type === "create_fk" && statement.cause !== "alter_pk") {
169296
- const { columnsTo, table: table6, tableTo, columns } = statement.fk;
169297
- const indexes = ddl22.indexes.list({ isUnique: true, table: tableTo });
169298
- const pk = ddl22.pks.one({ table: tableTo });
169299
- const columnsToSet = new Set(columnsTo);
169300
- const isUniqueFound = indexes.some((index6) => {
169301
- if (index6.columns.length !== columnsToSet.size) {
169302
- return false;
169303
- }
169304
- return index6.columns.every((col) => columnsToSet.has(col.value));
169305
- });
169306
- const isPkFound = pk && pk.columns.length === columnsToSet.size && pk.columns.every((col) => columnsToSet.has(col));
169307
- if (isPkFound || isUniqueFound) continue;
169308
- let composite = columnsTo.length > 1 ? "composite " : "";
169309
- grouped.push({
169310
- hint: `\xB7 You are trying to add reference from "${table6}" ("${columns.join('", ')}") to "${tableTo}" ("${columnsTo.join(
169311
- '", '
169312
- )}"). The referenced columns are not guaranteed to be unique together. A foreign key must point to a PRIMARY KEY or a set of columns with a UNIQUE constraint. You should add a ${composite}unique constraint to the referenced columns`
169313
- });
169314
- continue;
169315
- }
169316
169278
  }
169317
169279
  return grouped;
169318
169280
  };
@@ -169732,7 +169694,7 @@ var init_introspect2 = __esm({
169732
169694
  });
169733
169695
  }
169734
169696
  for (const seq of sequencesList) {
169735
- const depend = dependList.find((it2) => it2.oid === seq.oid);
169697
+ const depend = dependList.find((it2) => Number(it2.oid) === Number(seq.oid));
169736
169698
  if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
169737
169699
  continue;
169738
169700
  }
@@ -169796,22 +169758,22 @@ var init_introspect2 = __esm({
169796
169758
  continue;
169797
169759
  }
169798
169760
  const expr = serialsList.find(
169799
- (it2) => it2.tableId === column11.tableId && it2.ordinality === column11.ordinality
169761
+ (it2) => Number(it2.tableId) === Number(column11.tableId) && it2.ordinality === column11.ordinality
169800
169762
  );
169801
169763
  if (expr) {
169802
- const table6 = tablesList.find((it2) => it2.oid === column11.tableId);
169764
+ const table6 = tablesList.find((it2) => Number(it2.oid) === Number(column11.tableId));
169803
169765
  const isSerial = isSerialExpression(expr.expression, table6.schema);
169804
169766
  column11.type = isSerial ? type === "bigint" ? "bigserial" : type === "integer" ? "serial" : "smallserial" : type;
169805
169767
  }
169806
169768
  }
169807
169769
  for (const column11 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
169808
- const table6 = tablesList.find((it2) => it2.oid === column11.tableId);
169770
+ const table6 = tablesList.find((it2) => Number(it2.oid) === Number(column11.tableId));
169809
169771
  const enumType2 = column11.typeId in groupedEnums ? groupedEnums[column11.typeId] : column11.typeId in groupedArrEnums ? groupedArrEnums[column11.typeId] : null;
169810
169772
  let columnTypeMapped = enumType2 ? enumType2.name : column11.type.replaceAll("[]", "");
169811
169773
  columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char").replace("geometry(Point", "geometry(point");
169812
169774
  columnTypeMapped = trimChar(columnTypeMapped, '"');
169813
169775
  const columnDefault = defaultsList.find(
169814
- (it2) => it2.tableId === column11.tableId && it2.ordinality === column11.ordinality
169776
+ (it2) => Number(it2.tableId) === Number(column11.tableId) && it2.ordinality === column11.ordinality
169815
169777
  );
169816
169778
  const defaultValue = defaultForColumn(
169817
169779
  columnTypeMapped,
@@ -169820,10 +169782,10 @@ var init_introspect2 = __esm({
169820
169782
  Boolean(enumType2)
169821
169783
  );
169822
169784
  const unique = constraintsList.find((it2) => {
169823
- 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);
169824
169786
  }) ?? null;
169825
169787
  const pk = constraintsList.find((it2) => {
169826
- 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);
169827
169789
  }) ?? null;
169828
169790
  const metadata = column11.metadata;
169829
169791
  if (column11.generatedType === "s" && (!metadata || !metadata.expression)) {
@@ -169838,7 +169800,7 @@ ${JSON.stringify(column11.metadata)}`
169838
169800
  ${JSON.stringify(column11.metadata)}`
169839
169801
  );
169840
169802
  }
169841
- 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;
169842
169804
  columns.push({
169843
169805
  entityType: "columns",
169844
169806
  schema: table6.schema,
@@ -169868,10 +169830,12 @@ ${JSON.stringify(column11.metadata)}`
169868
169830
  });
169869
169831
  }
169870
169832
  for (const unique of constraintsList.filter((it2) => it2.type === "u")) {
169871
- const table6 = tablesList.find((it2) => it2.oid === unique.tableId);
169872
- 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));
169873
169835
  const columns2 = unique.columnsOrdinals.map((it2) => {
169874
- const column11 = columnsList.find((column12) => column12.tableId === unique.tableId && column12.ordinality === it2);
169836
+ const column11 = columnsList.find(
169837
+ (column12) => Number(column12.tableId) === Number(unique.tableId) && column12.ordinality === it2
169838
+ );
169875
169839
  return column11.name;
169876
169840
  });
169877
169841
  uniques.push({
@@ -169885,10 +169849,12 @@ ${JSON.stringify(column11.metadata)}`
169885
169849
  });
169886
169850
  }
169887
169851
  for (const pk of constraintsList.filter((it2) => it2.type === "p")) {
169888
- const table6 = tablesList.find((it2) => it2.oid === pk.tableId);
169889
- 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));
169890
169854
  const columns2 = pk.columnsOrdinals.map((it2) => {
169891
- const column11 = columnsList.find((column12) => column12.tableId === pk.tableId && column12.ordinality === it2);
169855
+ const column11 = columnsList.find(
169856
+ (column12) => Number(column12.tableId) === Number(pk.tableId) && column12.ordinality === it2
169857
+ );
169892
169858
  return column11.name;
169893
169859
  });
169894
169860
  pks.push({
@@ -169901,15 +169867,19 @@ ${JSON.stringify(column11.metadata)}`
169901
169867
  });
169902
169868
  }
169903
169869
  for (const fk5 of constraintsList.filter((it2) => it2.type === "f")) {
169904
- const table6 = tablesList.find((it2) => it2.oid === fk5.tableId);
169905
- const schema5 = namespaces.find((it2) => it2.oid === fk5.schemaId);
169906
- 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));
169907
169873
  const columns2 = fk5.columnsOrdinals.map((it2) => {
169908
- const column11 = columnsList.find((column12) => column12.tableId === fk5.tableId && column12.ordinality === it2);
169874
+ const column11 = columnsList.find(
169875
+ (column12) => Number(column12.tableId) === Number(fk5.tableId) && column12.ordinality === it2
169876
+ );
169909
169877
  return column11.name;
169910
169878
  });
169911
169879
  const columnsTo = fk5.columnsToOrdinals.map((it2) => {
169912
- const column11 = columnsList.find((column12) => column12.tableId === fk5.tableToId && column12.ordinality === it2);
169880
+ const column11 = columnsList.find(
169881
+ (column12) => Number(column12.tableId) === Number(fk5.tableToId) && column12.ordinality === it2
169882
+ );
169913
169883
  return column11.name;
169914
169884
  });
169915
169885
  fks.push({
@@ -169927,8 +169897,8 @@ ${JSON.stringify(column11.metadata)}`
169927
169897
  });
169928
169898
  }
169929
169899
  for (const check2 of constraintsList.filter((it2) => it2.type === "c")) {
169930
- const table6 = tablesList.find((it2) => it2.oid === check2.tableId);
169931
- 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));
169932
169902
  checks.push({
169933
169903
  entityType: "checks",
169934
169904
  schema: schema5.name,
@@ -169989,10 +169959,10 @@ ${JSON.stringify(column11.metadata)}`
169989
169959
  });
169990
169960
  for (const idx of idxs) {
169991
169961
  const { metadata } = idx;
169992
- const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && x6.indexId === idx.oid);
169993
- 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));
169994
169964
  const expr = splitExpressions(metadata.expression);
169995
- const table6 = tablesList.find((it2) => it2.oid === idx.metadata.tableId);
169965
+ const table6 = tablesList.find((it2) => Number(it2.oid) === Number(idx.metadata.tableId));
169996
169966
  const nonColumnsCount = metadata.columnOrdinals.reduce((acc, it2) => {
169997
169967
  if (it2 === 0) acc += 1;
169998
169968
  return acc;
@@ -170024,7 +169994,7 @@ ${JSON.stringify(column11.metadata)}`
170024
169994
  k5 += 1;
170025
169995
  } else {
170026
169996
  const column11 = columnsList.find((column12) => {
170027
- return column12.tableId === metadata.tableId && column12.ordinality === ordinal;
169997
+ return Number(column12.tableId) === Number(metadata.tableId) && column12.ordinality === ordinal;
170028
169998
  });
170029
169999
  if (!column11) throw new Error(`missing column: ${metadata.tableId}:${ordinal}`);
170030
170000
  const options = opts[i6];
@@ -170069,7 +170039,7 @@ ${JSON.stringify(column11.metadata)}`
170069
170039
  });
170070
170040
  }
170071
170041
  for (const it2 of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
170072
- const view5 = viewsList.find((x6) => x6.oid === it2.tableId);
170042
+ const view5 = viewsList.find((x6) => Number(x6.oid) === Number(it2.tableId));
170073
170043
  const typeDimensions = it2.type.split("[]").length - 1;
170074
170044
  const enumType2 = it2.typeId in groupedEnums ? groupedEnums[it2.typeId] : it2.typeId in groupedArrEnums ? groupedArrEnums[it2.typeId] : null;
170075
170045
  let columnTypeMapped = enumType2 ? enumType2.name : it2.type.replace("[]", "");
@@ -170091,8 +170061,8 @@ ${JSON.stringify(column11.metadata)}`
170091
170061
  });
170092
170062
  }
170093
170063
  for (const view5 of viewsList) {
170094
- const accessMethod = view5.accessMethod === 0 ? null : ams.find((it2) => it2.oid === view5.accessMethod);
170095
- 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;
170096
170066
  const definition = parseViewDefinition(view5.definition);
170097
170067
  const withOpts = wrapRecord(
170098
170068
  ((_b = view5.options) == null ? void 0 : _b.reduce((acc, it2) => {
@@ -170308,9 +170278,9 @@ var init_pull_postgres = __esm({
170308
170278
  var push_postgres_exports = {};
170309
170279
  __export(push_postgres_exports, {
170310
170280
  handle: () => handle10,
170311
- suggestions: () => suggestions3
170281
+ suggestions: () => suggestions2
170312
170282
  });
170313
- var import_hanji10, handle10, identifier2, suggestions3;
170283
+ var import_hanji10, handle10, identifier2, suggestions2;
170314
170284
  var init_push_postgres = __esm({
170315
170285
  "src/cli/commands/push-postgres.ts"() {
170316
170286
  "use strict";
@@ -170373,7 +170343,7 @@ var init_push_postgres = __esm({
170373
170343
  (0, import_hanji10.render)(`[${source_default.blue("i")}] No changes detected`);
170374
170344
  return;
170375
170345
  }
170376
- const hints = await suggestions3(db, jsonStatements);
170346
+ const hints = await suggestions2(db, jsonStatements);
170377
170347
  const explainMessage = explain("postgres", groupedStatements, explainFlag, hints);
170378
170348
  if (explainMessage) console.log(explainMessage);
170379
170349
  if (explainFlag) return;
@@ -170396,7 +170366,7 @@ var init_push_postgres = __esm({
170396
170366
  const schemakey = schema5 && schema5 !== "public" ? `"${schema5}".` : "";
170397
170367
  return `${schemakey}"${name}"`;
170398
170368
  };
170399
- suggestions3 = async (db, jsonStatements) => {
170369
+ suggestions2 = async (db, jsonStatements) => {
170400
170370
  const grouped = [];
170401
170371
  const filtered = jsonStatements.filter((it2) => {
170402
170372
  if (it2.type === "drop_view" && it2.cause) return false;
@@ -171335,9 +171305,9 @@ var init_pull_sqlite = __esm({
171335
171305
  var push_sqlite_exports = {};
171336
171306
  __export(push_sqlite_exports, {
171337
171307
  handle: () => handle12,
171338
- suggestions: () => suggestions4
171308
+ suggestions: () => suggestions3
171339
171309
  });
171340
- var import_hanji12, handle12, suggestions4;
171310
+ var import_hanji12, handle12, suggestions3;
171341
171311
  var init_push_sqlite = __esm({
171342
171312
  "src/cli/commands/push-sqlite.ts"() {
171343
171313
  "use strict";
@@ -171379,7 +171349,7 @@ var init_push_sqlite = __esm({
171379
171349
  [${source_default.blue("i")}] No changes detected`);
171380
171350
  return;
171381
171351
  }
171382
- const hints = await suggestions4(db, statements);
171352
+ const hints = await suggestions3(db, statements);
171383
171353
  const explainMessage = explain("sqlite", groupedStatements, explainFlag, hints);
171384
171354
  if (explainMessage) console.log(explainMessage);
171385
171355
  if (explainFlag) return;
@@ -171413,7 +171383,7 @@ var init_push_sqlite = __esm({
171413
171383
  (0, import_hanji12.render)(`[${source_default.green("\u2713")}] Changes applied`);
171414
171384
  }
171415
171385
  };
171416
- suggestions4 = async (connection, jsonStatements) => {
171386
+ suggestions3 = async (connection, jsonStatements) => {
171417
171387
  const grouped = [];
171418
171388
  for (const statement of jsonStatements) {
171419
171389
  if (statement.type === "drop_table") {
@@ -171485,9 +171455,9 @@ var init_push_libsql = __esm({
171485
171455
  var push_singlestore_exports = {};
171486
171456
  __export(push_singlestore_exports, {
171487
171457
  handle: () => handle14,
171488
- suggestions: () => suggestions5
171458
+ suggestions: () => suggestions4
171489
171459
  });
171490
- var import_hanji13, handle14, suggestions5;
171460
+ var import_hanji13, handle14, suggestions4;
171491
171461
  var init_push_singlestore = __esm({
171492
171462
  "src/cli/commands/push-singlestore.ts"() {
171493
171463
  "use strict";
@@ -171535,7 +171505,7 @@ ${filenames.join("\n")}
171535
171505
  if (filteredStatements.length === 0) {
171536
171506
  (0, import_hanji13.render)(`[${source_default.blue("i")}] No changes detected`);
171537
171507
  } else {
171538
- const { hints, truncates } = await suggestions5(db, filteredStatements);
171508
+ const { hints, truncates } = await suggestions4(db, filteredStatements);
171539
171509
  const combinedStatements = [...truncates, ...sqlStatements];
171540
171510
  if (verbose) {
171541
171511
  console.log();
@@ -171581,7 +171551,7 @@ ${filenames.join("\n")}
171581
171551
  }
171582
171552
  }
171583
171553
  };
171584
- suggestions5 = async (_db, _statements) => {
171554
+ suggestions4 = async (_db, _statements) => {
171585
171555
  const hints = [];
171586
171556
  const truncates = [];
171587
171557
  return { hints, truncates };
@@ -172910,9 +172880,9 @@ var init_pull_cockroach = __esm({
172910
172880
  var push_cockroach_exports = {};
172911
172881
  __export(push_cockroach_exports, {
172912
172882
  handle: () => handle16,
172913
- suggestions: () => suggestions6
172883
+ suggestions: () => suggestions5
172914
172884
  });
172915
- var import_hanji15, handle16, identifier3, suggestions6;
172885
+ var import_hanji15, handle16, identifier3, suggestions5;
172916
172886
  var init_push_cockroach = __esm({
172917
172887
  "src/cli/commands/push-cockroach.ts"() {
172918
172888
  "use strict";
@@ -172972,7 +172942,7 @@ var init_push_cockroach = __esm({
172972
172942
  (0, import_hanji15.render)(`[${source_default.blue("i")}] No changes detected`);
172973
172943
  return;
172974
172944
  }
172975
- const { losses, hints } = await suggestions6(db, jsonStatements);
172945
+ const { losses, hints } = await suggestions5(db, jsonStatements);
172976
172946
  if (verbose) {
172977
172947
  console.log();
172978
172948
  console.log(withStyle.warning("You are about to execute these statements:"));
@@ -173013,7 +172983,7 @@ var init_push_cockroach = __esm({
173013
172983
  const schemakey = schema5 && schema5 !== "public" ? `"${schema5}".` : "";
173014
172984
  return `${schemakey}"${name}"`;
173015
172985
  };
173016
- suggestions6 = async (db, jsonStatements) => {
172986
+ suggestions5 = async (db, jsonStatements) => {
173017
172987
  const statements = [];
173018
172988
  const hints = [];
173019
172989
  const filtered = jsonStatements.filter((it2) => {
@@ -174113,9 +174083,9 @@ var init_pull_mssql = __esm({
174113
174083
  var push_mssql_exports = {};
174114
174084
  __export(push_mssql_exports, {
174115
174085
  handle: () => handle18,
174116
- suggestions: () => suggestions7
174086
+ suggestions: () => suggestions6
174117
174087
  });
174118
- var import_hanji17, handle18, identifier4, suggestions7;
174088
+ var import_hanji17, handle18, identifier4, suggestions6;
174119
174089
  var init_push_mssql = __esm({
174120
174090
  "src/cli/commands/push-mssql.ts"() {
174121
174091
  "use strict";
@@ -174181,7 +174151,7 @@ var init_push_mssql = __esm({
174181
174151
  (0, import_hanji17.render)(`[${source_default.blue("i")}] No changes detected`);
174182
174152
  return;
174183
174153
  }
174184
- const { losses, hints } = await suggestions7(db, jsonStatements, ddl22);
174154
+ const { losses, hints } = await suggestions6(db, jsonStatements, ddl22);
174185
174155
  const statementsToExecute = [...losses, ...sqlStatements];
174186
174156
  if (verbose) {
174187
174157
  console.log();
@@ -174224,7 +174194,7 @@ var init_push_mssql = __esm({
174224
174194
  const tableKey = `[${table6}]`;
174225
174195
  return `${schemaKey}${tableKey}`;
174226
174196
  };
174227
- suggestions7 = async (db, jsonStatements, ddl22) => {
174197
+ suggestions6 = async (db, jsonStatements, ddl22) => {
174228
174198
  const losses = [];
174229
174199
  const hints = [];
174230
174200
  const filtered = jsonStatements.filter((it2) => {
@@ -177104,6 +177074,7 @@ var init_cors = __esm({
177104
177074
  // src/cli/commands/studio.ts
177105
177075
  var studio_exports = {};
177106
177076
  __export(studio_exports, {
177077
+ drizzleForDuckDb: () => drizzleForDuckDb,
177107
177078
  drizzleForLibSQL: () => drizzleForLibSQL,
177108
177079
  drizzleForMySQL: () => drizzleForMySQL,
177109
177080
  drizzleForPostgres: () => drizzleForPostgres,
@@ -177117,7 +177088,7 @@ __export(studio_exports, {
177117
177088
  prepareServer: () => prepareServer,
177118
177089
  prepareSingleStoreSchema: () => prepareSingleStoreSchema
177119
177090
  });
177120
- 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;
177121
177092
  var init_studio = __esm({
177122
177093
  "src/cli/commands/studio.ts"() {
177123
177094
  "use strict";
@@ -177349,6 +177320,23 @@ var init_studio = __esm({
177349
177320
  casing: casing2
177350
177321
  };
177351
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
+ };
177352
177340
  drizzleForMySQL = async (credentials2, mysqlSchema, relations5, schemaFiles, casing2) => {
177353
177341
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
177354
177342
  const { proxy, transactionProxy, benchmarkProxy, database, packageName } = await connectToMySQL2(credentials2);
@@ -179705,6 +179693,25 @@ var printConfigConnectionIssues = (options) => {
179705
179693
  // src/cli/commands/utils.ts
179706
179694
  init_common3();
179707
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
+
179708
179715
  // src/cli/validations/gel.ts
179709
179716
  init_esm();
179710
179717
  init_views();
@@ -179745,7 +179752,7 @@ var gelCredentials = unionType([
179745
179752
  }).transform(() => {
179746
179753
  })
179747
179754
  ]);
179748
- var printConfigConnectionIssues2 = (options) => {
179755
+ var printConfigConnectionIssues3 = (options) => {
179749
179756
  if ("url" in options) {
179750
179757
  let text = `Please provide required params for Gel driver:
179751
179758
  `;
@@ -179781,7 +179788,7 @@ var libSQLCredentials = objectType({
179781
179788
  url: stringType().min(1),
179782
179789
  authToken: stringType().min(1).optional()
179783
179790
  });
179784
- var printConfigConnectionIssues3 = (options, _command) => {
179791
+ var printConfigConnectionIssues4 = (options, _command) => {
179785
179792
  let text = `Please provide required params for 'turso' dialect:
179786
179793
  `;
179787
179794
  console.log(error2(text));
@@ -179811,7 +179818,7 @@ var mssqlCredentials = unionType([
179811
179818
  url: stringType().min(1)
179812
179819
  })
179813
179820
  ]);
179814
- var printConfigConnectionIssues4 = (options) => {
179821
+ var printConfigConnectionIssues5 = (options) => {
179815
179822
  if ("url" in options) {
179816
179823
  let text2 = `Please provide required params for MsSQL driver:
179817
179824
  `;
@@ -179860,7 +179867,7 @@ var mysqlCredentials = unionType([
179860
179867
  url: stringType().min(1)
179861
179868
  })
179862
179869
  ]);
179863
- var printConfigConnectionIssues5 = (options) => {
179870
+ var printConfigConnectionIssues6 = (options) => {
179864
179871
  if ("url" in options) {
179865
179872
  let text2 = `Please provide required params for MySQL driver:
179866
179873
  `;
@@ -179925,7 +179932,7 @@ var postgresCredentials = unionType([
179925
179932
  url: stringType().min(1)
179926
179933
  })
179927
179934
  ]);
179928
- var printConfigConnectionIssues6 = (options) => {
179935
+ var printConfigConnectionIssues7 = (options) => {
179929
179936
  if (options.driver === "aws-data-api") {
179930
179937
  let text = `Please provide required params for AWS Data API driver:
179931
179938
  `;
@@ -179992,7 +179999,7 @@ var singlestoreCredentials = unionType([
179992
179999
  url: stringType().min(1)
179993
180000
  })
179994
180001
  ]);
179995
- var printConfigConnectionIssues7 = (options) => {
180002
+ var printConfigConnectionIssues8 = (options) => {
179996
180003
  if ("url" in options) {
179997
180004
  let text2 = `Please provide required params for SingleStore driver:
179998
180005
  `;
@@ -180041,7 +180048,7 @@ var sqliteCredentials = unionType([
180041
180048
  return o5;
180042
180049
  })
180043
180050
  ]);
180044
- var printConfigConnectionIssues8 = (options, command2) => {
180051
+ var printConfigConnectionIssues9 = (options, command2) => {
180045
180052
  const parsedDriver = sqliteDriver.safeParse(options.driver);
180046
180053
  const driver2 = parsedDriver.success ? parsedDriver.data : "";
180047
180054
  if (driver2 === "expo") {
@@ -180245,7 +180252,7 @@ var preparePushConfig = async (options, from) => {
180245
180252
  if (config.dialect === "postgresql") {
180246
180253
  const parsed2 = postgresCredentials.safeParse(config);
180247
180254
  if (!parsed2.success) {
180248
- printConfigConnectionIssues6(config);
180255
+ printConfigConnectionIssues7(config);
180249
180256
  process.exit(1);
180250
180257
  }
180251
180258
  return {
@@ -180262,7 +180269,7 @@ var preparePushConfig = async (options, from) => {
180262
180269
  if (config.dialect === "mysql") {
180263
180270
  const parsed2 = mysqlCredentials.safeParse(config);
180264
180271
  if (!parsed2.success) {
180265
- printConfigConnectionIssues5(config);
180272
+ printConfigConnectionIssues6(config);
180266
180273
  process.exit(1);
180267
180274
  }
180268
180275
  return {
@@ -180279,7 +180286,7 @@ var preparePushConfig = async (options, from) => {
180279
180286
  if (config.dialect === "singlestore") {
180280
180287
  const parsed2 = singlestoreCredentials.safeParse(config);
180281
180288
  if (!parsed2.success) {
180282
- printConfigConnectionIssues7(config);
180289
+ printConfigConnectionIssues8(config);
180283
180290
  process.exit(1);
180284
180291
  }
180285
180292
  return {
@@ -180295,7 +180302,7 @@ var preparePushConfig = async (options, from) => {
180295
180302
  if (config.dialect === "sqlite") {
180296
180303
  const parsed2 = sqliteCredentials.safeParse(config);
180297
180304
  if (!parsed2.success) {
180298
- printConfigConnectionIssues8(config, "push");
180305
+ printConfigConnectionIssues9(config, "push");
180299
180306
  process.exit(1);
180300
180307
  }
180301
180308
  return {
@@ -180312,7 +180319,7 @@ var preparePushConfig = async (options, from) => {
180312
180319
  if (config.dialect === "turso") {
180313
180320
  const parsed2 = libSQLCredentials.safeParse(config);
180314
180321
  if (!parsed2.success) {
180315
- printConfigConnectionIssues8(config, "push");
180322
+ printConfigConnectionIssues9(config, "push");
180316
180323
  process.exit(1);
180317
180324
  }
180318
180325
  return {
@@ -180367,6 +180374,14 @@ var preparePushConfig = async (options, from) => {
180367
180374
  explain: false
180368
180375
  };
180369
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
+ }
180370
180385
  assertUnreachable(config.dialect);
180371
180386
  };
180372
180387
  var preparePullConfig = async (options, from) => {
@@ -180392,7 +180407,7 @@ var preparePullConfig = async (options, from) => {
180392
180407
  if (dialect5 === "postgresql") {
180393
180408
  const parsed2 = postgresCredentials.safeParse(config);
180394
180409
  if (!parsed2.success) {
180395
- printConfigConnectionIssues6(config);
180410
+ printConfigConnectionIssues7(config);
180396
180411
  process.exit(1);
180397
180412
  }
180398
180413
  return {
@@ -180411,7 +180426,7 @@ var preparePullConfig = async (options, from) => {
180411
180426
  if (dialect5 === "mysql") {
180412
180427
  const parsed2 = mysqlCredentials.safeParse(config);
180413
180428
  if (!parsed2.success) {
180414
- printConfigConnectionIssues5(config);
180429
+ printConfigConnectionIssues6(config);
180415
180430
  process.exit(1);
180416
180431
  }
180417
180432
  return {
@@ -180430,7 +180445,7 @@ var preparePullConfig = async (options, from) => {
180430
180445
  if (dialect5 === "singlestore") {
180431
180446
  const parsed2 = singlestoreCredentials.safeParse(config);
180432
180447
  if (!parsed2.success) {
180433
- printConfigConnectionIssues7(config);
180448
+ printConfigConnectionIssues8(config);
180434
180449
  process.exit(1);
180435
180450
  }
180436
180451
  return {
@@ -180449,7 +180464,7 @@ var preparePullConfig = async (options, from) => {
180449
180464
  if (dialect5 === "sqlite") {
180450
180465
  const parsed2 = sqliteCredentials.safeParse(config);
180451
180466
  if (!parsed2.success) {
180452
- printConfigConnectionIssues8(config, "pull");
180467
+ printConfigConnectionIssues9(config, "pull");
180453
180468
  process.exit(1);
180454
180469
  }
180455
180470
  return {
@@ -180468,7 +180483,7 @@ var preparePullConfig = async (options, from) => {
180468
180483
  if (dialect5 === "turso") {
180469
180484
  const parsed2 = libSQLCredentials.safeParse(config);
180470
180485
  if (!parsed2.success) {
180471
- printConfigConnectionIssues3(config, "pull");
180486
+ printConfigConnectionIssues4(config, "pull");
180472
180487
  process.exit(1);
180473
180488
  }
180474
180489
  return {
@@ -180487,7 +180502,7 @@ var preparePullConfig = async (options, from) => {
180487
180502
  if (dialect5 === "gel") {
180488
180503
  const parsed2 = gelCredentials.safeParse(config);
180489
180504
  if (!parsed2.success) {
180490
- printConfigConnectionIssues2(config);
180505
+ printConfigConnectionIssues3(config);
180491
180506
  process.exit(1);
180492
180507
  }
180493
180508
  return {
@@ -180540,6 +180555,14 @@ var preparePullConfig = async (options, from) => {
180540
180555
  migrationsTable: table6
180541
180556
  };
180542
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
+ }
180543
180566
  assertUnreachable(dialect5);
180544
180567
  };
180545
180568
  var prepareStudioConfig = async (options) => {
@@ -180562,7 +180585,7 @@ var prepareStudioConfig = async (options) => {
180562
180585
  if (dialect5 === "postgresql") {
180563
180586
  const parsed = postgresCredentials.safeParse(flattened);
180564
180587
  if (!parsed.success) {
180565
- printConfigConnectionIssues6(flattened);
180588
+ printConfigConnectionIssues7(flattened);
180566
180589
  process.exit(1);
180567
180590
  }
180568
180591
  const credentials2 = parsed.data;
@@ -180578,7 +180601,7 @@ var prepareStudioConfig = async (options) => {
180578
180601
  if (dialect5 === "mysql") {
180579
180602
  const parsed = mysqlCredentials.safeParse(flattened);
180580
180603
  if (!parsed.success) {
180581
- printConfigConnectionIssues5(flattened);
180604
+ printConfigConnectionIssues6(flattened);
180582
180605
  process.exit(1);
180583
180606
  }
180584
180607
  const credentials2 = parsed.data;
@@ -180594,7 +180617,7 @@ var prepareStudioConfig = async (options) => {
180594
180617
  if (dialect5 === "singlestore") {
180595
180618
  const parsed = singlestoreCredentials.safeParse(flattened);
180596
180619
  if (!parsed.success) {
180597
- printConfigConnectionIssues7(flattened);
180620
+ printConfigConnectionIssues8(flattened);
180598
180621
  process.exit(1);
180599
180622
  }
180600
180623
  const credentials2 = parsed.data;
@@ -180610,7 +180633,7 @@ var prepareStudioConfig = async (options) => {
180610
180633
  if (dialect5 === "sqlite") {
180611
180634
  const parsed = sqliteCredentials.safeParse(flattened);
180612
180635
  if (!parsed.success) {
180613
- printConfigConnectionIssues8(flattened, "studio");
180636
+ printConfigConnectionIssues9(flattened, "studio");
180614
180637
  process.exit(1);
180615
180638
  }
180616
180639
  const credentials2 = parsed.data;
@@ -180626,7 +180649,7 @@ var prepareStudioConfig = async (options) => {
180626
180649
  if (dialect5 === "turso") {
180627
180650
  const parsed = libSQLCredentials.safeParse(flattened);
180628
180651
  if (!parsed.success) {
180629
- printConfigConnectionIssues3(flattened, "studio");
180652
+ printConfigConnectionIssues4(flattened, "studio");
180630
180653
  process.exit(1);
180631
180654
  }
180632
180655
  const credentials2 = parsed.data;
@@ -180660,6 +180683,21 @@ var prepareStudioConfig = async (options) => {
180660
180683
  if (dialect5 === "mssql") {
180661
180684
  throw new Error(`You can't use 'studio' command with MsSql dialect yet`);
180662
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
+ }
180663
180701
  assertUnreachable(dialect5);
180664
180702
  };
180665
180703
  var migrateConfig = objectType({
@@ -180681,7 +180719,7 @@ var prepareMigrateConfig = async (configPath) => {
180681
180719
  if (dialect5 === "postgresql") {
180682
180720
  const parsed2 = postgresCredentials.safeParse(flattened);
180683
180721
  if (!parsed2.success) {
180684
- printConfigConnectionIssues6(flattened);
180722
+ printConfigConnectionIssues7(flattened);
180685
180723
  process.exit(1);
180686
180724
  }
180687
180725
  const credentials2 = parsed2.data;
@@ -180696,7 +180734,7 @@ var prepareMigrateConfig = async (configPath) => {
180696
180734
  if (dialect5 === "mysql") {
180697
180735
  const parsed2 = mysqlCredentials.safeParse(flattened);
180698
180736
  if (!parsed2.success) {
180699
- printConfigConnectionIssues5(flattened);
180737
+ printConfigConnectionIssues6(flattened);
180700
180738
  process.exit(1);
180701
180739
  }
180702
180740
  const credentials2 = parsed2.data;
@@ -180711,7 +180749,7 @@ var prepareMigrateConfig = async (configPath) => {
180711
180749
  if (dialect5 === "singlestore") {
180712
180750
  const parsed2 = singlestoreCredentials.safeParse(flattened);
180713
180751
  if (!parsed2.success) {
180714
- printConfigConnectionIssues7(flattened);
180752
+ printConfigConnectionIssues8(flattened);
180715
180753
  process.exit(1);
180716
180754
  }
180717
180755
  const credentials2 = parsed2.data;
@@ -180726,7 +180764,7 @@ var prepareMigrateConfig = async (configPath) => {
180726
180764
  if (dialect5 === "sqlite") {
180727
180765
  const parsed2 = sqliteCredentials.safeParse(flattened);
180728
180766
  if (!parsed2.success) {
180729
- printConfigConnectionIssues8(flattened, "migrate");
180767
+ printConfigConnectionIssues9(flattened, "migrate");
180730
180768
  process.exit(1);
180731
180769
  }
180732
180770
  const credentials2 = parsed2.data;
@@ -180741,7 +180779,7 @@ var prepareMigrateConfig = async (configPath) => {
180741
180779
  if (dialect5 === "turso") {
180742
180780
  const parsed2 = libSQLCredentials.safeParse(flattened);
180743
180781
  if (!parsed2.success) {
180744
- printConfigConnectionIssues3(flattened, "migrate");
180782
+ printConfigConnectionIssues4(flattened, "migrate");
180745
180783
  process.exit(1);
180746
180784
  }
180747
180785
  const credentials2 = parsed2.data;
@@ -180764,7 +180802,7 @@ var prepareMigrateConfig = async (configPath) => {
180764
180802
  if (dialect5 === "mssql") {
180765
180803
  const parsed2 = mssqlCredentials.safeParse(flattened);
180766
180804
  if (!parsed2.success) {
180767
- printConfigConnectionIssues4(flattened);
180805
+ printConfigConnectionIssues5(flattened);
180768
180806
  process.exit(1);
180769
180807
  }
180770
180808
  const credentials2 = parsed2.data;
@@ -180791,6 +180829,14 @@ var prepareMigrateConfig = async (configPath) => {
180791
180829
  table: table6
180792
180830
  };
180793
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
+ }
180794
180840
  assertUnreachable(dialect5);
180795
180841
  };
180796
180842
  var drizzleConfigFromFile = async (configPath, isExport) => {
@@ -181663,10 +181709,9 @@ var updateUpToV62 = (json) => {
181663
181709
  // src/cli/schema.ts
181664
181710
  init_utils4();
181665
181711
  init_common3();
181666
- init_outputs();
181667
181712
  init_views();
181668
181713
  var optionDialect = string("dialect").enum(...dialects).desc(
181669
- `Database dialect: 'gel', 'postgresql', 'mysql', 'sqlite', 'turso', 'singlestore' or 'mssql'`
181714
+ `Database dialect: 'gel', 'postgresql', 'mysql', 'sqlite', 'turso', 'singlestore', 'duckdb' or 'mssql'`
181670
181715
  );
181671
181716
  var optionOut = string().desc("Output folder, 'drizzle' by default");
181672
181717
  var optionConfig = string().desc("Path to drizzle config file");
@@ -181727,6 +181772,13 @@ var generate = command({
181727
181772
  } else if (dialect5 === "cockroach") {
181728
181773
  const { handle: handle21 } = await Promise.resolve().then(() => (init_generate_cockroach(), generate_cockroach_exports));
181729
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);
181730
181782
  } else {
181731
181783
  assertUnreachable(dialect5);
181732
181784
  }
@@ -181882,7 +181934,7 @@ var push = command({
181882
181934
  ...optionsFilters,
181883
181935
  ...optionsDatabaseCredentials,
181884
181936
  verbose: boolean().desc("Print all statements for each push").default(false),
181885
- strict: boolean().desc("Always ask for confirmation"),
181937
+ strict: boolean().desc("Always ask for confirmation").default(false),
181886
181938
  force: boolean().desc(
181887
181939
  "Auto-approve all data loss statements. Note: Data loss statements may truncate your tables and data"
181888
181940
  ).default(false),
@@ -181912,12 +181964,6 @@ var push = command({
181912
181964
  "tlsSecurity"
181913
181965
  ]
181914
181966
  );
181915
- if (typeof opts.strict !== "undefined") {
181916
- console.log(withStyle.fullWarning(
181917
- "\u26A0\uFE0F Deprecated: Do not use 'strict' flag. Use 'explain' instead"
181918
- ));
181919
- process.exit(1);
181920
- }
181921
181967
  return preparePushConfig(opts, from);
181922
181968
  },
181923
181969
  handler: async (config) => {
@@ -182199,7 +182245,8 @@ var studio = command({
182199
182245
  drizzleForSQLite: drizzleForSQLite2,
182200
182246
  prepareSingleStoreSchema: prepareSingleStoreSchema2,
182201
182247
  drizzleForSingleStore: drizzleForSingleStore2,
182202
- drizzleForLibSQL: drizzleForLibSQL2
182248
+ drizzleForLibSQL: drizzleForLibSQL2,
182249
+ drizzleForDuckDb: drizzleForDuckDb2
182203
182250
  // drizzleForMsSQL,
182204
182251
  } = await Promise.resolve().then(() => (init_studio(), studio_exports));
182205
182252
  let setup;
@@ -182244,6 +182291,8 @@ var studio = command({
182244
182291
  files,
182245
182292
  casing2
182246
182293
  );
182294
+ } else if (dialect5 === "duckdb") {
182295
+ setup = await drizzleForDuckDb2(credentials2);
182247
182296
  } else if (dialect5 === "cockroach") {
182248
182297
  throw new Error(`You can't use 'studio' command with 'cockroach' dialect`);
182249
182298
  } else {
@@ -182251,12 +182300,6 @@ var studio = command({
182251
182300
  }
182252
182301
  const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
182253
182302
  const server = await prepareServer2(setup);
182254
- console.log();
182255
- console.log(
182256
- withStyle.fullWarning(
182257
- "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"
182258
- )
182259
- );
182260
182303
  const { certs: certs2 } = await Promise.resolve().then(() => (init_certs(), certs_exports));
182261
182304
  const { key, cert } = await certs2() || {};
182262
182305
  server.start({
@@ -182329,6 +182372,13 @@ var exportRaw = command({
182329
182372
  } else if (dialect5 === "cockroach") {
182330
182373
  const { handleExport: handleExport7 } = await Promise.resolve().then(() => (init_generate_cockroach(), generate_cockroach_exports));
182331
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);
182332
182382
  } else {
182333
182383
  assertUnreachable(dialect5);
182334
182384
  }