mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -04:00
Add automatic schema migration to handle existing databases that don't have the simulation_run_id column in the positions table. Problem: - v0.3.0-alpha.3 databases lack simulation_run_id column - CREATE TABLE IF NOT EXISTS doesn't add new columns to existing tables - Index creation fails with "no such column: simulation_run_id" Solution: - Add _migrate_schema() function to detect and migrate old schemas - Check if positions table exists and inspect its columns - ALTER TABLE to add simulation_run_id if missing - Run migration before creating indexes This allows seamless upgrades from alpha.3 to alpha.4 without manual database deletion or migration scripts. Fixes docker compose startup error: sqlite3.OperationalError: no such column: simulation_run_id Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>