Merge branch 'global-feed-index' into 'main'

Add a created_at, kind index for the global feed

See merge request soapbox-pub/ditto!236
This commit is contained in:
Alex Gleason 2024-05-08 19:37:16 +00:00
commit 71899e54de
2 changed files with 15 additions and 1 deletions

View File

@ -4,7 +4,7 @@ export async function up(db: Kysely<any>): Promise<void> {
await db.schema
.createIndex('idx_events_kind_pubkey_created_at')
.on('events')
.columns(['kind', 'pubkey', 'created_at'])
.columns(['kind', 'pubkey', 'created_at desc'])
.execute();
}

View File

@ -0,0 +1,14 @@
import { Kysely } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> {
await db.schema
.createIndex('idx_events_created_at_kind')
.on('events')
.columns(['created_at desc', 'kind'])
.ifNotExists()
.execute();
}
export async function down(db: Kysely<any>): Promise<void> {
await db.schema.dropIndex('idx_events_created_at_kind').ifExists().execute();
}