Skip to content

Commit

Permalink
update drop index
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchwadair committed Mar 4, 2025
1 parent 7953915 commit e00f908
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drizzle-kit/src/jsonStatements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2890,7 +2890,7 @@ export const prepareSingleStoreCreateIndexesJson = (
tableName: string,
schema: string,
indexes: Record<string, string>,
internal: SingleStoreKitInternals,
internal?: SingleStoreKitInternals,
): JsonSingleStoreCreateIndexStatement[] => {
return Object.values(indexes).map((indexData) => {
let type: JsonSingleStoreCreateIndexStatement['type'];
Expand Down
4 changes: 2 additions & 2 deletions drizzle-kit/src/snapshotsDiffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3025,7 +3025,7 @@ export const applySingleStoreSnapshotsDiff = async (

const jsonCreateIndexesForAllAlteredTables = alteredTables
.map((it) => {
return prepareCreateIndexesJson(
return prepareSingleStoreCreateIndexesJson(
it.name,
it.schema,
it.addedIndexes || {},
Expand Down Expand Up @@ -3061,7 +3061,7 @@ export const applySingleStoreSnapshotsDiff = async (
);

jsonCreateIndexesForAllAlteredTables.push(
...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {}),
...prepareSingleStoreCreateIndexesJson(it.name, it.schema, createdIndexes || {}),
);
jsonDropIndexesForAllAlteredTables.push(
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {}),
Expand Down
3 changes: 2 additions & 1 deletion drizzle-kit/src/sqlgenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3701,7 +3701,8 @@ class SingleStoreDropIndexConvertor extends Convertor {
}

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

0 comments on commit e00f908

Please sign in to comment.