create table if not exists backtest_runs ( id bigserial primary key, model_code text not null, instrument_id bigint references instruments(id), timeframe_set jsonb not null default '{}'::jsonb, started_ts timestamptz not null, ended_ts timestamptz, config jsonb not null default '{}'::jsonb, summary jsonb not null default '{}'::jsonb, created_at timestamptz not null default now() ); create index if not exists idx_backtest_runs_model_started_desc on backtest_runs (model_code, started_ts desc); create index if not exists idx_backtest_runs_instr_started_desc on backtest_runs (instrument_id, started_ts desc);