drizzle-kit 0.31.4-e8ab855 → 0.31.5-7cb6516

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin.cjs CHANGED
@@ -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") {
@@ -18427,12 +18433,13 @@ __export(pgImports_exports, {
18427
18433
  prepareFromExports: () => prepareFromExports2,
18428
18434
  prepareFromPgImports: () => prepareFromPgImports
18429
18435
  });
18430
- var import_drizzle_orm3, import_pg_core, prepareFromExports2, prepareFromPgImports;
18436
+ var import_drizzle_orm3, import_pg_core, import_relations, prepareFromExports2, prepareFromPgImports;
18431
18437
  var init_pgImports = __esm({
18432
18438
  "src/serializer/pgImports.ts"() {
18433
18439
  "use strict";
18434
18440
  import_drizzle_orm3 = require("drizzle-orm");
18435
18441
  import_pg_core = require("drizzle-orm/pg-core");
18442
+ import_relations = require("drizzle-orm/relations");
18436
18443
  init_utils3();
18437
18444
  prepareFromExports2 = (exports2) => {
18438
18445
  const tables = [];
@@ -18443,6 +18450,7 @@ var init_pgImports = __esm({
18443
18450
  const policies = [];
18444
18451
  const views = [];
18445
18452
  const matViews = [];
18453
+ const relations5 = [];
18446
18454
  const i0values = Object.values(exports2);
18447
18455
  i0values.forEach((t4) => {
18448
18456
  if ((0, import_pg_core.isPgEnum)(t4)) {
@@ -18470,8 +18478,11 @@ var init_pgImports = __esm({
18470
18478
  if ((0, import_drizzle_orm3.is)(t4, import_pg_core.PgPolicy)) {
18471
18479
  policies.push(t4);
18472
18480
  }
18481
+ if ((0, import_drizzle_orm3.is)(t4, import_relations.Relations)) {
18482
+ relations5.push(t4);
18483
+ }
18473
18484
  });
18474
- return { tables, enums, schemas, sequences, views, matViews, roles, policies };
18485
+ return { tables, enums, schemas, sequences, views, matViews, roles, policies, relations: relations5 };
18475
18486
  };
18476
18487
  prepareFromPgImports = async (imports) => {
18477
18488
  const tables = [];
@@ -18482,6 +18493,7 @@ var init_pgImports = __esm({
18482
18493
  const roles = [];
18483
18494
  const policies = [];
18484
18495
  const matViews = [];
18496
+ const relations5 = [];
18485
18497
  const { unregister } = await safeRegister();
18486
18498
  for (let i4 = 0; i4 < imports.length; i4++) {
18487
18499
  const it = imports[i4];
@@ -18495,9 +18507,20 @@ var init_pgImports = __esm({
18495
18507
  matViews.push(...prepared.matViews);
18496
18508
  roles.push(...prepared.roles);
18497
18509
  policies.push(...prepared.policies);
18510
+ relations5.push(...prepared.relations);
18498
18511
  }
18499
18512
  unregister();
18500
- return { tables: Array.from(new Set(tables)), enums, schemas, sequences, views, matViews, roles, policies };
18513
+ return {
18514
+ tables: Array.from(new Set(tables)),
18515
+ enums,
18516
+ schemas,
18517
+ sequences,
18518
+ views,
18519
+ matViews,
18520
+ roles,
18521
+ policies,
18522
+ relations: relations5
18523
+ };
18501
18524
  };
18502
18525
  }
18503
18526
  });
@@ -21440,7 +21463,7 @@ ${filenames.join("\n")}
21440
21463
  });
21441
21464
 
21442
21465
  // src/migrationPreparator.ts
21443
- var import_crypto, import_fs5, prepareMySqlDbPushSnapshot, prepareSingleStoreDbPushSnapshot, prepareSQLiteDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSingleStoreMigrationSnapshot, prepareSqliteMigrationSnapshot, fillPgSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
21466
+ var import_crypto, import_fs5, prepareMySqlDbPushSnapshot, prepareSingleStoreDbPushSnapshot, prepareSQLiteDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSingleStoreMigrationSnapshot, prepareSqliteMigrationSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
21444
21467
  var init_migrationPreparator = __esm({
21445
21468
  "src/migrationPreparator.ts"() {
21446
21469
  "use strict";
@@ -21538,13 +21561,6 @@ var init_migrationPreparator = __esm({
21538
21561
  };
21539
21562
  return { prev: prevSnapshot, cur: result, custom: custom2 };
21540
21563
  };
21541
- fillPgSnapshot = ({
21542
- serialized,
21543
- id,
21544
- idPrev
21545
- }) => {
21546
- return { id, prevId: idPrev, ...serialized };
21547
- };
21548
21564
  preparePgMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
21549
21565
  const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
21550
21566
  const serialized = await serializePg(schemaPath, casing2);
@@ -21552,7 +21568,11 @@ var init_migrationPreparator = __esm({
21552
21568
  const idPrev = prevSnapshot.id;
21553
21569
  const result = { id, prevId: idPrev, ...serialized };
21554
21570
  const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
21555
- const custom2 = fillPgSnapshot({ serialized: prevRest, id, idPrev });
21571
+ const custom2 = {
21572
+ id,
21573
+ prevId: idPrev,
21574
+ ...prevRest
21575
+ };
21556
21576
  return { prev: prevSnapshot, cur: result, custom: custom2 };
21557
21577
  };
21558
21578
  preparePrevSnapshot = (snapshots, defaultPrev) => {
@@ -80522,7 +80542,7 @@ var init_connections = __esm({
80522
80542
  const { PGlite, types: types3 } = await import("@electric-sql/pglite");
80523
80543
  const { drizzle } = await import("drizzle-orm/pglite");
80524
80544
  const { migrate: migrate2 } = await import("drizzle-orm/pglite/migrator");
80525
- const pglite = new PGlite(normalisePGliteUrl(credentials2.url));
80545
+ const pglite = "client" in credentials2 ? credentials2.client : new PGlite(normalisePGliteUrl(credentials2.url));
80526
80546
  await pglite.waitReady;
80527
80547
  const drzl = drizzle(pglite);
80528
80548
  const migrateFn = async (config) => {
@@ -86750,12 +86770,12 @@ function generateIdentityParams2(identity) {
86750
86770
  }
86751
86771
  return `.generatedByDefaultAsIdentity(${paramsObj})`;
86752
86772
  }
86753
- var import_drizzle_orm10, import_relations, import_casing5, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault4, importsPatch2, relations4, escapeColumnKey4, withCasing3, dbColumnName4, paramNameFor2, schemaToTypeScript4, isCyclic4, isSelf4, buildArrayDefault2, mapDefault2, column9, dimensionsInArray2, createTableColumns4, createTableIndexes4, createTablePKs4, createTablePolicies2, createTableUniques4, createTableChecks4, createTableFKs4;
86773
+ var import_drizzle_orm10, import_relations2, import_casing5, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault4, importsPatch2, relations4, escapeColumnKey4, withCasing3, dbColumnName4, paramNameFor2, schemaToTypeScript4, isCyclic4, isSelf4, buildArrayDefault2, mapDefault2, column9, dimensionsInArray2, createTableColumns4, createTableIndexes4, createTablePKs4, createTablePolicies2, createTableUniques4, createTableChecks4, createTableFKs4;
86754
86774
  var init_introspect_pg = __esm({
86755
86775
  "src/introspect-pg.ts"() {
86756
86776
  "use strict";
86757
86777
  import_drizzle_orm10 = require("drizzle-orm");
86758
- import_relations = require("drizzle-orm/relations");
86778
+ import_relations2 = require("drizzle-orm/relations");
86759
86779
  init_utils();
86760
86780
  import_casing5 = require("drizzle-orm/casing");
86761
86781
  init_global();
@@ -91248,7 +91268,7 @@ __export(studio_exports, {
91248
91268
  prepareServer: () => prepareServer,
91249
91269
  prepareSingleStoreSchema: () => prepareSingleStoreSchema
91250
91270
  });
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;
91271
+ var import_crypto9, import_drizzle_orm11, import_mysql_core3, import_pg_core3, import_relations3, 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
91272
  var init_studio2 = __esm({
91253
91273
  "src/serializer/studio.ts"() {
91254
91274
  "use strict";
@@ -91256,9 +91276,9 @@ var init_studio2 = __esm({
91256
91276
  init_esm2();
91257
91277
  import_crypto9 = require("crypto");
91258
91278
  import_drizzle_orm11 = require("drizzle-orm");
91259
- import_drizzle_orm12 = require("drizzle-orm");
91260
91279
  import_mysql_core3 = require("drizzle-orm/mysql-core");
91261
91280
  import_pg_core3 = require("drizzle-orm/pg-core");
91281
+ import_relations3 = require("drizzle-orm/relations");
91262
91282
  import_singlestore_core3 = require("drizzle-orm/singlestore-core");
91263
91283
  import_sqlite_core3 = require("drizzle-orm/sqlite-core");
91264
91284
  import_fs12 = __toESM(require("fs"));
@@ -91270,6 +91290,7 @@ var init_studio2 = __esm({
91270
91290
  init_esm();
91271
91291
  init_utils3();
91272
91292
  init_serializer();
91293
+ init_utils4();
91273
91294
  preparePgSchema = async (path4) => {
91274
91295
  const imports = prepareFilenames(path4);
91275
91296
  const pgSchema2 = {};
@@ -91290,7 +91311,7 @@ var init_studio2 = __esm({
91290
91311
  pgSchema2[schema6] = pgSchema2[schema6] || {};
91291
91312
  pgSchema2[schema6][k3] = t4;
91292
91313
  }
91293
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91314
+ if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
91294
91315
  relations5[k3] = t4;
91295
91316
  }
91296
91317
  });
@@ -91319,7 +91340,7 @@ var init_studio2 = __esm({
91319
91340
  const schema6 = (0, import_mysql_core3.getTableConfig)(t4).schema || "public";
91320
91341
  mysqlSchema3[schema6][k3] = t4;
91321
91342
  }
91322
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91343
+ if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
91323
91344
  relations5[k3] = t4;
91324
91345
  }
91325
91346
  });
@@ -91348,7 +91369,7 @@ var init_studio2 = __esm({
91348
91369
  const schema6 = "public";
91349
91370
  sqliteSchema2[schema6][k3] = t4;
91350
91371
  }
91351
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91372
+ if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
91352
91373
  relations5[k3] = t4;
91353
91374
  }
91354
91375
  });
@@ -91377,7 +91398,7 @@ var init_studio2 = __esm({
91377
91398
  const schema6 = (0, import_singlestore_core3.getTableConfig)(t4).schema || "public";
91378
91399
  singlestoreSchema2[schema6][k3] = t4;
91379
91400
  }
91380
- if ((0, import_drizzle_orm11.is)(t4, import_drizzle_orm12.Relations)) {
91401
+ if ((0, import_drizzle_orm11.is)(t4, import_relations3.Relations)) {
91381
91402
  relations5[k3] = t4;
91382
91403
  }
91383
91404
  });
@@ -91385,7 +91406,7 @@ var init_studio2 = __esm({
91385
91406
  unregister();
91386
91407
  return { schema: singlestoreSchema2, relations: relations5, files };
91387
91408
  };
91388
- getCustomDefaults = (schema6) => {
91409
+ getCustomDefaults = (schema6, casing2) => {
91389
91410
  const customDefaults = [];
91390
91411
  Object.entries(schema6).map(([schema7, tables]) => {
91391
91412
  Object.entries(tables).map(([, table6]) => {
@@ -91404,7 +91425,7 @@ var init_studio2 = __esm({
91404
91425
  customDefaults.push({
91405
91426
  schema: schema7,
91406
91427
  table: tableConfig.name,
91407
- column: column11.name,
91428
+ column: getColumnCasing(column11, casing2),
91408
91429
  func: column11.defaultFn
91409
91430
  });
91410
91431
  }
@@ -91413,17 +91434,17 @@ var init_studio2 = __esm({
91413
91434
  });
91414
91435
  return customDefaults;
91415
91436
  };
91416
- drizzleForPostgres = async (credentials2, pgSchema2, relations5, schemaFiles) => {
91437
+ drizzleForPostgres = async (credentials2, pgSchema2, relations5, schemaFiles, casing2) => {
91417
91438
  const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91418
91439
  const db = await preparePostgresDB2(credentials2);
91419
- const customDefaults = getCustomDefaults(pgSchema2);
91440
+ const customDefaults = getCustomDefaults(pgSchema2, casing2);
91420
91441
  let dbUrl;
91421
91442
  if ("driver" in credentials2) {
91422
91443
  const { driver: driver2 } = credentials2;
91423
91444
  if (driver2 === "aws-data-api") {
91424
91445
  dbUrl = `aws-data-api://${credentials2.database}/${credentials2.secretArn}/${credentials2.resourceArn}`;
91425
91446
  } else if (driver2 === "pglite") {
91426
- dbUrl = credentials2.url;
91447
+ dbUrl = "client" in credentials2 ? credentials2.client.dataDir || "pglite://custom-client" : credentials2.url;
91427
91448
  } else {
91428
91449
  assertUnreachable(driver2);
91429
91450
  }
@@ -91443,13 +91464,14 @@ var init_studio2 = __esm({
91443
91464
  customDefaults,
91444
91465
  schema: pgSchema2,
91445
91466
  relations: relations5,
91446
- schemaFiles
91467
+ schemaFiles,
91468
+ casing: casing2
91447
91469
  };
91448
91470
  };
91449
- drizzleForMySQL = async (credentials2, mysqlSchema3, relations5, schemaFiles) => {
91471
+ drizzleForMySQL = async (credentials2, mysqlSchema3, relations5, schemaFiles, casing2) => {
91450
91472
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91451
91473
  const { proxy, transactionProxy, database, packageName } = await connectToMySQL2(credentials2);
91452
- const customDefaults = getCustomDefaults(mysqlSchema3);
91474
+ const customDefaults = getCustomDefaults(mysqlSchema3, casing2);
91453
91475
  let dbUrl;
91454
91476
  if ("url" in credentials2) {
91455
91477
  dbUrl = credentials2.url;
@@ -91467,13 +91489,14 @@ var init_studio2 = __esm({
91467
91489
  customDefaults,
91468
91490
  schema: mysqlSchema3,
91469
91491
  relations: relations5,
91470
- schemaFiles
91492
+ schemaFiles,
91493
+ casing: casing2
91471
91494
  };
91472
91495
  };
91473
- drizzleForSQLite = async (credentials2, sqliteSchema2, relations5, schemaFiles) => {
91496
+ drizzleForSQLite = async (credentials2, sqliteSchema2, relations5, schemaFiles, casing2) => {
91474
91497
  const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91475
91498
  const sqliteDB = await connectToSQLite2(credentials2);
91476
- const customDefaults = getCustomDefaults(sqliteSchema2);
91499
+ const customDefaults = getCustomDefaults(sqliteSchema2, casing2);
91477
91500
  let dbUrl;
91478
91501
  if ("driver" in credentials2) {
91479
91502
  const { driver: driver2 } = credentials2;
@@ -91496,13 +91519,14 @@ var init_studio2 = __esm({
91496
91519
  customDefaults,
91497
91520
  schema: sqliteSchema2,
91498
91521
  relations: relations5,
91499
- schemaFiles
91522
+ schemaFiles,
91523
+ casing: casing2
91500
91524
  };
91501
91525
  };
91502
- drizzleForLibSQL = async (credentials2, sqliteSchema2, relations5, schemaFiles) => {
91526
+ drizzleForLibSQL = async (credentials2, sqliteSchema2, relations5, schemaFiles, casing2) => {
91503
91527
  const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91504
91528
  const sqliteDB = await connectToLibSQL2(credentials2);
91505
- const customDefaults = getCustomDefaults(sqliteSchema2);
91529
+ const customDefaults = getCustomDefaults(sqliteSchema2, casing2);
91506
91530
  let dbUrl = `turso://${credentials2.url}/${credentials2.authToken}`;
91507
91531
  const dbHash = (0, import_crypto9.createHash)("sha256").update(dbUrl).digest("hex");
91508
91532
  return {
@@ -91515,13 +91539,14 @@ var init_studio2 = __esm({
91515
91539
  customDefaults,
91516
91540
  schema: sqliteSchema2,
91517
91541
  relations: relations5,
91518
- schemaFiles
91542
+ schemaFiles,
91543
+ casing: casing2
91519
91544
  };
91520
91545
  };
91521
- drizzleForSingleStore = async (credentials2, singlestoreSchema2, relations5, schemaFiles) => {
91546
+ drizzleForSingleStore = async (credentials2, singlestoreSchema2, relations5, schemaFiles, casing2) => {
91522
91547
  const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
91523
91548
  const { proxy, transactionProxy, database, packageName } = await connectToSingleStore2(credentials2);
91524
- const customDefaults = getCustomDefaults(singlestoreSchema2);
91549
+ const customDefaults = getCustomDefaults(singlestoreSchema2, casing2);
91525
91550
  let dbUrl;
91526
91551
  if ("url" in credentials2) {
91527
91552
  dbUrl = credentials2.url;
@@ -91539,14 +91564,15 @@ var init_studio2 = __esm({
91539
91564
  customDefaults,
91540
91565
  schema: singlestoreSchema2,
91541
91566
  relations: relations5,
91542
- schemaFiles
91567
+ schemaFiles,
91568
+ casing: casing2
91543
91569
  };
91544
91570
  };
91545
- extractRelations = (tablesConfig) => {
91571
+ extractRelations = (tablesConfig, casing2) => {
91546
91572
  const relations5 = Object.values(tablesConfig.tables).map(
91547
91573
  (it) => Object.entries(it.relations).map(([name, relation]) => {
91548
91574
  try {
91549
- const normalized = (0, import_drizzle_orm12.normalizeRelation)(
91575
+ const normalized = (0, import_relations3.normalizeRelation)(
91550
91576
  tablesConfig.tables,
91551
91577
  tablesConfig.tableNamesMap,
91552
91578
  relation
@@ -91554,8 +91580,8 @@ var init_studio2 = __esm({
91554
91580
  const rel = relation;
91555
91581
  const refTableName = rel.referencedTableName;
91556
91582
  const refTable = rel.referencedTable;
91557
- const fields = normalized.fields.map((it2) => it2.name).flat();
91558
- const refColumns = normalized.references.map((it2) => it2.name).flat();
91583
+ const fields = normalized.fields.map((it2) => getColumnCasing(it2, casing2)).flat();
91584
+ const refColumns = normalized.references.map((it2) => getColumnCasing(it2, casing2)).flat();
91559
91585
  let refSchema;
91560
91586
  if ((0, import_drizzle_orm11.is)(refTable, import_pg_core3.PgTable)) {
91561
91587
  refSchema = (0, import_pg_core3.getTableConfig)(refTable).schema;
@@ -91569,9 +91595,9 @@ var init_studio2 = __esm({
91569
91595
  throw new Error("unsupported dialect");
91570
91596
  }
91571
91597
  let type;
91572
- if ((0, import_drizzle_orm11.is)(rel, import_drizzle_orm12.One)) {
91598
+ if ((0, import_drizzle_orm11.is)(rel, import_relations3.One)) {
91573
91599
  type = "one";
91574
- } else if ((0, import_drizzle_orm11.is)(rel, import_drizzle_orm12.Many)) {
91600
+ } else if ((0, import_drizzle_orm11.is)(rel, import_relations3.Many)) {
91575
91601
  type = "many";
91576
91602
  } else {
91577
91603
  throw new Error("unsupported relation type");
@@ -91605,14 +91631,26 @@ var init_studio2 = __esm({
91605
91631
  params: external_exports.array(external_exports.any()).optional(),
91606
91632
  typings: external_exports.string().array().optional(),
91607
91633
  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")])
91634
+ method: external_exports.union([
91635
+ external_exports.literal("values"),
91636
+ external_exports.literal("get"),
91637
+ external_exports.literal("all"),
91638
+ external_exports.literal("run"),
91639
+ external_exports.literal("execute")
91640
+ ])
91609
91641
  })
91610
91642
  });
91611
91643
  transactionProxySchema = external_exports.object({
91612
91644
  type: external_exports.literal("tproxy"),
91613
91645
  data: external_exports.object({
91614
91646
  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()
91647
+ method: external_exports.union([
91648
+ external_exports.literal("values"),
91649
+ external_exports.literal("get"),
91650
+ external_exports.literal("all"),
91651
+ external_exports.literal("run"),
91652
+ external_exports.literal("execute")
91653
+ ]).optional()
91616
91654
  }).array()
91617
91655
  });
91618
91656
  defaultsSchema = external_exports.object({
@@ -91625,7 +91663,12 @@ var init_studio2 = __esm({
91625
91663
  })
91626
91664
  ).min(1)
91627
91665
  });
91628
- schema5 = external_exports.union([init, proxySchema, transactionProxySchema, defaultsSchema]);
91666
+ schema5 = external_exports.union([
91667
+ init,
91668
+ proxySchema,
91669
+ transactionProxySchema,
91670
+ defaultsSchema
91671
+ ]);
91629
91672
  jsonStringify = (data) => {
91630
91673
  return JSON.stringify(data, (_key, value) => {
91631
91674
  if (value instanceof Error) {
@@ -91653,6 +91696,7 @@ var init_studio2 = __esm({
91653
91696
  schema: drizzleSchema,
91654
91697
  relations: relations5,
91655
91698
  dbHash,
91699
+ casing: casing2,
91656
91700
  schemaFiles
91657
91701
  }, app) => {
91658
91702
  app = app !== void 0 ? app : new Hono2();
@@ -91672,15 +91716,20 @@ var init_studio2 = __esm({
91672
91716
  const relationalSchema = {
91673
91717
  ...Object.fromEntries(
91674
91718
  Object.entries(drizzleSchema).map(([schemaName, schema6]) => {
91675
- const mappedTableEntries = Object.entries(schema6).map(([tableName, table6]) => {
91676
- return [`__${schemaName}__.${tableName}`, table6];
91677
- });
91719
+ const mappedTableEntries = Object.entries(schema6).map(
91720
+ ([tableName, table6]) => {
91721
+ return [`__${schemaName}__.${tableName}`, table6];
91722
+ }
91723
+ );
91678
91724
  return mappedTableEntries;
91679
91725
  }).flat()
91680
91726
  ),
91681
91727
  ...relations5
91682
91728
  };
91683
- const relationsConfig = (0, import_drizzle_orm12.extractTablesRelationalConfig)(relationalSchema, import_drizzle_orm12.createTableRelationsHelpers);
91729
+ const relationsConfig = (0, import_relations3.extractTablesRelationalConfig)(
91730
+ relationalSchema,
91731
+ import_relations3.createTableRelationsHelpers
91732
+ );
91684
91733
  app.post("/", zValidator("json", schema5), async (c3) => {
91685
91734
  const body = c3.req.valid("json");
91686
91735
  const { type } = body;
@@ -91692,11 +91741,17 @@ var init_studio2 = __esm({
91692
91741
  }));
91693
91742
  let relations6 = [];
91694
91743
  try {
91695
- relations6 = extractRelations(relationsConfig);
91744
+ relations6 = extractRelations(relationsConfig, casing2);
91696
91745
  } 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");
91746
+ console.warn(
91747
+ "Failed to extract relations. This is likely due to ambiguous or misconfigured relations."
91748
+ );
91749
+ console.warn(
91750
+ "Please check your schema and ensure that all relations are correctly defined."
91751
+ );
91752
+ console.warn(
91753
+ "See: https://orm.drizzle.team/docs/relations#disambiguating-relations"
91754
+ );
91700
91755
  console.warn("Error message:", error2.message);
91701
91756
  }
91702
91757
  return c3.json({
@@ -91729,7 +91784,9 @@ var init_studio2 = __esm({
91729
91784
  return d3.schema === column11.schema && d3.table === column11.table && d3.column === column11.column;
91730
91785
  });
91731
91786
  if (!found) {
91732
- throw new Error(`Custom default not found for ${column11.schema}.${column11.table}.${column11.column}`);
91787
+ throw new Error(
91788
+ `Custom default not found for ${column11.schema}.${column11.table}.${column11.column}`
91789
+ );
91733
91790
  }
91734
91791
  const value = found.func();
91735
91792
  return {
@@ -94113,7 +94170,8 @@ var studio = command2({
94113
94170
  schema: schemaPath,
94114
94171
  port,
94115
94172
  host,
94116
- credentials: credentials2
94173
+ credentials: credentials2,
94174
+ casing: casing2
94117
94175
  } = await prepareStudioConfig(opts);
94118
94176
  const {
94119
94177
  drizzleForPostgres: drizzleForPostgres2,
@@ -94150,23 +94208,24 @@ var studio = command2({
94150
94208
  }
94151
94209
  }
94152
94210
  const { schema: schema6, relations: relations5, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94153
- setup = await drizzleForPostgres2(credentials2, schema6, relations5, files);
94211
+ setup = await drizzleForPostgres2(credentials2, schema6, relations5, files, casing2);
94154
94212
  } else if (dialect6 === "mysql") {
94155
94213
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94156
- setup = await drizzleForMySQL2(credentials2, schema6, relations5, files);
94214
+ setup = await drizzleForMySQL2(credentials2, schema6, relations5, files, casing2);
94157
94215
  } else if (dialect6 === "sqlite") {
94158
94216
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94159
- setup = await drizzleForSQLite2(credentials2, schema6, relations5, files);
94217
+ setup = await drizzleForSQLite2(credentials2, schema6, relations5, files, casing2);
94160
94218
  } else if (dialect6 === "turso") {
94161
94219
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94162
- setup = await drizzleForLibSQL2(credentials2, schema6, relations5, files);
94220
+ setup = await drizzleForLibSQL2(credentials2, schema6, relations5, files, casing2);
94163
94221
  } else if (dialect6 === "singlestore") {
94164
94222
  const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSingleStoreSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
94165
94223
  setup = await drizzleForSingleStore2(
94166
94224
  credentials2,
94167
94225
  schema6,
94168
94226
  relations5,
94169
- files
94227
+ files,
94228
+ casing2
94170
94229
  );
94171
94230
  } else if (dialect6 === "gel") {
94172
94231
  console.log(
@@ -94273,7 +94332,7 @@ init_utils5();
94273
94332
  var version2 = async () => {
94274
94333
  const { npmVersion } = await ormCoreVersions();
94275
94334
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
94276
- const envVersion = "0.31.4-e8ab855";
94335
+ const envVersion = "0.31.5-7cb6516";
94277
94336
  const kitVersion = envVersion ? `v${envVersion}` : "--";
94278
94337
  const versions = `drizzle-kit: ${kitVersion}
94279
94338
  ${ormVersion}`;