mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Index the Postgres FTS column
This commit is contained in:
parent
00cfd0af68
commit
101a16bc12
1 changed files with 21 additions and 0 deletions
21
src/db/migrations/021_pgfts_index.ts
Normal file
21
src/db/migrations/021_pgfts_index.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { Kysely } from 'kysely';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
if (['postgres:', 'postgresql:'].includes(Conf.databaseUrl.protocol!)) {
|
||||
await db.schema
|
||||
.createIndex('nostr_pgfts_gin_search_vec')
|
||||
.ifNotExists()
|
||||
.on('nostr_pgfts')
|
||||
.using('gin')
|
||||
.column('search_vec')
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
if (['postgres:', 'postgresql:'].includes(Conf.databaseUrl.protocol!)) {
|
||||
await db.schema.dropIndex('nostr_pgfts_gin_search_vec').ifExists().execute();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue