drizzle-kit 0.25.0-cd0b1a2 → 0.25.0-cf24be9

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -6591,11 +6591,17 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
6591
6591
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
6592
6592
  return { addedColumns, removedColumns };
6593
6593
  }
6594
- var import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl, normalisePGliteUrl;
6594
+ function getColumnCasing(column7, casing2) {
6595
+ if (!column7.name)
6596
+ return "";
6597
+ return !column7.keyAsName || casing2 === void 0 ? column7.name : casing2 === "camelCase" ? (0, import_casing.toCamelCase)(column7.name) : (0, import_casing.toSnakeCase)(column7.name);
6598
+ }
6599
+ var import_casing, import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl, normalisePGliteUrl;
6595
6600
  var init_utils = __esm({
6596
6601
  "src/utils.ts"() {
6597
6602
  "use strict";
6598
6603
  init_source();
6604
+ import_casing = require("drizzle-orm/casing");
6599
6605
  import_fs = require("fs");
6600
6606
  import_path = require("path");
6601
6607
  import_url = require("url");
@@ -6625,27 +6631,27 @@ var init_utils = __esm({
6625
6631
  process.exit(1);
6626
6632
  }
6627
6633
  };
6628
- dryJournal = (dialect7) => {
6634
+ dryJournal = (dialect4) => {
6629
6635
  return {
6630
6636
  version: snapshotVersion,
6631
- dialect: dialect7,
6637
+ dialect: dialect4,
6632
6638
  entries: []
6633
6639
  };
6634
6640
  };
6635
- prepareOutFolder = (out, dialect7) => {
6641
+ prepareOutFolder = (out, dialect4) => {
6636
6642
  const meta = (0, import_path.join)(out, "meta");
6637
6643
  const journalPath = (0, import_path.join)(meta, "_journal.json");
6638
6644
  if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
6639
6645
  (0, import_fs.mkdirSync)(meta, { recursive: true });
6640
- (0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect7)));
6646
+ (0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect4)));
6641
6647
  }
6642
6648
  const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
6643
6649
  const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
6644
6650
  snapshots.sort();
6645
6651
  return { meta, snapshots, journal };
6646
6652
  };
6647
- validatorForDialect = (dialect7) => {
6648
- switch (dialect7) {
6653
+ validatorForDialect = (dialect4) => {
6654
+ switch (dialect4) {
6649
6655
  case "postgresql":
6650
6656
  return { validator: backwardCompatiblePgSchema, version: 7 };
6651
6657
  case "sqlite":
@@ -6656,8 +6662,8 @@ var init_utils = __esm({
6656
6662
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
6657
6663
  }
6658
6664
  };
6659
- validateWithReport = (snapshots, dialect7) => {
6660
- const { validator: validator2, version: version3 } = validatorForDialect(dialect7);
6665
+ validateWithReport = (snapshots, dialect4) => {
6666
+ const { validator: validator2, version: version3 } = validatorForDialect(dialect4);
6661
6667
  const result = snapshots.reduce(
6662
6668
  (accum, it) => {
6663
6669
  const raw2 = JSON.parse((0, import_fs.readFileSync)(`./${it}`).toString());
@@ -6698,9 +6704,9 @@ var init_utils = __esm({
6698
6704
  );
6699
6705
  return result;
6700
6706
  };
6701
- prepareMigrationFolder = (outFolder = "drizzle", dialect7) => {
6702
- const { snapshots, journal } = prepareOutFolder(outFolder, dialect7);
6703
- const report = validateWithReport(snapshots, dialect7);
6707
+ prepareMigrationFolder = (outFolder = "drizzle", dialect4) => {
6708
+ const { snapshots, journal } = prepareOutFolder(outFolder, dialect4);
6709
+ const report = validateWithReport(snapshots, dialect4);
6704
6710
  if (report.nonLatest.length > 0) {
6705
6711
  console.log(
6706
6712
  report.nonLatest.map((it) => {
@@ -11250,7 +11256,7 @@ var init_outputs = __esm({
11250
11256
  });
11251
11257
 
11252
11258
  // src/cli/validations/common.ts
11253
- var assertCollisions, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, drivers, wrapParam;
11259
+ var assertCollisions, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTypes, casingType, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, drivers, wrapParam;
11254
11260
  var init_common = __esm({
11255
11261
  "src/cli/validations/common.ts"() {
11256
11262
  "use strict";
@@ -11294,6 +11300,8 @@ var init_common = __esm({
11294
11300
  {
11295
11301
  const _2 = "";
11296
11302
  }
11303
+ casingTypes = ["snake_case", "camelCase"];
11304
+ casingType = enumType(casingTypes);
11297
11305
  sqliteDriver = unionType(sqliteDriversLiterals);
11298
11306
  postgresDriver = unionType(postgresqlDriversLiterals);
11299
11307
  driver = unionType([sqliteDriver, postgresDriver]);
@@ -11312,7 +11320,8 @@ var init_common = __esm({
11312
11320
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
11313
11321
  schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
11314
11322
  migrations: configMigrations,
11315
- dbCredentials: anyType().optional()
11323
+ dbCredentials: anyType().optional(),
11324
+ casing: casingType.optional()
11316
11325
  }).passthrough();
11317
11326
  casing = unionType([literalType("camel"), literalType("preserve")]).default(
11318
11327
  "camel"
@@ -11394,6 +11403,7 @@ var init_cli = __esm({
11394
11403
  }).strict();
11395
11404
  pushParams = objectType({
11396
11405
  dialect: dialect3,
11406
+ casing: casingType.optional(),
11397
11407
  schema: unionType([stringType(), stringType().array()]),
11398
11408
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
11399
11409
  schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
@@ -17410,11 +17420,11 @@ var init_utils4 = __esm({
17410
17420
  prepareGenerateConfig = async (options, from) => {
17411
17421
  var _a;
17412
17422
  const config = from === "config" ? await drizzleConfigFromFile(options.config) : options;
17413
- const { schema: schema5, out, breakpoints, dialect: dialect7, driver: driver2 } = config;
17414
- if (!schema5 || !dialect7) {
17423
+ const { schema: schema5, out, breakpoints, dialect: dialect4, driver: driver2, casing: casing2 } = config;
17424
+ if (!schema5 || !dialect4) {
17415
17425
  console.log(error("Please provide required params:"));
17416
17426
  console.log(wrapParam("schema", schema5));
17417
- console.log(wrapParam("dialect", dialect7));
17427
+ console.log(wrapParam("dialect", dialect4));
17418
17428
  console.log(wrapParam("out", out, true));
17419
17429
  process.exit(1);
17420
17430
  }
@@ -17425,14 +17435,15 @@ var init_utils4 = __esm({
17425
17435
  }
17426
17436
  const prefix2 = ("migrations" in config ? (_a = config.migrations) == null ? void 0 : _a.prefix : options.prefix) || "index";
17427
17437
  return {
17428
- dialect: dialect7,
17438
+ dialect: dialect4,
17429
17439
  name: options.name,
17430
17440
  custom: options.custom || false,
17431
17441
  prefix: prefix2,
17432
17442
  breakpoints: breakpoints || true,
17433
17443
  schema: schema5,
17434
17444
  out: out || "drizzle",
17435
- bundle: driver2 === "expo"
17445
+ bundle: driver2 === "expo",
17446
+ casing: casing2
17436
17447
  };
17437
17448
  };
17438
17449
  flattenDatabaseCredentials = (config) => {
@@ -17499,6 +17510,7 @@ var init_utils4 = __esm({
17499
17510
  verbose: config.verbose ?? false,
17500
17511
  force: options.force ?? false,
17501
17512
  credentials: parsed2.data,
17513
+ casing: config.casing,
17502
17514
  tablesFilter,
17503
17515
  schemasFilter
17504
17516
  };
@@ -17516,6 +17528,7 @@ var init_utils4 = __esm({
17516
17528
  verbose: config.verbose ?? false,
17517
17529
  force: options.force ?? false,
17518
17530
  credentials: parsed2.data,
17531
+ casing: config.casing,
17519
17532
  tablesFilter,
17520
17533
  schemasFilter
17521
17534
  };
@@ -17533,6 +17546,7 @@ var init_utils4 = __esm({
17533
17546
  verbose: config.verbose ?? false,
17534
17547
  force: options.force ?? false,
17535
17548
  credentials: parsed2.data,
17549
+ casing: config.casing,
17536
17550
  tablesFilter,
17537
17551
  schemasFilter
17538
17552
  };
@@ -17550,6 +17564,7 @@ var init_utils4 = __esm({
17550
17564
  verbose: config.verbose ?? false,
17551
17565
  force: options.force ?? false,
17552
17566
  credentials: parsed2.data,
17567
+ casing: config.casing,
17553
17568
  tablesFilter,
17554
17569
  schemasFilter
17555
17570
  };
@@ -17568,11 +17583,11 @@ var init_utils4 = __esm({
17568
17583
  process.exit(1);
17569
17584
  }
17570
17585
  const config = parsed.data;
17571
- const dialect7 = config.dialect;
17586
+ const dialect4 = config.dialect;
17572
17587
  const tablesFilterConfig = config.tablesFilter;
17573
17588
  const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
17574
17589
  if (config.extensionsFilters) {
17575
- if (config.extensionsFilters.includes("postgis") && dialect7 === "postgresql") {
17590
+ if (config.extensionsFilters.includes("postgis") && dialect4 === "postgresql") {
17576
17591
  tablesFilter.push(
17577
17592
  ...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
17578
17593
  );
@@ -17580,7 +17595,7 @@ var init_utils4 = __esm({
17580
17595
  }
17581
17596
  const schemasFilterConfig = config.schemaFilter;
17582
17597
  const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
17583
- if (dialect7 === "postgresql") {
17598
+ if (dialect4 === "postgresql") {
17584
17599
  const parsed2 = postgresCredentials.safeParse(config);
17585
17600
  if (!parsed2.success) {
17586
17601
  printConfigConnectionIssues3(config);
@@ -17597,7 +17612,7 @@ var init_utils4 = __esm({
17597
17612
  prefix: ((_a = config.migrations) == null ? void 0 : _a.prefix) || "index"
17598
17613
  };
17599
17614
  }
17600
- if (dialect7 === "mysql") {
17615
+ if (dialect4 === "mysql") {
17601
17616
  const parsed2 = mysqlCredentials.safeParse(config);
17602
17617
  if (!parsed2.success) {
17603
17618
  printConfigConnectionIssues2(config);
@@ -17614,7 +17629,7 @@ var init_utils4 = __esm({
17614
17629
  prefix: ((_b = config.migrations) == null ? void 0 : _b.prefix) || "index"
17615
17630
  };
17616
17631
  }
17617
- if (dialect7 === "sqlite") {
17632
+ if (dialect4 === "sqlite") {
17618
17633
  const parsed2 = sqliteCredentials.safeParse(config);
17619
17634
  if (!parsed2.success) {
17620
17635
  printConfigConnectionIssues4(config, "pull");
@@ -17631,14 +17646,14 @@ var init_utils4 = __esm({
17631
17646
  prefix: ((_c = config.migrations) == null ? void 0 : _c.prefix) || "index"
17632
17647
  };
17633
17648
  }
17634
- if (dialect7 === "turso") {
17649
+ if (dialect4 === "turso") {
17635
17650
  const parsed2 = libSQLCredentials.safeParse(config);
17636
17651
  if (!parsed2.success) {
17637
17652
  printConfigConnectionIssues(config, "pull");
17638
17653
  process.exit(1);
17639
17654
  }
17640
17655
  return {
17641
- dialect: dialect7,
17656
+ dialect: dialect4,
17642
17657
  out: config.out,
17643
17658
  breakpoints: config.breakpoints,
17644
17659
  casing: config.casing,
@@ -17648,7 +17663,7 @@ var init_utils4 = __esm({
17648
17663
  prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index"
17649
17664
  };
17650
17665
  }
17651
- assertUnreachable(dialect7);
17666
+ assertUnreachable(dialect4);
17652
17667
  };
17653
17668
  prepareStudioConfig = async (options) => {
17654
17669
  const params = studioCliParams.parse(options);
@@ -17665,9 +17680,9 @@ var init_utils4 = __esm({
17665
17680
  process.exit(1);
17666
17681
  }
17667
17682
  const { host, port } = params;
17668
- const { dialect: dialect7, schema: schema5 } = result.data;
17683
+ const { dialect: dialect4, schema: schema5 } = result.data;
17669
17684
  const flattened = flattenDatabaseCredentials(config);
17670
- if (dialect7 === "postgresql") {
17685
+ if (dialect4 === "postgresql") {
17671
17686
  const parsed = postgresCredentials.safeParse(flattened);
17672
17687
  if (!parsed.success) {
17673
17688
  printConfigConnectionIssues3(flattened);
@@ -17675,14 +17690,14 @@ var init_utils4 = __esm({
17675
17690
  }
17676
17691
  const credentials2 = parsed.data;
17677
17692
  return {
17678
- dialect: dialect7,
17693
+ dialect: dialect4,
17679
17694
  schema: schema5,
17680
17695
  host,
17681
17696
  port,
17682
17697
  credentials: credentials2
17683
17698
  };
17684
17699
  }
17685
- if (dialect7 === "mysql") {
17700
+ if (dialect4 === "mysql") {
17686
17701
  const parsed = mysqlCredentials.safeParse(flattened);
17687
17702
  if (!parsed.success) {
17688
17703
  printConfigConnectionIssues2(flattened);
@@ -17690,14 +17705,14 @@ var init_utils4 = __esm({
17690
17705
  }
17691
17706
  const credentials2 = parsed.data;
17692
17707
  return {
17693
- dialect: dialect7,
17708
+ dialect: dialect4,
17694
17709
  schema: schema5,
17695
17710
  host,
17696
17711
  port,
17697
17712
  credentials: credentials2
17698
17713
  };
17699
17714
  }
17700
- if (dialect7 === "sqlite") {
17715
+ if (dialect4 === "sqlite") {
17701
17716
  const parsed = sqliteCredentials.safeParse(flattened);
17702
17717
  if (!parsed.success) {
17703
17718
  printConfigConnectionIssues4(flattened, "studio");
@@ -17705,14 +17720,14 @@ var init_utils4 = __esm({
17705
17720
  }
17706
17721
  const credentials2 = parsed.data;
17707
17722
  return {
17708
- dialect: dialect7,
17723
+ dialect: dialect4,
17709
17724
  schema: schema5,
17710
17725
  host,
17711
17726
  port,
17712
17727
  credentials: credentials2
17713
17728
  };
17714
17729
  }
17715
- if (dialect7 === "turso") {
17730
+ if (dialect4 === "turso") {
17716
17731
  const parsed = libSQLCredentials.safeParse(flattened);
17717
17732
  if (!parsed.success) {
17718
17733
  printConfigConnectionIssues(flattened, "studio");
@@ -17720,14 +17735,14 @@ var init_utils4 = __esm({
17720
17735
  }
17721
17736
  const credentials2 = parsed.data;
17722
17737
  return {
17723
- dialect: dialect7,
17738
+ dialect: dialect4,
17724
17739
  schema: schema5,
17725
17740
  host,
17726
17741
  port,
17727
17742
  credentials: credentials2
17728
17743
  };
17729
17744
  }
17730
- assertUnreachable(dialect7);
17745
+ assertUnreachable(dialect4);
17731
17746
  };
17732
17747
  migrateConfig = objectType({
17733
17748
  dialect: dialect3,
@@ -17742,10 +17757,10 @@ var init_utils4 = __esm({
17742
17757
  console.log(wrapParam("dialect", config.dialect));
17743
17758
  process.exit(1);
17744
17759
  }
17745
- const { dialect: dialect7, out } = parsed.data;
17760
+ const { dialect: dialect4, out } = parsed.data;
17746
17761
  const { schema: schema5, table: table4 } = parsed.data.migrations || {};
17747
17762
  const flattened = flattenDatabaseCredentials(config);
17748
- if (dialect7 === "postgresql") {
17763
+ if (dialect4 === "postgresql") {
17749
17764
  const parsed2 = postgresCredentials.safeParse(flattened);
17750
17765
  if (!parsed2.success) {
17751
17766
  printConfigConnectionIssues3(flattened);
@@ -17753,14 +17768,14 @@ var init_utils4 = __esm({
17753
17768
  }
17754
17769
  const credentials2 = parsed2.data;
17755
17770
  return {
17756
- dialect: dialect7,
17771
+ dialect: dialect4,
17757
17772
  out,
17758
17773
  credentials: credentials2,
17759
17774
  schema: schema5,
17760
17775
  table: table4
17761
17776
  };
17762
17777
  }
17763
- if (dialect7 === "mysql") {
17778
+ if (dialect4 === "mysql") {
17764
17779
  const parsed2 = mysqlCredentials.safeParse(flattened);
17765
17780
  if (!parsed2.success) {
17766
17781
  printConfigConnectionIssues2(flattened);
@@ -17768,14 +17783,14 @@ var init_utils4 = __esm({
17768
17783
  }
17769
17784
  const credentials2 = parsed2.data;
17770
17785
  return {
17771
- dialect: dialect7,
17786
+ dialect: dialect4,
17772
17787
  out,
17773
17788
  credentials: credentials2,
17774
17789
  schema: schema5,
17775
17790
  table: table4
17776
17791
  };
17777
17792
  }
17778
- if (dialect7 === "sqlite") {
17793
+ if (dialect4 === "sqlite") {
17779
17794
  const parsed2 = sqliteCredentials.safeParse(flattened);
17780
17795
  if (!parsed2.success) {
17781
17796
  printConfigConnectionIssues4(flattened, "migrate");
@@ -17783,14 +17798,14 @@ var init_utils4 = __esm({
17783
17798
  }
17784
17799
  const credentials2 = parsed2.data;
17785
17800
  return {
17786
- dialect: dialect7,
17801
+ dialect: dialect4,
17787
17802
  out,
17788
17803
  credentials: credentials2,
17789
17804
  schema: schema5,
17790
17805
  table: table4
17791
17806
  };
17792
17807
  }
17793
- if (dialect7 === "turso") {
17808
+ if (dialect4 === "turso") {
17794
17809
  const parsed2 = libSQLCredentials.safeParse(flattened);
17795
17810
  if (!parsed2.success) {
17796
17811
  printConfigConnectionIssues(flattened, "migrate");
@@ -17798,14 +17813,14 @@ var init_utils4 = __esm({
17798
17813
  }
17799
17814
  const credentials2 = parsed2.data;
17800
17815
  return {
17801
- dialect: dialect7,
17816
+ dialect: dialect4,
17802
17817
  out,
17803
17818
  credentials: credentials2,
17804
17819
  schema: schema5,
17805
17820
  table: table4
17806
17821
  };
17807
17822
  }
17808
- assertUnreachable(dialect7);
17823
+ assertUnreachable(dialect4);
17809
17824
  };
17810
17825
  drizzleConfigFromFile = async (configPath) => {
17811
17826
  const prefix2 = process.env.TEST_CONFIG_PATH_PREFIX || "";
@@ -17834,6 +17849,7 @@ var init_utils4 = __esm({
17834
17849
  unregister();
17835
17850
  const res = configCommonSchema.safeParse(content);
17836
17851
  if (!res.success) {
17852
+ console.log(res.error);
17837
17853
  if (!("dialect" in content)) {
17838
17854
  console.log(error("Please specify 'dialect' param in config file"));
17839
17855
  }
@@ -17906,7 +17922,7 @@ function clearDefaults(defaultValue, collate) {
17906
17922
  return `(${resultDefault})`;
17907
17923
  }
17908
17924
  }
17909
- var import_drizzle_orm2, import_drizzle_orm3, import_mysql_core2, import_mysql_core3, dialect4, indexName, generateMySqlSnapshot, fromDatabase;
17925
+ var import_drizzle_orm2, import_drizzle_orm3, import_mysql_core2, import_mysql_core3, indexName, generateMySqlSnapshot, fromDatabase;
17910
17926
  var init_mysqlSerializer = __esm({
17911
17927
  "src/serializer/mysqlSerializer.ts"() {
17912
17928
  "use strict";
@@ -17916,12 +17932,13 @@ var init_mysqlSerializer = __esm({
17916
17932
  import_mysql_core2 = require("drizzle-orm/mysql-core");
17917
17933
  import_mysql_core3 = require("drizzle-orm/mysql-core");
17918
17934
  init_outputs();
17935
+ init_utils();
17919
17936
  init_serializer();
17920
- dialect4 = new import_mysql_core2.MySqlDialect();
17921
17937
  indexName = (tableName, columns) => {
17922
17938
  return `${tableName}_${columns.join("_")}_index`;
17923
17939
  };
17924
- generateMySqlSnapshot = (tables) => {
17940
+ generateMySqlSnapshot = (tables, casing2) => {
17941
+ const dialect4 = new import_mysql_core2.MySqlDialect({ casing: casing2 });
17925
17942
  const result = {};
17926
17943
  const internal = { tables: {}, indexes: {} };
17927
17944
  for (const table4 of tables) {
@@ -17940,12 +17957,13 @@ var init_mysqlSerializer = __esm({
17940
17957
  const primaryKeysObject = {};
17941
17958
  const uniqueConstraintObject = {};
17942
17959
  columns.forEach((column7) => {
17960
+ const name = getColumnCasing(column7, casing2);
17943
17961
  const notNull = column7.notNull;
17944
17962
  const sqlTypeLowered = column7.getSQLType().toLowerCase();
17945
17963
  const autoIncrement = typeof column7.autoIncrement === "undefined" ? false : column7.autoIncrement;
17946
17964
  const generated = column7.generated;
17947
17965
  const columnToSet = {
17948
- name: column7.name,
17966
+ name,
17949
17967
  type: column7.getSQLType(),
17950
17968
  primaryKey: false,
17951
17969
  // If field is autoincrement it's notNull by default
@@ -17959,9 +17977,9 @@ var init_mysqlSerializer = __esm({
17959
17977
  } : void 0
17960
17978
  };
17961
17979
  if (column7.primary) {
17962
- primaryKeysObject[`${tableName}_${column7.name}`] = {
17963
- name: `${tableName}_${column7.name}`,
17964
- columns: [column7.name]
17980
+ primaryKeysObject[`${tableName}_${name}`] = {
17981
+ name: `${tableName}_${name}`,
17982
+ columns: [name]
17965
17983
  };
17966
17984
  }
17967
17985
  if (column7.isUnique) {
@@ -17975,7 +17993,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
17975
17993
  The unique constraint ${source_default.underline.blue(
17976
17994
  column7.uniqueName
17977
17995
  )} on the ${source_default.underline.blue(
17978
- column7.name
17996
+ name
17979
17997
  )} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
17980
17998
  existingUnique.columns.join(",")
17981
17999
  )} columns
@@ -17990,7 +18008,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
17990
18008
  }
17991
18009
  if (column7.default !== void 0) {
17992
18010
  if ((0, import_drizzle_orm2.is)(column7.default, import_drizzle_orm3.SQL)) {
17993
- columnToSet.default = sqlToStr(column7.default);
18011
+ columnToSet.default = sqlToStr(column7.default, casing2);
17994
18012
  } else {
17995
18013
  if (typeof column7.default === "string") {
17996
18014
  columnToSet.default = `'${column7.default}'`;
@@ -18012,20 +18030,27 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
18012
18030
  }
18013
18031
  }
18014
18032
  }
18015
- columnsObject[column7.name] = columnToSet;
18033
+ columnsObject[name] = columnToSet;
18016
18034
  });
18017
18035
  primaryKeys.map((pk) => {
18018
- const columnNames = pk.columns.map((c) => c.name);
18019
- primaryKeysObject[pk.getName()] = {
18020
- name: pk.getName(),
18036
+ const originalColumnNames = pk.columns.map((c) => c.name);
18037
+ const columnNames = pk.columns.map((c) => getColumnCasing(c, casing2));
18038
+ let name = pk.getName();
18039
+ if (casing2 !== void 0) {
18040
+ for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
18041
+ name = name.replace(originalColumnNames[i2], columnNames[i2]);
18042
+ }
18043
+ }
18044
+ primaryKeysObject[name] = {
18045
+ name,
18021
18046
  columns: columnNames
18022
18047
  };
18023
18048
  for (const column7 of pk.columns) {
18024
- columnsObject[column7.name].notNull = true;
18049
+ columnsObject[getColumnCasing(column7, casing2)].notNull = true;
18025
18050
  }
18026
18051
  });
18027
18052
  uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
18028
- const columnNames = unq.columns.map((c) => c.name);
18053
+ const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
18029
18054
  const name = unq.name ?? (0, import_mysql_core2.uniqueKeyName)(table4, columnNames);
18030
18055
  const existingUnique = uniqueConstraintObject[name];
18031
18056
  if (typeof existingUnique !== "undefined") {
@@ -18053,15 +18078,25 @@ The unique constraint ${source_default.underline.blue(
18053
18078
  };
18054
18079
  });
18055
18080
  const fks = foreignKeys.map((fk4) => {
18056
- const name = fk4.getName();
18057
18081
  const tableFrom = tableName;
18058
18082
  const onDelete = fk4.onDelete ?? "no action";
18059
18083
  const onUpdate = fk4.onUpdate ?? "no action";
18060
18084
  const reference = fk4.reference();
18061
18085
  const referenceFT = reference.foreignTable;
18062
18086
  const tableTo = (0, import_drizzle_orm2.getTableName)(referenceFT);
18063
- const columnsFrom = reference.columns.map((it) => it.name);
18064
- const columnsTo = reference.foreignColumns.map((it) => it.name);
18087
+ const originalColumnsFrom = reference.columns.map((it) => it.name);
18088
+ const columnsFrom = reference.columns.map((it) => getColumnCasing(it, casing2));
18089
+ const originalColumnsTo = reference.foreignColumns.map((it) => it.name);
18090
+ const columnsTo = reference.foreignColumns.map((it) => getColumnCasing(it, casing2));
18091
+ let name = fk4.getName();
18092
+ if (casing2 !== void 0) {
18093
+ for (let i2 = 0; i2 < originalColumnsFrom.length; i2++) {
18094
+ name = name.replace(originalColumnsFrom[i2], columnsFrom[i2]);
18095
+ }
18096
+ for (let i2 = 0; i2 < originalColumnsTo.length; i2++) {
18097
+ name = name.replace(originalColumnsTo[i2], columnsTo[i2]);
18098
+ }
18099
+ }
18065
18100
  return {
18066
18101
  name,
18067
18102
  tableFrom,
@@ -18101,7 +18136,7 @@ The unique constraint ${source_default.underline.blue(
18101
18136
  }
18102
18137
  return sql;
18103
18138
  } else {
18104
- return `${it.name}`;
18139
+ return `${getColumnCasing(it, casing2)}`;
18105
18140
  }
18106
18141
  });
18107
18142
  if (value.config.unique) {
@@ -18546,7 +18581,7 @@ function buildArrayString(array, sqlType) {
18546
18581
  }).join(",");
18547
18582
  return `{${values}}`;
18548
18583
  }
18549
- var import_drizzle_orm5, import_pg_core2, import_pg_core3, dialect5, indexName2, generatePgSnapshot, trimChar, fromDatabase2, defaultForColumn;
18584
+ var import_drizzle_orm5, import_pg_core2, import_pg_core3, indexName2, generatePgSnapshot, trimChar, fromDatabase2, defaultForColumn;
18550
18585
  var init_pgSerializer = __esm({
18551
18586
  "src/serializer/pgSerializer.ts"() {
18552
18587
  "use strict";
@@ -18558,12 +18593,12 @@ var init_pgSerializer = __esm({
18558
18593
  init_outputs();
18559
18594
  init_utils();
18560
18595
  init_serializer();
18561
- dialect5 = new import_pg_core2.PgDialect();
18562
18596
  indexName2 = (tableName, columns) => {
18563
18597
  return `${tableName}_${columns.join("_")}_index`;
18564
18598
  };
18565
- generatePgSnapshot = (tables, enums, schemas, sequences, schemaFilter) => {
18599
+ generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
18566
18600
  var _a, _b, _c, _d, _e, _f;
18601
+ const dialect4 = new import_pg_core2.PgDialect({ casing: casing2 });
18567
18602
  const result = {};
18568
18603
  const sequencesToReturn = {};
18569
18604
  const indexesInSchema = {};
@@ -18588,6 +18623,7 @@ var init_pgSerializer = __esm({
18588
18623
  const uniqueConstraintObject = {};
18589
18624
  columns.forEach((column7) => {
18590
18625
  var _a2, _b2, _c2, _d2, _e2, _f2;
18626
+ const name = getColumnCasing(column7, casing2);
18591
18627
  const notNull = column7.notNull;
18592
18628
  const primaryKey = column7.primary;
18593
18629
  const sqlTypeLowered = column7.getSQLType().toLowerCase();
@@ -18600,18 +18636,18 @@ var init_pgSerializer = __esm({
18600
18636
  const startWith = stringFromIdentityProperty((_d2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _d2.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
18601
18637
  const cache = stringFromIdentityProperty((_e2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _e2.cache) ?? "1";
18602
18638
  const columnToSet = {
18603
- name: column7.name,
18639
+ name,
18604
18640
  type: column7.getSQLType(),
18605
18641
  typeSchema,
18606
18642
  primaryKey,
18607
18643
  notNull,
18608
18644
  generated: generated ? {
18609
- as: (0, import_drizzle_orm5.is)(generated.as, import_drizzle_orm5.SQL) ? dialect5.sqlToQuery(generated.as).sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as()).sql : generated.as,
18645
+ as: (0, import_drizzle_orm5.is)(generated.as, import_drizzle_orm5.SQL) ? dialect4.sqlToQuery(generated.as).sql : typeof generated.as === "function" ? dialect4.sqlToQuery(generated.as()).sql : generated.as,
18610
18646
  type: "stored"
18611
18647
  } : void 0,
18612
18648
  identity: identity ? {
18613
18649
  type: identity.type,
18614
- name: identity.sequenceName ?? `${tableName}_${column7.name}_seq`,
18650
+ name: identity.sequenceName ?? `${tableName}_${name}_seq`,
18615
18651
  schema: schema5 ?? "public",
18616
18652
  increment,
18617
18653
  startWith,
@@ -18632,7 +18668,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
18632
18668
  The unique constraint ${source_default.underline.blue(
18633
18669
  column7.uniqueName
18634
18670
  )} on the ${source_default.underline.blue(
18635
- column7.name
18671
+ name
18636
18672
  )} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
18637
18673
  existingUnique.columns.join(",")
18638
18674
  )} columns
@@ -18648,7 +18684,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
18648
18684
  }
18649
18685
  if (column7.default !== void 0) {
18650
18686
  if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
18651
- columnToSet.default = sqlToStr(column7.default);
18687
+ columnToSet.default = sqlToStr(column7.default, casing2);
18652
18688
  } else {
18653
18689
  if (typeof column7.default === "string") {
18654
18690
  columnToSet.default = `'${column7.default}'`;
@@ -18676,17 +18712,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
18676
18712
  }
18677
18713
  }
18678
18714
  }
18679
- columnsObject[column7.name] = columnToSet;
18715
+ columnsObject[name] = columnToSet;
18680
18716
  });
18681
18717
  primaryKeys.map((pk) => {
18682
- const columnNames = pk.columns.map((c) => c.name);
18683
- primaryKeysObject[pk.getName()] = {
18684
- name: pk.getName(),
18718
+ const originalColumnNames = pk.columns.map((c) => c.name);
18719
+ const columnNames = pk.columns.map((c) => getColumnCasing(c, casing2));
18720
+ let name = pk.getName();
18721
+ if (casing2 !== void 0) {
18722
+ for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
18723
+ name = name.replace(originalColumnNames[i2], columnNames[i2]);
18724
+ }
18725
+ }
18726
+ primaryKeysObject[name] = {
18727
+ name,
18685
18728
  columns: columnNames
18686
18729
  };
18687
18730
  });
18688
18731
  uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
18689
- const columnNames = unq.columns.map((c) => c.name);
18732
+ const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
18690
18733
  const name = unq.name ?? (0, import_pg_core2.uniqueKeyName)(table4, columnNames);
18691
18734
  const existingUnique = uniqueConstraintObject[name];
18692
18735
  if (typeof existingUnique !== "undefined") {
@@ -18713,15 +18756,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
18713
18756
  };
18714
18757
  });
18715
18758
  const fks = foreignKeys.map((fk4) => {
18716
- const name = fk4.getName();
18717
18759
  const tableFrom = tableName;
18718
18760
  const onDelete = fk4.onDelete;
18719
18761
  const onUpdate = fk4.onUpdate;
18720
18762
  const reference = fk4.reference();
18721
18763
  const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
18722
18764
  const schemaTo = (0, import_pg_core3.getTableConfig)(reference.foreignTable).schema;
18723
- const columnsFrom = reference.columns.map((it) => it.name);
18724
- const columnsTo = reference.foreignColumns.map((it) => it.name);
18765
+ const originalColumnsFrom = reference.columns.map((it) => it.name);
18766
+ const columnsFrom = reference.columns.map((it) => getColumnCasing(it, casing2));
18767
+ const originalColumnsTo = reference.foreignColumns.map((it) => it.name);
18768
+ const columnsTo = reference.foreignColumns.map((it) => getColumnCasing(it, casing2));
18769
+ let name = fk4.getName();
18770
+ if (casing2 !== void 0) {
18771
+ for (let i2 = 0; i2 < originalColumnsFrom.length; i2++) {
18772
+ name = name.replace(originalColumnsFrom[i2], columnsFrom[i2]);
18773
+ }
18774
+ for (let i2 = 0; i2 < originalColumnsTo.length; i2++) {
18775
+ name = name.replace(originalColumnsTo[i2], columnsTo[i2]);
18776
+ }
18777
+ }
18725
18778
  return {
18726
18779
  name,
18727
18780
  tableFrom,
@@ -18747,19 +18800,20 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
18747
18800
  ${withStyle.errorWarning(
18748
18801
  `Please specify an index name in ${(0, import_drizzle_orm5.getTableName)(
18749
18802
  value.config.table
18750
- )} table that has "${dialect5.sqlToQuery(it).sql}" expression. We can generate index names for indexes on columns only; for expressions in indexes, you need to specify the name yourself.`
18803
+ )} table that has "${dialect4.sqlToQuery(it).sql}" expression. We can generate index names for indexes on columns only; for expressions in indexes, you need to specify the name yourself.`
18751
18804
  )}`
18752
18805
  );
18753
18806
  process.exit(1);
18754
18807
  }
18755
18808
  }
18756
18809
  it = it;
18810
+ const name2 = getColumnCasing(it, casing2);
18757
18811
  if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
18758
18812
  console.log(
18759
18813
  `
18760
18814
  ${withStyle.errorWarning(
18761
18815
  `You are specifying an index on the ${source_default.blueBright(
18762
- it.name
18816
+ name2
18763
18817
  )} column inside the ${source_default.blueBright(
18764
18818
  tableName
18765
18819
  )} table with the ${source_default.blueBright(
@@ -18769,7 +18823,7 @@ ${withStyle.errorWarning(
18769
18823
  )}].
18770
18824
 
18771
18825
  You can specify it using current syntax: ${source_default.underline(
18772
- `index("${value.config.name}").using("${value.config.method}", table.${it.name}.op("${vectorOps[0]}"))`
18826
+ `index("${value.config.name}").using("${value.config.method}", table.${name2}.op("${vectorOps[0]}"))`
18773
18827
  )}
18774
18828
 
18775
18829
  You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
@@ -18778,7 +18832,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
18778
18832
  );
18779
18833
  process.exit(1);
18780
18834
  }
18781
- indexColumnNames.push(it.name);
18835
+ indexColumnNames.push(name2);
18782
18836
  });
18783
18837
  const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
18784
18838
  let indexColumns = columns2.map(
@@ -18786,7 +18840,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
18786
18840
  var _a2, _b2, _c2, _d2, _e2;
18787
18841
  if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
18788
18842
  return {
18789
- expression: dialect5.sqlToQuery(it, "indexes").sql,
18843
+ expression: dialect4.sqlToQuery(it, "indexes").sql,
18790
18844
  asc: true,
18791
18845
  isExpression: true,
18792
18846
  nulls: "last"
@@ -18794,7 +18848,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
18794
18848
  } else {
18795
18849
  it = it;
18796
18850
  return {
18797
- expression: it.name,
18851
+ expression: getColumnCasing(it, casing2),
18798
18852
  isExpression: false,
18799
18853
  asc: ((_a2 = it.indexConfig) == null ? void 0 : _a2.order) === "asc",
18800
18854
  nulls: ((_b2 = it.indexConfig) == null ? void 0 : _b2.nulls) ? (_c2 = it.indexConfig) == null ? void 0 : _c2.nulls : ((_d2 = it.indexConfig) == null ? void 0 : _d2.order) === "desc" ? "first" : "last",
@@ -18825,7 +18879,7 @@ ${withStyle.errorWarning(
18825
18879
  name,
18826
18880
  columns: indexColumns,
18827
18881
  isUnique: value.config.unique ?? false,
18828
- where: value.config.where ? dialect5.sqlToQuery(value.config.where).sql : void 0,
18882
+ where: value.config.where ? dialect4.sqlToQuery(value.config.where).sql : void 0,
18829
18883
  concurrently: value.config.concurrently ?? false,
18830
18884
  method: value.config.method ?? "btree",
18831
18885
  with: value.config.with ?? {}
@@ -19263,7 +19317,7 @@ ${withStyle.errorWarning(
19263
19317
  schema: tableSchema
19264
19318
  } : void 0
19265
19319
  };
19266
- if (identityName) {
19320
+ if (identityName && typeof identityName === "string") {
19267
19321
  delete sequencesToReturn[`${tableSchema}.${identityName.startsWith('"') && identityName.endsWith('"') ? identityName.slice(1, -1) : identityName}`];
19268
19322
  delete sequencesToReturn[identityName];
19269
19323
  }
@@ -19594,7 +19648,7 @@ function extractGeneratedColumns(input) {
19594
19648
  }
19595
19649
  return columns;
19596
19650
  }
19597
- var import_drizzle_orm7, import_sqlite_core2, dialect6, generateSqliteSnapshot, fromDatabase3;
19651
+ var import_drizzle_orm7, import_sqlite_core2, generateSqliteSnapshot, fromDatabase3;
19598
19652
  var init_sqliteSerializer = __esm({
19599
19653
  "src/serializer/sqliteSerializer.ts"() {
19600
19654
  "use strict";
@@ -19602,9 +19656,10 @@ var init_sqliteSerializer = __esm({
19602
19656
  import_drizzle_orm7 = require("drizzle-orm");
19603
19657
  import_sqlite_core2 = require("drizzle-orm/sqlite-core");
19604
19658
  init_outputs();
19659
+ init_utils();
19605
19660
  init_serializer();
19606
- dialect6 = new import_sqlite_core2.SQLiteSyncDialect();
19607
- generateSqliteSnapshot = (tables) => {
19661
+ generateSqliteSnapshot = (tables, casing2) => {
19662
+ const dialect4 = new import_sqlite_core2.SQLiteSyncDialect({ casing: casing2 });
19608
19663
  const result = {};
19609
19664
  const internal = { indexes: {} };
19610
19665
  for (const table4 of tables) {
@@ -19622,28 +19677,29 @@ var init_sqliteSerializer = __esm({
19622
19677
  uniqueConstraints
19623
19678
  } = (0, import_sqlite_core2.getTableConfig)(table4);
19624
19679
  columns.forEach((column7) => {
19680
+ const name = getColumnCasing(column7, casing2);
19625
19681
  const notNull = column7.notNull;
19626
19682
  const primaryKey = column7.primary;
19627
19683
  const generated = column7.generated;
19628
19684
  const columnToSet = {
19629
- name: column7.name,
19685
+ name,
19630
19686
  type: column7.getSQLType(),
19631
19687
  primaryKey,
19632
19688
  notNull,
19633
19689
  autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false,
19634
19690
  generated: generated ? {
19635
- as: (0, import_drizzle_orm7.is)(generated.as, import_drizzle_orm7.SQL) ? `(${dialect6.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect6.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
19691
+ as: (0, import_drizzle_orm7.is)(generated.as, import_drizzle_orm7.SQL) ? `(${dialect4.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect4.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
19636
19692
  type: generated.mode ?? "virtual"
19637
19693
  } : void 0
19638
19694
  };
19639
19695
  if (column7.default !== void 0) {
19640
19696
  if ((0, import_drizzle_orm7.is)(column7.default, import_drizzle_orm7.SQL)) {
19641
- columnToSet.default = sqlToStr(column7.default);
19697
+ columnToSet.default = sqlToStr(column7.default, casing2);
19642
19698
  } else {
19643
19699
  columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : typeof column7.default === "object" || Array.isArray(column7.default) ? `'${JSON.stringify(column7.default)}'` : column7.default;
19644
19700
  }
19645
19701
  }
19646
- columnsObject[column7.name] = columnToSet;
19702
+ columnsObject[name] = columnToSet;
19647
19703
  if (column7.isUnique) {
19648
19704
  const existingUnique = indexesObject[column7.uniqueName];
19649
19705
  if (typeof existingUnique !== "undefined") {
@@ -19655,7 +19711,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
19655
19711
  The unique constraint ${source_default.underline.blue(
19656
19712
  column7.uniqueName
19657
19713
  )} on the ${source_default.underline.blue(
19658
- column7.name
19714
+ name
19659
19715
  )} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
19660
19716
  existingUnique.columns.join(",")
19661
19717
  )} columns
@@ -19671,15 +19727,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
19671
19727
  }
19672
19728
  });
19673
19729
  const foreignKeys = tableForeignKeys.map((fk4) => {
19674
- const name = fk4.getName();
19675
19730
  const tableFrom = tableName;
19676
19731
  const onDelete = fk4.onDelete ?? "no action";
19677
19732
  const onUpdate = fk4.onUpdate ?? "no action";
19678
19733
  const reference = fk4.reference();
19679
19734
  const referenceFT = reference.foreignTable;
19680
19735
  const tableTo = (0, import_drizzle_orm7.getTableName)(referenceFT);
19681
- const columnsFrom = reference.columns.map((it) => it.name);
19682
- const columnsTo = reference.foreignColumns.map((it) => it.name);
19736
+ const originalColumnsFrom = reference.columns.map((it) => it.name);
19737
+ const columnsFrom = reference.columns.map((it) => getColumnCasing(it, casing2));
19738
+ const originalColumnsTo = reference.foreignColumns.map((it) => it.name);
19739
+ const columnsTo = reference.foreignColumns.map((it) => getColumnCasing(it, casing2));
19740
+ let name = fk4.getName();
19741
+ if (casing2 !== void 0) {
19742
+ for (let i2 = 0; i2 < originalColumnsFrom.length; i2++) {
19743
+ name = name.replace(originalColumnsFrom[i2], columnsFrom[i2]);
19744
+ }
19745
+ for (let i2 = 0; i2 < originalColumnsTo.length; i2++) {
19746
+ name = name.replace(originalColumnsTo[i2], columnsTo[i2]);
19747
+ }
19748
+ }
19683
19749
  return {
19684
19750
  name,
19685
19751
  tableFrom,
@@ -19699,7 +19765,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
19699
19765
  let indexColumns = columns2.map((it) => {
19700
19766
  var _a;
19701
19767
  if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
19702
- const sql = dialect6.sqlToQuery(it, "indexes").sql;
19768
+ const sql = dialect4.sqlToQuery(it, "indexes").sql;
19703
19769
  if (typeof internal.indexes[name] === "undefined") {
19704
19770
  internal.indexes[name] = {
19705
19771
  columns: {
@@ -19719,13 +19785,13 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
19719
19785
  }
19720
19786
  return sql;
19721
19787
  } else {
19722
- return it.name;
19788
+ return getColumnCasing(it, casing2);
19723
19789
  }
19724
19790
  });
19725
19791
  let where = void 0;
19726
19792
  if (value.config.where !== void 0) {
19727
19793
  if ((0, import_drizzle_orm7.is)(value.config.where, import_drizzle_orm7.SQL)) {
19728
- where = dialect6.sqlToQuery(value.config.where).sql;
19794
+ where = dialect4.sqlToQuery(value.config.where).sql;
19729
19795
  }
19730
19796
  }
19731
19797
  indexesObject[name] = {
@@ -19736,7 +19802,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
19736
19802
  };
19737
19803
  });
19738
19804
  uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
19739
- const columnNames = unq.columns.map((c) => c.name);
19805
+ const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
19740
19806
  const name = unq.name ?? (0, import_sqlite_core2.uniqueKeyName)(table4, columnNames);
19741
19807
  const existingUnique = indexesObject[name];
19742
19808
  if (typeof existingUnique !== "undefined") {
@@ -19766,12 +19832,20 @@ The unique constraint ${source_default.underline.blue(
19766
19832
  });
19767
19833
  primaryKeys.forEach((it) => {
19768
19834
  if (it.columns.length > 1) {
19769
- primaryKeysObject[it.getName()] = {
19770
- columns: it.columns.map((it2) => it2.name),
19771
- name: it.getName()
19835
+ const originalColumnNames = it.columns.map((c) => c.name);
19836
+ const columnNames = it.columns.map((c) => getColumnCasing(c, casing2));
19837
+ let name = it.getName();
19838
+ if (casing2 !== void 0) {
19839
+ for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
19840
+ name = name.replace(originalColumnNames[i2], columnNames[i2]);
19841
+ }
19842
+ }
19843
+ primaryKeysObject[name] = {
19844
+ columns: columnNames,
19845
+ name
19772
19846
  };
19773
19847
  } else {
19774
- columnsObject[it.columns[0].name].primaryKey = true;
19848
+ columnsObject[getColumnCasing(it.columns[0], casing2)].primaryKey = true;
19775
19849
  }
19776
19850
  });
19777
19851
  result[tableName] = {
@@ -20016,16 +20090,17 @@ WHERE
20016
20090
  });
20017
20091
 
20018
20092
  // src/serializer/index.ts
20019
- var import_fs3, glob, import_path3, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
20093
+ var import_casing2, import_fs3, glob, import_path3, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
20020
20094
  var init_serializer = __esm({
20021
20095
  "src/serializer/index.ts"() {
20022
20096
  "use strict";
20023
20097
  init_source();
20098
+ import_casing2 = require("drizzle-orm/casing");
20024
20099
  import_fs3 = __toESM(require("fs"));
20025
20100
  glob = __toESM(require_glob());
20026
20101
  import_path3 = __toESM(require("path"));
20027
20102
  init_views();
20028
- sqlToStr = (sql) => {
20103
+ sqlToStr = (sql, casing2) => {
20029
20104
  return sql.toQuery({
20030
20105
  escapeName: () => {
20031
20106
  throw new Error("we don't support params for `sql` default values");
@@ -20035,10 +20110,11 @@ var init_serializer = __esm({
20035
20110
  },
20036
20111
  escapeString: () => {
20037
20112
  throw new Error("we don't support params for `sql` default values");
20038
- }
20113
+ },
20114
+ casing: new import_casing2.CasingCache(casing2)
20039
20115
  }).sql;
20040
20116
  };
20041
- serializeMySql = async (path5) => {
20117
+ serializeMySql = async (path5, casing2) => {
20042
20118
  const filenames = prepareFilenames(path5);
20043
20119
  console.log(source_default.gray(`Reading schema files:
20044
20120
  ${filenames.join("\n")}
@@ -20046,23 +20122,23 @@ ${filenames.join("\n")}
20046
20122
  const { prepareFromMySqlImports: prepareFromMySqlImports2 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
20047
20123
  const { generateMySqlSnapshot: generateMySqlSnapshot2 } = await Promise.resolve().then(() => (init_mysqlSerializer(), mysqlSerializer_exports));
20048
20124
  const { tables } = await prepareFromMySqlImports2(filenames);
20049
- return generateMySqlSnapshot2(tables);
20125
+ return generateMySqlSnapshot2(tables, casing2);
20050
20126
  };
20051
- serializePg = async (path5, schemaFilter) => {
20127
+ serializePg = async (path5, casing2, schemaFilter) => {
20052
20128
  const filenames = prepareFilenames(path5);
20053
20129
  const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
20054
20130
  const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
20055
20131
  const { tables, enums, schemas, sequences } = await prepareFromPgImports2(
20056
20132
  filenames
20057
20133
  );
20058
- return generatePgSnapshot2(tables, enums, schemas, sequences, schemaFilter);
20134
+ return generatePgSnapshot2(tables, enums, schemas, sequences, casing2, schemaFilter);
20059
20135
  };
20060
- serializeSQLite = async (path5) => {
20136
+ serializeSQLite = async (path5, casing2) => {
20061
20137
  const filenames = prepareFilenames(path5);
20062
20138
  const { prepareFromSqliteImports: prepareFromSqliteImports2 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
20063
20139
  const { generateSqliteSnapshot: generateSqliteSnapshot2 } = await Promise.resolve().then(() => (init_sqliteSerializer(), sqliteSerializer_exports));
20064
20140
  const { tables } = await prepareFromSqliteImports2(filenames);
20065
- return generateSqliteSnapshot2(tables);
20141
+ return generateSqliteSnapshot2(tables, casing2);
20066
20142
  };
20067
20143
  prepareFilenames = (path5) => {
20068
20144
  if (typeof path5 === "string") {
@@ -20111,45 +20187,45 @@ var init_migrationPreparator = __esm({
20111
20187
  init_mysqlSchema();
20112
20188
  init_pgSchema();
20113
20189
  init_sqliteSchema();
20114
- prepareMySqlDbPushSnapshot = async (prev, schemaPath) => {
20115
- const serialized = await serializeMySql(schemaPath);
20190
+ prepareMySqlDbPushSnapshot = async (prev, schemaPath, casing2) => {
20191
+ const serialized = await serializeMySql(schemaPath, casing2);
20116
20192
  const id = (0, import_crypto.randomUUID)();
20117
20193
  const idPrev = prev.id;
20118
- const { version: version3, dialect: dialect7, ...rest } = serialized;
20119
- const result = { version: version3, dialect: dialect7, id, prevId: idPrev, ...rest };
20194
+ const { version: version3, dialect: dialect4, ...rest } = serialized;
20195
+ const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
20120
20196
  return { prev, cur: result };
20121
20197
  };
20122
- prepareSQLiteDbPushSnapshot = async (prev, schemaPath) => {
20123
- const serialized = await serializeSQLite(schemaPath);
20198
+ prepareSQLiteDbPushSnapshot = async (prev, schemaPath, casing2) => {
20199
+ const serialized = await serializeSQLite(schemaPath, casing2);
20124
20200
  const id = (0, import_crypto.randomUUID)();
20125
20201
  const idPrev = prev.id;
20126
- const { version: version3, dialect: dialect7, ...rest } = serialized;
20202
+ const { version: version3, dialect: dialect4, ...rest } = serialized;
20127
20203
  const result = {
20128
20204
  version: version3,
20129
- dialect: dialect7,
20205
+ dialect: dialect4,
20130
20206
  id,
20131
20207
  prevId: idPrev,
20132
20208
  ...rest
20133
20209
  };
20134
20210
  return { prev, cur: result };
20135
20211
  };
20136
- preparePgDbPushSnapshot = async (prev, schemaPath, schemaFilter = ["public"]) => {
20137
- const serialized = await serializePg(schemaPath, schemaFilter);
20212
+ preparePgDbPushSnapshot = async (prev, schemaPath, casing2, schemaFilter = ["public"]) => {
20213
+ const serialized = await serializePg(schemaPath, casing2, schemaFilter);
20138
20214
  const id = (0, import_crypto.randomUUID)();
20139
20215
  const idPrev = prev.id;
20140
- const { version: version3, dialect: dialect7, ...rest } = serialized;
20141
- const result = { version: version3, dialect: dialect7, id, prevId: idPrev, ...rest };
20216
+ const { version: version3, dialect: dialect4, ...rest } = serialized;
20217
+ const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
20142
20218
  return { prev, cur: result };
20143
20219
  };
20144
- prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath) => {
20220
+ prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath, casing2) => {
20145
20221
  const prevSnapshot = mysqlSchema.parse(
20146
20222
  preparePrevSnapshot(migrationFolders, dryMySql)
20147
20223
  );
20148
- const serialized = await serializeMySql(schemaPath);
20224
+ const serialized = await serializeMySql(schemaPath, casing2);
20149
20225
  const id = (0, import_crypto.randomUUID)();
20150
20226
  const idPrev = prevSnapshot.id;
20151
- const { version: version3, dialect: dialect7, ...rest } = serialized;
20152
- const result = { version: version3, dialect: dialect7, id, prevId: idPrev, ...rest };
20227
+ const { version: version3, dialect: dialect4, ...rest } = serialized;
20228
+ const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
20153
20229
  const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
20154
20230
  const custom2 = {
20155
20231
  id,
@@ -20158,17 +20234,17 @@ var init_migrationPreparator = __esm({
20158
20234
  };
20159
20235
  return { prev: prevSnapshot, cur: result, custom: custom2 };
20160
20236
  };
20161
- prepareSqliteMigrationSnapshot = async (snapshots, schemaPath) => {
20237
+ prepareSqliteMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
20162
20238
  const prevSnapshot = sqliteSchema.parse(
20163
20239
  preparePrevSnapshot(snapshots, drySQLite)
20164
20240
  );
20165
- const serialized = await serializeSQLite(schemaPath);
20241
+ const serialized = await serializeSQLite(schemaPath, casing2);
20166
20242
  const id = (0, import_crypto.randomUUID)();
20167
20243
  const idPrev = prevSnapshot.id;
20168
- const { version: version3, dialect: dialect7, ...rest } = serialized;
20244
+ const { version: version3, dialect: dialect4, ...rest } = serialized;
20169
20245
  const result = {
20170
20246
  version: version3,
20171
- dialect: dialect7,
20247
+ dialect: dialect4,
20172
20248
  id,
20173
20249
  prevId: idPrev,
20174
20250
  ...rest
@@ -20188,9 +20264,9 @@ var init_migrationPreparator = __esm({
20188
20264
  }) => {
20189
20265
  return { id, prevId: idPrev, ...serialized };
20190
20266
  };
20191
- preparePgMigrationSnapshot = async (snapshots, schemaPath) => {
20267
+ preparePgMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
20192
20268
  const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
20193
- const serialized = await serializePg(schemaPath);
20269
+ const serialized = await serializePg(schemaPath, casing2);
20194
20270
  const id = (0, import_crypto.randomUUID)();
20195
20271
  const idPrev = prevSnapshot.id;
20196
20272
  const result = { id, prevId: idPrev, ...serialized };
@@ -23016,10 +23092,10 @@ var init_jsonDiffer = __esm({
23016
23092
  });
23017
23093
 
23018
23094
  // src/sqlgenerator.ts
23019
- function fromJson(statements, dialect7, action, json2) {
23095
+ function fromJson(statements, dialect4, action, json2) {
23020
23096
  const result = statements.flatMap((statement) => {
23021
23097
  const filtered = convertors.filter((it) => {
23022
- return it.can(statement, dialect7);
23098
+ return it.can(statement, dialect4);
23023
23099
  });
23024
23100
  const convertor = filtered.length === 1 ? filtered[0] : void 0;
23025
23101
  if (!convertor) {
@@ -23029,7 +23105,7 @@ function fromJson(statements, dialect7, action, json2) {
23029
23105
  }).filter((it) => it !== "");
23030
23106
  return result;
23031
23107
  }
23032
- var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
23108
+ var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
23033
23109
  var init_sqlgenerator = __esm({
23034
23110
  "src/sqlgenerator.ts"() {
23035
23111
  "use strict";
@@ -23087,8 +23163,8 @@ var init_sqlgenerator = __esm({
23087
23163
  Convertor = class {
23088
23164
  };
23089
23165
  PgCreateTableConvertor = class extends Convertor {
23090
- can(statement, dialect7) {
23091
- return statement.type === "create_table" && dialect7 === "postgresql";
23166
+ can(statement, dialect4) {
23167
+ return statement.type === "create_table" && dialect4 === "postgresql";
23092
23168
  }
23093
23169
  convert(st) {
23094
23170
  const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints } = st;
@@ -23132,8 +23208,8 @@ var init_sqlgenerator = __esm({
23132
23208
  }
23133
23209
  };
23134
23210
  MySqlCreateTableConvertor = class extends Convertor {
23135
- can(statement, dialect7) {
23136
- return statement.type === "create_table" && dialect7 === "mysql";
23211
+ can(statement, dialect4) {
23212
+ return statement.type === "create_table" && dialect4 === "mysql";
23137
23213
  }
23138
23214
  convert(st) {
23139
23215
  var _a, _b;
@@ -23183,8 +23259,8 @@ var init_sqlgenerator = __esm({
23183
23259
  }
23184
23260
  };
23185
23261
  SQLiteCreateTableConvertor = class extends Convertor {
23186
- can(statement, dialect7) {
23187
- return statement.type === "sqlite_create_table" && (dialect7 === "sqlite" || dialect7 === "turso");
23262
+ can(statement, dialect4) {
23263
+ return statement.type === "sqlite_create_table" && (dialect4 === "sqlite" || dialect4 === "turso");
23188
23264
  }
23189
23265
  convert(st) {
23190
23266
  const {
@@ -23246,8 +23322,8 @@ var init_sqlgenerator = __esm({
23246
23322
  }
23247
23323
  };
23248
23324
  PgAlterTableAlterColumnSetGenerated = class extends Convertor {
23249
- can(statement, dialect7) {
23250
- return statement.type === "alter_table_alter_column_set_identity" && dialect7 === "postgresql";
23325
+ can(statement, dialect4) {
23326
+ return statement.type === "alter_table_alter_column_set_identity" && dialect4 === "postgresql";
23251
23327
  }
23252
23328
  convert(statement) {
23253
23329
  const { identity, tableName, columnName, schema: schema5 } = statement;
@@ -23259,8 +23335,8 @@ var init_sqlgenerator = __esm({
23259
23335
  }
23260
23336
  };
23261
23337
  PgAlterTableAlterColumnDropGenerated = class extends Convertor {
23262
- can(statement, dialect7) {
23263
- return statement.type === "alter_table_alter_column_drop_identity" && dialect7 === "postgresql";
23338
+ can(statement, dialect4) {
23339
+ return statement.type === "alter_table_alter_column_drop_identity" && dialect4 === "postgresql";
23264
23340
  }
23265
23341
  convert(statement) {
23266
23342
  const { tableName, columnName, schema: schema5 } = statement;
@@ -23269,8 +23345,8 @@ var init_sqlgenerator = __esm({
23269
23345
  }
23270
23346
  };
23271
23347
  PgAlterTableAlterColumnAlterGenerated = class extends Convertor {
23272
- can(statement, dialect7) {
23273
- return statement.type === "alter_table_alter_column_change_identity" && dialect7 === "postgresql";
23348
+ can(statement, dialect4) {
23349
+ return statement.type === "alter_table_alter_column_change_identity" && dialect4 === "postgresql";
23274
23350
  }
23275
23351
  convert(statement) {
23276
23352
  const { identity, oldIdentity, tableName, columnName, schema: schema5 } = statement;
@@ -23317,8 +23393,8 @@ var init_sqlgenerator = __esm({
23317
23393
  }
23318
23394
  };
23319
23395
  PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
23320
- can(statement, dialect7) {
23321
- return statement.type === "create_unique_constraint" && dialect7 === "postgresql";
23396
+ can(statement, dialect4) {
23397
+ return statement.type === "create_unique_constraint" && dialect4 === "postgresql";
23322
23398
  }
23323
23399
  convert(statement) {
23324
23400
  const unsquashed = PgSquasher.unsquashUnique(statement.data);
@@ -23327,8 +23403,8 @@ var init_sqlgenerator = __esm({
23327
23403
  }
23328
23404
  };
23329
23405
  PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
23330
- can(statement, dialect7) {
23331
- return statement.type === "delete_unique_constraint" && dialect7 === "postgresql";
23406
+ can(statement, dialect4) {
23407
+ return statement.type === "delete_unique_constraint" && dialect4 === "postgresql";
23332
23408
  }
23333
23409
  convert(statement) {
23334
23410
  const unsquashed = PgSquasher.unsquashUnique(statement.data);
@@ -23337,8 +23413,8 @@ var init_sqlgenerator = __esm({
23337
23413
  }
23338
23414
  };
23339
23415
  MySQLAlterTableAddUniqueConstraintConvertor = class extends Convertor {
23340
- can(statement, dialect7) {
23341
- return statement.type === "create_unique_constraint" && dialect7 === "mysql";
23416
+ can(statement, dialect4) {
23417
+ return statement.type === "create_unique_constraint" && dialect4 === "mysql";
23342
23418
  }
23343
23419
  convert(statement) {
23344
23420
  const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
@@ -23346,8 +23422,8 @@ var init_sqlgenerator = __esm({
23346
23422
  }
23347
23423
  };
23348
23424
  MySQLAlterTableDropUniqueConstraintConvertor = class extends Convertor {
23349
- can(statement, dialect7) {
23350
- return statement.type === "delete_unique_constraint" && dialect7 === "mysql";
23425
+ can(statement, dialect4) {
23426
+ return statement.type === "delete_unique_constraint" && dialect4 === "mysql";
23351
23427
  }
23352
23428
  convert(statement) {
23353
23429
  const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
@@ -23355,8 +23431,8 @@ var init_sqlgenerator = __esm({
23355
23431
  }
23356
23432
  };
23357
23433
  CreatePgSequenceConvertor = class extends Convertor {
23358
- can(statement, dialect7) {
23359
- return statement.type === "create_sequence" && dialect7 === "postgresql";
23434
+ can(statement, dialect4) {
23435
+ return statement.type === "create_sequence" && dialect4 === "postgresql";
23360
23436
  }
23361
23437
  convert(st) {
23362
23438
  const { name, values, schema: schema5 } = st;
@@ -23365,8 +23441,8 @@ var init_sqlgenerator = __esm({
23365
23441
  }
23366
23442
  };
23367
23443
  DropPgSequenceConvertor = class extends Convertor {
23368
- can(statement, dialect7) {
23369
- return statement.type === "drop_sequence" && dialect7 === "postgresql";
23444
+ can(statement, dialect4) {
23445
+ return statement.type === "drop_sequence" && dialect4 === "postgresql";
23370
23446
  }
23371
23447
  convert(st) {
23372
23448
  const { name, schema: schema5 } = st;
@@ -23375,8 +23451,8 @@ var init_sqlgenerator = __esm({
23375
23451
  }
23376
23452
  };
23377
23453
  RenamePgSequenceConvertor = class extends Convertor {
23378
- can(statement, dialect7) {
23379
- return statement.type === "rename_sequence" && dialect7 === "postgresql";
23454
+ can(statement, dialect4) {
23455
+ return statement.type === "rename_sequence" && dialect4 === "postgresql";
23380
23456
  }
23381
23457
  convert(st) {
23382
23458
  const { nameFrom, nameTo, schema: schema5 } = st;
@@ -23386,8 +23462,8 @@ var init_sqlgenerator = __esm({
23386
23462
  }
23387
23463
  };
23388
23464
  MovePgSequenceConvertor = class extends Convertor {
23389
- can(statement, dialect7) {
23390
- return statement.type === "move_sequence" && dialect7 === "postgresql";
23465
+ can(statement, dialect4) {
23466
+ return statement.type === "move_sequence" && dialect4 === "postgresql";
23391
23467
  }
23392
23468
  convert(st) {
23393
23469
  const { schemaFrom, schemaTo, name } = st;
@@ -23397,8 +23473,8 @@ var init_sqlgenerator = __esm({
23397
23473
  }
23398
23474
  };
23399
23475
  AlterPgSequenceConvertor = class extends Convertor {
23400
- can(statement, dialect7) {
23401
- return statement.type === "alter_sequence" && dialect7 === "postgresql";
23476
+ can(statement, dialect4) {
23477
+ return statement.type === "alter_sequence" && dialect4 === "postgresql";
23402
23478
  }
23403
23479
  convert(st) {
23404
23480
  const { name, schema: schema5, values } = st;
@@ -23413,20 +23489,22 @@ var init_sqlgenerator = __esm({
23413
23489
  }
23414
23490
  convert(st) {
23415
23491
  const { name, values, schema: schema5 } = st;
23416
- const tableNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
23492
+ const enumNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
23417
23493
  let valuesStatement = "(";
23418
23494
  valuesStatement += values.map((it) => `'${it}'`).join(", ");
23419
23495
  valuesStatement += ")";
23420
- let statement = "DO $$ BEGIN";
23421
- statement += "\n";
23422
- statement += ` CREATE TYPE ${tableNameWithSchema} AS ENUM${valuesStatement};`;
23423
- statement += "\n";
23424
- statement += "EXCEPTION";
23425
- statement += "\n";
23426
- statement += " WHEN duplicate_object THEN null;";
23427
- statement += "\n";
23428
- statement += "END $$;";
23429
- statement += "\n";
23496
+ let statement = `CREATE TYPE ${enumNameWithSchema} AS ENUM${valuesStatement};`;
23497
+ return statement;
23498
+ }
23499
+ };
23500
+ DropTypeEnumConvertor = class extends Convertor {
23501
+ can(statement) {
23502
+ return statement.type === "drop_type_enum";
23503
+ }
23504
+ convert(st) {
23505
+ const { name, schema: schema5 } = st;
23506
+ const enumNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
23507
+ let statement = `DROP TYPE ${enumNameWithSchema};`;
23430
23508
  return statement;
23431
23509
  }
23432
23510
  };
@@ -23435,14 +23513,61 @@ var init_sqlgenerator = __esm({
23435
23513
  return statement.type === "alter_type_add_value";
23436
23514
  }
23437
23515
  convert(st) {
23438
- const { name, schema: schema5, value } = st;
23439
- const schemaPrefix = schema5 && schema5 !== "public" ? `"${schema5}".` : "";
23440
- return `ALTER TYPE ${schemaPrefix}"${name}" ADD VALUE '${value}';`;
23516
+ const { name, schema: schema5, value, before } = st;
23517
+ const enumNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
23518
+ return `ALTER TYPE ${enumNameWithSchema} ADD VALUE '${value}'${before.length ? ` BEFORE '${before}'` : ""};`;
23519
+ }
23520
+ };
23521
+ AlterTypeSetSchemaConvertor = class extends Convertor {
23522
+ can(statement) {
23523
+ return statement.type === "move_type_enum";
23524
+ }
23525
+ convert(st) {
23526
+ const { name, schemaFrom, schemaTo } = st;
23527
+ const enumNameWithSchema = schemaFrom ? `"${schemaFrom}"."${name}"` : `"${name}"`;
23528
+ return `ALTER TYPE ${enumNameWithSchema} SET SCHEMA "${schemaTo}";`;
23529
+ }
23530
+ };
23531
+ AlterRenameTypeConvertor = class extends Convertor {
23532
+ can(statement) {
23533
+ return statement.type === "rename_type_enum";
23534
+ }
23535
+ convert(st) {
23536
+ const { nameTo, nameFrom, schema: schema5 } = st;
23537
+ const enumNameWithSchema = schema5 ? `"${schema5}"."${nameFrom}"` : `"${nameFrom}"`;
23538
+ return `ALTER TYPE ${enumNameWithSchema} RENAME TO "${nameTo}";`;
23539
+ }
23540
+ };
23541
+ AlterTypeDropValueConvertor = class extends Convertor {
23542
+ can(statement) {
23543
+ return statement.type === "alter_type_drop_value";
23544
+ }
23545
+ convert(st) {
23546
+ const { columnsWithEnum, name, newValues, schema: schema5 } = st;
23547
+ const statements = [];
23548
+ for (const withEnum of columnsWithEnum) {
23549
+ statements.push(
23550
+ `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE text;`
23551
+ );
23552
+ }
23553
+ statements.push(new DropTypeEnumConvertor().convert({ name, schema: schema5, type: "drop_type_enum" }));
23554
+ statements.push(new CreateTypeEnumConvertor().convert({
23555
+ name,
23556
+ schema: schema5,
23557
+ values: newValues,
23558
+ type: "create_type_enum"
23559
+ }));
23560
+ for (const withEnum of columnsWithEnum) {
23561
+ statements.push(
23562
+ `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE "${schema5}"."${name}" USING "${withEnum.column}"::"${schema5}"."${name}";`
23563
+ );
23564
+ }
23565
+ return statements;
23441
23566
  }
23442
23567
  };
23443
23568
  PgDropTableConvertor = class extends Convertor {
23444
- can(statement, dialect7) {
23445
- return statement.type === "drop_table" && dialect7 === "postgresql";
23569
+ can(statement, dialect4) {
23570
+ return statement.type === "drop_table" && dialect4 === "postgresql";
23446
23571
  }
23447
23572
  convert(statement) {
23448
23573
  const { tableName, schema: schema5 } = statement;
@@ -23451,8 +23576,8 @@ var init_sqlgenerator = __esm({
23451
23576
  }
23452
23577
  };
23453
23578
  MySQLDropTableConvertor = class extends Convertor {
23454
- can(statement, dialect7) {
23455
- return statement.type === "drop_table" && dialect7 === "mysql";
23579
+ can(statement, dialect4) {
23580
+ return statement.type === "drop_table" && dialect4 === "mysql";
23456
23581
  }
23457
23582
  convert(statement) {
23458
23583
  const { tableName } = statement;
@@ -23460,8 +23585,8 @@ var init_sqlgenerator = __esm({
23460
23585
  }
23461
23586
  };
23462
23587
  SQLiteDropTableConvertor = class extends Convertor {
23463
- can(statement, dialect7) {
23464
- return statement.type === "drop_table" && (dialect7 === "sqlite" || dialect7 === "turso");
23588
+ can(statement, dialect4) {
23589
+ return statement.type === "drop_table" && (dialect4 === "sqlite" || dialect4 === "turso");
23465
23590
  }
23466
23591
  convert(statement) {
23467
23592
  const { tableName } = statement;
@@ -23469,8 +23594,8 @@ var init_sqlgenerator = __esm({
23469
23594
  }
23470
23595
  };
23471
23596
  PgRenameTableConvertor = class extends Convertor {
23472
- can(statement, dialect7) {
23473
- return statement.type === "rename_table" && dialect7 === "postgresql";
23597
+ can(statement, dialect4) {
23598
+ return statement.type === "rename_table" && dialect4 === "postgresql";
23474
23599
  }
23475
23600
  convert(statement) {
23476
23601
  const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
@@ -23480,8 +23605,8 @@ var init_sqlgenerator = __esm({
23480
23605
  }
23481
23606
  };
23482
23607
  SqliteRenameTableConvertor = class extends Convertor {
23483
- can(statement, dialect7) {
23484
- return statement.type === "rename_table" && (dialect7 === "sqlite" || dialect7 === "turso");
23608
+ can(statement, dialect4) {
23609
+ return statement.type === "rename_table" && (dialect4 === "sqlite" || dialect4 === "turso");
23485
23610
  }
23486
23611
  convert(statement) {
23487
23612
  const { tableNameFrom, tableNameTo } = statement;
@@ -23489,8 +23614,8 @@ var init_sqlgenerator = __esm({
23489
23614
  }
23490
23615
  };
23491
23616
  MySqlRenameTableConvertor = class extends Convertor {
23492
- can(statement, dialect7) {
23493
- return statement.type === "rename_table" && dialect7 === "mysql";
23617
+ can(statement, dialect4) {
23618
+ return statement.type === "rename_table" && dialect4 === "mysql";
23494
23619
  }
23495
23620
  convert(statement) {
23496
23621
  const { tableNameFrom, tableNameTo } = statement;
@@ -23498,8 +23623,8 @@ var init_sqlgenerator = __esm({
23498
23623
  }
23499
23624
  };
23500
23625
  PgAlterTableRenameColumnConvertor = class extends Convertor {
23501
- can(statement, dialect7) {
23502
- return statement.type === "alter_table_rename_column" && dialect7 === "postgresql";
23626
+ can(statement, dialect4) {
23627
+ return statement.type === "alter_table_rename_column" && dialect4 === "postgresql";
23503
23628
  }
23504
23629
  convert(statement) {
23505
23630
  const { tableName, oldColumnName, newColumnName, schema: schema5 } = statement;
@@ -23508,8 +23633,8 @@ var init_sqlgenerator = __esm({
23508
23633
  }
23509
23634
  };
23510
23635
  MySqlAlterTableRenameColumnConvertor = class extends Convertor {
23511
- can(statement, dialect7) {
23512
- return statement.type === "alter_table_rename_column" && dialect7 === "mysql";
23636
+ can(statement, dialect4) {
23637
+ return statement.type === "alter_table_rename_column" && dialect4 === "mysql";
23513
23638
  }
23514
23639
  convert(statement) {
23515
23640
  const { tableName, oldColumnName, newColumnName } = statement;
@@ -23517,8 +23642,8 @@ var init_sqlgenerator = __esm({
23517
23642
  }
23518
23643
  };
23519
23644
  SQLiteAlterTableRenameColumnConvertor = class extends Convertor {
23520
- can(statement, dialect7) {
23521
- return statement.type === "alter_table_rename_column" && (dialect7 === "sqlite" || dialect7 === "turso");
23645
+ can(statement, dialect4) {
23646
+ return statement.type === "alter_table_rename_column" && (dialect4 === "sqlite" || dialect4 === "turso");
23522
23647
  }
23523
23648
  convert(statement) {
23524
23649
  const { tableName, oldColumnName, newColumnName } = statement;
@@ -23526,8 +23651,8 @@ var init_sqlgenerator = __esm({
23526
23651
  }
23527
23652
  };
23528
23653
  PgAlterTableDropColumnConvertor = class extends Convertor {
23529
- can(statement, dialect7) {
23530
- return statement.type === "alter_table_drop_column" && dialect7 === "postgresql";
23654
+ can(statement, dialect4) {
23655
+ return statement.type === "alter_table_drop_column" && dialect4 === "postgresql";
23531
23656
  }
23532
23657
  convert(statement) {
23533
23658
  const { tableName, columnName, schema: schema5 } = statement;
@@ -23536,8 +23661,8 @@ var init_sqlgenerator = __esm({
23536
23661
  }
23537
23662
  };
23538
23663
  MySqlAlterTableDropColumnConvertor = class extends Convertor {
23539
- can(statement, dialect7) {
23540
- return statement.type === "alter_table_drop_column" && dialect7 === "mysql";
23664
+ can(statement, dialect4) {
23665
+ return statement.type === "alter_table_drop_column" && dialect4 === "mysql";
23541
23666
  }
23542
23667
  convert(statement) {
23543
23668
  const { tableName, columnName } = statement;
@@ -23545,8 +23670,8 @@ var init_sqlgenerator = __esm({
23545
23670
  }
23546
23671
  };
23547
23672
  SQLiteAlterTableDropColumnConvertor = class extends Convertor {
23548
- can(statement, dialect7) {
23549
- return statement.type === "alter_table_drop_column" && (dialect7 === "sqlite" || dialect7 === "turso");
23673
+ can(statement, dialect4) {
23674
+ return statement.type === "alter_table_drop_column" && (dialect4 === "sqlite" || dialect4 === "turso");
23550
23675
  }
23551
23676
  convert(statement) {
23552
23677
  const { tableName, columnName } = statement;
@@ -23554,8 +23679,8 @@ var init_sqlgenerator = __esm({
23554
23679
  }
23555
23680
  };
23556
23681
  PgAlterTableAddColumnConvertor = class extends Convertor {
23557
- can(statement, dialect7) {
23558
- return statement.type === "alter_table_add_column" && dialect7 === "postgresql";
23682
+ can(statement, dialect4) {
23683
+ return statement.type === "alter_table_add_column" && dialect4 === "postgresql";
23559
23684
  }
23560
23685
  convert(statement) {
23561
23686
  const { tableName, column: column7, schema: schema5 } = statement;
@@ -23574,8 +23699,8 @@ var init_sqlgenerator = __esm({
23574
23699
  }
23575
23700
  };
23576
23701
  MySqlAlterTableAddColumnConvertor = class extends Convertor {
23577
- can(statement, dialect7) {
23578
- return statement.type === "alter_table_add_column" && dialect7 === "mysql";
23702
+ can(statement, dialect4) {
23703
+ return statement.type === "alter_table_add_column" && dialect4 === "mysql";
23579
23704
  }
23580
23705
  convert(statement) {
23581
23706
  const { tableName, column: column7 } = statement;
@@ -23598,8 +23723,8 @@ var init_sqlgenerator = __esm({
23598
23723
  }
23599
23724
  };
23600
23725
  SQLiteAlterTableAddColumnConvertor = class extends Convertor {
23601
- can(statement, dialect7) {
23602
- return statement.type === "sqlite_alter_table_add_column" && (dialect7 === "sqlite" || dialect7 === "turso");
23726
+ can(statement, dialect4) {
23727
+ return statement.type === "sqlite_alter_table_add_column" && (dialect4 === "sqlite" || dialect4 === "turso");
23603
23728
  }
23604
23729
  convert(statement) {
23605
23730
  const { tableName, column: column7, referenceData } = statement;
@@ -23614,8 +23739,8 @@ var init_sqlgenerator = __esm({
23614
23739
  }
23615
23740
  };
23616
23741
  PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
23617
- can(statement, dialect7) {
23618
- return statement.type === "alter_table_alter_column_set_type" && dialect7 === "postgresql";
23742
+ can(statement, dialect4) {
23743
+ return statement.type === "alter_table_alter_column_set_type" && dialect4 === "postgresql";
23619
23744
  }
23620
23745
  convert(statement) {
23621
23746
  const { tableName, columnName, newDataType, schema: schema5 } = statement;
@@ -23624,8 +23749,8 @@ var init_sqlgenerator = __esm({
23624
23749
  }
23625
23750
  };
23626
23751
  PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
23627
- can(statement, dialect7) {
23628
- return statement.type === "alter_table_alter_column_set_default" && dialect7 === "postgresql";
23752
+ can(statement, dialect4) {
23753
+ return statement.type === "alter_table_alter_column_set_default" && dialect4 === "postgresql";
23629
23754
  }
23630
23755
  convert(statement) {
23631
23756
  const { tableName, columnName, schema: schema5 } = statement;
@@ -23634,8 +23759,8 @@ var init_sqlgenerator = __esm({
23634
23759
  }
23635
23760
  };
23636
23761
  PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
23637
- can(statement, dialect7) {
23638
- return statement.type === "alter_table_alter_column_drop_default" && dialect7 === "postgresql";
23762
+ can(statement, dialect4) {
23763
+ return statement.type === "alter_table_alter_column_drop_default" && dialect4 === "postgresql";
23639
23764
  }
23640
23765
  convert(statement) {
23641
23766
  const { tableName, columnName, schema: schema5 } = statement;
@@ -23644,8 +23769,8 @@ var init_sqlgenerator = __esm({
23644
23769
  }
23645
23770
  };
23646
23771
  PgAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
23647
- can(statement, dialect7) {
23648
- return statement.type === "alter_table_alter_column_drop_generated" && dialect7 === "postgresql";
23772
+ can(statement, dialect4) {
23773
+ return statement.type === "alter_table_alter_column_drop_generated" && dialect4 === "postgresql";
23649
23774
  }
23650
23775
  convert(statement) {
23651
23776
  const { tableName, columnName, schema: schema5 } = statement;
@@ -23654,8 +23779,8 @@ var init_sqlgenerator = __esm({
23654
23779
  }
23655
23780
  };
23656
23781
  PgAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
23657
- can(statement, dialect7) {
23658
- return statement.type === "alter_table_alter_column_set_generated" && dialect7 === "postgresql";
23782
+ can(statement, dialect4) {
23783
+ return statement.type === "alter_table_alter_column_set_generated" && dialect4 === "postgresql";
23659
23784
  }
23660
23785
  convert(statement) {
23661
23786
  const {
@@ -23692,8 +23817,8 @@ var init_sqlgenerator = __esm({
23692
23817
  }
23693
23818
  };
23694
23819
  PgAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
23695
- can(statement, dialect7) {
23696
- return statement.type === "alter_table_alter_column_alter_generated" && dialect7 === "postgresql";
23820
+ can(statement, dialect4) {
23821
+ return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "postgresql";
23697
23822
  }
23698
23823
  convert(statement) {
23699
23824
  const {
@@ -23730,8 +23855,8 @@ var init_sqlgenerator = __esm({
23730
23855
  }
23731
23856
  };
23732
23857
  SqliteAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
23733
- can(statement, dialect7) {
23734
- return statement.type === "alter_table_alter_column_drop_generated" && (dialect7 === "sqlite" || dialect7 === "turso");
23858
+ can(statement, dialect4) {
23859
+ return statement.type === "alter_table_alter_column_drop_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
23735
23860
  }
23736
23861
  convert(statement) {
23737
23862
  const {
@@ -23771,8 +23896,8 @@ var init_sqlgenerator = __esm({
23771
23896
  }
23772
23897
  };
23773
23898
  SqliteAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
23774
- can(statement, dialect7) {
23775
- return statement.type === "alter_table_alter_column_set_generated" && (dialect7 === "sqlite" || dialect7 === "turso");
23899
+ can(statement, dialect4) {
23900
+ return statement.type === "alter_table_alter_column_set_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
23776
23901
  }
23777
23902
  convert(statement) {
23778
23903
  const {
@@ -23812,8 +23937,8 @@ var init_sqlgenerator = __esm({
23812
23937
  }
23813
23938
  };
23814
23939
  SqliteAlterTableAlterColumnAlterGeneratedConvertor = class extends Convertor {
23815
- can(statement, dialect7) {
23816
- return statement.type === "alter_table_alter_column_alter_generated" && (dialect7 === "sqlite" || dialect7 === "turso");
23940
+ can(statement, dialect4) {
23941
+ return statement.type === "alter_table_alter_column_alter_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
23817
23942
  }
23818
23943
  convert(statement) {
23819
23944
  const {
@@ -23853,8 +23978,8 @@ var init_sqlgenerator = __esm({
23853
23978
  }
23854
23979
  };
23855
23980
  MySqlAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
23856
- can(statement, dialect7) {
23857
- return statement.type === "alter_table_alter_column_alter_generated" && dialect7 === "mysql";
23981
+ can(statement, dialect4) {
23982
+ return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "mysql";
23858
23983
  }
23859
23984
  convert(statement) {
23860
23985
  const {
@@ -23891,24 +24016,24 @@ var init_sqlgenerator = __esm({
23891
24016
  }
23892
24017
  };
23893
24018
  MySqlAlterTableAddPk = class extends Convertor {
23894
- can(statement, dialect7) {
23895
- return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "mysql";
24019
+ can(statement, dialect4) {
24020
+ return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "mysql";
23896
24021
  }
23897
24022
  convert(statement) {
23898
24023
  return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
23899
24024
  }
23900
24025
  };
23901
24026
  MySqlAlterTableDropPk = class extends Convertor {
23902
- can(statement, dialect7) {
23903
- return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "mysql";
24027
+ can(statement, dialect4) {
24028
+ return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "mysql";
23904
24029
  }
23905
24030
  convert(statement) {
23906
24031
  return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
23907
24032
  }
23908
24033
  };
23909
24034
  LibSQLModifyColumn = class extends Convertor {
23910
- can(statement, dialect7) {
23911
- return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") && dialect7 === "turso";
24035
+ can(statement, dialect4) {
24036
+ return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") && dialect4 === "turso";
23912
24037
  }
23913
24038
  convert(statement, json2) {
23914
24039
  const { tableName, columnName } = statement;
@@ -23968,8 +24093,8 @@ var init_sqlgenerator = __esm({
23968
24093
  }
23969
24094
  };
23970
24095
  MySqlModifyColumn = class extends Convertor {
23971
- can(statement, dialect7) {
23972
- return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_generated" || statement.type === "alter_table_alter_column_drop_generated") && dialect7 === "mysql";
24096
+ can(statement, dialect4) {
24097
+ return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_generated" || statement.type === "alter_table_alter_column_drop_generated") && dialect4 === "mysql";
23973
24098
  }
23974
24099
  convert(statement) {
23975
24100
  var _a, _b, _c, _d, _e, _f, _g;
@@ -24106,8 +24231,8 @@ var init_sqlgenerator = __esm({
24106
24231
  }
24107
24232
  };
24108
24233
  PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
24109
- can(statement, dialect7) {
24110
- return statement.type === "create_composite_pk" && dialect7 === "postgresql";
24234
+ can(statement, dialect4) {
24235
+ return statement.type === "create_composite_pk" && dialect4 === "postgresql";
24111
24236
  }
24112
24237
  convert(statement) {
24113
24238
  const { name, columns } = PgSquasher.unsquashPK(statement.data);
@@ -24116,8 +24241,8 @@ var init_sqlgenerator = __esm({
24116
24241
  }
24117
24242
  };
24118
24243
  PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
24119
- can(statement, dialect7) {
24120
- return statement.type === "delete_composite_pk" && dialect7 === "postgresql";
24244
+ can(statement, dialect4) {
24245
+ return statement.type === "delete_composite_pk" && dialect4 === "postgresql";
24121
24246
  }
24122
24247
  convert(statement) {
24123
24248
  const { name, columns } = PgSquasher.unsquashPK(statement.data);
@@ -24126,8 +24251,8 @@ var init_sqlgenerator = __esm({
24126
24251
  }
24127
24252
  };
24128
24253
  PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
24129
- can(statement, dialect7) {
24130
- return statement.type === "alter_composite_pk" && dialect7 === "postgresql";
24254
+ can(statement, dialect4) {
24255
+ return statement.type === "alter_composite_pk" && dialect4 === "postgresql";
24131
24256
  }
24132
24257
  convert(statement) {
24133
24258
  const { name, columns } = PgSquasher.unsquashPK(statement.old);
@@ -24140,8 +24265,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24140
24265
  }
24141
24266
  };
24142
24267
  MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
24143
- can(statement, dialect7) {
24144
- return statement.type === "create_composite_pk" && dialect7 === "mysql";
24268
+ can(statement, dialect4) {
24269
+ return statement.type === "create_composite_pk" && dialect4 === "mysql";
24145
24270
  }
24146
24271
  convert(statement) {
24147
24272
  const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
@@ -24149,8 +24274,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24149
24274
  }
24150
24275
  };
24151
24276
  MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
24152
- can(statement, dialect7) {
24153
- return statement.type === "delete_composite_pk" && dialect7 === "mysql";
24277
+ can(statement, dialect4) {
24278
+ return statement.type === "delete_composite_pk" && dialect4 === "mysql";
24154
24279
  }
24155
24280
  convert(statement) {
24156
24281
  const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
@@ -24158,8 +24283,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24158
24283
  }
24159
24284
  };
24160
24285
  MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
24161
- can(statement, dialect7) {
24162
- return statement.type === "alter_composite_pk" && dialect7 === "mysql";
24286
+ can(statement, dialect4) {
24287
+ return statement.type === "alter_composite_pk" && dialect4 === "mysql";
24163
24288
  }
24164
24289
  convert(statement) {
24165
24290
  const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
@@ -24170,8 +24295,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24170
24295
  }
24171
24296
  };
24172
24297
  PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
24173
- can(statement, dialect7) {
24174
- return statement.type === "alter_table_alter_column_set_pk" && dialect7 === "postgresql";
24298
+ can(statement, dialect4) {
24299
+ return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "postgresql";
24175
24300
  }
24176
24301
  convert(statement) {
24177
24302
  const { tableName, columnName } = statement;
@@ -24180,8 +24305,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24180
24305
  }
24181
24306
  };
24182
24307
  PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
24183
- can(statement, dialect7) {
24184
- return statement.type === "alter_table_alter_column_drop_pk" && dialect7 === "postgresql";
24308
+ can(statement, dialect4) {
24309
+ return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "postgresql";
24185
24310
  }
24186
24311
  convert(statement) {
24187
24312
  const { tableName, columnName, schema: schema5 } = statement;
@@ -24204,8 +24329,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24204
24329
  }
24205
24330
  };
24206
24331
  PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
24207
- can(statement, dialect7) {
24208
- return statement.type === "alter_table_alter_column_set_notnull" && dialect7 === "postgresql";
24332
+ can(statement, dialect4) {
24333
+ return statement.type === "alter_table_alter_column_set_notnull" && dialect4 === "postgresql";
24209
24334
  }
24210
24335
  convert(statement) {
24211
24336
  const { tableName, columnName } = statement;
@@ -24214,8 +24339,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24214
24339
  }
24215
24340
  };
24216
24341
  PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
24217
- can(statement, dialect7) {
24218
- return statement.type === "alter_table_alter_column_drop_notnull" && dialect7 === "postgresql";
24342
+ can(statement, dialect4) {
24343
+ return statement.type === "alter_table_alter_column_drop_notnull" && dialect4 === "postgresql";
24219
24344
  }
24220
24345
  convert(statement) {
24221
24346
  const { tableName, columnName } = statement;
@@ -24224,8 +24349,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24224
24349
  }
24225
24350
  };
24226
24351
  PgCreateForeignKeyConvertor = class extends Convertor {
24227
- can(statement, dialect7) {
24228
- return statement.type === "create_reference" && dialect7 === "postgresql";
24352
+ can(statement, dialect4) {
24353
+ return statement.type === "create_reference" && dialect4 === "postgresql";
24229
24354
  }
24230
24355
  convert(statement) {
24231
24356
  const {
@@ -24254,8 +24379,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24254
24379
  }
24255
24380
  };
24256
24381
  LibSQLCreateForeignKeyConvertor = class extends Convertor {
24257
- can(statement, dialect7) {
24258
- return statement.type === "create_reference" && dialect7 === "turso";
24382
+ can(statement, dialect4) {
24383
+ return statement.type === "create_reference" && dialect4 === "turso";
24259
24384
  }
24260
24385
  convert(statement, json2, action) {
24261
24386
  const { columnsFrom, columnsTo, tableFrom, onDelete, onUpdate, tableTo } = action === "push" ? SQLiteSquasher.unsquashPushFK(statement.data) : SQLiteSquasher.unsquashFK(statement.data);
@@ -24271,8 +24396,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24271
24396
  }
24272
24397
  };
24273
24398
  MySqlCreateForeignKeyConvertor = class extends Convertor {
24274
- can(statement, dialect7) {
24275
- return statement.type === "create_reference" && dialect7 === "mysql";
24399
+ can(statement, dialect4) {
24400
+ return statement.type === "create_reference" && dialect4 === "mysql";
24276
24401
  }
24277
24402
  convert(statement) {
24278
24403
  const {
@@ -24292,8 +24417,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24292
24417
  }
24293
24418
  };
24294
24419
  PgAlterForeignKeyConvertor = class extends Convertor {
24295
- can(statement, dialect7) {
24296
- return statement.type === "alter_reference" && dialect7 === "postgresql";
24420
+ can(statement, dialect4) {
24421
+ return statement.type === "alter_reference" && dialect4 === "postgresql";
24297
24422
  }
24298
24423
  convert(statement) {
24299
24424
  const newFk = PgSquasher.unsquashFK(statement.data);
@@ -24317,8 +24442,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24317
24442
  }
24318
24443
  };
24319
24444
  PgDeleteForeignKeyConvertor = class extends Convertor {
24320
- can(statement, dialect7) {
24321
- return statement.type === "delete_reference" && dialect7 === "postgresql";
24445
+ can(statement, dialect4) {
24446
+ return statement.type === "delete_reference" && dialect4 === "postgresql";
24322
24447
  }
24323
24448
  convert(statement) {
24324
24449
  const tableFrom = statement.tableName;
@@ -24329,8 +24454,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24329
24454
  }
24330
24455
  };
24331
24456
  MySqlDeleteForeignKeyConvertor = class extends Convertor {
24332
- can(statement, dialect7) {
24333
- return statement.type === "delete_reference" && dialect7 === "mysql";
24457
+ can(statement, dialect4) {
24458
+ return statement.type === "delete_reference" && dialect4 === "mysql";
24334
24459
  }
24335
24460
  convert(statement) {
24336
24461
  const tableFrom = statement.tableName;
@@ -24340,8 +24465,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24340
24465
  }
24341
24466
  };
24342
24467
  CreatePgIndexConvertor = class extends Convertor {
24343
- can(statement, dialect7) {
24344
- return statement.type === "create_index_pg" && dialect7 === "postgresql";
24468
+ can(statement, dialect4) {
24469
+ return statement.type === "create_index_pg" && dialect4 === "postgresql";
24345
24470
  }
24346
24471
  convert(statement) {
24347
24472
  const {
@@ -24372,8 +24497,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24372
24497
  }
24373
24498
  };
24374
24499
  CreateMySqlIndexConvertor = class extends Convertor {
24375
- can(statement, dialect7) {
24376
- return statement.type === "create_index" && dialect7 === "mysql";
24500
+ can(statement, dialect4) {
24501
+ return statement.type === "create_index" && dialect4 === "mysql";
24377
24502
  }
24378
24503
  convert(statement) {
24379
24504
  const { name, columns, isUnique } = MySqlSquasher.unsquashIdx(
@@ -24388,8 +24513,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24388
24513
  }
24389
24514
  };
24390
24515
  CreateSqliteIndexConvertor = class extends Convertor {
24391
- can(statement, dialect7) {
24392
- return statement.type === "create_index" && (dialect7 === "sqlite" || dialect7 === "turso");
24516
+ can(statement, dialect4) {
24517
+ return statement.type === "create_index" && (dialect4 === "sqlite" || dialect4 === "turso");
24393
24518
  }
24394
24519
  convert(statement) {
24395
24520
  const { name, columns, isUnique, where } = SQLiteSquasher.unsquashIdx(
@@ -24405,8 +24530,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24405
24530
  }
24406
24531
  };
24407
24532
  PgDropIndexConvertor = class extends Convertor {
24408
- can(statement, dialect7) {
24409
- return statement.type === "drop_index" && dialect7 === "postgresql";
24533
+ can(statement, dialect4) {
24534
+ return statement.type === "drop_index" && dialect4 === "postgresql";
24410
24535
  }
24411
24536
  convert(statement) {
24412
24537
  const { name } = PgSquasher.unsquashIdx(statement.data);
@@ -24414,8 +24539,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24414
24539
  }
24415
24540
  };
24416
24541
  PgCreateSchemaConvertor = class extends Convertor {
24417
- can(statement, dialect7) {
24418
- return statement.type === "create_schema" && dialect7 === "postgresql";
24542
+ can(statement, dialect4) {
24543
+ return statement.type === "create_schema" && dialect4 === "postgresql";
24419
24544
  }
24420
24545
  convert(statement) {
24421
24546
  const { name } = statement;
@@ -24424,8 +24549,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24424
24549
  }
24425
24550
  };
24426
24551
  PgRenameSchemaConvertor = class extends Convertor {
24427
- can(statement, dialect7) {
24428
- return statement.type === "rename_schema" && dialect7 === "postgresql";
24552
+ can(statement, dialect4) {
24553
+ return statement.type === "rename_schema" && dialect4 === "postgresql";
24429
24554
  }
24430
24555
  convert(statement) {
24431
24556
  const { from, to } = statement;
@@ -24434,8 +24559,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24434
24559
  }
24435
24560
  };
24436
24561
  PgDropSchemaConvertor = class extends Convertor {
24437
- can(statement, dialect7) {
24438
- return statement.type === "drop_schema" && dialect7 === "postgresql";
24562
+ can(statement, dialect4) {
24563
+ return statement.type === "drop_schema" && dialect4 === "postgresql";
24439
24564
  }
24440
24565
  convert(statement) {
24441
24566
  const { name } = statement;
@@ -24444,8 +24569,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24444
24569
  }
24445
24570
  };
24446
24571
  PgAlterTableSetSchemaConvertor = class extends Convertor {
24447
- can(statement, dialect7) {
24448
- return statement.type === "alter_table_set_schema" && dialect7 === "postgresql";
24572
+ can(statement, dialect4) {
24573
+ return statement.type === "alter_table_set_schema" && dialect4 === "postgresql";
24449
24574
  }
24450
24575
  convert(statement) {
24451
24576
  const { tableName, schemaFrom, schemaTo } = statement;
@@ -24454,8 +24579,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24454
24579
  }
24455
24580
  };
24456
24581
  PgAlterTableSetNewSchemaConvertor = class extends Convertor {
24457
- can(statement, dialect7) {
24458
- return statement.type === "alter_table_set_new_schema" && dialect7 === "postgresql";
24582
+ can(statement, dialect4) {
24583
+ return statement.type === "alter_table_set_new_schema" && dialect4 === "postgresql";
24459
24584
  }
24460
24585
  convert(statement) {
24461
24586
  const { tableName, to, from } = statement;
@@ -24465,8 +24590,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24465
24590
  }
24466
24591
  };
24467
24592
  PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
24468
- can(statement, dialect7) {
24469
- return statement.type === "alter_table_remove_from_schema" && dialect7 === "postgresql";
24593
+ can(statement, dialect4) {
24594
+ return statement.type === "alter_table_remove_from_schema" && dialect4 === "postgresql";
24470
24595
  }
24471
24596
  convert(statement) {
24472
24597
  const { tableName, schema: schema5 } = statement;
@@ -24476,8 +24601,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24476
24601
  }
24477
24602
  };
24478
24603
  SqliteDropIndexConvertor = class extends Convertor {
24479
- can(statement, dialect7) {
24480
- return statement.type === "drop_index" && (dialect7 === "sqlite" || dialect7 === "turso");
24604
+ can(statement, dialect4) {
24605
+ return statement.type === "drop_index" && (dialect4 === "sqlite" || dialect4 === "turso");
24481
24606
  }
24482
24607
  convert(statement) {
24483
24608
  const { name } = PgSquasher.unsquashIdx(statement.data);
@@ -24485,8 +24610,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24485
24610
  }
24486
24611
  };
24487
24612
  MySqlDropIndexConvertor = class extends Convertor {
24488
- can(statement, dialect7) {
24489
- return statement.type === "drop_index" && dialect7 === "mysql";
24613
+ can(statement, dialect4) {
24614
+ return statement.type === "drop_index" && dialect4 === "mysql";
24490
24615
  }
24491
24616
  convert(statement) {
24492
24617
  const { name } = MySqlSquasher.unsquashIdx(statement.data);
@@ -24494,8 +24619,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24494
24619
  }
24495
24620
  };
24496
24621
  SQLiteRecreateTableConvertor = class extends Convertor {
24497
- can(statement, dialect7) {
24498
- return statement.type === "recreate_table" && dialect7 === "sqlite";
24622
+ can(statement, dialect4) {
24623
+ return statement.type === "recreate_table" && dialect4 === "sqlite";
24499
24624
  }
24500
24625
  convert(statement) {
24501
24626
  const { tableName, columns, compositePKs, referenceData } = statement;
@@ -24536,8 +24661,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24536
24661
  }
24537
24662
  };
24538
24663
  LibSQLRecreateTableConvertor = class extends Convertor {
24539
- can(statement, dialect7) {
24540
- return statement.type === "recreate_table" && dialect7 === "turso";
24664
+ can(statement, dialect4) {
24665
+ return statement.type === "recreate_table" && dialect4 === "turso";
24541
24666
  }
24542
24667
  convert(statement) {
24543
24668
  const { tableName, columns, compositePKs, referenceData } = statement;
@@ -24584,6 +24709,11 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24584
24709
  convertors.push(new SQLiteRecreateTableConvertor());
24585
24710
  convertors.push(new LibSQLRecreateTableConvertor());
24586
24711
  convertors.push(new CreateTypeEnumConvertor());
24712
+ convertors.push(new DropTypeEnumConvertor());
24713
+ convertors.push(new AlterTypeAddValueConvertor());
24714
+ convertors.push(new AlterTypeSetSchemaConvertor());
24715
+ convertors.push(new AlterRenameTypeConvertor());
24716
+ convertors.push(new AlterTypeDropValueConvertor());
24587
24717
  convertors.push(new CreatePgSequenceConvertor());
24588
24718
  convertors.push(new DropPgSequenceConvertor());
24589
24719
  convertors.push(new RenamePgSequenceConvertor());
@@ -24615,7 +24745,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
24615
24745
  convertors.push(new PgDropIndexConvertor());
24616
24746
  convertors.push(new SqliteDropIndexConvertor());
24617
24747
  convertors.push(new MySqlDropIndexConvertor());
24618
- convertors.push(new AlterTypeAddValueConvertor());
24619
24748
  convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
24620
24749
  convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
24621
24750
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
@@ -24917,7 +25046,7 @@ var init_sqlitePushUtils = __esm({
24917
25046
  });
24918
25047
 
24919
25048
  // src/jsonStatements.ts
24920
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
25049
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
24921
25050
  var init_jsonStatements = __esm({
24922
25051
  "src/jsonStatements.ts"() {
24923
25052
  "use strict";
@@ -25007,6 +25136,28 @@ var init_jsonStatements = __esm({
25007
25136
  };
25008
25137
  });
25009
25138
  };
25139
+ prepareDropEnumValues = (name, schema5, removedValues, json2) => {
25140
+ if (!removedValues.length)
25141
+ return [];
25142
+ const affectedColumns = [];
25143
+ for (const tableKey2 in json2.tables) {
25144
+ const table4 = json2.tables[tableKey2];
25145
+ for (const columnKey in table4.columns) {
25146
+ const column7 = table4.columns[columnKey];
25147
+ if (column7.type === name && column7.typeSchema === schema5) {
25148
+ affectedColumns.push({ schema: table4.schema || "public", table: table4.name, column: column7.name });
25149
+ }
25150
+ }
25151
+ }
25152
+ return [{
25153
+ type: "alter_type_drop_value",
25154
+ name,
25155
+ schema: schema5,
25156
+ deletedValues: removedValues,
25157
+ newValues: json2.enums[`${schema5}.${name}`].values,
25158
+ columnsWithEnum: affectedColumns
25159
+ }];
25160
+ };
25010
25161
  prepareDropEnumJson = (name, schema5) => {
25011
25162
  return {
25012
25163
  type: "drop_type_enum",
@@ -27200,6 +27351,9 @@ var init_snapshotsDiffer = __esm({
27200
27351
  const jsonAlterEnumsWithAddedValues = typedResult.alteredEnums.map((it) => {
27201
27352
  return prepareAddValuesToEnumJson(it.name, it.schema, it.addedValues);
27202
27353
  }).flat() ?? [];
27354
+ const jsonAlterEnumsWithDroppedValues = typedResult.alteredEnums.map((it) => {
27355
+ return prepareDropEnumValues(it.name, it.schema, it.deletedValues, curFull);
27356
+ }).flat() ?? [];
27203
27357
  const createSequences = createdSequences.map((it) => {
27204
27358
  return prepareCreateSequenceJson(it);
27205
27359
  }) ?? [];
@@ -27257,6 +27411,7 @@ var init_snapshotsDiffer = __esm({
27257
27411
  jsonStatements.push(...jsonAlteredCompositePKs);
27258
27412
  jsonStatements.push(...jsonAddedUniqueConstraints);
27259
27413
  jsonStatements.push(...jsonAlteredUniqueConstraints);
27414
+ jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
27260
27415
  jsonStatements.push(...dropEnums);
27261
27416
  jsonStatements.push(...dropSequences);
27262
27417
  jsonStatements.push(...dropSchemas);
@@ -27277,7 +27432,17 @@ var init_snapshotsDiffer = __esm({
27277
27432
  }
27278
27433
  return true;
27279
27434
  });
27280
- const sqlStatements = fromJson(filteredJsonStatements, "postgresql");
27435
+ const filteredEnumsJsonStatements = filteredJsonStatements.filter((st) => {
27436
+ if (st.type === "alter_type_add_value") {
27437
+ if (jsonStatements.find(
27438
+ (it) => it.type === "alter_type_drop_value" && it.name === st.name && it.schema === st.schema
27439
+ )) {
27440
+ return false;
27441
+ }
27442
+ }
27443
+ return true;
27444
+ });
27445
+ const sqlStatements = fromJson(filteredEnumsJsonStatements, "postgresql");
27281
27446
  const uniqueSqlStatements = [];
27282
27447
  sqlStatements.forEach((ss) => {
27283
27448
  if (!uniqueSqlStatements.includes(ss)) {
@@ -27293,7 +27458,7 @@ var init_snapshotsDiffer = __esm({
27293
27458
  });
27294
27459
  const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
27295
27460
  return {
27296
- statements: filteredJsonStatements,
27461
+ statements: filteredEnumsJsonStatements,
27297
27462
  sqlStatements: uniqueSqlStatements,
27298
27463
  _meta
27299
27464
  };
@@ -29637,6 +29802,7 @@ var init_migrate = __esm({
29637
29802
  prepareAndMigratePg = async (config) => {
29638
29803
  const outFolder = config.out;
29639
29804
  const schemaPath = config.schema;
29805
+ const casing2 = config.casing;
29640
29806
  try {
29641
29807
  assertV1OutFolder(outFolder);
29642
29808
  const { snapshots, journal } = prepareMigrationFolder(
@@ -29645,7 +29811,8 @@ var init_migrate = __esm({
29645
29811
  );
29646
29812
  const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
29647
29813
  snapshots,
29648
- schemaPath
29814
+ schemaPath,
29815
+ casing2
29649
29816
  );
29650
29817
  const validatedPrev = pgSchema.parse(prev);
29651
29818
  const validatedCur = pgSchema.parse(cur);
@@ -29688,10 +29855,11 @@ var init_migrate = __esm({
29688
29855
  console.error(e2);
29689
29856
  }
29690
29857
  };
29691
- preparePgPush = async (schemaPath, snapshot, schemaFilter) => {
29858
+ preparePgPush = async (schemaPath, snapshot, schemaFilter, casing2) => {
29692
29859
  const { prev, cur } = await preparePgDbPushSnapshot(
29693
29860
  snapshot,
29694
29861
  schemaPath,
29862
+ casing2,
29695
29863
  schemaFilter
29696
29864
  );
29697
29865
  const validatedPrev = pgSchema.parse(prev);
@@ -29712,11 +29880,12 @@ var init_migrate = __esm({
29712
29880
  );
29713
29881
  return { sqlStatements, statements, squashedPrev, squashedCur };
29714
29882
  };
29715
- prepareMySQLPush = async (schemaPath, snapshot) => {
29883
+ prepareMySQLPush = async (schemaPath, snapshot, casing2) => {
29716
29884
  try {
29717
29885
  const { prev, cur } = await prepareMySqlDbPushSnapshot(
29718
29886
  snapshot,
29719
- schemaPath
29887
+ schemaPath,
29888
+ casing2
29720
29889
  );
29721
29890
  const validatedPrev = mysqlSchema.parse(prev);
29722
29891
  const validatedCur = mysqlSchema.parse(cur);
@@ -29740,12 +29909,14 @@ var init_migrate = __esm({
29740
29909
  prepareAndMigrateMysql = async (config) => {
29741
29910
  const outFolder = config.out;
29742
29911
  const schemaPath = config.schema;
29912
+ const casing2 = config.casing;
29743
29913
  try {
29744
29914
  assertV1OutFolder(outFolder);
29745
29915
  const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
29746
29916
  const { prev, cur, custom: custom2 } = await prepareMySqlMigrationSnapshot(
29747
29917
  snapshots,
29748
- schemaPath
29918
+ schemaPath,
29919
+ casing2
29749
29920
  );
29750
29921
  const validatedPrev = mysqlSchema.parse(prev);
29751
29922
  const validatedCur = mysqlSchema.parse(cur);
@@ -29789,12 +29960,14 @@ var init_migrate = __esm({
29789
29960
  prepareAndMigrateSqlite = async (config) => {
29790
29961
  const outFolder = config.out;
29791
29962
  const schemaPath = config.schema;
29963
+ const casing2 = config.casing;
29792
29964
  try {
29793
29965
  assertV1OutFolder(outFolder);
29794
29966
  const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
29795
29967
  const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
29796
29968
  snapshots,
29797
- schemaPath
29969
+ schemaPath,
29970
+ casing2
29798
29971
  );
29799
29972
  const validatedPrev = sqliteSchema.parse(prev);
29800
29973
  const validatedCur = sqliteSchema.parse(cur);
@@ -29840,12 +30013,14 @@ var init_migrate = __esm({
29840
30013
  prepareAndMigrateLibSQL = async (config) => {
29841
30014
  const outFolder = config.out;
29842
30015
  const schemaPath = config.schema;
30016
+ const casing2 = config.casing;
29843
30017
  try {
29844
30018
  assertV1OutFolder(outFolder);
29845
30019
  const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
29846
30020
  const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
29847
30021
  snapshots,
29848
- schemaPath
30022
+ schemaPath,
30023
+ casing2
29849
30024
  );
29850
30025
  const validatedPrev = sqliteSchema.parse(prev);
29851
30026
  const validatedCur = sqliteSchema.parse(cur);
@@ -29888,8 +30063,8 @@ var init_migrate = __esm({
29888
30063
  console.error(e2);
29889
30064
  }
29890
30065
  };
29891
- prepareSQLitePush = async (schemaPath, snapshot) => {
29892
- const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
30066
+ prepareSQLitePush = async (schemaPath, snapshot, casing2) => {
30067
+ const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
29893
30068
  const validatedPrev = sqliteSchema.parse(prev);
29894
30069
  const validatedCur = sqliteSchema.parse(cur);
29895
30070
  const squashedPrev = squashSqliteScheme(validatedPrev, "push");
@@ -29911,8 +30086,8 @@ var init_migrate = __esm({
29911
30086
  meta: _meta
29912
30087
  };
29913
30088
  };
29914
- prepareLibSQLPush = async (schemaPath, snapshot) => {
29915
- const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
30089
+ prepareLibSQLPush = async (schemaPath, snapshot, casing2) => {
30090
+ const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
29916
30091
  const validatedPrev = sqliteSchema.parse(prev);
29917
30092
  const validatedCur = sqliteSchema.parse(cur);
29918
30093
  const squashedPrev = squashSqliteScheme(validatedPrev, "push");
@@ -56234,9 +56409,9 @@ var require_dist_cjs46 = __commonJS({
56234
56409
  }
56235
56410
  });
56236
56411
 
56237
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
56412
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
56238
56413
  var require_httpAuthSchemeProvider3 = __commonJS({
56239
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
56414
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
56240
56415
  "use strict";
56241
56416
  Object.defineProperty(exports2, "__esModule", { value: true });
56242
56417
  exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOOIDCHttpAuthSchemeProvider = exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0;
@@ -56303,9 +56478,9 @@ var require_httpAuthSchemeProvider3 = __commonJS({
56303
56478
  }
56304
56479
  });
56305
56480
 
56306
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
56481
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
56307
56482
  var require_package4 = __commonJS({
56308
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) {
56483
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) {
56309
56484
  module2.exports = {
56310
56485
  name: "@aws-sdk/client-sso-oidc",
56311
56486
  description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native",
@@ -56409,9 +56584,9 @@ var require_package4 = __commonJS({
56409
56584
  }
56410
56585
  });
56411
56586
 
56412
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
56587
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
56413
56588
  var require_ruleset2 = __commonJS({
56414
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) {
56589
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) {
56415
56590
  "use strict";
56416
56591
  Object.defineProperty(exports2, "__esModule", { value: true });
56417
56592
  exports2.ruleSet = void 0;
@@ -56444,9 +56619,9 @@ var require_ruleset2 = __commonJS({
56444
56619
  }
56445
56620
  });
56446
56621
 
56447
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
56622
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
56448
56623
  var require_endpointResolver2 = __commonJS({
56449
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) {
56624
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) {
56450
56625
  "use strict";
56451
56626
  Object.defineProperty(exports2, "__esModule", { value: true });
56452
56627
  exports2.defaultEndpointResolver = void 0;
@@ -56464,9 +56639,9 @@ var require_endpointResolver2 = __commonJS({
56464
56639
  }
56465
56640
  });
56466
56641
 
56467
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
56642
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
56468
56643
  var require_runtimeConfig_shared2 = __commonJS({
56469
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) {
56644
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) {
56470
56645
  "use strict";
56471
56646
  Object.defineProperty(exports2, "__esModule", { value: true });
56472
56647
  exports2.getRuntimeConfig = void 0;
@@ -56510,9 +56685,9 @@ var require_runtimeConfig_shared2 = __commonJS({
56510
56685
  }
56511
56686
  });
56512
56687
 
56513
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
56688
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
56514
56689
  var require_runtimeConfig2 = __commonJS({
56515
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) {
56690
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) {
56516
56691
  "use strict";
56517
56692
  Object.defineProperty(exports2, "__esModule", { value: true });
56518
56693
  exports2.getRuntimeConfig = void 0;
@@ -56563,9 +56738,9 @@ var require_runtimeConfig2 = __commonJS({
56563
56738
  }
56564
56739
  });
56565
56740
 
56566
- // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
56741
+ // ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
56567
56742
  var require_dist_cjs47 = __commonJS({
56568
- "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) {
56743
+ "../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) {
56569
56744
  "use strict";
56570
56745
  var __defProp3 = Object.defineProperty;
56571
56746
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -57911,9 +58086,9 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
57911
58086
  }
57912
58087
  });
57913
58088
 
57914
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js
58089
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js
57915
58090
  var require_httpAuthSchemeProvider4 = __commonJS({
57916
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
58091
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
57917
58092
  "use strict";
57918
58093
  Object.defineProperty(exports2, "__esModule", { value: true });
57919
58094
  exports2.resolveHttpAuthSchemeConfig = exports2.resolveStsAuthConfig = exports2.defaultSTSHttpAuthSchemeProvider = exports2.defaultSTSHttpAuthSchemeParametersProvider = void 0;
@@ -57983,9 +58158,9 @@ var require_httpAuthSchemeProvider4 = __commonJS({
57983
58158
  }
57984
58159
  });
57985
58160
 
57986
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js
58161
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js
57987
58162
  var require_EndpointParameters = __commonJS({
57988
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) {
58163
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) {
57989
58164
  "use strict";
57990
58165
  Object.defineProperty(exports2, "__esModule", { value: true });
57991
58166
  exports2.commonParams = exports2.resolveClientEndpointParameters = void 0;
@@ -58009,9 +58184,9 @@ var require_EndpointParameters = __commonJS({
58009
58184
  }
58010
58185
  });
58011
58186
 
58012
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/package.json
58187
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json
58013
58188
  var require_package5 = __commonJS({
58014
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) {
58189
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) {
58015
58190
  module2.exports = {
58016
58191
  name: "@aws-sdk/client-sts",
58017
58192
  description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",
@@ -58117,9 +58292,9 @@ var require_package5 = __commonJS({
58117
58292
  }
58118
58293
  });
58119
58294
 
58120
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js
58295
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js
58121
58296
  var require_ruleset3 = __commonJS({
58122
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) {
58297
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) {
58123
58298
  "use strict";
58124
58299
  Object.defineProperty(exports2, "__esModule", { value: true });
58125
58300
  exports2.ruleSet = void 0;
@@ -58164,9 +58339,9 @@ var require_ruleset3 = __commonJS({
58164
58339
  }
58165
58340
  });
58166
58341
 
58167
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js
58342
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js
58168
58343
  var require_endpointResolver3 = __commonJS({
58169
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) {
58344
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) {
58170
58345
  "use strict";
58171
58346
  Object.defineProperty(exports2, "__esModule", { value: true });
58172
58347
  exports2.defaultEndpointResolver = void 0;
@@ -58184,9 +58359,9 @@ var require_endpointResolver3 = __commonJS({
58184
58359
  }
58185
58360
  });
58186
58361
 
58187
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js
58362
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js
58188
58363
  var require_runtimeConfig_shared3 = __commonJS({
58189
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) {
58364
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) {
58190
58365
  "use strict";
58191
58366
  Object.defineProperty(exports2, "__esModule", { value: true });
58192
58367
  exports2.getRuntimeConfig = void 0;
@@ -58230,9 +58405,9 @@ var require_runtimeConfig_shared3 = __commonJS({
58230
58405
  }
58231
58406
  });
58232
58407
 
58233
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
58408
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
58234
58409
  var require_runtimeConfig3 = __commonJS({
58235
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) {
58410
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) {
58236
58411
  "use strict";
58237
58412
  Object.defineProperty(exports2, "__esModule", { value: true });
58238
58413
  exports2.getRuntimeConfig = void 0;
@@ -58296,9 +58471,9 @@ var require_runtimeConfig3 = __commonJS({
58296
58471
  }
58297
58472
  });
58298
58473
 
58299
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js
58474
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js
58300
58475
  var require_httpAuthExtensionConfiguration = __commonJS({
58301
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js"(exports2) {
58476
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js"(exports2) {
58302
58477
  "use strict";
58303
58478
  Object.defineProperty(exports2, "__esModule", { value: true });
58304
58479
  exports2.resolveHttpAuthRuntimeConfig = exports2.getHttpAuthExtensionConfiguration = void 0;
@@ -58344,9 +58519,9 @@ var require_httpAuthExtensionConfiguration = __commonJS({
58344
58519
  }
58345
58520
  });
58346
58521
 
58347
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js
58522
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js
58348
58523
  var require_runtimeExtensions = __commonJS({
58349
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) {
58524
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) {
58350
58525
  "use strict";
58351
58526
  Object.defineProperty(exports2, "__esModule", { value: true });
58352
58527
  exports2.resolveRuntimeExtensions = void 0;
@@ -58375,9 +58550,9 @@ var require_runtimeExtensions = __commonJS({
58375
58550
  }
58376
58551
  });
58377
58552
 
58378
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
58553
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
58379
58554
  var require_STSClient = __commonJS({
58380
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) {
58555
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) {
58381
58556
  "use strict";
58382
58557
  Object.defineProperty(exports2, "__esModule", { value: true });
58383
58558
  exports2.STSClient = exports2.__Client = void 0;
@@ -58439,9 +58614,9 @@ var require_STSClient = __commonJS({
58439
58614
  }
58440
58615
  });
58441
58616
 
58442
- // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
58617
+ // ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
58443
58618
  var require_dist_cjs50 = __commonJS({
58444
- "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0_@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) {
58619
+ "../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) {
58445
58620
  "use strict";
58446
58621
  var __defProp3 = Object.defineProperty;
58447
58622
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -62599,7 +62774,7 @@ var init_studio2 = __esm({
62599
62774
  });
62600
62775
  };
62601
62776
  prepareServer = async ({
62602
- dialect: dialect7,
62777
+ dialect: dialect4,
62603
62778
  driver: driver2,
62604
62779
  proxy,
62605
62780
  customDefaults,
@@ -62649,7 +62824,7 @@ var init_studio2 = __esm({
62649
62824
  }));
62650
62825
  return c.json({
62651
62826
  version: "6",
62652
- dialect: dialect7,
62827
+ dialect: dialect4,
62653
62828
  driver: driver2,
62654
62829
  schemaFiles,
62655
62830
  customDefaults: preparedDefaults,
@@ -78956,11 +79131,13 @@ var init_pgIntrospect = __esm({
78956
79131
  });
78957
79132
 
78958
79133
  // src/introspect-sqlite.ts
78959
- var sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
79134
+ var import_casing3, sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, dbColumnName, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
78960
79135
  var init_introspect_sqlite = __esm({
78961
79136
  "src/introspect-sqlite.ts"() {
78962
79137
  "use strict";
79138
+ import_casing3 = require("drizzle-orm/casing");
78963
79139
  init_utils3();
79140
+ init_global();
78964
79141
  sqliteImportsList = /* @__PURE__ */ new Set([
78965
79142
  "sqliteTable",
78966
79143
  "integer",
@@ -78998,6 +79175,15 @@ var init_introspect_sqlite = __esm({
78998
79175
  }
78999
79176
  return value;
79000
79177
  };
79178
+ dbColumnName = ({ name, casing: casing2, withMode = false }) => {
79179
+ if (casing2 === "preserve") {
79180
+ return "";
79181
+ }
79182
+ if (casing2 === "camel") {
79183
+ return (0, import_casing3.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
79184
+ }
79185
+ assertUnreachable(casing2);
79186
+ };
79001
79187
  schemaToTypeScript = (schema5, casing2) => {
79002
79188
  Object.values(schema5.tables).forEach((table4) => {
79003
79189
  Object.values(table4.foreignKeys).forEach((fk4) => {
@@ -79117,13 +79303,14 @@ var init_introspect_sqlite = __esm({
79117
79303
  };
79118
79304
  column4 = (type, name, defaultValue, autoincrement, casing2) => {
79119
79305
  let lowered = type;
79306
+ casing2 = casing2;
79120
79307
  if (lowered === "integer") {
79121
- let out = `${withCasing(name, casing2)}: integer("${name}")`;
79308
+ let out = `${withCasing(name, casing2)}: integer(${dbColumnName({ name, casing: casing2 })})`;
79122
79309
  out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
79123
79310
  return out;
79124
79311
  }
79125
79312
  if (lowered === "real") {
79126
- let out = `${withCasing(name, casing2)}: real("${name}")`;
79313
+ let out = `${withCasing(name, casing2)}: real(${dbColumnName({ name, casing: casing2 })})`;
79127
79314
  out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
79128
79315
  return out;
79129
79316
  }
@@ -79131,20 +79318,20 @@ var init_introspect_sqlite = __esm({
79131
79318
  const match2 = lowered.match(/\d+/);
79132
79319
  let out;
79133
79320
  if (match2) {
79134
- out = `${withCasing(name, casing2)}: text("${name}", { length: ${match2[0]} })`;
79321
+ out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2, withMode: true })}{ length: ${match2[0]} })`;
79135
79322
  } else {
79136
- out = `${withCasing(name, casing2)}: text("${name}")`;
79323
+ out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2 })})`;
79137
79324
  }
79138
79325
  out += defaultValue ? `.default("${mapColumnDefault(defaultValue)}")` : "";
79139
79326
  return out;
79140
79327
  }
79141
79328
  if (lowered === "blob") {
79142
- let out = `${withCasing(name, casing2)}: blob("${name}")`;
79329
+ let out = `${withCasing(name, casing2)}: blob(${dbColumnName({ name, casing: casing2 })})`;
79143
79330
  out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
79144
79331
  return out;
79145
79332
  }
79146
79333
  if (lowered === "numeric") {
79147
- let out = `${withCasing(name, casing2)}: numeric("${name}")`;
79334
+ let out = `${withCasing(name, casing2)}: numeric(${dbColumnName({ name, casing: casing2 })})`;
79148
79335
  out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
79149
79336
  return out;
79150
79337
  }
@@ -79368,13 +79555,13 @@ var init_push = __esm({
79368
79555
  init_mysqlPushUtils();
79369
79556
  init_pgPushUtils();
79370
79557
  init_sqlitePushUtils();
79371
- mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force) => {
79558
+ mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force, casing2) => {
79372
79559
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
79373
79560
  const { mysqlPushIntrospect: mysqlPushIntrospect2 } = await Promise.resolve().then(() => (init_mysqlIntrospect(), mysqlIntrospect_exports));
79374
79561
  const { db, database } = await connectToMySQL2(credentials2);
79375
79562
  const { schema: schema5 } = await mysqlPushIntrospect2(db, database, tablesFilter);
79376
79563
  const { prepareMySQLPush: prepareMySQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
79377
- const statements = await prepareMySQLPush2(schemaPath, schema5);
79564
+ const statements = await prepareMySQLPush2(schemaPath, schema5, casing2);
79378
79565
  const filteredStatements = filterStatements(
79379
79566
  statements.statements ?? [],
79380
79567
  statements.validatedCur,
@@ -79469,13 +79656,13 @@ var init_push = __esm({
79469
79656
  console.log(e2);
79470
79657
  }
79471
79658
  };
79472
- pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force) => {
79659
+ pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force, casing2) => {
79473
79660
  const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
79474
79661
  const { pgPushIntrospect: pgPushIntrospect2 } = await Promise.resolve().then(() => (init_pgIntrospect(), pgIntrospect_exports));
79475
79662
  const db = await preparePostgresDB2(credentials2);
79476
79663
  const { schema: schema5 } = await pgPushIntrospect2(db, tablesFilter, schemasFilter);
79477
79664
  const { preparePgPush: preparePgPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
79478
- const statements = await preparePgPush2(schemaPath, schema5, schemasFilter);
79665
+ const statements = await preparePgPush2(schemaPath, schema5, schemasFilter, casing2);
79479
79666
  try {
79480
79667
  if (statements.sqlStatements.length === 0) {
79481
79668
  (0, import_hanji11.render)(`[${source_default.blue("i")}] No changes detected`);
@@ -79543,13 +79730,13 @@ var init_push = __esm({
79543
79730
  console.error(e2);
79544
79731
  }
79545
79732
  };
79546
- sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
79733
+ sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
79547
79734
  const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
79548
79735
  const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
79549
79736
  const db = await connectToSQLite2(credentials2);
79550
79737
  const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
79551
79738
  const { prepareSQLitePush: prepareSQLitePush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
79552
- const statements = await prepareSQLitePush2(schemaPath, schema5);
79739
+ const statements = await prepareSQLitePush2(schemaPath, schema5, casing2);
79553
79740
  if (statements.sqlStatements.length === 0) {
79554
79741
  (0, import_hanji11.render)(`
79555
79742
  [${source_default.blue("i")}] No changes detected`);
@@ -79631,13 +79818,13 @@ var init_push = __esm({
79631
79818
  }
79632
79819
  }
79633
79820
  };
79634
- libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
79821
+ libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
79635
79822
  const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
79636
79823
  const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
79637
79824
  const db = await connectToLibSQL2(credentials2);
79638
79825
  const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
79639
79826
  const { prepareLibSQLPush: prepareLibSQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
79640
- const statements = await prepareLibSQLPush2(schemaPath, schema5);
79827
+ const statements = await prepareLibSQLPush2(schemaPath, schema5, casing2);
79641
79828
  if (statements.sqlStatements.length === 0) {
79642
79829
  (0, import_hanji11.render)(`
79643
79830
  [${source_default.blue("i")}] No changes detected`);
@@ -80067,11 +80254,13 @@ var require_pluralize = __commonJS({
80067
80254
  });
80068
80255
 
80069
80256
  // src/introspect-mysql.ts
80070
- var mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
80257
+ var import_casing4, mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, dbColumnName2, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
80071
80258
  var init_introspect_mysql = __esm({
80072
80259
  "src/introspect-mysql.ts"() {
80073
80260
  "use strict";
80261
+ import_casing4 = require("drizzle-orm/casing");
80074
80262
  init_utils3();
80263
+ init_global();
80075
80264
  init_mysqlSerializer();
80076
80265
  mysqlImportsList = /* @__PURE__ */ new Set([
80077
80266
  "mysqlTable",
@@ -80151,7 +80340,16 @@ var init_introspect_mysql = __esm({
80151
80340
  if (casing2 === "camel") {
80152
80341
  return escapeColumnKey2(value.camelCase());
80153
80342
  }
80154
- return escapeColumnKey2(value);
80343
+ assertUnreachable(casing2);
80344
+ };
80345
+ dbColumnName2 = ({ name, casing: casing2, withMode = false }) => {
80346
+ if (casing2 === "preserve") {
80347
+ return "";
80348
+ }
80349
+ if (casing2 === "camel") {
80350
+ return (0, import_casing4.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
80351
+ }
80352
+ assertUnreachable(casing2);
80155
80353
  };
80156
80354
  schemaToTypeScript2 = (schema5, casing2) => {
80157
80355
  const withCasing4 = prepareCasing(casing2);
@@ -80212,6 +80410,7 @@ var init_introspect_mysql = __esm({
80212
80410
  Object.values(table4.columns),
80213
80411
  Object.values(table4.foreignKeys),
80214
80412
  withCasing4,
80413
+ casing2,
80215
80414
  table4.name,
80216
80415
  schema5
80217
80416
  );
@@ -80291,51 +80490,51 @@ import { sql } from "drizzle-orm"
80291
80490
  }
80292
80491
  return defaultValue;
80293
80492
  };
80294
- column5 = (type, name, casing2, defaultValue, autoincrement, onUpdate, isExpression) => {
80493
+ column5 = (type, name, casing2, rawCasing, defaultValue, autoincrement, onUpdate, isExpression) => {
80295
80494
  let lowered = type;
80296
80495
  if (!type.startsWith("enum(")) {
80297
80496
  lowered = type.toLowerCase();
80298
80497
  }
80299
80498
  if (lowered === "serial") {
80300
- return `${casing2(name)}: serial("${name}")`;
80499
+ return `${casing2(name)}: serial(${dbColumnName2({ name, casing: rawCasing })})`;
80301
80500
  }
80302
80501
  if (lowered.startsWith("int")) {
80303
80502
  const isUnsigned = lowered.startsWith("int unsigned");
80304
- let out = `${casing2(name)}: int("${name}"${isUnsigned ? ", { unsigned: true }" : ""})`;
80503
+ let out = `${casing2(name)}: int(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? "{ unsigned: true }" : ""})`;
80305
80504
  out += autoincrement ? `.autoincrement()` : "";
80306
80505
  out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80307
80506
  return out;
80308
80507
  }
80309
80508
  if (lowered.startsWith("tinyint")) {
80310
80509
  const isUnsigned = lowered.startsWith("tinyint unsigned");
80311
- let out = `${casing2(name)}: tinyint("${name}"${isUnsigned ? ", { unsigned: true }" : ""})`;
80510
+ let out = `${casing2(name)}: tinyint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
80312
80511
  out += autoincrement ? `.autoincrement()` : "";
80313
80512
  out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80314
80513
  return out;
80315
80514
  }
80316
80515
  if (lowered.startsWith("smallint")) {
80317
80516
  const isUnsigned = lowered.startsWith("smallint unsigned");
80318
- let out = `${casing2(name)}: smallint("${name}"${isUnsigned ? ", { unsigned: true }" : ""})`;
80517
+ let out = `${casing2(name)}: smallint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
80319
80518
  out += autoincrement ? `.autoincrement()` : "";
80320
80519
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80321
80520
  return out;
80322
80521
  }
80323
80522
  if (lowered.startsWith("mediumint")) {
80324
80523
  const isUnsigned = lowered.startsWith("mediumint unsigned");
80325
- let out = `${casing2(name)}: mediumint("${name}"${isUnsigned ? ", { unsigned: true }" : ""})`;
80524
+ let out = `${casing2(name)}: mediumint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
80326
80525
  out += autoincrement ? `.autoincrement()` : "";
80327
80526
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80328
80527
  return out;
80329
80528
  }
80330
80529
  if (lowered.startsWith("bigint")) {
80331
80530
  const isUnsigned = lowered.startsWith("bigint unsigned");
80332
- let out = `${casing2(name)}: bigint("${name}", { mode: "number"${isUnsigned ? ", unsigned: true" : ""} })`;
80531
+ let out = `${casing2(name)}: bigint(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: "number"${isUnsigned ? ", unsigned: true" : ""} })`;
80333
80532
  out += autoincrement ? `.autoincrement()` : "";
80334
80533
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80335
80534
  return out;
80336
80535
  }
80337
80536
  if (lowered === "boolean") {
80338
- let out = `${casing2(name)}: boolean("${name}")`;
80537
+ let out = `${casing2(name)}: boolean(${dbColumnName2({ name, casing: rawCasing })})`;
80339
80538
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80340
80539
  return out;
80341
80540
  }
@@ -80345,17 +80544,18 @@ import { sql } from "drizzle-orm"
80345
80544
  const [precision, scale] = lowered.slice(7, lowered.length - 1).split(",");
80346
80545
  params = { precision, scale };
80347
80546
  }
80348
- let out = params ? `${casing2(name)}: double("${name}", ${timeConfig(params)})` : `${casing2(name)}: double("${name}")`;
80547
+ const timeConfigParams = params ? timeConfig(params) : void 0;
80548
+ let out = params ? `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfig(params)})` : `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing })})`;
80349
80549
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80350
80550
  return out;
80351
80551
  }
80352
80552
  if (lowered === "float") {
80353
- let out = `${casing2(name)}: float("${name}")`;
80553
+ let out = `${casing2(name)}: float(${dbColumnName2({ name, casing: rawCasing })})`;
80354
80554
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80355
80555
  return out;
80356
80556
  }
80357
80557
  if (lowered === "real") {
80358
- let out = `${casing2(name)}: real("${name}")`;
80558
+ let out = `${casing2(name)}: real(${dbColumnName2({ name, casing: rawCasing })})`;
80359
80559
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80360
80560
  return out;
80361
80561
  }
@@ -80364,7 +80564,7 @@ import { sql } from "drizzle-orm"
80364
80564
  let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
80365
80565
  fsp = fsp ? fsp : null;
80366
80566
  const params = timeConfig({ fsp, mode: "'string'" });
80367
- let out = params ? `${casing2(name)}: timestamp("${name}", ${params})` : `${casing2(name)}: timestamp("${name}")`;
80567
+ let out = params ? `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing })})`;
80368
80568
  defaultValue = defaultValue === "now()" || defaultValue === "(CURRENT_TIMESTAMP)" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80369
80569
  out += defaultValue;
80370
80570
  let onUpdateNow = onUpdate ? ".onUpdateNow()" : "";
@@ -80376,7 +80576,7 @@ import { sql } from "drizzle-orm"
80376
80576
  let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
80377
80577
  fsp = fsp ? fsp : null;
80378
80578
  const params = timeConfig({ fsp });
80379
- let out = params ? `${casing2(name)}: time("${name}", ${params})` : `${casing2(name)}: time("${name}")`;
80579
+ let out = params ? `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing })})`;
80380
80580
  defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80381
80581
  out += defaultValue;
80382
80582
  return out;
@@ -80385,45 +80585,45 @@ import { sql } from "drizzle-orm"
80385
80585
  let out = `// you can use { mode: 'date' }, if you want to have Date as type for this column
80386
80586
  ${casing2(
80387
80587
  name
80388
- )}: date("${name}", { mode: 'string' })`;
80588
+ )}: date(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string' })`;
80389
80589
  defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80390
80590
  out += defaultValue;
80391
80591
  return out;
80392
80592
  }
80393
80593
  if (lowered === "text") {
80394
- let out = `${casing2(name)}: text("${name}")`;
80594
+ let out = `${casing2(name)}: text(${dbColumnName2({ name, casing: rawCasing })})`;
80395
80595
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80396
80596
  return out;
80397
80597
  }
80398
80598
  if (lowered === "tinytext") {
80399
- let out = `${casing2(name)}: tinytext("${name}")`;
80599
+ let out = `${casing2(name)}: tinytext(${dbColumnName2({ name, casing: rawCasing })})`;
80400
80600
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80401
80601
  return out;
80402
80602
  }
80403
80603
  if (lowered === "mediumtext") {
80404
- let out = `${casing2(name)}: mediumtext("${name}")`;
80604
+ let out = `${casing2(name)}: mediumtext(${dbColumnName2({ name, casing: rawCasing })})`;
80405
80605
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80406
80606
  return out;
80407
80607
  }
80408
80608
  if (lowered === "longtext") {
80409
- let out = `${casing2(name)}: longtext("${name}")`;
80609
+ let out = `${casing2(name)}: longtext(${dbColumnName2({ name, casing: rawCasing })})`;
80410
80610
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80411
80611
  return out;
80412
80612
  }
80413
80613
  if (lowered === "year") {
80414
- let out = `${casing2(name)}: year("${name}")`;
80614
+ let out = `${casing2(name)}: year(${dbColumnName2({ name, casing: rawCasing })})`;
80415
80615
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80416
80616
  return out;
80417
80617
  }
80418
80618
  if (lowered === "json") {
80419
- let out = `${casing2(name)}: json("${name}")`;
80619
+ let out = `${casing2(name)}: json(${dbColumnName2({ name, casing: rawCasing })})`;
80420
80620
  out += defaultValue ? `.default(${mapColumnDefaultForJson(defaultValue)})` : "";
80421
80621
  return out;
80422
80622
  }
80423
80623
  if (lowered.startsWith("varchar")) {
80424
80624
  let out = `${casing2(
80425
80625
  name
80426
- )}: varchar("${name}", { length: ${lowered.substring(
80626
+ )}: varchar(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
80427
80627
  "varchar".length + 1,
80428
80628
  lowered.length - 1
80429
80629
  )} })`;
@@ -80433,7 +80633,7 @@ import { sql } from "drizzle-orm"
80433
80633
  if (lowered.startsWith("char")) {
80434
80634
  let out = `${casing2(
80435
80635
  name
80436
- )}: char("${name}", { length: ${lowered.substring(
80636
+ )}: char(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
80437
80637
  "char".length + 1,
80438
80638
  lowered.length - 1
80439
80639
  )} })`;
@@ -80446,10 +80646,10 @@ import { sql } from "drizzle-orm"
80446
80646
  const fsp = lowered.startsWith("datetime(") ? lowered.substring("datetime".length + 1, lowered.length - 1) : void 0;
80447
80647
  out = fsp ? `${casing2(
80448
80648
  name
80449
- )}: datetime("${name}", { mode: 'string', fsp: ${lowered.substring(
80649
+ )}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string', fsp: ${lowered.substring(
80450
80650
  "datetime".length + 1,
80451
80651
  lowered.length - 1
80452
- )} })` : `${casing2(name)}: datetime("${name}", { mode: 'string'})`;
80652
+ )} })` : `${casing2(name)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string'})`;
80453
80653
  defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80454
80654
  out += defaultValue;
80455
80655
  return out;
@@ -80460,7 +80660,8 @@ import { sql } from "drizzle-orm"
80460
80660
  const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
80461
80661
  params = { precision, scale };
80462
80662
  }
80463
- let out = params ? `${casing2(name)}: decimal("${name}", ${timeConfig(params)})` : `${casing2(name)}: decimal("${name}")`;
80663
+ const timeConfigParams = params ? timeConfig(params) : void 0;
80664
+ let out = params ? `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfigParams})` : `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing })})`;
80464
80665
  defaultValue = typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80465
80666
  out += defaultValue;
80466
80667
  return out;
@@ -80470,14 +80671,14 @@ import { sql } from "drizzle-orm"
80470
80671
  let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
80471
80672
  length = length ? length : null;
80472
80673
  const params = binaryConfig({ length });
80473
- let out = params ? `${casing2(name)}: binary("${name}", ${params})` : `${casing2(name)}: binary("${name}")`;
80674
+ let out = params ? `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing })})`;
80474
80675
  defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80475
80676
  out += defaultValue;
80476
80677
  return out;
80477
80678
  }
80478
80679
  if (lowered.startsWith("enum")) {
80479
80680
  const values = lowered.substring("enum".length + 1, lowered.length - 1);
80480
- let out = `${casing2(name)}: mysqlEnum("${name}", [${values}])`;
80681
+ let out = `${casing2(name)}: mysqlEnum(${dbColumnName2({ name, casing: rawCasing, withMode: true })}[${values}])`;
80481
80682
  out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80482
80683
  return out;
80483
80684
  }
@@ -80486,7 +80687,7 @@ import { sql } from "drizzle-orm"
80486
80687
  let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
80487
80688
  length = length ? length : null;
80488
80689
  const params = binaryConfig({ length });
80489
- let out = params ? `${casing2(name)}: varbinary("${name}", ${params})` : `${casing2(name)}: varbinary("${name}")`;
80690
+ let out = params ? `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing })})`;
80490
80691
  defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
80491
80692
  out += defaultValue;
80492
80693
  return out;
@@ -80495,7 +80696,7 @@ import { sql } from "drizzle-orm"
80495
80696
  return `// Warning: Can't parse ${type} from database
80496
80697
  // ${type}Type: ${type}("${name}")`;
80497
80698
  };
80498
- createTableColumns2 = (columns, fks, casing2, tableName, schema5) => {
80699
+ createTableColumns2 = (columns, fks, casing2, rawCasing, tableName, schema5) => {
80499
80700
  let statement = "";
80500
80701
  const oneColumnsFKs = Object.values(fks).filter((it) => {
80501
80702
  return !isSelf2(it);
@@ -80513,6 +80714,7 @@ import { sql } from "drizzle-orm"
80513
80714
  it.type,
80514
80715
  it.name,
80515
80716
  casing2,
80717
+ rawCasing,
80516
80718
  it.default,
80517
80719
  it.autoincrement,
80518
80720
  it.onUpdate,
@@ -80643,13 +80845,14 @@ function generateIdentityParams(identity) {
80643
80845
  }
80644
80846
  return `.generatedByDefaultAsIdentity(${paramsObj})`;
80645
80847
  }
80646
- var import_drizzle_orm9, import_relations, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault3, importsPatch2, relations3, escapeColumnKey3, withCasing2, paramNameFor, schemaToTypeScript3, isCyclic3, isSelf3, buildArrayDefault, mapDefault, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
80848
+ var import_drizzle_orm9, import_relations, import_casing5, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault3, importsPatch2, relations3, escapeColumnKey3, withCasing2, dbColumnName3, paramNameFor, schemaToTypeScript3, isCyclic3, isSelf3, buildArrayDefault, mapDefault, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
80647
80849
  var init_introspect_pg = __esm({
80648
80850
  "src/introspect-pg.ts"() {
80649
80851
  "use strict";
80650
80852
  import_drizzle_orm9 = require("drizzle-orm");
80651
80853
  import_relations = require("drizzle-orm/relations");
80652
80854
  init_utils3();
80855
+ import_casing5 = require("drizzle-orm/casing");
80653
80856
  init_vector();
80654
80857
  init_global();
80655
80858
  init_pgSerializer();
@@ -80775,6 +80978,15 @@ var init_introspect_pg = __esm({
80775
80978
  }
80776
80979
  assertUnreachable(casing2);
80777
80980
  };
80981
+ dbColumnName3 = ({ name, casing: casing2, withMode = false }) => {
80982
+ if (casing2 === "preserve") {
80983
+ return "";
80984
+ }
80985
+ if (casing2 === "camel") {
80986
+ return (0, import_casing5.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
80987
+ }
80988
+ assertUnreachable(casing2);
80989
+ };
80778
80990
  paramNameFor = (name, schema5) => {
80779
80991
  const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5.capitalise()}` : "";
80780
80992
  return `${name}${schemaSuffix}`;
@@ -81070,49 +81282,49 @@ var init_introspect_pg = __esm({
81070
81282
  let out = `${withCasing2(name, casing2)}: ${withCasing2(
81071
81283
  paramNameFor(type.replace("[]", ""), typeSchema),
81072
81284
  casing2
81073
- )}("${name}")`;
81285
+ )}(${dbColumnName3({ name, casing: casing2 })})`;
81074
81286
  return out;
81075
81287
  }
81076
81288
  if (lowered.startsWith("serial")) {
81077
- return `${withCasing2(name, casing2)}: serial("${name}")`;
81289
+ return `${withCasing2(name, casing2)}: serial(${dbColumnName3({ name, casing: casing2 })})`;
81078
81290
  }
81079
81291
  if (lowered.startsWith("smallserial")) {
81080
- return `${withCasing2(name, casing2)}: smallserial("${name}")`;
81292
+ return `${withCasing2(name, casing2)}: smallserial(${dbColumnName3({ name, casing: casing2 })})`;
81081
81293
  }
81082
81294
  if (lowered.startsWith("bigserial")) {
81083
81295
  return `${withCasing2(
81084
81296
  name,
81085
81297
  casing2
81086
- )}: bigserial("${name}", { mode: "bigint" })`;
81298
+ )}: bigserial(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "bigint" })`;
81087
81299
  }
81088
81300
  if (lowered.startsWith("integer")) {
81089
- let out = `${withCasing2(name, casing2)}: integer("${name}")`;
81301
+ let out = `${withCasing2(name, casing2)}: integer(${dbColumnName3({ name, casing: casing2 })})`;
81090
81302
  return out;
81091
81303
  }
81092
81304
  if (lowered.startsWith("smallint")) {
81093
- let out = `${withCasing2(name, casing2)}: smallint("${name}")`;
81305
+ let out = `${withCasing2(name, casing2)}: smallint(${dbColumnName3({ name, casing: casing2 })})`;
81094
81306
  return out;
81095
81307
  }
81096
81308
  if (lowered.startsWith("bigint")) {
81097
81309
  let out = `// You can use { mode: "bigint" } if numbers are exceeding js number limitations
81098
81310
  `;
81099
- out += `${withCasing2(name, casing2)}: bigint("${name}", { mode: "number" })`;
81311
+ out += `${withCasing2(name, casing2)}: bigint(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "number" })`;
81100
81312
  return out;
81101
81313
  }
81102
81314
  if (lowered.startsWith("boolean")) {
81103
- let out = `${withCasing2(name, casing2)}: boolean("${name}")`;
81315
+ let out = `${withCasing2(name, casing2)}: boolean(${dbColumnName3({ name, casing: casing2 })})`;
81104
81316
  return out;
81105
81317
  }
81106
81318
  if (lowered.startsWith("double precision")) {
81107
- let out = `${withCasing2(name, casing2)}: doublePrecision("${name}")`;
81319
+ let out = `${withCasing2(name, casing2)}: doublePrecision(${dbColumnName3({ name, casing: casing2 })})`;
81108
81320
  return out;
81109
81321
  }
81110
81322
  if (lowered.startsWith("real")) {
81111
- let out = `${withCasing2(name, casing2)}: real("${name}")`;
81323
+ let out = `${withCasing2(name, casing2)}: real(${dbColumnName3({ name, casing: casing2 })})`;
81112
81324
  return out;
81113
81325
  }
81114
81326
  if (lowered.startsWith("uuid")) {
81115
- let out = `${withCasing2(name, casing2)}: uuid("${name}")`;
81327
+ let out = `${withCasing2(name, casing2)}: uuid(${dbColumnName3({ name, casing: casing2 })})`;
81116
81328
  return out;
81117
81329
  }
81118
81330
  if (lowered.startsWith("numeric")) {
@@ -81121,7 +81333,7 @@ var init_introspect_pg = __esm({
81121
81333
  const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
81122
81334
  params = { precision, scale };
81123
81335
  }
81124
- let out = params ? `${withCasing2(name, casing2)}: numeric("${name}", ${timeConfig2(params)})` : `${withCasing2(name, casing2)}: numeric("${name}")`;
81336
+ let out = params ? `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2, withMode: true })}${timeConfig2(params)})` : `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2 })})`;
81125
81337
  return out;
81126
81338
  }
81127
81339
  if (lowered.startsWith("timestamp")) {
@@ -81135,7 +81347,7 @@ var init_introspect_pg = __esm({
81135
81347
  withTimezone,
81136
81348
  mode: "'string'"
81137
81349
  });
81138
- let out = params ? `${withCasing2(name, casing2)}: timestamp("${name}", ${params})` : `${withCasing2(name, casing2)}: timestamp("${name}")`;
81350
+ let out = params ? `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2 })})`;
81139
81351
  return out;
81140
81352
  }
81141
81353
  if (lowered.startsWith("time")) {
@@ -81145,44 +81357,44 @@ var init_introspect_pg = __esm({
81145
81357
  ) : null;
81146
81358
  precision = precision ? precision : null;
81147
81359
  const params = timeConfig2({ precision, withTimezone });
81148
- let out = params ? `${withCasing2(name, casing2)}: time("${name}", ${params})` : `${withCasing2(name, casing2)}: time("${name}")`;
81360
+ let out = params ? `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2 })})`;
81149
81361
  return out;
81150
81362
  }
81151
81363
  if (lowered.startsWith("interval")) {
81152
81364
  const params = intervalConfig(lowered);
81153
- let out = params ? `${withCasing2(name, casing2)}: interval("${name}", ${params})` : `${withCasing2(name, casing2)}: interval("${name}")`;
81365
+ let out = params ? `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2 })})`;
81154
81366
  return out;
81155
81367
  }
81156
81368
  if (lowered === "date") {
81157
- let out = `${withCasing2(name, casing2)}: date("${name}")`;
81369
+ let out = `${withCasing2(name, casing2)}: date(${dbColumnName3({ name, casing: casing2 })})`;
81158
81370
  return out;
81159
81371
  }
81160
81372
  if (lowered.startsWith("text")) {
81161
- let out = `${withCasing2(name, casing2)}: text("${name}")`;
81373
+ let out = `${withCasing2(name, casing2)}: text(${dbColumnName3({ name, casing: casing2 })})`;
81162
81374
  return out;
81163
81375
  }
81164
81376
  if (lowered.startsWith("jsonb")) {
81165
- let out = `${withCasing2(name, casing2)}: jsonb("${name}")`;
81377
+ let out = `${withCasing2(name, casing2)}: jsonb(${dbColumnName3({ name, casing: casing2 })})`;
81166
81378
  return out;
81167
81379
  }
81168
81380
  if (lowered.startsWith("json")) {
81169
- let out = `${withCasing2(name, casing2)}: json("${name}")`;
81381
+ let out = `${withCasing2(name, casing2)}: json(${dbColumnName3({ name, casing: casing2 })})`;
81170
81382
  return out;
81171
81383
  }
81172
81384
  if (lowered.startsWith("inet")) {
81173
- let out = `${withCasing2(name, casing2)}: inet("${name}")`;
81385
+ let out = `${withCasing2(name, casing2)}: inet(${dbColumnName3({ name, casing: casing2 })})`;
81174
81386
  return out;
81175
81387
  }
81176
81388
  if (lowered.startsWith("cidr")) {
81177
- let out = `${withCasing2(name, casing2)}: cidr("${name}")`;
81389
+ let out = `${withCasing2(name, casing2)}: cidr(${dbColumnName3({ name, casing: casing2 })})`;
81178
81390
  return out;
81179
81391
  }
81180
81392
  if (lowered.startsWith("macaddr8")) {
81181
- let out = `${withCasing2(name, casing2)}: macaddr8("${name}")`;
81393
+ let out = `${withCasing2(name, casing2)}: macaddr8(${dbColumnName3({ name, casing: casing2 })})`;
81182
81394
  return out;
81183
81395
  }
81184
81396
  if (lowered.startsWith("macaddr")) {
81185
- let out = `${withCasing2(name, casing2)}: macaddr("${name}")`;
81397
+ let out = `${withCasing2(name, casing2)}: macaddr(${dbColumnName3({ name, casing: casing2 })})`;
81186
81398
  return out;
81187
81399
  }
81188
81400
  if (lowered.startsWith("varchar")) {
@@ -81191,21 +81403,21 @@ var init_introspect_pg = __esm({
81191
81403
  out = `${withCasing2(
81192
81404
  name,
81193
81405
  casing2
81194
- )}: varchar("${name}", { length: ${lowered.substring(
81406
+ )}: varchar(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
81195
81407
  8,
81196
81408
  lowered.length - 1
81197
81409
  )} })`;
81198
81410
  } else {
81199
- out = `${withCasing2(name, casing2)}: varchar("${name}")`;
81411
+ out = `${withCasing2(name, casing2)}: varchar(${dbColumnName3({ name, casing: casing2 })})`;
81200
81412
  }
81201
81413
  return out;
81202
81414
  }
81203
81415
  if (lowered.startsWith("point")) {
81204
- let out = `${withCasing2(name, casing2)}: point("${name}")`;
81416
+ let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
81205
81417
  return out;
81206
81418
  }
81207
81419
  if (lowered.startsWith("line")) {
81208
- let out = `${withCasing2(name, casing2)}: point("${name}")`;
81420
+ let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
81209
81421
  return out;
81210
81422
  }
81211
81423
  if (lowered.startsWith("geometry")) {
@@ -81214,14 +81426,14 @@ var init_introspect_pg = __esm({
81214
81426
  if (lowered.length !== 8) {
81215
81427
  const geometryOptions = lowered.slice(9, -1).split(",");
81216
81428
  if (geometryOptions.length === 1 && geometryOptions[0] !== "") {
81217
- out = `${withCasing2(name, casing2)}: geometry("${name}", { type: "${geometryOptions[0]}" })`;
81429
+ out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}" })`;
81218
81430
  } else if (geometryOptions.length === 2) {
81219
- out = `${withCasing2(name, casing2)}: geometry("${name}", { type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
81431
+ out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
81220
81432
  } else {
81221
81433
  isGeoUnknown = true;
81222
81434
  }
81223
81435
  } else {
81224
- out = `${withCasing2(name, casing2)}: geometry("${name}")`;
81436
+ out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2 })})`;
81225
81437
  }
81226
81438
  if (isGeoUnknown) {
81227
81439
  let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
@@ -81238,12 +81450,12 @@ var init_introspect_pg = __esm({
81238
81450
  out = `${withCasing2(
81239
81451
  name,
81240
81452
  casing2
81241
- )}: vector("${name}", { dimensions: ${lowered.substring(
81453
+ )}: vector(${dbColumnName3({ name, casing: casing2, withMode: true })}{ dimensions: ${lowered.substring(
81242
81454
  7,
81243
81455
  lowered.length - 1
81244
81456
  )} })`;
81245
81457
  } else {
81246
- out = `${withCasing2(name, casing2)}: vector("${name}")`;
81458
+ out = `${withCasing2(name, casing2)}: vector(${dbColumnName3({ name, casing: casing2 })})`;
81247
81459
  }
81248
81460
  return out;
81249
81461
  }
@@ -81253,12 +81465,12 @@ var init_introspect_pg = __esm({
81253
81465
  out = `${withCasing2(
81254
81466
  name,
81255
81467
  casing2
81256
- )}: char("${name}", { length: ${lowered.substring(
81468
+ )}: char(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
81257
81469
  5,
81258
81470
  lowered.length - 1
81259
81471
  )} })`;
81260
81472
  } else {
81261
- out = `${withCasing2(name, casing2)}: char("${name}")`;
81473
+ out = `${withCasing2(name, casing2)}: char(${dbColumnName3({ name, casing: casing2 })})`;
81262
81474
  }
81263
81475
  return out;
81264
81476
  }
@@ -83356,9 +83568,9 @@ init_source();
83356
83568
 
83357
83569
  // src/cli/commands/check.ts
83358
83570
  init_utils();
83359
- var checkHandler = (out, dialect7) => {
83360
- const { snapshots } = prepareOutFolder(out, dialect7);
83361
- const report = validateWithReport(snapshots, dialect7);
83571
+ var checkHandler = (out, dialect4) => {
83572
+ const { snapshots } = prepareOutFolder(out, dialect4);
83573
+ const report = validateWithReport(snapshots, dialect4);
83362
83574
  if (report.nonLatest.length > 0) {
83363
83575
  console.log(
83364
83576
  report.nonLatest.map((it) => {
@@ -84645,12 +84857,14 @@ var optionBreakpoints = boolean().desc(
84645
84857
  `Prepare SQL statements with breakpoints`
84646
84858
  );
84647
84859
  var optionDriver = string().enum(...drivers).desc("Database driver");
84860
+ var optionCasing = string().enum("camelCase", "snake_case").desc("Casing for serialization");
84648
84861
  var generate = command({
84649
84862
  name: "generate",
84650
84863
  options: {
84651
84864
  config: optionConfig,
84652
84865
  dialect: optionDialect,
84653
84866
  driver: optionDriver,
84867
+ casing: optionCasing,
84654
84868
  schema: string().desc("Path to a schema file or folder"),
84655
84869
  out: optionOut,
84656
84870
  name: string().desc("Migration file name"),
@@ -84663,7 +84877,7 @@ var generate = command({
84663
84877
  "generate",
84664
84878
  opts,
84665
84879
  ["prefix", "name", "custom"],
84666
- ["driver", "breakpoints", "schema", "out", "dialect"]
84880
+ ["driver", "breakpoints", "schema", "out", "dialect", "casing"]
84667
84881
  );
84668
84882
  return prepareGenerateConfig(opts, from);
84669
84883
  },
@@ -84676,17 +84890,17 @@ var generate = command({
84676
84890
  prepareAndMigrateSqlite: prepareAndMigrateSqlite2,
84677
84891
  prepareAndMigrateLibSQL: prepareAndMigrateLibSQL2
84678
84892
  } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
84679
- const dialect7 = opts.dialect;
84680
- if (dialect7 === "postgresql") {
84893
+ const dialect4 = opts.dialect;
84894
+ if (dialect4 === "postgresql") {
84681
84895
  await prepareAndMigratePg2(opts);
84682
- } else if (dialect7 === "mysql") {
84896
+ } else if (dialect4 === "mysql") {
84683
84897
  await prepareAndMigrateMysql2(opts);
84684
- } else if (dialect7 === "sqlite") {
84898
+ } else if (dialect4 === "sqlite") {
84685
84899
  await prepareAndMigrateSqlite2(opts);
84686
- } else if (dialect7 === "turso") {
84900
+ } else if (dialect4 === "turso") {
84687
84901
  await prepareAndMigrateLibSQL2(opts);
84688
84902
  } else {
84689
- assertUnreachable(dialect7);
84903
+ assertUnreachable(dialect4);
84690
84904
  }
84691
84905
  }
84692
84906
  });
@@ -84701,9 +84915,9 @@ var migrate = command({
84701
84915
  handler: async (opts) => {
84702
84916
  await assertOrmCoreVersion();
84703
84917
  await assertPackages("drizzle-orm");
84704
- const { dialect: dialect7, schema: schema5, table: table4, out, credentials: credentials2 } = opts;
84918
+ const { dialect: dialect4, schema: schema5, table: table4, out, credentials: credentials2 } = opts;
84705
84919
  try {
84706
- if (dialect7 === "postgresql") {
84920
+ if (dialect4 === "postgresql") {
84707
84921
  if ("driver" in credentials2) {
84708
84922
  const { driver: driver2 } = credentials2;
84709
84923
  if (driver2 === "aws-data-api") {
@@ -84734,7 +84948,7 @@ var migrate = command({
84734
84948
  migrationsSchema: schema5
84735
84949
  })
84736
84950
  );
84737
- } else if (dialect7 === "mysql") {
84951
+ } else if (dialect4 === "mysql") {
84738
84952
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
84739
84953
  const { migrate: migrate2 } = await connectToMySQL2(credentials2);
84740
84954
  await (0, import_hanji13.renderWithTask)(
@@ -84745,7 +84959,7 @@ var migrate = command({
84745
84959
  migrationsSchema: schema5
84746
84960
  })
84747
84961
  );
84748
- } else if (dialect7 === "sqlite") {
84962
+ } else if (dialect4 === "sqlite") {
84749
84963
  const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
84750
84964
  const { migrate: migrate2 } = await connectToSQLite2(credentials2);
84751
84965
  await (0, import_hanji13.renderWithTask)(
@@ -84756,7 +84970,7 @@ var migrate = command({
84756
84970
  migrationsSchema: schema5
84757
84971
  })
84758
84972
  );
84759
- } else if (dialect7 === "turso") {
84973
+ } else if (dialect4 === "turso") {
84760
84974
  const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
84761
84975
  const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
84762
84976
  await (0, import_hanji13.renderWithTask)(
@@ -84768,7 +84982,7 @@ var migrate = command({
84768
84982
  })
84769
84983
  );
84770
84984
  } else {
84771
- assertUnreachable(dialect7);
84985
+ assertUnreachable(dialect4);
84772
84986
  }
84773
84987
  } catch (e2) {
84774
84988
  console.error(e2);
@@ -84802,6 +85016,7 @@ var push = command({
84802
85016
  options: {
84803
85017
  config: optionConfig,
84804
85018
  dialect: optionDialect,
85019
+ casing: optionCasing,
84805
85020
  schema: string().desc("Path to a schema file or folder"),
84806
85021
  ...optionsFilters,
84807
85022
  ...optionsDatabaseCredentials,
@@ -84830,7 +85045,8 @@ var push = command({
84830
85045
  "authToken",
84831
85046
  "schemaFilters",
84832
85047
  "extensionsFilters",
84833
- "tablesFilter"
85048
+ "tablesFilter",
85049
+ "casing"
84834
85050
  ]
84835
85051
  );
84836
85052
  return preparePushConfig(opts, from);
@@ -84839,17 +85055,18 @@ var push = command({
84839
85055
  await assertPackages("drizzle-orm");
84840
85056
  await assertOrmCoreVersion();
84841
85057
  const {
84842
- dialect: dialect7,
85058
+ dialect: dialect4,
84843
85059
  schemaPath,
84844
85060
  strict,
84845
85061
  verbose,
84846
85062
  credentials: credentials2,
84847
85063
  tablesFilter,
84848
85064
  schemasFilter,
84849
- force
85065
+ force,
85066
+ casing: casing2
84850
85067
  } = config;
84851
85068
  try {
84852
- if (dialect7 === "mysql") {
85069
+ if (dialect4 === "mysql") {
84853
85070
  const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
84854
85071
  await mysqlPush2(
84855
85072
  schemaPath,
@@ -84857,9 +85074,10 @@ var push = command({
84857
85074
  tablesFilter,
84858
85075
  strict,
84859
85076
  verbose,
84860
- force
85077
+ force,
85078
+ casing2
84861
85079
  );
84862
- } else if (dialect7 === "postgresql") {
85080
+ } else if (dialect4 === "postgresql") {
84863
85081
  if ("driver" in credentials2) {
84864
85082
  const { driver: driver2 } = credentials2;
84865
85083
  if (driver2 === "aws-data-api") {
@@ -84888,9 +85106,10 @@ var push = command({
84888
85106
  credentials2,
84889
85107
  tablesFilter,
84890
85108
  schemasFilter,
84891
- force
85109
+ force,
85110
+ casing2
84892
85111
  );
84893
- } else if (dialect7 === "sqlite") {
85112
+ } else if (dialect4 === "sqlite") {
84894
85113
  const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
84895
85114
  await sqlitePush2(
84896
85115
  schemaPath,
@@ -84898,9 +85117,10 @@ var push = command({
84898
85117
  strict,
84899
85118
  credentials2,
84900
85119
  tablesFilter,
84901
- force
85120
+ force,
85121
+ casing2
84902
85122
  );
84903
- } else if (dialect7 === "turso") {
85123
+ } else if (dialect4 === "turso") {
84904
85124
  const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
84905
85125
  await libSQLPush2(
84906
85126
  schemaPath,
@@ -84908,10 +85128,11 @@ var push = command({
84908
85128
  strict,
84909
85129
  credentials2,
84910
85130
  tablesFilter,
84911
- force
85131
+ force,
85132
+ casing2
84912
85133
  );
84913
85134
  } else {
84914
- assertUnreachable(dialect7);
85135
+ assertUnreachable(dialect4);
84915
85136
  }
84916
85137
  } catch (e2) {
84917
85138
  console.error(e2);
@@ -84932,8 +85153,8 @@ var check = command({
84932
85153
  },
84933
85154
  handler: async (config) => {
84934
85155
  await assertOrmCoreVersion();
84935
- const { out, dialect: dialect7 } = config;
84936
- checkHandler(out, dialect7);
85156
+ const { out, dialect: dialect4 } = config;
85157
+ checkHandler(out, dialect4);
84937
85158
  console.log("Everything's fine \u{1F436}\u{1F525}");
84938
85159
  }
84939
85160
  });
@@ -84950,15 +85171,15 @@ var up = command({
84950
85171
  },
84951
85172
  handler: async (config) => {
84952
85173
  await assertOrmCoreVersion();
84953
- const { out, dialect: dialect7 } = config;
85174
+ const { out, dialect: dialect4 } = config;
84954
85175
  await assertPackages("drizzle-orm");
84955
- if (dialect7 === "postgresql") {
85176
+ if (dialect4 === "postgresql") {
84956
85177
  upPgHandler(out);
84957
85178
  }
84958
- if (dialect7 === "mysql") {
85179
+ if (dialect4 === "mysql") {
84959
85180
  upMysqlHandler(out);
84960
85181
  }
84961
- if (dialect7 === "sqlite" || dialect7 === "turso") {
85182
+ if (dialect4 === "sqlite" || dialect4 === "turso") {
84962
85183
  upSqliteHandler(out);
84963
85184
  }
84964
85185
  }
@@ -85005,7 +85226,7 @@ var pull = command({
85005
85226
  await assertPackages("drizzle-orm");
85006
85227
  await assertOrmCoreVersion();
85007
85228
  const {
85008
- dialect: dialect7,
85229
+ dialect: dialect4,
85009
85230
  credentials: credentials2,
85010
85231
  out,
85011
85232
  casing: casing2,
@@ -85022,7 +85243,7 @@ var pull = command({
85022
85243
  );
85023
85244
  console.log();
85024
85245
  try {
85025
- if (dialect7 === "postgresql") {
85246
+ if (dialect4 === "postgresql") {
85026
85247
  if ("driver" in credentials2) {
85027
85248
  const { driver: driver2 } = credentials2;
85028
85249
  if (driver2 === "aws-data-api") {
@@ -85053,7 +85274,7 @@ var pull = command({
85053
85274
  schemasFilter,
85054
85275
  prefix2
85055
85276
  );
85056
- } else if (dialect7 === "mysql") {
85277
+ } else if (dialect4 === "mysql") {
85057
85278
  const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
85058
85279
  await introspectMysql2(
85059
85280
  casing2,
@@ -85063,7 +85284,7 @@ var pull = command({
85063
85284
  tablesFilter,
85064
85285
  prefix2
85065
85286
  );
85066
- } else if (dialect7 === "sqlite") {
85287
+ } else if (dialect4 === "sqlite") {
85067
85288
  const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
85068
85289
  await introspectSqlite2(
85069
85290
  casing2,
@@ -85073,7 +85294,7 @@ var pull = command({
85073
85294
  tablesFilter,
85074
85295
  prefix2
85075
85296
  );
85076
- } else if (dialect7 === "turso") {
85297
+ } else if (dialect4 === "turso") {
85077
85298
  const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
85078
85299
  await introspectLibSQL2(
85079
85300
  casing2,
@@ -85084,7 +85305,7 @@ var pull = command({
85084
85305
  prefix2
85085
85306
  );
85086
85307
  } else {
85087
- assertUnreachable(dialect7);
85308
+ assertUnreachable(dialect4);
85088
85309
  }
85089
85310
  } catch (e2) {
85090
85311
  console.error(e2);
@@ -85122,7 +85343,7 @@ var studio = command({
85122
85343
  await assertPackages("drizzle-orm");
85123
85344
  assertStudioNodeVersion();
85124
85345
  const {
85125
- dialect: dialect7,
85346
+ dialect: dialect4,
85126
85347
  schema: schemaPath,
85127
85348
  port,
85128
85349
  host,
@@ -85138,7 +85359,7 @@ var studio = command({
85138
85359
  } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
85139
85360
  let setup;
85140
85361
  try {
85141
- if (dialect7 === "postgresql") {
85362
+ if (dialect4 === "postgresql") {
85142
85363
  if ("driver" in credentials2) {
85143
85364
  const { driver: driver2 } = credentials2;
85144
85365
  if (driver2 === "aws-data-api") {
@@ -85161,17 +85382,17 @@ var studio = command({
85161
85382
  }
85162
85383
  const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
85163
85384
  setup = await drizzleForPostgres2(credentials2, schema5, relations4, files);
85164
- } else if (dialect7 === "mysql") {
85385
+ } else if (dialect4 === "mysql") {
85165
85386
  const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
85166
85387
  setup = await drizzleForMySQL2(credentials2, schema5, relations4, files);
85167
- } else if (dialect7 === "sqlite") {
85388
+ } else if (dialect4 === "sqlite") {
85168
85389
  const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
85169
85390
  setup = await drizzleForSQLite2(credentials2, schema5, relations4, files);
85170
- } else if (dialect7 === "turso") {
85391
+ } else if (dialect4 === "turso") {
85171
85392
  const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
85172
85393
  setup = await drizzleForLibSQL(credentials2, schema5, relations4, files);
85173
85394
  } else {
85174
- assertUnreachable(dialect7);
85395
+ assertUnreachable(dialect4);
85175
85396
  }
85176
85397
  const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
85177
85398
  const server = await prepareServer2(setup);
@@ -85222,7 +85443,7 @@ init_utils2();
85222
85443
  var version2 = async () => {
85223
85444
  const { npmVersion } = await ormCoreVersions();
85224
85445
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
85225
- const envVersion = "0.25.0-cd0b1a2";
85446
+ const envVersion = "0.25.0-cf24be9";
85226
85447
  const kitVersion = envVersion ? `v${envVersion}` : "--";
85227
85448
  const versions = `drizzle-kit: ${kitVersion}
85228
85449
  ${ormVersion}`;