fix: add missing bets table to migration

The bets schema was defined in schema.ts but never created in
startup.ts, causing crash on index creation referencing bets table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 08:32:08 +00:00
co-authored by Claude Opus 4.6
parent 80de7a9389
commit 8e9285cd50
+17
View File
@@ -126,6 +126,23 @@ export function runMigrations() {
); );
`) `)
sqlite.exec(`
CREATE TABLE IF NOT EXISTS bets (
id TEXT PRIMARY KEY,
fight_id TEXT NOT NULL REFERENCES fights(id),
bettor_pubkey TEXT NOT NULL,
bot_id TEXT NOT NULL REFERENCES bots(id),
amount_sats INTEGER NOT NULL,
odds_at_placement REAL NOT NULL,
cashu_token TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending',
payout_sats INTEGER,
payout_token TEXT,
created_at TEXT NOT NULL,
settled_at TEXT
);
`)
sqlite.exec(` sqlite.exec(`
CREATE TABLE IF NOT EXISTS analytics ( CREATE TABLE IF NOT EXISTS analytics (
date TEXT NOT NULL, date TEXT NOT NULL,