drizzle-kit 0.31.4-e8ab855 → 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 +15 -17
  2. package/api.mjs +15 -17
  3. package/bin.cjs +100 -56
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -23673,6 +23673,7 @@ function isConfig(data) {
23673
23673
  if (Object.keys(data).length === 0) return true;
23674
23674
  return false;
23675
23675
  }
23676
+ var textDecoder;
23676
23677
  var init_utils2 = __esm({
23677
23678
  "../drizzle-orm/dist/utils.js"() {
23678
23679
  "use strict";
@@ -23682,6 +23683,7 @@ var init_utils2 = __esm({
23682
23683
  init_subquery();
23683
23684
  init_table();
23684
23685
  init_view_common();
23686
+ textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
23685
23687
  }
23686
23688
  });
23687
23689
 
@@ -26186,7 +26188,8 @@ __export(dist_exports, {
26186
26188
  relations: () => relations,
26187
26189
  sql: () => sql,
26188
26190
  sum: () => sum,
26189
- sumDistinct: () => sumDistinct
26191
+ sumDistinct: () => sumDistinct,
26192
+ textDecoder: () => textDecoder
26190
26193
  });
26191
26194
  var init_dist = __esm({
26192
26195
  "../drizzle-orm/dist/index.js"() {
@@ -32466,14 +32469,11 @@ var init_blob = __esm({
32466
32469
  return "blob";
32467
32470
  }
32468
32471
  mapFromDriverValue(value) {
32469
- if (Buffer.isBuffer(value)) {
32470
- return BigInt(value.toString());
32471
- }
32472
- if (value instanceof ArrayBuffer) {
32473
- const decoder = new TextDecoder();
32474
- return BigInt(decoder.decode(value));
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"));
32475
32475
  }
32476
- return BigInt(String.fromCodePoint(...value));
32476
+ return BigInt(textDecoder.decode(value));
32477
32477
  }
32478
32478
  mapToDriverValue(value) {
32479
32479
  return Buffer.from(value.toString());
@@ -32498,14 +32498,11 @@ var init_blob = __esm({
32498
32498
  return "blob";
32499
32499
  }
32500
32500
  mapFromDriverValue(value) {
32501
- if (Buffer.isBuffer(value)) {
32502
- return JSON.parse(value.toString());
32503
- }
32504
- if (value instanceof ArrayBuffer) {
32505
- const decoder = new TextDecoder();
32506
- return JSON.parse(decoder.decode(value));
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"));
32507
32504
  }
32508
- return JSON.parse(String.fromCodePoint(...value));
32505
+ return JSON.parse(textDecoder.decode(value));
32509
32506
  }
32510
32507
  mapToDriverValue(value) {
32511
32508
  return Buffer.from(JSON.stringify(value));
@@ -42512,6 +42509,7 @@ var init_studio = __esm({
42512
42509
  "use strict";
42513
42510
  init_esm();
42514
42511
  init_schemaValidator();
42512
+ init_common();
42515
42513
  init_mysql();
42516
42514
  init_postgres();
42517
42515
  init_sqlite();
@@ -42527,7 +42525,8 @@ var init_studio = __esm({
42527
42525
  });
42528
42526
  studioConfig = objectType({
42529
42527
  dialect: dialect4,
42530
- schema: unionType([stringType(), stringType().array()]).optional()
42528
+ schema: unionType([stringType(), stringType().array()]).optional(),
42529
+ casing: casingType.optional()
42531
42530
  });
42532
42531
  }
42533
42532
  });
@@ -42560,7 +42559,6 @@ var init_utils9 = __esm({
42560
42559
  init_cli();
42561
42560
  init_common();
42562
42561
  init_gel();
42563
- init_gel();
42564
42562
  init_libsql();
42565
42563
  init_mysql();
42566
42564
  init_outputs();
package/api.mjs CHANGED
@@ -23678,6 +23678,7 @@ function isConfig(data) {
23678
23678
  if (Object.keys(data).length === 0) return true;
23679
23679
  return false;
23680
23680
  }
23681
+ var textDecoder;
23681
23682
  var init_utils2 = __esm({
23682
23683
  "../drizzle-orm/dist/utils.js"() {
23683
23684
  "use strict";
@@ -23687,6 +23688,7 @@ var init_utils2 = __esm({
23687
23688
  init_subquery();
23688
23689
  init_table();
23689
23690
  init_view_common();
23691
+ textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
23690
23692
  }
23691
23693
  });
23692
23694
 
@@ -26191,7 +26193,8 @@ __export(dist_exports, {
26191
26193
  relations: () => relations,
26192
26194
  sql: () => sql,
26193
26195
  sum: () => sum,
26194
- sumDistinct: () => sumDistinct
26196
+ sumDistinct: () => sumDistinct,
26197
+ textDecoder: () => textDecoder
26195
26198
  });
26196
26199
  var init_dist = __esm({
26197
26200
  "../drizzle-orm/dist/index.js"() {
@@ -32471,14 +32474,11 @@ var init_blob = __esm({
32471
32474
  return "blob";
32472
32475
  }
32473
32476
  mapFromDriverValue(value) {
32474
- if (Buffer.isBuffer(value)) {
32475
- return BigInt(value.toString());
32476
- }
32477
- if (value instanceof ArrayBuffer) {
32478
- const decoder = new TextDecoder();
32479
- return BigInt(decoder.decode(value));
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"));
32480
32480
  }
32481
- return BigInt(String.fromCodePoint(...value));
32481
+ return BigInt(textDecoder.decode(value));
32482
32482
  }
32483
32483
  mapToDriverValue(value) {
32484
32484
  return Buffer.from(value.toString());
@@ -32503,14 +32503,11 @@ var init_blob = __esm({
32503
32503
  return "blob";
32504
32504
  }
32505
32505
  mapFromDriverValue(value) {
32506
- if (Buffer.isBuffer(value)) {
32507
- return JSON.parse(value.toString());
32508
- }
32509
- if (value instanceof ArrayBuffer) {
32510
- const decoder = new TextDecoder();
32511
- return JSON.parse(decoder.decode(value));
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"));
32512
32509
  }
32513
- return JSON.parse(String.fromCodePoint(...value));
32510
+ return JSON.parse(textDecoder.decode(value));
32514
32511
  }
32515
32512
  mapToDriverValue(value) {
32516
32513
  return Buffer.from(JSON.stringify(value));
@@ -42517,6 +42514,7 @@ var init_studio = __esm({
42517
42514
  "use strict";
42518
42515
  init_esm();
42519
42516
  init_schemaValidator();
42517
+ init_common();
42520
42518
  init_mysql();
42521
42519
  init_postgres();
42522
42520
  init_sqlite();
@@ -42532,7 +42530,8 @@ var init_studio = __esm({
42532
42530
  });
42533
42531
  studioConfig = objectType({
42534
42532
  dialect: dialect4,
42535
- schema: unionType([stringType(), stringType().array()]).optional()
42533
+ schema: unionType([stringType(), stringType().array()]).optional(),
42534
+ casing: casingType.optional()
42536
42535
  });
42537
42536
  }
42538
42537
  });
@@ -42565,7 +42564,6 @@ var init_utils9 = __esm({
42565
42564
  init_cli();
42566
42565
  init_common();
42567
42566
  init_gel();
42568
- init_gel();
42569
42567
  init_libsql();
42570
42568
  init_mysql();
42571
42569
  init_outputs();
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-e8ab855";
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-e8ab855",
3
+ "version": "0.31.5",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",