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