mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'stats64' into 'main'
Use char(64) for stats primary keys See merge request soapbox-pub/ditto!504
This commit is contained in:
commit
80302b3915
1 changed files with 14 additions and 0 deletions
14
src/db/migrations/036_stats64.ts
Normal file
14
src/db/migrations/036_stats64.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.deleteFrom('event_stats').where(sql<number>`length(event_id)`, '>', 64).execute();
|
||||||
|
await db.deleteFrom('author_stats').where(sql<number>`length(pubkey)`, '>', 64).execute();
|
||||||
|
|
||||||
|
await db.schema.alterTable('event_stats').alterColumn('event_id', (col) => col.setDataType('char(64)')).execute();
|
||||||
|
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('char(64)')).execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
await db.schema.alterTable('event_stats').alterColumn('event_id', (col) => col.setDataType('text')).execute();
|
||||||
|
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('text')).execute();
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue