refactor(event_zaps): rename amount to amount_millisats

This commit is contained in:
P. Reis 2024-06-21 18:20:10 -03:00
parent 1b4ebaccd8
commit 2d937a7378
2 changed files with 3 additions and 4 deletions

View file

@ -75,6 +75,6 @@ interface EventZapRow {
receipt_id: string; receipt_id: string;
target_event_id: string; target_event_id: string;
sender_pubkey: string; sender_pubkey: string;
amount: number; amount_millisats: number;
comment: string; comment: string;
} }

View file

@ -3,11 +3,10 @@ import { Kysely } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> { export async function up(db: Kysely<any>): Promise<void> {
await db.schema await db.schema
.createTable('event_zaps') .createTable('event_zaps')
.ifNotExists()
.addColumn('receipt_id', 'text', (col) => col.primaryKey()) .addColumn('receipt_id', 'text', (col) => col.primaryKey())
.addColumn('target_event_id', 'text', (col) => col.notNull()) .addColumn('target_event_id', 'text', (col) => col.notNull())
.addColumn('sender_pubkey', 'text', (col) => col.notNull()) .addColumn('sender_pubkey', 'text', (col) => col.notNull())
.addColumn('amount', 'integer', (col) => col.notNull()) .addColumn('amount_millisats', 'integer', (col) => col.notNull())
.addColumn('comment', 'text', (col) => col.notNull()) .addColumn('comment', 'text', (col) => col.notNull())
.execute(); .execute();
@ -21,6 +20,6 @@ export async function up(db: Kysely<any>): Promise<void> {
} }
export async function down(db: Kysely<any>): Promise<void> { export async function down(db: Kysely<any>): Promise<void> {
await db.schema.dropIndex('idx_event_zaps_id_amount').execute(); await db.schema.dropIndex('idx_event_zaps_id_amount').ifExists().execute();
await db.schema.dropTable('event_zaps').execute(); await db.schema.dropTable('event_zaps').execute();
} }