mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
16 lines
469 B
TypeScript
16 lines
469 B
TypeScript
import { type Kysely, sql } from 'kysely';
|
|
|
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
const result = await sql<{ count: number }>`
|
|
SELECT COUNT(*) as count
|
|
FROM pg_indexes
|
|
WHERE indexname = 'nostr_events_new_pkey'
|
|
`.execute(db);
|
|
|
|
if (result.rows[0].count > 0) {
|
|
await sql`ALTER INDEX nostr_events_new_pkey RENAME TO nostr_events_pkey;`.execute(db);
|
|
}
|
|
}
|
|
|
|
export async function down(_db: Kysely<unknown>): Promise<void> {
|
|
}
|