25 lines
1008 B
SQL
25 lines
1008 B
SQL
alter table if exists backtest_runs
|
|
add column if not exists subject_type text,
|
|
add column if not exists trading_plan_id bigint references trading_plans(id),
|
|
add column if not exists candidate_model_code text;
|
|
|
|
update backtest_runs
|
|
set subject_type = coalesce(subject_type, 'signal');
|
|
|
|
create index if not exists idx_backtest_runs_subject_started_desc
|
|
on backtest_runs (subject_type, started_ts desc);
|
|
|
|
create index if not exists idx_backtest_runs_plan_started_desc
|
|
on backtest_runs (trading_plan_id, started_ts desc);
|
|
|
|
alter table if exists backtest_results
|
|
add column if not exists trading_plan_id bigint references trading_plans(id),
|
|
add column if not exists candidate_id bigint references trade_plan_candidates(id),
|
|
add column if not exists candidate_model_code text;
|
|
|
|
create index if not exists idx_backtest_results_plan_id
|
|
on backtest_results (trading_plan_id, id desc);
|
|
|
|
create index if not exists idx_backtest_results_candidate_id
|
|
on backtest_results (candidate_id, id desc);
|