mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-02 01:27:24 -04:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user