mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat: create author_search table
This commit is contained in:
parent
593cedba06
commit
40c187680e
1 changed files with 18 additions and 0 deletions
18
src/db/migrations/032_add_author_search.ts
Normal file
18
src/db/migrations/032_add_author_search.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema
|
||||||
|
.createTable('author_search')
|
||||||
|
.addColumn('pubkey', 'char(64)', (col) => col.primaryKey())
|
||||||
|
.addColumn('search', 'text', (col) => col.notNull())
|
||||||
|
.ifNotExists()
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
await sql`CREATE EXTENSION IF NOT EXISTS pg_trgm;`.execute(db);
|
||||||
|
await sql`CREATE INDEX author_search_search_idx ON author_search USING GIN (search gin_trgm_ops);`.execute(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema.dropIndex('author_search_search_idx').ifExists().execute();
|
||||||
|
await db.schema.dropTable('author_search').execute();
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue