mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
try fixing migration 034
This commit is contained in:
parent
e064531ca2
commit
184f958d8e
1 changed files with 13 additions and 5 deletions
|
|
@ -1,12 +1,20 @@
|
|||
import { Kysely, sql } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.alterTable('author_stats')
|
||||
.addColumn('search', 'text', (col) => col.notNull().defaultTo(''))
|
||||
.execute();
|
||||
try {
|
||||
await db.schema
|
||||
.alterTable('author_stats')
|
||||
.addColumn('search', 'text', (col) => col.notNull().defaultTo(''))
|
||||
.execute();
|
||||
} catch (e) {
|
||||
if (e.message.toLowerCase().includes('already exists')) {
|
||||
console.warn('skipping 034');
|
||||
}
|
||||
}
|
||||
|
||||
await sql`CREATE INDEX author_stats_search_idx ON author_stats USING GIN (search gin_trgm_ops)`.execute(db);
|
||||
await sql`CREATE INDEX IF NOT EXISTS author_stats_search_idx ON author_stats USING GIN (search gin_trgm_ops)`.execute(
|
||||
db,
|
||||
);
|
||||
|
||||
await db.insertInto('author_stats')
|
||||
.columns(['pubkey', 'search'])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue