Skip to content

Commit e00f908

Browse files
committed
update drop index
1 parent 7953915 commit e00f908

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

drizzle-kit/src/jsonStatements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2890,7 +2890,7 @@ export const prepareSingleStoreCreateIndexesJson = (
28902890
tableName: string,
28912891
schema: string,
28922892
indexes: Record<string, string>,
2893-
internal: SingleStoreKitInternals,
2893+
internal?: SingleStoreKitInternals,
28942894
): JsonSingleStoreCreateIndexStatement[] => {
28952895
return Object.values(indexes).map((indexData) => {
28962896
let type: JsonSingleStoreCreateIndexStatement['type'];

drizzle-kit/src/snapshotsDiffer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,7 +3025,7 @@ export const applySingleStoreSnapshotsDiff = async (
30253025

30263026
const jsonCreateIndexesForAllAlteredTables = alteredTables
30273027
.map((it) => {
3028-
return prepareCreateIndexesJson(
3028+
return prepareSingleStoreCreateIndexesJson(
30293029
it.name,
30303030
it.schema,
30313031
it.addedIndexes || {},
@@ -3061,7 +3061,7 @@ export const applySingleStoreSnapshotsDiff = async (
30613061
);
30623062

30633063
jsonCreateIndexesForAllAlteredTables.push(
3064-
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {}),
3064+
...prepareSingleStoreCreateIndexesJson(it.name, it.schema, createdIndexes || {}),
30653065
);
30663066
jsonDropIndexesForAllAlteredTables.push(
30673067
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {}),

drizzle-kit/src/sqlgenerator.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3701,7 +3701,8 @@ class SingleStoreDropIndexConvertor extends Convertor {
37013701
}
37023702

37033703
convert(statement: JsonDropIndexStatement): string {
3704-
const { name } = SingleStoreSquasher.unsquashIdx(statement.data);
3704+
// we have two different index types, but `name` is always the first element in the squashed data
3705+
const name = statement.data.split(';')[0];
37053706
return `DROP INDEX \`${name}\` ON \`${statement.tableName}\`;`;
37063707
}
37073708
}

0 commit comments

Comments
 (0)