Use composite index for tags
This commit is contained in:
parent
9c4301e791
commit
19adb3ab44
|
@ -0,0 +1,31 @@
|
|||
import { Kysely } from '@/deps.ts';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema.dropIndex('idx_tags_tag').on('tags').execute();
|
||||
await db.schema.dropIndex('idx_tags_value').on('tags').execute();
|
||||
|
||||
await db.schema
|
||||
.createIndex('idx_tags_tag_value')
|
||||
.on('tags')
|
||||
.columns(['tag', 'value'])
|
||||
.execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.dropIndex('idx_tags_tag_value')
|
||||
.on('tags')
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.createIndex('idx_tags_tag')
|
||||
.on('tags')
|
||||
.column('tag')
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.createIndex('idx_tags_value')
|
||||
.on('tags')
|
||||
.column('value')
|
||||
.execute();
|
||||
}
|
Loading…
Reference in New Issue