mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat: add migration for event_zaps;create idx_event_zaps_id_amount
This commit is contained in:
parent
ddb93af09f
commit
bac0b48801
1 changed files with 26 additions and 0 deletions
26
src/db/migrations/027_add_zap_events.ts
Normal file
26
src/db/migrations/027_add_zap_events.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { Kysely } from 'kysely';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await db.schema
|
||||
.createTable('event_zaps')
|
||||
.ifNotExists()
|
||||
.addColumn('receipt_id', 'text', (col) => col.primaryKey())
|
||||
.addColumn('target_event_id', 'text', (col) => col.notNull())
|
||||
.addColumn('sender_pubkey', 'text', (col) => col.notNull())
|
||||
.addColumn('amount', 'integer', (col) => col.notNull())
|
||||
.addColumn('comment', 'text', (col) => col.notNull())
|
||||
.execute();
|
||||
|
||||
await db.schema
|
||||
.createIndex('idx_event_zaps_id_amount')
|
||||
.on('event_zaps')
|
||||
.column('amount')
|
||||
.column('target_event_id')
|
||||
.ifNotExists()
|
||||
.execute();
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await db.schema.dropIndex('idx_event_zaps_id_amount').execute();
|
||||
await db.schema.dropTable('event_zaps').execute();
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue