drizzle-kit 0.22.0-29f7626 → 0.22.0-3c62a84

Sign up to get free protection for your applications and to get access to all the features.
package/payload.d.ts CHANGED
@@ -50,14 +50,14 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
50
50
  nulls: zod.ZodOptional<zod.ZodString>;
51
51
  opclass: zod.ZodOptional<zod.ZodString>;
52
52
  }, "strip", zod.ZodTypeAny, {
53
- expression: string;
54
53
  isExpression: boolean;
54
+ expression: string;
55
55
  asc: boolean;
56
56
  nulls?: string | undefined;
57
57
  opclass?: string | undefined;
58
58
  }, {
59
- expression: string;
60
59
  isExpression: boolean;
60
+ expression: string;
61
61
  asc: boolean;
62
62
  nulls?: string | undefined;
63
63
  opclass?: string | undefined;
@@ -70,8 +70,8 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
70
70
  }, "strict", zod.ZodTypeAny, {
71
71
  name: string;
72
72
  columns: {
73
- expression: string;
74
73
  isExpression: boolean;
74
+ expression: string;
75
75
  asc: boolean;
76
76
  nulls?: string | undefined;
77
77
  opclass?: string | undefined;
@@ -84,8 +84,8 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
84
84
  }, {
85
85
  name: string;
86
86
  columns: {
87
- expression: string;
88
87
  isExpression: boolean;
88
+ expression: string;
89
89
  asc: boolean;
90
90
  nulls?: string | undefined;
91
91
  opclass?: string | undefined;
@@ -163,8 +163,8 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
163
163
  indexes: Record<string, {
164
164
  name: string;
165
165
  columns: {
166
- expression: string;
167
166
  isExpression: boolean;
167
+ expression: string;
168
168
  asc: boolean;
169
169
  nulls?: string | undefined;
170
170
  opclass?: string | undefined;
@@ -211,8 +211,8 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
211
211
  indexes: Record<string, {
212
212
  name: string;
213
213
  columns: {
214
- expression: string;
215
214
  isExpression: boolean;
215
+ expression: string;
216
216
  asc: boolean;
217
217
  nulls?: string | undefined;
218
218
  opclass?: string | undefined;
@@ -336,8 +336,8 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
336
336
  indexes: Record<string, {
337
337
  name: string;
338
338
  columns: {
339
- expression: string;
340
339
  isExpression: boolean;
340
+ expression: string;
341
341
  asc: boolean;
342
342
  nulls?: string | undefined;
343
343
  opclass?: string | undefined;
@@ -410,8 +410,8 @@ declare const pgSchema: zod.ZodObject<zod.objectUtil.extendShape<{
410
410
  indexes: Record<string, {
411
411
  name: string;
412
412
  columns: {
413
- expression: string;
414
413
  isExpression: boolean;
414
+ expression: string;
415
415
  asc: boolean;
416
416
  nulls?: string | undefined;
417
417
  opclass?: string | undefined;
@@ -636,6 +636,37 @@ declare const schema$1: zod.ZodObject<zod.objectUtil.extendShape<{
636
636
  columns: Record<string, string>;
637
637
  tables: Record<string, string>;
638
638
  }>;
639
+ internal: zod.ZodOptional<zod.ZodObject<{
640
+ indexes: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
641
+ columns: zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
642
+ isExpression: zod.ZodOptional<zod.ZodBoolean>;
643
+ }, "strip", zod.ZodTypeAny, {
644
+ isExpression?: boolean | undefined;
645
+ }, {
646
+ isExpression?: boolean | undefined;
647
+ }>>>;
648
+ }, "strip", zod.ZodTypeAny, {
649
+ columns: Record<string, {
650
+ isExpression?: boolean | undefined;
651
+ } | undefined>;
652
+ }, {
653
+ columns: Record<string, {
654
+ isExpression?: boolean | undefined;
655
+ } | undefined>;
656
+ }>>>>;
657
+ }, "strip", zod.ZodTypeAny, {
658
+ indexes?: Record<string, {
659
+ columns: Record<string, {
660
+ isExpression?: boolean | undefined;
661
+ } | undefined>;
662
+ } | undefined> | undefined;
663
+ }, {
664
+ indexes?: Record<string, {
665
+ columns: Record<string, {
666
+ isExpression?: boolean | undefined;
667
+ } | undefined>;
668
+ } | undefined> | undefined;
669
+ }>>;
639
670
  }, {
640
671
  id: zod.ZodString;
641
672
  prevId: zod.ZodString;
@@ -683,6 +714,13 @@ declare const schema$1: zod.ZodObject<zod.objectUtil.extendShape<{
683
714
  tables: Record<string, string>;
684
715
  };
685
716
  enums: {};
717
+ internal?: {
718
+ indexes?: Record<string, {
719
+ columns: Record<string, {
720
+ isExpression?: boolean | undefined;
721
+ } | undefined>;
722
+ } | undefined> | undefined;
723
+ } | undefined;
686
724
  }, {
687
725
  tables: Record<string, {
688
726
  name: string;
@@ -727,6 +765,13 @@ declare const schema$1: zod.ZodObject<zod.objectUtil.extendShape<{
727
765
  tables: Record<string, string>;
728
766
  };
729
767
  enums: {};
768
+ internal?: {
769
+ indexes?: Record<string, {
770
+ columns: Record<string, {
771
+ isExpression?: boolean | undefined;
772
+ } | undefined>;
773
+ } | undefined> | undefined;
774
+ } | undefined;
730
775
  }>;
731
776
  type SQLiteSchema = TypeOf<typeof schema$1>;
732
777
 
@@ -911,7 +956,7 @@ declare const schema: zod.ZodObject<zod.objectUtil.extendShape<{
911
956
  tables: Record<string, string>;
912
957
  }>;
913
958
  internal: zod.ZodOptional<zod.ZodObject<{
914
- tables: zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
959
+ tables: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
915
960
  columns: zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
916
961
  isDefaultAnExpression: zod.ZodOptional<zod.ZodBoolean>;
917
962
  }, "strip", zod.ZodTypeAny, {
@@ -927,19 +972,46 @@ declare const schema: zod.ZodObject<zod.objectUtil.extendShape<{
927
972
  columns: Record<string, {
928
973
  isDefaultAnExpression?: boolean | undefined;
929
974
  } | undefined>;
930
- }>>>;
975
+ }>>>>;
976
+ indexes: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
977
+ columns: zod.ZodRecord<zod.ZodString, zod.ZodOptional<zod.ZodObject<{
978
+ isExpression: zod.ZodOptional<zod.ZodBoolean>;
979
+ }, "strip", zod.ZodTypeAny, {
980
+ isExpression?: boolean | undefined;
981
+ }, {
982
+ isExpression?: boolean | undefined;
983
+ }>>>;
984
+ }, "strip", zod.ZodTypeAny, {
985
+ columns: Record<string, {
986
+ isExpression?: boolean | undefined;
987
+ } | undefined>;
988
+ }, {
989
+ columns: Record<string, {
990
+ isExpression?: boolean | undefined;
991
+ } | undefined>;
992
+ }>>>>;
931
993
  }, "strip", zod.ZodTypeAny, {
932
- tables: Record<string, {
994
+ indexes?: Record<string, {
995
+ columns: Record<string, {
996
+ isExpression?: boolean | undefined;
997
+ } | undefined>;
998
+ } | undefined> | undefined;
999
+ tables?: Record<string, {
933
1000
  columns: Record<string, {
934
1001
  isDefaultAnExpression?: boolean | undefined;
935
1002
  } | undefined>;
936
- } | undefined>;
1003
+ } | undefined> | undefined;
937
1004
  }, {
938
- tables: Record<string, {
1005
+ indexes?: Record<string, {
1006
+ columns: Record<string, {
1007
+ isExpression?: boolean | undefined;
1008
+ } | undefined>;
1009
+ } | undefined> | undefined;
1010
+ tables?: Record<string, {
939
1011
  columns: Record<string, {
940
1012
  isDefaultAnExpression?: boolean | undefined;
941
1013
  } | undefined>;
942
- } | undefined>;
1014
+ } | undefined> | undefined;
943
1015
  }>>;
944
1016
  }, {
945
1017
  id: zod.ZodString;
@@ -991,11 +1063,16 @@ declare const schema: zod.ZodObject<zod.objectUtil.extendShape<{
991
1063
  tables: Record<string, string>;
992
1064
  };
993
1065
  internal?: {
994
- tables: Record<string, {
1066
+ indexes?: Record<string, {
1067
+ columns: Record<string, {
1068
+ isExpression?: boolean | undefined;
1069
+ } | undefined>;
1070
+ } | undefined> | undefined;
1071
+ tables?: Record<string, {
995
1072
  columns: Record<string, {
996
1073
  isDefaultAnExpression?: boolean | undefined;
997
1074
  } | undefined>;
998
- } | undefined>;
1075
+ } | undefined> | undefined;
999
1076
  } | undefined;
1000
1077
  }, {
1001
1078
  tables: Record<string, {
@@ -1044,11 +1121,16 @@ declare const schema: zod.ZodObject<zod.objectUtil.extendShape<{
1044
1121
  tables: Record<string, string>;
1045
1122
  };
1046
1123
  internal?: {
1047
- tables: Record<string, {
1124
+ indexes?: Record<string, {
1125
+ columns: Record<string, {
1126
+ isExpression?: boolean | undefined;
1127
+ } | undefined>;
1128
+ } | undefined> | undefined;
1129
+ tables?: Record<string, {
1048
1130
  columns: Record<string, {
1049
1131
  isDefaultAnExpression?: boolean | undefined;
1050
1132
  } | undefined>;
1051
- } | undefined>;
1133
+ } | undefined> | undefined;
1052
1134
  } | undefined;
1053
1135
  }>;
1054
1136
  type MySqlSchema = TypeOf<typeof schema>;
package/payload.js CHANGED
@@ -7990,7 +7990,16 @@ var init_mysqlSchema = __esm({
7990
7990
  (0, import_zod.object)({ isDefaultAnExpression: (0, import_zod.boolean)().optional() }).optional()
7991
7991
  )
7992
7992
  }).optional()
7993
- )
7993
+ ).optional(),
7994
+ indexes: (0, import_zod.record)(
7995
+ (0, import_zod.string)(),
7996
+ (0, import_zod.object)({
7997
+ columns: (0, import_zod.record)(
7998
+ (0, import_zod.string)(),
7999
+ (0, import_zod.object)({ isExpression: (0, import_zod.boolean)().optional() }).optional()
8000
+ )
8001
+ }).optional()
8002
+ ).optional()
7994
8003
  }).optional();
7995
8004
  dialect = (0, import_zod.literal)("mysql");
7996
8005
  schemaHash = (0, import_zod.object)({
@@ -8655,7 +8664,7 @@ var init_pgSchema = __esm({
8655
8664
  });
8656
8665
 
8657
8666
  // src/serializer/sqliteSchema.ts
8658
- var import_zod3, index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
8667
+ var import_zod3, index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals3, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema2, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
8659
8668
  var init_sqliteSchema = __esm({
8660
8669
  "src/serializer/sqliteSchema.ts"() {
8661
8670
  "use strict";
@@ -8733,6 +8742,17 @@ var init_sqliteSchema = __esm({
8733
8742
  columns: (0, import_zod3.record)((0, import_zod3.string)(), (0, import_zod3.string)())
8734
8743
  })
8735
8744
  }).strict();
8745
+ kitInternals3 = (0, import_zod3.object)({
8746
+ indexes: (0, import_zod3.record)(
8747
+ (0, import_zod3.string)(),
8748
+ (0, import_zod3.object)({
8749
+ columns: (0, import_zod3.record)(
8750
+ (0, import_zod3.string)(),
8751
+ (0, import_zod3.object)({ isExpression: (0, import_zod3.boolean)().optional() }).optional()
8752
+ )
8753
+ }).optional()
8754
+ ).optional()
8755
+ }).optional();
8736
8756
  latestVersion = (0, import_zod3.literal)("6");
8737
8757
  schemaInternal2 = (0, import_zod3.object)({
8738
8758
  version: latestVersion,
@@ -8742,7 +8762,8 @@ var init_sqliteSchema = __esm({
8742
8762
  _meta: (0, import_zod3.object)({
8743
8763
  tables: (0, import_zod3.record)((0, import_zod3.string)(), (0, import_zod3.string)()),
8744
8764
  columns: (0, import_zod3.record)((0, import_zod3.string)(), (0, import_zod3.string)())
8745
- })
8765
+ }),
8766
+ internal: kitInternals3
8746
8767
  }).strict();
8747
8768
  schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
8748
8769
  schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
@@ -12091,7 +12112,7 @@ var init_jsonStatements = __esm({
12091
12112
  uniqueConstraints: Object.values(uniqueConstraints)
12092
12113
  };
12093
12114
  };
12094
- prepareMySqlCreateTableJson = (table4, json2) => {
12115
+ prepareMySqlCreateTableJson = (table4, json2, internals) => {
12095
12116
  const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
12096
12117
  return {
12097
12118
  type: "create_table",
@@ -12100,7 +12121,8 @@ var init_jsonStatements = __esm({
12100
12121
  columns: Object.values(columns),
12101
12122
  compositePKs: Object.values(compositePrimaryKeys),
12102
12123
  compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name2].compositePrimaryKeys[MySqlSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name].name : "",
12103
- uniqueConstraints: Object.values(uniqueConstraints)
12124
+ uniqueConstraints: Object.values(uniqueConstraints),
12125
+ internals
12104
12126
  };
12105
12127
  };
12106
12128
  prepareSQLiteCreateTable = (table4) => {
@@ -12854,13 +12876,14 @@ var init_jsonStatements = __esm({
12854
12876
  };
12855
12877
  });
12856
12878
  };
12857
- prepareCreateIndexesJson = (tableName, schema4, indexes) => {
12879
+ prepareCreateIndexesJson = (tableName, schema4, indexes, internal) => {
12858
12880
  return Object.values(indexes).map((indexData) => {
12859
12881
  return {
12860
12882
  type: "create_index",
12861
12883
  tableName,
12862
12884
  data: indexData,
12863
- schema: schema4
12885
+ schema: schema4,
12886
+ internal
12864
12887
  };
12865
12888
  });
12866
12889
  };
@@ -13797,7 +13820,12 @@ var init_snapshotsDiffer = __esm({
13797
13820
  const typedResult = diffResultSchemeMysql.parse(diffResult);
13798
13821
  const jsonStatements = [];
13799
13822
  const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
13800
- return prepareCreateIndexesJson(it.name, it.schema, it.indexes);
13823
+ return prepareCreateIndexesJson(
13824
+ it.name,
13825
+ it.schema,
13826
+ it.indexes,
13827
+ curFull.internal
13828
+ );
13801
13829
  }).flat();
13802
13830
  const jsonDropTables = deletedTables.map((it) => {
13803
13831
  return prepareDropTableJson(it);
@@ -13896,7 +13924,8 @@ var init_snapshotsDiffer = __esm({
13896
13924
  return prepareCreateIndexesJson(
13897
13925
  it.name,
13898
13926
  it.schema,
13899
- it.addedIndexes || {}
13927
+ it.addedIndexes || {},
13928
+ curFull.internal
13900
13929
  );
13901
13930
  }).flat();
13902
13931
  const jsonDropIndexesForAllAlteredTables = alteredTables.map((it) => {
@@ -13956,7 +13985,11 @@ var init_snapshotsDiffer = __esm({
13956
13985
  (t) => t.type === "delete_reference"
13957
13986
  );
13958
13987
  const jsonMySqlCreateTables = createdTables.map((it) => {
13959
- return prepareMySqlCreateTableJson(it, curFull);
13988
+ return prepareMySqlCreateTableJson(
13989
+ it,
13990
+ curFull,
13991
+ curFull.internal
13992
+ );
13960
13993
  });
13961
13994
  jsonStatements.push(...jsonMySqlCreateTables);
13962
13995
  jsonStatements.push(...jsonDropTables);
@@ -13996,7 +14029,7 @@ var init_snapshotsDiffer = __esm({
13996
14029
  _meta
13997
14030
  };
13998
14031
  };
13999
- applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2) => {
14032
+ applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
14000
14033
  const tablesDiff = diffSchemasOrTables(json1.tables, json2.tables);
14001
14034
  const {
14002
14035
  created: createdTables,
@@ -14076,7 +14109,12 @@ var init_snapshotsDiffer = __esm({
14076
14109
  return prepareSQLiteCreateTable(it);
14077
14110
  });
14078
14111
  const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
14079
- return prepareCreateIndexesJson(it.name, it.schema, it.indexes);
14112
+ return prepareCreateIndexesJson(
14113
+ it.name,
14114
+ it.schema,
14115
+ it.indexes,
14116
+ curFull.internal
14117
+ );
14080
14118
  }).flat();
14081
14119
  const jsonDropTables = deletedTables.map((it) => {
14082
14120
  return prepareDropTableJson(it);
@@ -14178,7 +14216,8 @@ var init_snapshotsDiffer = __esm({
14178
14216
  return prepareCreateIndexesJson(
14179
14217
  it.name,
14180
14218
  it.schema,
14181
- it.addedIndexes || {}
14219
+ it.addedIndexes || {},
14220
+ curFull.internal
14182
14221
  );
14183
14222
  }).flat();
14184
14223
  const jsonDropIndexesForAllAlteredTables = allAltered.map((it) => {
@@ -14612,7 +14651,14 @@ var init_sqlgenerator = __esm({
14612
14651
  return statement.type === "create_table" && dialect7 === "mysql";
14613
14652
  }
14614
14653
  convert(st) {
14615
- const { tableName, columns, schema: schema4, compositePKs, uniqueConstraints } = st;
14654
+ const {
14655
+ tableName,
14656
+ columns,
14657
+ schema: schema4,
14658
+ compositePKs,
14659
+ uniqueConstraints,
14660
+ internals
14661
+ } = st;
14616
14662
  let statement = "";
14617
14663
  statement += `CREATE TABLE \`${tableName}\` (
14618
14664
  `;
@@ -14635,7 +14681,10 @@ var init_sqlgenerator = __esm({
14635
14681
  for (const uniqueConstraint4 of uniqueConstraints) {
14636
14682
  statement += ",\n";
14637
14683
  const unsquashedUnique = MySqlSquasher.unsquashUnique(uniqueConstraint4);
14638
- statement += ` CONSTRAINT \`${unsquashedUnique.name}\` UNIQUE(\`${unsquashedUnique.columns.join(`\`,\``)}\`)`;
14684
+ const uniqueString = unsquashedUnique.columns.map((it) => {
14685
+ return internals?.indexes ? internals?.indexes[unsquashedUnique.name]?.columns[it]?.isExpression ? it : `\`${it}\`` : `\`${it}\``;
14686
+ }).join(",");
14687
+ statement += ` CONSTRAINT \`${unsquashedUnique.name}\` UNIQUE(${uniqueString})`;
14639
14688
  }
14640
14689
  }
14641
14690
  statement += `
@@ -15564,8 +15613,10 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
15564
15613
  statement.data
15565
15614
  );
15566
15615
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
15567
- const value = columns.map((it) => `\`${it}\``).join(",");
15568
- return `CREATE ${indexPart} \`${name2}\` ON \`${statement.tableName}\` (${value});`;
15616
+ const uniqueString = columns.map((it) => {
15617
+ return statement.internal?.indexes ? statement.internal?.indexes[name2]?.columns[it]?.isExpression ? it : `\`${it}\`` : `\`${it}\``;
15618
+ }).join(",");
15619
+ return `CREATE ${indexPart} \`${name2}\` ON \`${statement.tableName}\` (${uniqueString});`;
15569
15620
  }
15570
15621
  };
15571
15622
  CreateSqliteIndexConvertor = class extends Convertor {
@@ -15578,8 +15629,10 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
15578
15629
  );
15579
15630
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
15580
15631
  const whereStatement = where ? ` WHERE ${where}` : "";
15581
- const value = columns.map((it) => `\`${it}\``).join(",");
15582
- return `CREATE ${indexPart} \`${name2}\` ON \`${statement.tableName}\` (${value})${whereStatement};`;
15632
+ const uniqueString = columns.map((it) => {
15633
+ return statement.internal?.indexes ? statement.internal?.indexes[name2]?.columns[it]?.isExpression ? it : `\`${it}\`` : `\`${it}\``;
15634
+ }).join(",");
15635
+ return `CREATE ${indexPart} \`${name2}\` ON \`${statement.tableName}\` (${uniqueString})${whereStatement};`;
15583
15636
  }
15584
15637
  };
15585
15638
  PgDropIndexConvertor = class extends Convertor {
@@ -19155,6 +19208,7 @@ var init_sqliteSerializer = __esm({
19155
19208
  dialect5 = new SQLiteSyncDialect();
19156
19209
  generateSqliteSnapshot = (tables) => {
19157
19210
  const result = {};
19211
+ const internal = { indexes: {} };
19158
19212
  for (const table4 of tables) {
19159
19213
  const columnsObject = {};
19160
19214
  const indexesObject = {};
@@ -19241,7 +19295,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
19241
19295
  const name2 = value.config.name;
19242
19296
  let indexColumns = columns2.map((it) => {
19243
19297
  if (is(it, SQL)) {
19244
- return dialect5.sqlToQuery(it, "indexes").sql;
19298
+ const sql2 = dialect5.sqlToQuery(it, "indexes").sql;
19299
+ if (typeof internal.indexes[name2] === "undefined") {
19300
+ internal.indexes[name2] = {
19301
+ columns: {
19302
+ [sql2]: {
19303
+ isExpression: true
19304
+ }
19305
+ }
19306
+ };
19307
+ } else {
19308
+ if (typeof internal.indexes[name2]?.columns[sql2] === "undefined") {
19309
+ internal.indexes[name2].columns[sql2] = {
19310
+ isExpression: true
19311
+ };
19312
+ } else {
19313
+ internal.indexes[name2].columns[sql2].isExpression = true;
19314
+ }
19315
+ }
19316
+ return sql2;
19245
19317
  } else {
19246
19318
  return it.name;
19247
19319
  }
@@ -19315,7 +19387,8 @@ The unique constraint ${source_default.underline.blue(
19315
19387
  _meta: {
19316
19388
  tables: {},
19317
19389
  columns: {}
19318
- }
19390
+ },
19391
+ internal
19319
19392
  };
19320
19393
  };
19321
19394
  fromDatabase2 = async (db, tablesFilter = (table4) => true, progressCallback) => {
@@ -23577,6 +23650,7 @@ var init_mysqlSerializer = __esm({
23577
23650
  dialect6 = new MySqlDialect();
23578
23651
  generateMySqlSnapshot = (tables) => {
23579
23652
  const result = {};
23653
+ const internal = { tables: {}, indexes: {} };
23580
23654
  for (const table4 of tables) {
23581
23655
  const {
23582
23656
  name: tableName,
@@ -23728,9 +23802,27 @@ The unique constraint ${source_default.underline.blue(
23728
23802
  const name2 = value.config.name;
23729
23803
  let indexColumns = columns2.map((it) => {
23730
23804
  if (is(it, SQL)) {
23731
- return dialect6.sqlToQuery(it, "indexes").sql;
23805
+ const sql2 = dialect6.sqlToQuery(it, "indexes").sql;
23806
+ if (typeof internal.indexes[name2] === "undefined") {
23807
+ internal.indexes[name2] = {
23808
+ columns: {
23809
+ [sql2]: {
23810
+ isExpression: true
23811
+ }
23812
+ }
23813
+ };
23814
+ } else {
23815
+ if (typeof internal.indexes[name2]?.columns[sql2] === "undefined") {
23816
+ internal.indexes[name2].columns[sql2] = {
23817
+ isExpression: true
23818
+ };
23819
+ } else {
23820
+ internal.indexes[name2].columns[sql2].isExpression = true;
23821
+ }
23822
+ }
23823
+ return sql2;
23732
23824
  } else {
23733
- return it.name;
23825
+ return `${it.name}`;
23734
23826
  }
23735
23827
  });
23736
23828
  if (value.config.unique) {
@@ -23797,12 +23889,13 @@ We have encountered a collision between the index name on columns ${source_defau
23797
23889
  _meta: {
23798
23890
  tables: {},
23799
23891
  columns: {}
23800
- }
23892
+ },
23893
+ internal
23801
23894
  };
23802
23895
  };
23803
23896
  fromDatabase3 = async (db, inputSchema, tablesFilter = (table4) => true, progressCallback) => {
23804
23897
  const result = {};
23805
- const internals = { tables: {} };
23898
+ const internals = { tables: {}, indexes: {} };
23806
23899
  const columns = await db.query(`select * from information_schema.columns
23807
23900
  where table_schema = '${inputSchema}' and table_name != '__drizzle_migrations'
23808
23901
  order by table_name, ordinal_position;`);
@@ -25345,7 +25438,9 @@ var generateSQLiteMigration = async (prev, cur) => {
25345
25438
  squashedPrev,
25346
25439
  squashedCur,
25347
25440
  tablesResolver,
25348
- columnsResolver
25441
+ columnsResolver,
25442
+ validatedPrev,
25443
+ validatedCur
25349
25444
  );
25350
25445
  return sqlStatements;
25351
25446
  };
@@ -25374,7 +25469,9 @@ var pushSQLiteSchema = async (imports, drizzleInstance) => {
25374
25469
  squashedPrev,
25375
25470
  squashedCur,
25376
25471
  tablesResolver,
25377
- columnsResolver
25472
+ columnsResolver,
25473
+ validatedPrev,
25474
+ validatedCur
25378
25475
  );
25379
25476
  const { shouldAskForApprove, statementsToExecute, infoToPrint } = await logSuggestionsAndReturn(
25380
25477
  db,