Use char(64) for stats primary keys

This commit is contained in:
Alex Gleason 2024-09-20 09:58:46 -05:00
parent e27c1519fb
commit 2b2cdca282
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -0,0 +1,11 @@
import { Kysely } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> {
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('char(64)')).execute();
await db.schema.alterTable('event_stats').alterColumn('event_id', (col) => col.setDataType('char(64)')).execute();
}
export async function down(db: Kysely<any>): Promise<void> {
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('text')).execute();
await db.schema.alterTable('event_stats').alterColumn('event_id', (col) => col.setDataType('text')).execute();
}