From 9da65c2d53f1e002aa09fca85ae7559386e308a9 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 4 Nov 2025 22:39:36 -0500 Subject: [PATCH] fix: correct Database default path to match system-wide db_path Changes: - Change Database.__init__ default from "data/trading.db" to "data/jobs.db" Root Cause: - Job creation uses "data/jobs.db" (via JobManager, SimulationWorker) - BaseAgent's Database() was using "data/trading.db" by default - This caused jobs table to exist in jobs.db but trading_days INSERT tried to reference job_id from trading.db, causing FK constraint failure Impact: - Fixes: "FOREIGN KEY constraint failed" when creating trading_day records - Ensures all components use same database file for referential integrity - Maintains DEV/PROD mode isolation via get_db_path() Related: api/database.py:521 --- api/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/database.py b/api/database.py index 49d1fea..b876243 100644 --- a/api/database.py +++ b/api/database.py @@ -518,7 +518,7 @@ class Database: """ if db_path is None: from tools.deployment_config import get_db_path - db_path = get_db_path("data/trading.db") + db_path = get_db_path("data/jobs.db") self.db_path = db_path self.connection = sqlite3.connect(db_path, check_same_thread=False)