drizzle-kit 1.0.0-beta.3-d4ff358 → 1.0.0-beta.3-b32f005

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