mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Use composite index for tags
This commit is contained in:
parent
9c4301e791
commit
19adb3ab44
1 changed files with 31 additions and 0 deletions
31
src/db/migrations/012_tags_composite_index.ts
Normal file
31
src/db/migrations/012_tags_composite_index.ts
Normal file
|
|
@ -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…
Add table
Reference in a new issue