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/api-postgres.js CHANGED
@@ -5993,6 +5993,7 @@ var init_stringify = __esm({
5993
5993
  case `number`:
5994
5994
  return Number.isFinite(value) ? value.toString() : `null`;
5995
5995
  case `boolean`:
5996
+ return value.toString();
5996
5997
  case `bigint`:
5997
5998
  return n6 ? `${value.toString()}n` : value.toString();
5998
5999
  case `object`: {
@@ -6229,7 +6230,7 @@ function formatTime(date2) {
6229
6230
  const iso = instant.toString({ timeZone: "UTC" });
6230
6231
  return iso;
6231
6232
  }
6232
- var import_polyfill, SmallInt, Int, BigInt2, Numeric, Real, Double, Boolean2, Char, Varchar, Text, toDefaultArray, Json, Jsonb, Time, TimeTz, DateType, Timestamp, TimestampTz, Uuid, Interval2, Inet, Cidr, MacAddr, MacAddr8, Vector, HalfVec, SparseVec, Bit, Point, Line, GeometryPoint, Enum, Serial, BigSerial, SmallSerial, Custom, typeFor, splitSqlType, vectorOps, indexName, isSerialExpression, parseOnType, systemNamespaceNames, isSystemNamespace, wrapRecord, parseViewDefinition, defaultNameForIdentitySequence, defaultNameForPK, defaultNameForFK, defaultNameForUnique, defaultNameForIndex, trimDefaultValueSuffix, defaultForColumn, defaultToSQL, isDefaultAction, isSerialType, defaultsCommutative, defaults;
6233
+ var import_polyfill, SmallInt, Int, BigInt2, Numeric, Real, Double, Boolean2, Char, Varchar, Text, toDefaultArray, Json, Jsonb, Time, TimeTz, DateType, Timestamp, TimestampTz, Uuid, Interval2, Inet, Cidr, MacAddr, MacAddr8, Vector, HalfVec, SparseVec, Bit, Point, Line, GeometryPoint, Enum, Serial, BigSerial, SmallSerial, Custom, typeFor, splitSqlType, vectorOps, indexName, isSerialExpression, parseOnType, systemNamespaceNames, isSystemNamespace, wrapRecord, parseViewDefinition, defaultNameForIdentitySequence, defaultNameForPK, defaultNameForFK, defaultNameForUnique, defaultNameForIndex, trimDefaultValueSuffix, defaultForColumn, defaultToSQL, isDefaultAction, isSerialType, mapSerialToInt, defaultsCommutative, defaults;
6233
6234
  var init_grammar = __esm({
6234
6235
  "src/dialects/postgres/grammar.ts"() {
6235
6236
  "use strict";
@@ -7819,6 +7820,18 @@ var init_grammar = __esm({
7819
7820
  isSerialType = (type) => {
7820
7821
  return /^(?:serial|bigserial|smallserial)$/i.test(type);
7821
7822
  };
7823
+ mapSerialToInt = (type) => {
7824
+ switch (type) {
7825
+ case "smallserial":
7826
+ return "smallint";
7827
+ case "serial":
7828
+ return "int";
7829
+ case "bigserial":
7830
+ return "bigint";
7831
+ default:
7832
+ throw new Error(`Unsupported type: ${type}`);
7833
+ }
7834
+ };
7822
7835
  defaultsCommutative = (diffDef, type, dimensions) => {
7823
7836
  if (!diffDef) return false;
7824
7837
  let from = diffDef.from;
@@ -15208,8 +15221,7 @@ var init_schemaValidator = __esm({
15208
15221
  "singlestore",
15209
15222
  "gel",
15210
15223
  "mssql",
15211
- "cockroach",
15212
- "duckdb"
15224
+ "cockroach"
15213
15225
  ];
15214
15226
  dialect = enumType(dialects);
15215
15227
  }
@@ -22999,7 +23011,7 @@ var init_convertor = __esm({
22999
23011
  return [drop, add];
23000
23012
  });
23001
23013
  alterColumnConvertor = convertor("alter_column", (st) => {
23002
- const { diff: diff2, to: column7, isEnum, wasEnum, wasSerial } = st;
23014
+ const { diff: diff2, to: column7, isEnum, wasEnum, wasSerial, toSerial } = st;
23003
23015
  const statements = [];
23004
23016
  const key = column7.schema !== "public" ? `"${column7.schema}"."${column7.table}"` : `"${column7.table}"`;
23005
23017
  const recreateDefault = diff2.type && (isEnum || wasEnum) && diff2.$left.default;
@@ -23009,17 +23021,21 @@ var init_convertor = __esm({
23009
23021
  if (diff2.type) {
23010
23022
  const typeSchema = column7.typeSchema && column7.typeSchema !== "public" ? `"${column7.typeSchema}".` : "";
23011
23023
  const textProxy = wasEnum && isEnum ? "text::" : "";
23012
- const suffix = isEnum ? ` USING "${column7.name}"::${textProxy}${typeSchema}"${column7.type}"${"[]".repeat(column7.dimensions)}` : ` USING "${column7.name}"::${column7.type}${"[]".repeat(column7.dimensions)}`;
23013
- let type;
23014
- if (diff2.type) {
23015
- type = diff2.typeSchema?.to && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : diff2.type.to;
23016
- } else {
23017
- type = `${typeSchema}${column7.typeSchema ? `"${column7.type}"` : column7.type}`;
23018
- }
23024
+ const suffix = isEnum ? ` USING "${column7.name}"::${textProxy}${typeSchema}"${column7.type}"${"[]".repeat(column7.dimensions)}` : ` USING "${column7.name}"::${toSerial ? mapSerialToInt(column7.type) : column7.type}${"[]".repeat(column7.dimensions)}`;
23025
+ const type = diff2.typeSchema?.to && diff2.typeSchema.to !== "public" ? `"${diff2.typeSchema.to}"."${diff2.type.to}"` : isEnum ? `"${diff2.type.to}"` : toSerial ? mapSerialToInt(diff2.type.to) : diff2.type.to;
23019
23026
  if (wasSerial) {
23020
- statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column7.name}" DROP DEFAULT`);
23027
+ statements.push(`ALTER TABLE ${key} ALTER COLUMN "${column7.name}" DROP DEFAULT;`);
23028
+ const sequenceKey = column7.schema !== "public" ? `"${column7.schema}"."${column7.table}_${column7.name}_seq"` : `"${column7.table}_${column7.name}_seq"`;
23029
+ statements.push(`DROP SEQUENCE ${sequenceKey};`);
23030
+ }
23031
+ if (toSerial) {
23021
23032
  const sequenceKey = column7.schema !== "public" ? `"${column7.schema}"."${column7.table}_${column7.name}_seq"` : `"${column7.table}_${column7.name}_seq"`;
23022
- statements.push(`DROP SEQUENCE ${sequenceKey}`);
23033
+ const sequenceName = column7.schema !== "public" ? `${column7.schema}.${column7.table}_${column7.name}_seq` : `${column7.table}_${column7.name}_seq`;
23034
+ statements.push(`CREATE SEQUENCE ${sequenceKey};`);
23035
+ statements.push(
23036
+ `ALTER TABLE ${key} ALTER COLUMN "${column7.name}" SET DEFAULT nextval('${sequenceName}')`
23037
+ );
23038
+ statements.push(`ALTER SEQUENCE ${sequenceKey} OWNED BY "${column7.schema}"."${column7.table}"."${column7.name}";`);
23023
23039
  }
23024
23040
  statements.push(
23025
23041
  `ALTER TABLE ${key} ALTER COLUMN "${column7.name}" SET DATA TYPE ${type}${"[]".repeat(column7.dimensions)}${suffix};`
@@ -24321,6 +24337,7 @@ var init_diff = __esm({
24321
24337
  }).map((it) => {
24322
24338
  const column7 = it.$right;
24323
24339
  const wasSerial = isSerialType(it.$left.type);
24340
+ const toSerial = !isSerialType(it.$left.type) && isSerialType(it.$right.type);
24324
24341
  const isEnum = ddl22.enums.one({ schema: column7.typeSchema ?? "public", name: column7.type }) !== null;
24325
24342
  const wasEnum = (it.type && ddl1.enums.one({ schema: column7.typeSchema ?? "public", name: it.type.from }) !== null) ?? false;
24326
24343
  return prepareStatement("alter_column", {
@@ -24328,7 +24345,8 @@ var init_diff = __esm({
24328
24345
  to: column7,
24329
24346
  isEnum,
24330
24347
  wasEnum,
24331
- wasSerial
24348
+ wasSerial,
24349
+ toSerial
24332
24350
  });
24333
24351
  });
24334
24352
  const createSequences = createdSequences.map((it) => prepareStatement("create_sequence", { sequence: it }));
@@ -25015,7 +25033,7 @@ var init_introspect = __esm({
25015
25033
  });
25016
25034
  }
25017
25035
  for (const seq of sequencesList) {
25018
- const depend = dependList.find((it) => Number(it.oid) === Number(seq.oid));
25036
+ const depend = dependList.find((it) => it.oid === seq.oid);
25019
25037
  if (depend && (depend.deptype === "a" || depend.deptype === "i")) {
25020
25038
  continue;
25021
25039
  }
@@ -25079,22 +25097,22 @@ var init_introspect = __esm({
25079
25097
  continue;
25080
25098
  }
25081
25099
  const expr = serialsList.find(
25082
- (it) => Number(it.tableId) === Number(column7.tableId) && it.ordinality === column7.ordinality
25100
+ (it) => it.tableId === column7.tableId && it.ordinality === column7.ordinality
25083
25101
  );
25084
25102
  if (expr) {
25085
- const table6 = tablesList.find((it) => Number(it.oid) === Number(column7.tableId));
25103
+ const table6 = tablesList.find((it) => it.oid === column7.tableId);
25086
25104
  const isSerial = isSerialExpression(expr.expression, table6.schema);
25087
25105
  column7.type = isSerial ? type === "bigint" ? "bigserial" : type === "integer" ? "serial" : "smallserial" : type;
25088
25106
  }
25089
25107
  }
25090
25108
  for (const column7 of columnsList.filter((x6) => x6.kind === "r" || x6.kind === "p")) {
25091
- const table6 = tablesList.find((it) => Number(it.oid) === Number(column7.tableId));
25109
+ const table6 = tablesList.find((it) => it.oid === column7.tableId);
25092
25110
  const enumType2 = column7.typeId in groupedEnums ? groupedEnums[column7.typeId] : column7.typeId in groupedArrEnums ? groupedArrEnums[column7.typeId] : null;
25093
25111
  let columnTypeMapped = enumType2 ? enumType2.name : column7.type.replaceAll("[]", "");
25094
25112
  columnTypeMapped = columnTypeMapped.replace("character varying", "varchar").replace(" without time zone", "").replace("character", "char").replace("geometry(Point", "geometry(point");
25095
25113
  columnTypeMapped = trimChar(columnTypeMapped, '"');
25096
25114
  const columnDefault = defaultsList.find(
25097
- (it) => Number(it.tableId) === Number(column7.tableId) && it.ordinality === column7.ordinality
25115
+ (it) => it.tableId === column7.tableId && it.ordinality === column7.ordinality
25098
25116
  );
25099
25117
  const defaultValue = defaultForColumn(
25100
25118
  columnTypeMapped,
@@ -25103,10 +25121,10 @@ var init_introspect = __esm({
25103
25121
  Boolean(enumType2)
25104
25122
  );
25105
25123
  const unique = constraintsList.find((it) => {
25106
- return it.type === "u" && Number(it.tableId) === Number(column7.tableId) && it.columnsOrdinals.length === 1 && it.columnsOrdinals.includes(column7.ordinality);
25124
+ return it.type === "u" && it.tableId === column7.tableId && it.columnsOrdinals.length === 1 && it.columnsOrdinals.includes(column7.ordinality);
25107
25125
  }) ?? null;
25108
25126
  const pk = constraintsList.find((it) => {
25109
- return it.type === "p" && Number(it.tableId) === Number(column7.tableId) && it.columnsOrdinals.length === 1 && it.columnsOrdinals.includes(column7.ordinality);
25127
+ return it.type === "p" && it.tableId === column7.tableId && it.columnsOrdinals.length === 1 && it.columnsOrdinals.includes(column7.ordinality);
25110
25128
  }) ?? null;
25111
25129
  const metadata = column7.metadata;
25112
25130
  if (column7.generatedType === "s" && (!metadata || !metadata.expression)) {
@@ -25121,7 +25139,7 @@ ${JSON.stringify(column7.metadata)}`
25121
25139
  ${JSON.stringify(column7.metadata)}`
25122
25140
  );
25123
25141
  }
25124
- const sequence = metadata?.seqId ? sequencesList.find((it) => Number(it.oid) === Number(metadata.seqId)) ?? null : null;
25142
+ const sequence = metadata?.seqId ? sequencesList.find((it) => it.oid === Number(metadata.seqId)) ?? null : null;
25125
25143
  columns.push({
25126
25144
  entityType: "columns",
25127
25145
  schema: table6.schema,
@@ -25151,12 +25169,10 @@ ${JSON.stringify(column7.metadata)}`
25151
25169
  });
25152
25170
  }
25153
25171
  for (const unique of constraintsList.filter((it) => it.type === "u")) {
25154
- const table6 = tablesList.find((it) => Number(it.oid) === Number(unique.tableId));
25155
- const schema5 = namespaces.find((it) => Number(it.oid) === Number(unique.schemaId));
25172
+ const table6 = tablesList.find((it) => it.oid === unique.tableId);
25173
+ const schema5 = namespaces.find((it) => it.oid === unique.schemaId);
25156
25174
  const columns2 = unique.columnsOrdinals.map((it) => {
25157
- const column7 = columnsList.find(
25158
- (column8) => Number(column8.tableId) === Number(unique.tableId) && column8.ordinality === it
25159
- );
25175
+ const column7 = columnsList.find((column8) => column8.tableId === unique.tableId && column8.ordinality === it);
25160
25176
  return column7.name;
25161
25177
  });
25162
25178
  uniques.push({
@@ -25170,12 +25186,10 @@ ${JSON.stringify(column7.metadata)}`
25170
25186
  });
25171
25187
  }
25172
25188
  for (const pk of constraintsList.filter((it) => it.type === "p")) {
25173
- const table6 = tablesList.find((it) => Number(it.oid) === Number(pk.tableId));
25174
- const schema5 = namespaces.find((it) => Number(it.oid) === Number(pk.schemaId));
25189
+ const table6 = tablesList.find((it) => it.oid === pk.tableId);
25190
+ const schema5 = namespaces.find((it) => it.oid === pk.schemaId);
25175
25191
  const columns2 = pk.columnsOrdinals.map((it) => {
25176
- const column7 = columnsList.find(
25177
- (column8) => Number(column8.tableId) === Number(pk.tableId) && column8.ordinality === it
25178
- );
25192
+ const column7 = columnsList.find((column8) => column8.tableId === pk.tableId && column8.ordinality === it);
25179
25193
  return column7.name;
25180
25194
  });
25181
25195
  pks.push({
@@ -25188,19 +25202,15 @@ ${JSON.stringify(column7.metadata)}`
25188
25202
  });
25189
25203
  }
25190
25204
  for (const fk5 of constraintsList.filter((it) => it.type === "f")) {
25191
- const table6 = tablesList.find((it) => Number(it.oid) === Number(fk5.tableId));
25192
- const schema5 = namespaces.find((it) => Number(it.oid) === Number(fk5.schemaId));
25193
- const tableTo = tablesList.find((it) => Number(it.oid) === Number(fk5.tableToId));
25205
+ const table6 = tablesList.find((it) => it.oid === fk5.tableId);
25206
+ const schema5 = namespaces.find((it) => it.oid === fk5.schemaId);
25207
+ const tableTo = tablesList.find((it) => it.oid === fk5.tableToId);
25194
25208
  const columns2 = fk5.columnsOrdinals.map((it) => {
25195
- const column7 = columnsList.find(
25196
- (column8) => Number(column8.tableId) === Number(fk5.tableId) && column8.ordinality === it
25197
- );
25209
+ const column7 = columnsList.find((column8) => column8.tableId === fk5.tableId && column8.ordinality === it);
25198
25210
  return column7.name;
25199
25211
  });
25200
25212
  const columnsTo = fk5.columnsToOrdinals.map((it) => {
25201
- const column7 = columnsList.find(
25202
- (column8) => Number(column8.tableId) === Number(fk5.tableToId) && column8.ordinality === it
25203
- );
25213
+ const column7 = columnsList.find((column8) => column8.tableId === fk5.tableToId && column8.ordinality === it);
25204
25214
  return column7.name;
25205
25215
  });
25206
25216
  fks.push({
@@ -25218,8 +25228,8 @@ ${JSON.stringify(column7.metadata)}`
25218
25228
  });
25219
25229
  }
25220
25230
  for (const check of constraintsList.filter((it) => it.type === "c")) {
25221
- const table6 = tablesList.find((it) => Number(it.oid) === Number(check.tableId));
25222
- const schema5 = namespaces.find((it) => Number(it.oid) === Number(check.schemaId));
25231
+ const table6 = tablesList.find((it) => it.oid === check.tableId);
25232
+ const schema5 = namespaces.find((it) => it.oid === check.schemaId);
25223
25233
  checks.push({
25224
25234
  entityType: "checks",
25225
25235
  schema: schema5.name,
@@ -25280,10 +25290,10 @@ ${JSON.stringify(column7.metadata)}`
25280
25290
  });
25281
25291
  for (const idx of idxs) {
25282
25292
  const { metadata } = idx;
25283
- const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && Number(x6.indexId) === Number(idx.oid));
25284
- const forPK = metadata.isPrimary && constraintsList.some((x6) => x6.type === "p" && Number(x6.indexId) === Number(idx.oid));
25293
+ const forUnique = metadata.isUnique && constraintsList.some((x6) => x6.type === "u" && x6.indexId === idx.oid);
25294
+ const forPK = metadata.isPrimary && constraintsList.some((x6) => x6.type === "p" && x6.indexId === idx.oid);
25285
25295
  const expr = splitExpressions(metadata.expression);
25286
- const table6 = tablesList.find((it) => Number(it.oid) === Number(idx.metadata.tableId));
25296
+ const table6 = tablesList.find((it) => it.oid === idx.metadata.tableId);
25287
25297
  const nonColumnsCount = metadata.columnOrdinals.reduce((acc, it) => {
25288
25298
  if (it === 0) acc += 1;
25289
25299
  return acc;
@@ -25315,7 +25325,7 @@ ${JSON.stringify(column7.metadata)}`
25315
25325
  k6 += 1;
25316
25326
  } else {
25317
25327
  const column7 = columnsList.find((column8) => {
25318
- return Number(column8.tableId) === Number(metadata.tableId) && column8.ordinality === ordinal;
25328
+ return column8.tableId === metadata.tableId && column8.ordinality === ordinal;
25319
25329
  });
25320
25330
  if (!column7) throw new Error(`missing column: ${metadata.tableId}:${ordinal}`);
25321
25331
  const options = opts[i7];
@@ -25360,7 +25370,7 @@ ${JSON.stringify(column7.metadata)}`
25360
25370
  });
25361
25371
  }
25362
25372
  for (const it of columnsList.filter((x6) => x6.kind === "m" || x6.kind === "v")) {
25363
- const view5 = viewsList.find((x6) => Number(x6.oid) === Number(it.tableId));
25373
+ const view5 = viewsList.find((x6) => x6.oid === it.tableId);
25364
25374
  const typeDimensions = it.type.split("[]").length - 1;
25365
25375
  const enumType2 = it.typeId in groupedEnums ? groupedEnums[it.typeId] : it.typeId in groupedArrEnums ? groupedArrEnums[it.typeId] : null;
25366
25376
  let columnTypeMapped = enumType2 ? enumType2.name : it.type.replace("[]", "");
@@ -25382,8 +25392,8 @@ ${JSON.stringify(column7.metadata)}`
25382
25392
  });
25383
25393
  }
25384
25394
  for (const view5 of viewsList) {
25385
- const accessMethod = Number(view5.accessMethod) === 0 ? null : ams.find((it) => Number(it.oid) === Number(view5.accessMethod));
25386
- const tablespace = Number(view5.tablespaceid) === 0 ? null : tablespaces.find((it) => Number(it.oid) === Number(view5.tablespaceid)).name;
25395
+ const accessMethod = view5.accessMethod === 0 ? null : ams.find((it) => it.oid === view5.accessMethod);
25396
+ const tablespace = view5.tablespaceid === 0 ? null : tablespaces.find((it) => it.oid === view5.tablespaceid).name;
25387
25397
  const definition = parseViewDefinition(view5.definition);
25388
25398
  const withOpts = wrapRecord(
25389
25399
  view5.options?.reduce((acc, it) => {
@@ -145253,7 +145263,6 @@ __export(connections_exports, {
145253
145263
  connectToSQLite: () => connectToSQLite,
145254
145264
  connectToSingleStore: () => connectToSingleStore,
145255
145265
  prepareCockroach: () => prepareCockroach,
145256
- prepareDuckDb: () => prepareDuckDb,
145257
145266
  prepareGelDB: () => prepareGelDB,
145258
145267
  preparePostgresDB: () => preparePostgresDB
145259
145268
  });
@@ -145270,7 +145279,7 @@ function parseMssqlUrl(url) {
145270
145279
  }
145271
145280
  };
145272
145281
  }
145273
- var import_net, ms, normalisePGliteUrl, preparePostgresDB, prepareDuckDb, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
145282
+ var import_net, ms, normalisePGliteUrl, preparePostgresDB, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
145274
145283
  var init_connections = __esm({
145275
145284
  "src/cli/connections.ts"() {
145276
145285
  "use strict";
@@ -145406,13 +145415,7 @@ var init_connections = __esm({
145406
145415
  }
145407
145416
  return results;
145408
145417
  };
145409
- return {
145410
- packageName: "pglite",
145411
- query,
145412
- proxy,
145413
- transactionProxy,
145414
- migrate: migrateFn
145415
- };
145418
+ return { packageName: "pglite", query, proxy, transactionProxy, migrate: migrateFn };
145416
145419
  }
145417
145420
  assertUnreachable(driver2);
145418
145421
  }
@@ -145653,13 +145656,7 @@ var init_connections = __esm({
145653
145656
  }
145654
145657
  return results;
145655
145658
  };
145656
- return {
145657
- packageName: "postgres",
145658
- query,
145659
- proxy,
145660
- transactionProxy,
145661
- migrate: migrateFn
145662
- };
145659
+ return { packageName: "postgres", query, proxy, transactionProxy, migrate: migrateFn };
145663
145660
  }
145664
145661
  if (await checkPackage("@vercel/postgres")) {
145665
145662
  console.log(
@@ -145740,13 +145737,7 @@ var init_connections = __esm({
145740
145737
  }
145741
145738
  return results;
145742
145739
  };
145743
- return {
145744
- packageName: "@vercel/postgres",
145745
- query,
145746
- proxy,
145747
- transactionProxy,
145748
- migrate: migrateFn
145749
- };
145740
+ return { packageName: "@vercel/postgres", query, proxy, transactionProxy, migrate: migrateFn };
145750
145741
  }
145751
145742
  if (await checkPackage("@neondatabase/serverless")) {
145752
145743
  console.log(
@@ -145759,11 +145750,7 @@ var init_connections = __esm({
145759
145750
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
145760
145751
  )
145761
145752
  );
145762
- const {
145763
- Pool,
145764
- neonConfig,
145765
- types: pgTypes
145766
- } = require("@neondatabase/serverless");
145753
+ const { Pool, neonConfig, types: pgTypes } = require("@neondatabase/serverless");
145767
145754
  const { drizzle } = require("drizzle-orm/neon-serverless");
145768
145755
  const { migrate } = require("drizzle-orm/neon-serverless/migrator");
145769
145756
  const ssl = "ssl" in credentials ? credentials.ssl === "prefer" || credentials.ssl === "require" || credentials.ssl === "allow" ? { rejectUnauthorized: false } : credentials.ssl === "verify-full" ? {} : credentials.ssl : {};
@@ -145833,13 +145820,7 @@ var init_connections = __esm({
145833
145820
  }
145834
145821
  return results;
145835
145822
  };
145836
- return {
145837
- packageName: "@neondatabase/serverless",
145838
- query,
145839
- proxy,
145840
- transactionProxy,
145841
- migrate: migrateFn
145842
- };
145823
+ return { packageName: "@neondatabase/serverless", query, proxy, transactionProxy, migrate: migrateFn };
145843
145824
  }
145844
145825
  if (await checkPackage("bun")) {
145845
145826
  console.log(withStyle.info(`Using 'bun' driver for database querying`));
@@ -145890,54 +145871,6 @@ var init_connections = __esm({
145890
145871
  console.warn("For the 'bun' driver, run your script using: bun --bun");
145891
145872
  process.exit(1);
145892
145873
  };
145893
- prepareDuckDb = async (credentials) => {
145894
- if (await checkPackage("@duckdb/node-api")) {
145895
- console.log(
145896
- withStyle.info(`Using '@duckdb/node-api' driver for database querying`)
145897
- );
145898
- const { DuckDBInstance } = require("@duckdb/node-api");
145899
- const instance = await DuckDBInstance.create(credentials.url);
145900
- const client = await instance.connect();
145901
- const query = async (sql, params = []) => {
145902
- const result2 = await client.run(sql, params);
145903
- const rows = await result2.getRowObjectsJson();
145904
- return rows;
145905
- };
145906
- const proxy = async (params) => {
145907
- const result2 = await client.run(params.sql, params.params);
145908
- return params.mode === "array" ? await result2.getRowsJson() : await result2.getRowObjectsJson();
145909
- };
145910
- const transactionProxy = async (queries) => {
145911
- const results = [];
145912
- try {
145913
- await client.run("BEGIN");
145914
- for (const query2 of queries) {
145915
- const result2 = await client.run(query2.sql);
145916
- results.push(await result2.getRowObjectsJson());
145917
- }
145918
- await client.run("COMMIT");
145919
- } catch (error3) {
145920
- await client.run("ROLLBACK");
145921
- results.push(error3);
145922
- }
145923
- return results;
145924
- };
145925
- return {
145926
- packageName: "@duckdb/node-api",
145927
- query,
145928
- proxy,
145929
- transactionProxy,
145930
- migrate: () => {
145931
- throw new Error("DuckDB does not support migrations");
145932
- }
145933
- };
145934
- }
145935
- console.error(
145936
- // "To connect to DuckDb database - please install either of 'duckdb', '@duckdb/node-api' drivers",
145937
- "To connect to DuckDb database - please install '@duckdb/node-api' driver"
145938
- );
145939
- process.exit(1);
145940
- };
145941
145874
  prepareCockroach = async (credentials) => {
145942
145875
  if (await checkPackage("pg")) {
145943
145876
  const { default: pg } = require("pg");
@@ -145990,7 +145923,9 @@ var init_connections = __esm({
145990
145923
  };
145991
145924
  return { query, proxy, migrate: migrateFn };
145992
145925
  }
145993
- console.error("To connect to Cockroach - please install 'pg' package");
145926
+ console.error(
145927
+ "To connect to Cockroach - please install 'pg' package"
145928
+ );
145994
145929
  process.exit(1);
145995
145930
  };
145996
145931
  prepareGelDB = async (credentials) => {
@@ -146049,7 +145984,9 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
146049
145984
  };
146050
145985
  return { packageName: "gel", query, proxy, transactionProxy };
146051
145986
  }
146052
- console.error("To connect to gel database - please install 'edgedb' driver");
145987
+ console.error(
145988
+ "To connect to gel database - please install 'edgedb' driver"
145989
+ );
146053
145990
  process.exit(1);
146054
145991
  };
146055
145992
  parseSingleStoreCredentials = (credentials) => {
@@ -146501,7 +146438,9 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
146501
146438
  migrate: migrateFn
146502
146439
  };
146503
146440
  }
146504
- console.error("To connect to MsSQL database - please install 'mssql' driver");
146441
+ console.error(
146442
+ "To connect to MsSQL database - please install 'mssql' driver"
146443
+ );
146505
146444
  process.exit(1);
146506
146445
  };
146507
146446
  prepareSqliteParams = (params, driver2) => {
@@ -146606,10 +146545,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
146606
146545
  await remoteCallback(query2, [], "run");
146607
146546
  };
146608
146547
  const proxy = async (params) => {
146609
- const preparedParams = prepareSqliteParams(
146610
- params.params || [],
146611
- "d1-http"
146612
- );
146548
+ const preparedParams = prepareSqliteParams(params.params || [], "d1-http");
146613
146549
  const result2 = await remoteCallback(
146614
146550
  params.sql,
146615
146551
  preparedParams,
@@ -146834,19 +146770,17 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
146834
146770
  };
146835
146771
  const transactionProxy = async (queries) => {
146836
146772
  const results = [];
146837
- const tx = sqlite.transaction(
146838
- (queries2) => {
146839
- for (const query of queries2) {
146840
- let result2 = [];
146841
- if (query.method === "values" || query.method === "get" || query.method === "all") {
146842
- result2 = sqlite.prepare(query.sql).all();
146843
- } else {
146844
- sqlite.prepare(query.sql).run();
146845
- }
146846
- results.push(result2);
146773
+ const tx = sqlite.transaction((queries2) => {
146774
+ for (const query of queries2) {
146775
+ let result2 = [];
146776
+ if (query.method === "values" || query.method === "get" || query.method === "all") {
146777
+ result2 = sqlite.prepare(query.sql).all();
146778
+ } else {
146779
+ sqlite.prepare(query.sql).run();
146847
146780
  }
146781
+ results.push(result2);
146848
146782
  }
146849
- );
146783
+ });
146850
146784
  try {
146851
146785
  tx(queries);
146852
146786
  } catch (error3) {
@@ -146854,13 +146788,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
146854
146788
  }
146855
146789
  return results;
146856
146790
  };
146857
- return {
146858
- ...db,
146859
- packageName: "better-sqlite3",
146860
- proxy,
146861
- transactionProxy,
146862
- migrate: migrateFn
146863
- };
146791
+ return { ...db, packageName: "better-sqlite3", proxy, transactionProxy, migrate: migrateFn };
146864
146792
  }
146865
146793
  if (await checkPackage("bun")) {
146866
146794
  console.log(withStyle.info(`Using 'bun' driver for database querying`));
@@ -152400,7 +152328,6 @@ var init_cors = __esm({
152400
152328
  // src/cli/commands/studio.ts
152401
152329
  var studio_exports = {};
152402
152330
  __export(studio_exports, {
152403
- drizzleForDuckDb: () => drizzleForDuckDb,
152404
152331
  drizzleForLibSQL: () => drizzleForLibSQL,
152405
152332
  drizzleForMySQL: () => drizzleForMySQL,
152406
152333
  drizzleForPostgres: () => drizzleForPostgres,
@@ -152414,7 +152341,7 @@ __export(studio_exports, {
152414
152341
  prepareServer: () => prepareServer,
152415
152342
  prepareSingleStoreSchema: () => prepareSingleStoreSchema
152416
152343
  });
152417
- var import_crypto10, import_drizzle_orm3, import_relations3, import_mssql_core2, import_mysql_core2, import_pg_core3, import_singlestore_core, import_sqlite_core2, import_fs6, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForDuckDb, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init2, proxySchema, transactionProxySchema, benchmarkProxySchema, defaultsSchema, schema4, jsonStringify, prepareServer;
152344
+ var import_crypto10, import_drizzle_orm3, import_relations3, import_mssql_core2, import_mysql_core2, import_pg_core3, import_singlestore_core, import_sqlite_core2, import_fs6, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init2, proxySchema, transactionProxySchema, benchmarkProxySchema, defaultsSchema, schema4, jsonStringify, prepareServer;
152418
152345
  var init_studio = __esm({
152419
152346
  "src/cli/commands/studio.ts"() {
152420
152347
  "use strict";
@@ -152646,23 +152573,6 @@ var init_studio = __esm({
152646
152573
  casing: casing2
152647
152574
  };
152648
152575
  };
152649
- drizzleForDuckDb = async (credentials) => {
152650
- const { prepareDuckDb: prepareDuckDb2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
152651
- const db = await prepareDuckDb2(credentials);
152652
- const dbUrl = `duckdb://${credentials.url}`;
152653
- const dbHash = (0, import_crypto10.createHash)("sha256").update(dbUrl).digest("hex");
152654
- return {
152655
- dbHash,
152656
- dialect: "duckdb",
152657
- driver: void 0,
152658
- packageName: db.packageName,
152659
- proxy: db.proxy,
152660
- transactionProxy: db.transactionProxy,
152661
- customDefaults: [],
152662
- schema: {},
152663
- relations: {}
152664
- };
152665
- };
152666
152576
  drizzleForMySQL = async (credentials, mysqlSchema, relations2, schemaFiles, casing2) => {
152667
152577
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
152668
152578
  const { proxy, transactionProxy, benchmarkProxy, database, packageName } = await connectToMySQL2(credentials);