mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'followers-index' into 'main'
author_stats: add index on followers_count See merge request soapbox-pub/ditto!503
This commit is contained in:
commit
e27c1519fb
1 changed files with 17 additions and 0 deletions
17
src/db/migrations/035_author_stats_followers_index.ts
Normal file
17
src/db/migrations/035_author_stats_followers_index.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema
|
||||||
|
.createIndex('author_stats_followers_count_idx')
|
||||||
|
.ifNotExists()
|
||||||
|
.on('author_stats')
|
||||||
|
.column('followers_count desc')
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
// This index should have never been added, because pubkey is the primary key.
|
||||||
|
await db.schema.dropIndex('idx_author_stats_pubkey').ifExists().execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema.dropIndex('author_stats_followers_count_idx').ifExists().execute();
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue