From 3af166c8a4f9bb9332183bdc045a2eb2fa7fd661 Mon Sep 17 00:00:00 2001 From: Jan-Timo Date: Wed, 11 Feb 2026 13:46:37 +0100 Subject: [PATCH] fix sqlite3.OperationalError: no such table: main.token_time_series --- db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.py b/db.py index 9f4efd3..11df49c 100644 --- a/db.py +++ b/db.py @@ -50,7 +50,6 @@ class TokenDatabase: PRIMARY KEY(endpoint, model) ) ''') - await db.execute('CREATE INDEX IF NOT EXISTS idx_token_time_series_timestamp ON token_time_series(timestamp)') await db.execute(''' CREATE TABLE IF NOT EXISTS token_time_series ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -63,6 +62,7 @@ class TokenDatabase: FOREIGN KEY(endpoint, model) REFERENCES token_counts(endpoint, model) ) ''') + await db.execute('CREATE INDEX IF NOT EXISTS idx_token_time_series_timestamp ON token_time_series(timestamp)') await db.commit() async def update_token_counts(self, endpoint: str, model: str, input_tokens: int, output_tokens: int):