drizzle-kit 0.31.4 → 0.31.5

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.
Files changed (4) hide show
  1. package/api.js +29 -42
  2. package/api.mjs +29 -42
  3. package/bin.cjs +100 -56
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -22733,7 +22733,7 @@ var version;
22733
22733
  var init_version = __esm({
22734
22734
  "../drizzle-orm/dist/version.js"() {
22735
22735
  "use strict";
22736
- version = "0.44.2";
22736
+ version = "0.44.5";
22737
22737
  }
22738
22738
  });
22739
22739
 
@@ -23408,7 +23408,7 @@ var init_alias = __esm({
23408
23408
  });
23409
23409
 
23410
23410
  // ../drizzle-orm/dist/errors.js
23411
- var _a31, _b13, DrizzleError, _a32, _b14, TransactionRollbackError;
23411
+ var _a31, _b13, DrizzleError, DrizzleQueryError, _a32, _b14, TransactionRollbackError;
23412
23412
  var init_errors2 = __esm({
23413
23413
  "../drizzle-orm/dist/errors.js"() {
23414
23414
  "use strict";
@@ -23421,6 +23421,17 @@ var init_errors2 = __esm({
23421
23421
  }
23422
23422
  };
23423
23423
  __publicField(DrizzleError, _a31, "DrizzleError");
23424
+ DrizzleQueryError = class _DrizzleQueryError extends Error {
23425
+ constructor(query, params, cause) {
23426
+ super(`Failed query: ${query}
23427
+ params: ${params}`);
23428
+ this.query = query;
23429
+ this.params = params;
23430
+ this.cause = cause;
23431
+ Error.captureStackTrace(this, _DrizzleQueryError);
23432
+ if (cause) this.cause = cause;
23433
+ }
23434
+ };
23424
23435
  TransactionRollbackError = class extends (_b14 = DrizzleError, _a32 = entityKind, _b14) {
23425
23436
  constructor() {
23426
23437
  super({ message: "Rollback" });
@@ -23662,6 +23673,7 @@ function isConfig(data) {
23662
23673
  if (Object.keys(data).length === 0) return true;
23663
23674
  return false;
23664
23675
  }
23676
+ var textDecoder;
23665
23677
  var init_utils2 = __esm({
23666
23678
  "../drizzle-orm/dist/utils.js"() {
23667
23679
  "use strict";
@@ -23671,6 +23683,7 @@ var init_utils2 = __esm({
23671
23683
  init_subquery();
23672
23684
  init_table();
23673
23685
  init_view_common();
23686
+ textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
23674
23687
  }
23675
23688
  });
23676
23689
 
@@ -26067,6 +26080,7 @@ __export(dist_exports, {
26067
26080
  ConsoleLogWriter: () => ConsoleLogWriter,
26068
26081
  DefaultLogger: () => DefaultLogger,
26069
26082
  DrizzleError: () => DrizzleError,
26083
+ DrizzleQueryError: () => DrizzleQueryError,
26070
26084
  ExtraConfigBuilder: () => ExtraConfigBuilder,
26071
26085
  ExtraConfigColumns: () => ExtraConfigColumns,
26072
26086
  FakePrimitiveParam: () => FakePrimitiveParam,
@@ -26174,7 +26188,8 @@ __export(dist_exports, {
26174
26188
  relations: () => relations,
26175
26189
  sql: () => sql,
26176
26190
  sum: () => sum,
26177
- sumDistinct: () => sumDistinct
26191
+ sumDistinct: () => sumDistinct,
26192
+ textDecoder: () => textDecoder
26178
26193
  });
26179
26194
  var init_dist = __esm({
26180
26195
  "../drizzle-orm/dist/index.js"() {
@@ -30298,25 +30313,6 @@ var init_cache = __esm({
30298
30313
  }
30299
30314
  });
30300
30315
 
30301
- // ../drizzle-orm/dist/errors/index.js
30302
- var DrizzleQueryError;
30303
- var init_errors3 = __esm({
30304
- "../drizzle-orm/dist/errors/index.js"() {
30305
- "use strict";
30306
- DrizzleQueryError = class _DrizzleQueryError extends Error {
30307
- constructor(query, params, cause) {
30308
- super(`Failed query: ${query}
30309
- params: ${params}`);
30310
- this.query = query;
30311
- this.params = params;
30312
- this.cause = cause;
30313
- Error.captureStackTrace(this, _DrizzleQueryError);
30314
- if (cause) this.cause = cause;
30315
- }
30316
- };
30317
- }
30318
- });
30319
-
30320
30316
  // ../drizzle-orm/dist/pg-core/session.js
30321
30317
  var _a167, PgPreparedQuery, _a168, PgSession, _a169, _b120, PgTransaction;
30322
30318
  var init_session = __esm({
@@ -30325,7 +30321,6 @@ var init_session = __esm({
30325
30321
  init_cache();
30326
30322
  init_entity();
30327
30323
  init_errors2();
30328
- init_errors3();
30329
30324
  init_sql2();
30330
30325
  init_tracing();
30331
30326
  init_db();
@@ -32474,14 +32469,11 @@ var init_blob = __esm({
32474
32469
  return "blob";
32475
32470
  }
32476
32471
  mapFromDriverValue(value) {
32477
- if (Buffer.isBuffer(value)) {
32478
- return BigInt(value.toString());
32472
+ if (typeof Buffer !== "undefined" && Buffer.from) {
32473
+ const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
32474
+ return BigInt(buf.toString("utf8"));
32479
32475
  }
32480
- if (value instanceof ArrayBuffer) {
32481
- const decoder = new TextDecoder();
32482
- return BigInt(decoder.decode(value));
32483
- }
32484
- return BigInt(String.fromCodePoint(...value));
32476
+ return BigInt(textDecoder.decode(value));
32485
32477
  }
32486
32478
  mapToDriverValue(value) {
32487
32479
  return Buffer.from(value.toString());
@@ -32506,14 +32498,11 @@ var init_blob = __esm({
32506
32498
  return "blob";
32507
32499
  }
32508
32500
  mapFromDriverValue(value) {
32509
- if (Buffer.isBuffer(value)) {
32510
- return JSON.parse(value.toString());
32501
+ if (typeof Buffer !== "undefined" && Buffer.from) {
32502
+ const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
32503
+ return JSON.parse(buf.toString("utf8"));
32511
32504
  }
32512
- if (value instanceof ArrayBuffer) {
32513
- const decoder = new TextDecoder();
32514
- return JSON.parse(decoder.decode(value));
32515
- }
32516
- return JSON.parse(String.fromCodePoint(...value));
32505
+ return JSON.parse(textDecoder.decode(value));
32517
32506
  }
32518
32507
  mapToDriverValue(value) {
32519
32508
  return Buffer.from(JSON.stringify(value));
@@ -35666,7 +35655,6 @@ var init_session2 = __esm({
35666
35655
  init_cache();
35667
35656
  init_entity();
35668
35657
  init_errors2();
35669
- init_errors3();
35670
35658
  init_query_promise();
35671
35659
  init_db2();
35672
35660
  ExecuteResultSync = class extends (_b164 = QueryPromise, _a232 = entityKind, _b164) {
@@ -41306,7 +41294,6 @@ var init_session3 = __esm({
41306
41294
  init_cache();
41307
41295
  init_entity();
41308
41296
  init_errors2();
41309
- init_errors3();
41310
41297
  init_sql();
41311
41298
  init_db3();
41312
41299
  _a341 = entityKind;
@@ -42522,6 +42509,7 @@ var init_studio = __esm({
42522
42509
  "use strict";
42523
42510
  init_esm();
42524
42511
  init_schemaValidator();
42512
+ init_common();
42525
42513
  init_mysql();
42526
42514
  init_postgres();
42527
42515
  init_sqlite();
@@ -42537,7 +42525,8 @@ var init_studio = __esm({
42537
42525
  });
42538
42526
  studioConfig = objectType({
42539
42527
  dialect: dialect4,
42540
- schema: unionType([stringType(), stringType().array()]).optional()
42528
+ schema: unionType([stringType(), stringType().array()]).optional(),
42529
+ casing: casingType.optional()
42541
42530
  });
42542
42531
  }
42543
42532
  });
@@ -42570,7 +42559,6 @@ var init_utils9 = __esm({
42570
42559
  init_cli();
42571
42560
  init_common();
42572
42561
  init_gel();
42573
- init_gel();
42574
42562
  init_libsql();
42575
42563
  init_mysql();
42576
42564
  init_outputs();
@@ -46528,7 +46516,6 @@ var init_session4 = __esm({
46528
46516
  init_cache();
46529
46517
  init_entity();
46530
46518
  init_errors2();
46531
- init_errors3();
46532
46519
  init_sql();
46533
46520
  init_db4();
46534
46521
  _a434 = entityKind;
package/api.mjs CHANGED
@@ -22738,7 +22738,7 @@ var version;
22738
22738
  var init_version = __esm({
22739
22739
  "../drizzle-orm/dist/version.js"() {
22740
22740
  "use strict";
22741
- version = "0.44.2";
22741
+ version = "0.44.5";
22742
22742
  }
22743
22743
  });
22744
22744
 
@@ -23413,7 +23413,7 @@ var init_alias = __esm({
23413
23413
  });
23414
23414
 
23415
23415
  // ../drizzle-orm/dist/errors.js
23416
- var _a31, _b13, DrizzleError, _a32, _b14, TransactionRollbackError;
23416
+ var _a31, _b13, DrizzleError, DrizzleQueryError, _a32, _b14, TransactionRollbackError;
23417
23417
  var init_errors2 = __esm({
23418
23418
  "../drizzle-orm/dist/errors.js"() {
23419
23419
  "use strict";
@@ -23426,6 +23426,17 @@ var init_errors2 = __esm({
23426
23426
  }
23427
23427
  };
23428
23428
  __publicField(DrizzleError, _a31, "DrizzleError");
23429
+ DrizzleQueryError = class _DrizzleQueryError extends Error {
23430
+ constructor(query, params, cause) {
23431
+ super(`Failed query: ${query}
23432
+ params: ${params}`);
23433
+ this.query = query;
23434
+ this.params = params;
23435
+ this.cause = cause;
23436
+ Error.captureStackTrace(this, _DrizzleQueryError);
23437
+ if (cause) this.cause = cause;
23438
+ }
23439
+ };
23429
23440
  TransactionRollbackError = class extends (_b14 = DrizzleError, _a32 = entityKind, _b14) {
23430
23441
  constructor() {
23431
23442
  super({ message: "Rollback" });
@@ -23667,6 +23678,7 @@ function isConfig(data) {
23667
23678
  if (Object.keys(data).length === 0) return true;
23668
23679
  return false;
23669
23680
  }
23681
+ var textDecoder;
23670
23682
  var init_utils2 = __esm({
23671
23683
  "../drizzle-orm/dist/utils.js"() {
23672
23684
  "use strict";
@@ -23676,6 +23688,7 @@ var init_utils2 = __esm({
23676
23688
  init_subquery();
23677
23689
  init_table();
23678
23690
  init_view_common();
23691
+ textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
23679
23692
  }
23680
23693
  });
23681
23694
 
@@ -26072,6 +26085,7 @@ __export(dist_exports, {
26072
26085
  ConsoleLogWriter: () => ConsoleLogWriter,
26073
26086
  DefaultLogger: () => DefaultLogger,
26074
26087
  DrizzleError: () => DrizzleError,
26088
+ DrizzleQueryError: () => DrizzleQueryError,
26075
26089
  ExtraConfigBuilder: () => ExtraConfigBuilder,
26076
26090
  ExtraConfigColumns: () => ExtraConfigColumns,
26077
26091
  FakePrimitiveParam: () => FakePrimitiveParam,
@@ -26179,7 +26193,8 @@ __export(dist_exports, {
26179
26193
  relations: () => relations,
26180
26194
  sql: () => sql,
26181
26195
  sum: () => sum,
26182
- sumDistinct: () => sumDistinct
26196
+ sumDistinct: () => sumDistinct,
26197
+ textDecoder: () => textDecoder
26183
26198
  });
26184
26199
  var init_dist = __esm({
26185
26200
  "../drizzle-orm/dist/index.js"() {
@@ -30303,25 +30318,6 @@ var init_cache = __esm({
30303
30318
  }
30304
30319
  });
30305
30320
 
30306
- // ../drizzle-orm/dist/errors/index.js
30307
- var DrizzleQueryError;
30308
- var init_errors3 = __esm({
30309
- "../drizzle-orm/dist/errors/index.js"() {
30310
- "use strict";
30311
- DrizzleQueryError = class _DrizzleQueryError extends Error {
30312
- constructor(query, params, cause) {
30313
- super(`Failed query: ${query}
30314
- params: ${params}`);
30315
- this.query = query;
30316
- this.params = params;
30317
- this.cause = cause;
30318
- Error.captureStackTrace(this, _DrizzleQueryError);
30319
- if (cause) this.cause = cause;
30320
- }
30321
- };
30322
- }
30323
- });
30324
-
30325
30321
  // ../drizzle-orm/dist/pg-core/session.js
30326
30322
  var _a167, PgPreparedQuery, _a168, PgSession, _a169, _b120, PgTransaction;
30327
30323
  var init_session = __esm({
@@ -30330,7 +30326,6 @@ var init_session = __esm({
30330
30326
  init_cache();
30331
30327
  init_entity();
30332
30328
  init_errors2();
30333
- init_errors3();
30334
30329
  init_sql2();
30335
30330
  init_tracing();
30336
30331
  init_db();
@@ -32479,14 +32474,11 @@ var init_blob = __esm({
32479
32474
  return "blob";
32480
32475
  }
32481
32476
  mapFromDriverValue(value) {
32482
- if (Buffer.isBuffer(value)) {
32483
- return BigInt(value.toString());
32477
+ if (typeof Buffer !== "undefined" && Buffer.from) {
32478
+ const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
32479
+ return BigInt(buf.toString("utf8"));
32484
32480
  }
32485
- if (value instanceof ArrayBuffer) {
32486
- const decoder = new TextDecoder();
32487
- return BigInt(decoder.decode(value));
32488
- }
32489
- return BigInt(String.fromCodePoint(...value));
32481
+ return BigInt(textDecoder.decode(value));
32490
32482
  }
32491
32483
  mapToDriverValue(value) {
32492
32484
  return Buffer.from(value.toString());
@@ -32511,14 +32503,11 @@ var init_blob = __esm({
32511
32503
  return "blob";
32512
32504
  }
32513
32505
  mapFromDriverValue(value) {
32514
- if (Buffer.isBuffer(value)) {
32515
- return JSON.parse(value.toString());
32506
+ if (typeof Buffer !== "undefined" && Buffer.from) {
32507
+ const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
32508
+ return JSON.parse(buf.toString("utf8"));
32516
32509
  }
32517
- if (value instanceof ArrayBuffer) {
32518
- const decoder = new TextDecoder();
32519
- return JSON.parse(decoder.decode(value));
32520
- }
32521
- return JSON.parse(String.fromCodePoint(...value));
32510
+ return JSON.parse(textDecoder.decode(value));
32522
32511
  }
32523
32512
  mapToDriverValue(value) {
32524
32513
  return Buffer.from(JSON.stringify(value));
@@ -35671,7 +35660,6 @@ var init_session2 = __esm({
35671
35660
  init_cache();
35672
35661
  init_entity();
35673
35662
  init_errors2();
35674
- init_errors3();
35675
35663
  init_query_promise();
35676
35664
  init_db2();
35677
35665
  ExecuteResultSync = class extends (_b164 = QueryPromise, _a232 = entityKind, _b164) {
@@ -41311,7 +41299,6 @@ var init_session3 = __esm({
41311
41299
  init_cache();
41312
41300
  init_entity();
41313
41301
  init_errors2();
41314
- init_errors3();
41315
41302
  init_sql();
41316
41303
  init_db3();
41317
41304
  _a341 = entityKind;
@@ -42527,6 +42514,7 @@ var init_studio = __esm({
42527
42514
  "use strict";
42528
42515
  init_esm();
42529
42516
  init_schemaValidator();
42517
+ init_common();
42530
42518
  init_mysql();
42531
42519
  init_postgres();
42532
42520
  init_sqlite();
@@ -42542,7 +42530,8 @@ var init_studio = __esm({
42542
42530
  });
42543
42531
  studioConfig = objectType({
42544
42532
  dialect: dialect4,
42545
- schema: unionType([stringType(), stringType().array()]).optional()
42533
+ schema: unionType([stringType(), stringType().array()]).optional(),
42534
+ casing: casingType.optional()
42546
42535
  });
42547
42536
  }
42548
42537
  });
@@ -42575,7 +42564,6 @@ var init_utils9 = __esm({
42575
42564
  init_cli();
42576
42565
  init_common();
42577
42566
  init_gel();
42578
- init_gel();
42579
42567
  init_libsql();
42580
42568
  init_mysql();
42581
42569
  init_outputs();
@@ -46533,7 +46521,6 @@ var init_session4 = __esm({
46533
46521
  init_cache();
46534
46522
  init_entity();
46535
46523
  init_errors2();
46536
- init_errors3();
46537
46524
  init_sql();
46538
46525
  init_db4();
46539
46526
  _a434 = entityKind;
package/bin.cjs CHANGED
@@ -11266,6 +11266,7 @@ var init_studio = __esm({
11266
11266
  "use strict";
11267
11267
  init_esm();
11268
11268
  init_schemaValidator();
11269
+ init_common();
11269
11270
  init_mysql();
11270
11271
  init_postgres();
11271
11272
  init_sqlite();
@@ -11281,7 +11282,8 @@ var init_studio = __esm({
11281
11282
  });
11282
11283
  studioConfig = objectType({
11283
11284
  dialect: dialect4,
11284
- schema: unionType([stringType(), stringType().array()]).optional()
11285
+ schema: unionType([stringType(), stringType().array()]).optional(),
11286
+ casing: casingType.optional()
11285
11287
  });
11286
11288
  }
11287
11289
  });
@@ -16942,7 +16944,6 @@ var init_utils3 = __esm({
16942
16944
  init_cli();
16943
16945
  init_common();
16944
16946
  init_gel();
16945
- init_gel();
16946
16947
  init_libsql();
16947
16948
  init_mysql();
16948
16949
  init_outputs();
@@ -17358,7 +17359,7 @@ var init_utils3 = __esm({
17358
17359
  process.exit(1);
17359
17360
  }
17360
17361
  const { host, port } = params;
17361
- const { dialect: dialect6, schema: schema6 } = result.data;
17362
+ const { dialect: dialect6, schema: schema6, casing: casing2 } = result.data;
17362
17363
  const flattened = flattenDatabaseCredentials(config);
17363
17364
  if (dialect6 === "postgresql") {
17364
17365
  const parsed = postgresCredentials.safeParse(flattened);
@@ -17372,7 +17373,8 @@ var init_utils3 = __esm({
17372
17373
  schema: schema6,
17373
17374
  host,
17374
17375
  port,
17375
- credentials: credentials2
17376
+ credentials: credentials2,
17377
+ casing: casing2
17376
17378
  };
17377
17379
  }
17378
17380
  if (dialect6 === "mysql") {
@@ -17387,7 +17389,8 @@ var init_utils3 = __esm({
17387
17389
  schema: schema6,
17388
17390
  host,
17389
17391
  port,
17390
- credentials: credentials2
17392
+ credentials: credentials2,
17393
+ casing: casing2
17391
17394
  };
17392
17395
  }
17393
17396
  if (dialect6 === "singlestore") {
@@ -17402,7 +17405,8 @@ var init_utils3 = __esm({
17402
17405
  schema: schema6,
17403
17406
  host,
17404
17407
  port,
17405
- credentials: credentials2
17408
+ credentials: credentials2,
17409
+ casing: casing2
17406
17410
  };
17407
17411
  }
17408
17412
  if (dialect6 === "sqlite") {
@@ -17417,7 +17421,8 @@ var init_utils3 = __esm({
17417
17421
  schema: schema6,
17418
17422
  host,
17419
17423
  port,
17420
- credentials: credentials2
17424
+ credentials: credentials2,
17425
+ casing: casing2
17421
17426
  };
17422
17427
  }
17423
17428
  if (dialect6 === "turso") {
@@ -17432,7 +17437,8 @@ var init_utils3 = __esm({
17432
17437
  schema: schema6,
17433
17438
  host,
17434
17439
  port,
17435
- credentials: credentials2
17440
+ credentials: credentials2,
17441
+ casing: casing2
17436
17442
  };
17437
17443
  }
17438
17444
  if (dialect6 === "gel") {
@@ -91248,7 +91254,7 @@ __export(studio_exports, {
91248
91254
  prepareServer: () => prepareServer,
91249
91255
  prepareSingleStoreSchema: () => prepareSingleStoreSchema
91250
91256
  });
91251
- var import_crypto9, import_drizzle_orm11, import_drizzle_orm12, import_mysql_core3, import_pg_core3, import_singlestore_core3, import_sqlite_core3, import_fs12, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
91257
+ var import_crypto9, import_drizzle_orm11, import_mysql_core3, import_pg_core3, import_singlestore_core3, import_sqlite_core3, import_fs12, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
91252
91258
  var init_studio2 = __esm({
91253
91259
  "src/serializer/studio.ts"() {
91254
91260
  "use strict";
@@ -91256,7 +91262,6 @@ var init_studio2 = __esm({
91256
91262
  init_esm2();
91257
91263
  import_crypto9 = require("crypto");
91258
91264
  import_drizzle_orm11 = require("drizzle-orm");
91259
- import_drizzle_orm12 = require("drizzle-orm");
91260
91265
  import_mysql_core3 = require("drizzle-orm/mysql-core");
91261
91266
  import_pg_core3 = require("drizzle-orm/pg-core");
91262
91267
  import_singlestore_core3 = require("drizzle-orm/singlestore-core");
@@ -91270,6 +91275,7 @@ var init_studio2 = __esm({
91270
91275
  init_esm();
91271
91276
  init_utils3();
91272
91277
  init_serializer();
91278
+ init_utils4();
91273
91279
  preparePgSchema = async (path4) => {
91274
91280
  const imports = prepareFilenames(path4);
91275
91281
  const pgSchema2 = {};
@@ -91290,7 +91296,7 @@ var init_studio2 = __esm({
91290
91296
  pgSchema2[schema6] = pgSchema2[schema6] || {};
91291
91297
  pgSchema2[schema6][k3] = t4;
91292
91298
  }
91293
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91299
+ if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm11.Relations)) {
91294
91300
  relations5[k3] = t4;
91295
91301
  }
91296
91302
  });
@@ -91319,7 +91325,7 @@ var init_studio2 = __esm({
91319
91325
  const schema6 = (0, import_mysql_core3.getTableConfig)(t4).schema || "public";
91320
91326
  mysqlSchema3[schema6][k3] = t4;
91321
91327
  }
91322
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91328
+ if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm11.Relations)) {
91323
91329
  relations5[k3] = t4;
91324
91330
  }
91325
91331
  });
@@ -91348,7 +91354,7 @@ var init_studio2 = __esm({
91348
91354
  const schema6 = "public";
91349
91355
  sqliteSchema2[schema6][k3] = t4;
91350
91356
  }
91351
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91357
+ if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm11.Relations)) {
91352
91358
  relations5[k3] = t4;
91353
91359
  }
91354
91360
  });
@@ -91377,7 +91383,7 @@ var init_studio2 = __esm({
91377
91383
  const schema6 = (0, import_singlestore_core3.getTableConfig)(t4).schema || "public";
91378
91384
  singlestoreSchema2[schema6][k3] = t4;
91379
91385
  }
91380
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91386
+ if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm11.Relations)) {
91381
91387
  relations5[k3] = t4;
91382
91388
  }
91383
91389
  });
@@ -91385,7 +91391,7 @@ var init_studio2 = __esm({
91385
91391
  unregister();
91386
91392
  return { schema: singlestoreSchema2, relations: relations5, files };
91387
91393
  };
91388
- getCustomDefaults = (schema6) => {
91394
+ getCustomDefaults = (schema6, casing2) => {
91389
91395
  const customDefaults = [];
91390
91396
  Object.entries(schema6).map(([schema7, tables]) => {
91391
91397
  Object.entries(tables).map(([, table6]) => {
@@ -91404,7 +91410,7 @@ var init_studio2 = __esm({
91404
91410
  customDefaults.push({
91405
91411
  schema: schema7,
91406
91412
  table: tableConfig.name,
91407
- column: column11.name,
91413
+ column: getColumnCasing(column11, casing2),
91408
91414
  func: column11.defaultFn
91409
91415
  });
91410
91416
  }
@@ -91413,10 +91419,10 @@ var init_studio2 = __esm({
91413
91419
  });
91414
91420
  return customDefaults;
91415
91421
  };
91416
- drizzleForPostgres = async (credentials2, pgSchema2, relations5, schemaFiles) => {
91422
+ drizzleForPostgres = async (credentials2, pgSchema2, relations5, schemaFiles, casing2) => {
91417
91423
  const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91418
91424
  const db = await preparePostgresDB2(credentials2);
91419
- const customDefaults = getCustomDefaults(pgSchema2);
91425
+ const customDefaults = getCustomDefaults(pgSchema2, casing2);
91420
91426
  let dbUrl;
91421
91427
  if ("driver" in credentials2) {
91422
91428
  const { driver: driver2 } = credentials2;
@@ -91443,13 +91449,14 @@ var init_studio2 = __esm({
91443
91449
  customDefaults,
91444
91450
  schema: pgSchema2,
91445
91451
  relations: relations5,
91446
- schemaFiles
91452
+ schemaFiles,
91453
+ casing: casing2
91447
91454
  };
91448
91455
  };
91449
- drizzleForMySQL = async (credentials2, mysqlSchema3, relations5, schemaFiles) => {
91456
+ drizzleForMySQL = async (credentials2, mysqlSchema3, relations5, schemaFiles, casing2) => {
91450
91457
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91451
91458
  const { proxy, transactionProxy, database, packageName } = await connectToMySQL2(credentials2);
91452
- const customDefaults = getCustomDefaults(mysqlSchema3);
91459
+ const customDefaults = getCustomDefaults(mysqlSchema3, casing2);
91453
91460
  let dbUrl;
91454
91461
  if ("url" in credentials2) {
91455
91462
  dbUrl = credentials2.url;
@@ -91467,13 +91474,14 @@ var init_studio2 = __esm({
91467
91474
  customDefaults,
91468
91475
  schema: mysqlSchema3,
91469
91476
  relations: relations5,
91470
- schemaFiles
91477
+ schemaFiles,
91478
+ casing: casing2
91471
91479
  };
91472
91480
  };
91473
- drizzleForSQLite = async (credentials2, sqliteSchema2, relations5, schemaFiles) => {
91481
+ drizzleForSQLite = async (credentials2, sqliteSchema2, relations5, schemaFiles, casing2) => {
91474
91482
  const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91475
91483
  const sqliteDB = await connectToSQLite2(credentials2);
91476
- const customDefaults = getCustomDefaults(sqliteSchema2);
91484
+ const customDefaults = getCustomDefaults(sqliteSchema2, casing2);
91477
91485
  let dbUrl;
91478
91486
  if ("driver" in credentials2) {
91479
91487
  const { driver: driver2 } = credentials2;
@@ -91496,13 +91504,14 @@ var init_studio2 = __esm({
91496
91504
  customDefaults,
91497
91505
  schema: sqliteSchema2,
91498
91506
  relations: relations5,
91499
- schemaFiles
91507
+ schemaFiles,
91508
+ casing: casing2
91500
91509
  };
91501
91510
  };
91502
- drizzleForLibSQL = async (credentials2, sqliteSchema2, relations5, schemaFiles) => {
91511
+ drizzleForLibSQL = async (credentials2, sqliteSchema2, relations5, schemaFiles, casing2) => {
91503
91512
  const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91504
91513
  const sqliteDB = await connectToLibSQL2(credentials2);
91505
- const customDefaults = getCustomDefaults(sqliteSchema2);
91514
+ const customDefaults = getCustomDefaults(sqliteSchema2, casing2);
91506
91515
  let dbUrl = `turso://${credentials2.url}/${credentials2.authToken}`;
91507
91516
  const dbHash = (0, import_crypto9.createHash)("sha256").update(dbUrl).digest("hex");
91508
91517
  return {
@@ -91515,13 +91524,14 @@ var init_studio2 = __esm({
91515
91524
  customDefaults,
91516
91525
  schema: sqliteSchema2,
91517
91526
  relations: relations5,
91518
- schemaFiles
91527
+ schemaFiles,
91528
+ casing: casing2
91519
91529
  };
91520
91530
  };
91521
- drizzleForSingleStore = async (credentials2, singlestoreSchema2, relations5, schemaFiles) => {
91531
+ drizzleForSingleStore = async (credentials2, singlestoreSchema2, relations5, schemaFiles, casing2) => {
91522
91532
  const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91523
91533
  const { proxy, transactionProxy, database, packageName } = await connectToSingleStore2(credentials2);
91524
- const customDefaults = getCustomDefaults(singlestoreSchema2);
91534
+ const customDefaults = getCustomDefaults(singlestoreSchema2, casing2);
91525
91535
  let dbUrl;
91526
91536
  if ("url" in credentials2) {
91527
91537
  dbUrl = credentials2.url;
@@ -91539,14 +91549,15 @@ var init_studio2 = __esm({
91539
91549
  customDefaults,
91540
91550
  schema: singlestoreSchema2,
91541
91551
  relations: relations5,
91542
- schemaFiles
91552
+ schemaFiles,
91553
+ casing: casing2
91543
91554
  };
91544
91555
  };
91545
- extractRelations = (tablesConfig) => {
91556
+ extractRelations = (tablesConfig, casing2) => {
91546
91557
  const relations5 = Object.values(tablesConfig.tables).map(
91547
91558
  (it) => Object.entries(it.relations).map(([name, relation]) => {
91548
91559
  try {
91549
- const normalized = (0, import_drizzle_orm12.normalizeRelation)(
91560
+ const normalized = (0, import_drizzle_orm11.normalizeRelation)(
91550
91561
  tablesConfig.tables,
91551
91562
  tablesConfig.tableNamesMap,
91552
91563
  relation
@@ -91554,8 +91565,8 @@ var init_studio2 = __esm({
91554
91565
  const rel = relation;
91555
91566
  const refTableName = rel.referencedTableName;
91556
91567
  const refTable = rel.referencedTable;
91557
- const fields = normalized.fields.map((it2) => it2.name).flat();
91558
- const refColumns = normalized.references.map((it2) => it2.name).flat();
91568
+ const fields = normalized.fields.map((it2) => getColumnCasing(it2, casing2)).flat();
91569
+ const refColumns = normalized.references.map((it2) => getColumnCasing(it2, casing2)).flat();
91559
91570
  let refSchema;
91560
91571
  if ((0, import_drizzle_orm11.is)(refTable, import_pg_core3.PgTable)) {
91561
91572
  refSchema = (0, import_pg_core3.getTableConfig)(refTable).schema;
@@ -91569,9 +91580,9 @@ var init_studio2 = __esm({
91569
91580
  throw new Error("unsupported dialect");
91570
91581
  }
91571
91582
  let type;
91572
- if ((0, import_drizzle_orm11.is)(rel, import_drizzle_orm12.One)) {
91583
+ if ((0, import_drizzle_orm11.is)(rel, import_drizzle_orm11.One)) {
91573
91584
  type = "one";
91574
- } else if ((0, import_drizzle_orm11.is)(rel, import_drizzle_orm12.Many)) {
91585
+ } else if ((0, import_drizzle_orm11.is)(rel, import_drizzle_orm11.Many)) {
91575
91586
  type = "many";
91576
91587
  } else {
91577
91588
  throw new Error("unsupported relation type");
@@ -91605,14 +91616,26 @@ var init_studio2 = __esm({
91605
91616
  params: external_exports.array(external_exports.any()).optional(),
91606
91617
  typings: external_exports.string().array().optional(),
91607
91618
  mode: external_exports.enum(["array", "object"]).default("object"),
91608
- method: external_exports.union([external_exports.literal("values"), external_exports.literal("get"), external_exports.literal("all"), external_exports.literal("run"), external_exports.literal("execute")])
91619
+ method: external_exports.union([
91620
+ external_exports.literal("values"),
91621
+ external_exports.literal("get"),
91622
+ external_exports.literal("all"),
91623
+ external_exports.literal("run"),
91624
+ external_exports.literal("execute")
91625
+ ])
91609
91626
  })
91610
91627
  });
91611
91628
  transactionProxySchema = external_exports.object({
91612
91629
  type: external_exports.literal("tproxy"),
91613
91630
  data: external_exports.object({
91614
91631
  sql: external_exports.string(),
91615
- method: external_exports.union([external_exports.literal("values"), external_exports.literal("get"), external_exports.literal("all"), external_exports.literal("run"), external_exports.literal("execute")]).optional()
91632
+ method: external_exports.union([
91633
+ external_exports.literal("values"),
91634
+ external_exports.literal("get"),
91635
+ external_exports.literal("all"),
91636
+ external_exports.literal("run"),
91637
+ external_exports.literal("execute")
91638
+ ]).optional()
91616
91639
  }).array()
91617
91640
  });
91618
91641
  defaultsSchema = external_exports.object({
@@ -91625,7 +91648,12 @@ var init_studio2 = __esm({
91625
91648
  })
91626
91649
  ).min(1)
91627
91650
  });
91628
- schema5 = external_exports.union([init, proxySchema, transactionProxySchema, defaultsSchema]);
91651
+ schema5 = external_exports.union([
91652
+ init,
91653
+ proxySchema,
91654
+ transactionProxySchema,
91655
+ defaultsSchema
91656
+ ]);
91629
91657
  jsonStringify = (data) => {
91630
91658
  return JSON.stringify(data, (_key, value) => {
91631
91659
  if (value instanceof Error) {
@@ -91653,6 +91681,7 @@ var init_studio2 = __esm({
91653
91681
  schema: drizzleSchema,
91654
91682
  relations: relations5,
91655
91683
  dbHash,
91684
+ casing: casing2,
91656
91685
  schemaFiles
91657
91686
  }, app) => {
91658
91687
  app = app !== void 0 ? app : new Hono2();
@@ -91672,15 +91701,20 @@ var init_studio2 = __esm({
91672
91701
  const relationalSchema = {
91673
91702
  ...Object.fromEntries(
91674
91703
  Object.entries(drizzleSchema).map(([schemaName, schema6]) => {
91675
- const mappedTableEntries = Object.entries(schema6).map(([tableName, table6]) => {
91676
- return [`__${schemaName}__.${tableName}`, table6];
91677
- });
91704
+ const mappedTableEntries = Object.entries(schema6).map(
91705
+ ([tableName, table6]) => {
91706
+ return [`__${schemaName}__.${tableName}`, table6];
91707
+ }
91708
+ );
91678
91709
  return mappedTableEntries;
91679
91710
  }).flat()
91680
91711
  ),
91681
91712
  ...relations5
91682
91713
  };
91683
- const relationsConfig = (0, import_drizzle_orm12.extractTablesRelationalConfig)(relationalSchema, import_drizzle_orm12.createTableRelationsHelpers);
91714
+ const relationsConfig = (0, import_drizzle_orm11.extractTablesRelationalConfig)(
91715
+ relationalSchema,
91716
+ import_drizzle_orm11.createTableRelationsHelpers
91717
+ );
91684
91718
  app.post("/", zValidator("json", schema5), async (c3) => {
91685
91719
  const body = c3.req.valid("json");
91686
91720
  const { type } = body;
@@ -91692,11 +91726,17 @@ var init_studio2 = __esm({
91692
91726
  }));
91693
91727
  let relations6 = [];
91694
91728
  try {
91695
- relations6 = extractRelations(relationsConfig);
91729
+ relations6 = extractRelations(relationsConfig, casing2);
91696
91730
  } catch (error2) {
91697
- console.warn("Failed to extract relations. This is likely due to ambiguous or misconfigured relations.");
91698
- console.warn("Please check your schema and ensure that all relations are correctly defined.");
91699
- console.warn("See: https://orm.drizzle.team/docs/relations#disambiguating-relations");
91731
+ console.warn(
91732
+ "Failed to extract relations. This is likely due to ambiguous or misconfigured relations."
91733
+ );
91734
+ console.warn(
91735
+ "Please check your schema and ensure that all relations are correctly defined."
91736
+ );
91737
+ console.warn(
91738
+ "See: https://orm.drizzle.team/docs/relations#disambiguating-relations"
91739
+ );
91700
91740
  console.warn("Error message:", error2.message);
91701
91741
  }
91702
91742
  return c3.json({
@@ -91729,7 +91769,9 @@ var init_studio2 = __esm({
91729
91769
  return d3.schema === column11.schema && d3.table === column11.table && d3.column === column11.column;
91730
91770
  });
91731
91771
  if (!found) {
91732
- throw new Error(`Custom default not found for ${column11.schema}.${column11.table}.${column11.column}`);
91772
+ throw new Error(
91773
+ `Custom default not found for ${column11.schema}.${column11.table}.${column11.column}`
91774
+ );
91733
91775
  }
91734
91776
  const value = found.func();
91735
91777
  return {
@@ -94113,7 +94155,8 @@ var studio = command2({
94113
94155
  schema: schemaPath,
94114
94156
  port,
94115
94157
  host,
94116
- credentials: credentials2
94158
+ credentials: credentials2,
94159
+ casing: casing2
94117
94160
  } = await prepareStudioConfig(opts);
94118
94161
  const {
94119
94162
  drizzleForPostgres: drizzleForPostgres2,
@@ -94150,23 +94193,24 @@ var studio = command2({
94150
94193
  }
94151
94194
  }
94152
94195
  const { schema: schema6, relations: relations5, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94153
- setup = await drizzleForPostgres2(credentials2, schema6, relations5, files);
94196
+ setup = await drizzleForPostgres2(credentials2, schema6, relations5, files, casing2);
94154
94197
  } else if (dialect6 === "mysql") {
94155
94198
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94156
- setup = await drizzleForMySQL2(credentials2, schema6, relations5, files);
94199
+ setup = await drizzleForMySQL2(credentials2, schema6, relations5, files, casing2);
94157
94200
  } else if (dialect6 === "sqlite") {
94158
94201
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94159
- setup = await drizzleForSQLite2(credentials2, schema6, relations5, files);
94202
+ setup = await drizzleForSQLite2(credentials2, schema6, relations5, files, casing2);
94160
94203
  } else if (dialect6 === "turso") {
94161
94204
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94162
- setup = await drizzleForLibSQL2(credentials2, schema6, relations5, files);
94205
+ setup = await drizzleForLibSQL2(credentials2, schema6, relations5, files, casing2);
94163
94206
  } else if (dialect6 === "singlestore") {
94164
94207
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSingleStoreSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94165
94208
  setup = await drizzleForSingleStore2(
94166
94209
  credentials2,
94167
94210
  schema6,
94168
94211
  relations5,
94169
- files
94212
+ files,
94213
+ casing2
94170
94214
  );
94171
94215
  } else if (dialect6 === "gel") {
94172
94216
  console.log(
@@ -94273,7 +94317,7 @@ init_utils5();
94273
94317
  var version2 = async () => {
94274
94318
  const { npmVersion } = await ormCoreVersions();
94275
94319
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
94276
- const envVersion = "0.31.4";
94320
+ const envVersion = "0.31.5";
94277
94321
  const kitVersion = envVersion ? `v${envVersion}` : "--";
94278
94322
  const versions = `drizzle-kit: ${kitVersion}
94279
94323
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.31.4",
3
+ "version": "0.31.5",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",