add migration for removing pubkey_domains table

This commit is contained in:
Siddharth Singh 2024-05-04 11:57:05 +05:30
parent e25372313b
commit e037ccc7ed
No known key found for this signature in database

View file

@ -0,0 +1,25 @@
import { Kysely } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> {
await db.schema
.dropTable('pubkey_domains')
.ifExists()
.execute();
}
export async function down(db: Kysely<any>): Promise<void> {
await db.schema
.createTable('pubkey_domains')
.ifNotExists()
.addColumn('pubkey', 'text', (col) => col.primaryKey())
.addColumn('domain', 'text', (col) => col.notNull())
.addColumn('last_updated_at', 'integer', (col) => col.notNull().defaultTo(0))
.execute();
await db.schema
.createIndex('pubkey_domains_domain_index')
.on('pubkey_domains')
.column('domain')
.ifNotExists()
.execute();
}