prop/priv/repo/migrations/20260331214714_add_point_forecast_index.exs
Graham McIntire 6145f80c22
Add forecast sparkline graph to point detail panel
- point_detail response includes forecast array (score per valid_time)
- SVG sparkline shows score trend across all forecast hours
- Trend indicator: Improving/Declining/Steady based on first vs last score
- Add covering index (band_mhz, lat, lon, valid_time) INCLUDE (score) for
  point_forecast queries
2026-03-31 16:47:52 -05:00

16 lines
671 B
Elixir

defmodule Microwaveprop.Repo.Migrations.AddPointForecastIndex do
use Ecto.Migration
def change do
# Covers point_forecast query: WHERE band_mhz AND lat AND lon ORDER BY valid_time
# INCLUDE score for index-only scan
create index(:propagation_scores, [:band_mhz, :lat, :lon, :valid_time],
include: [:score],
name: :propagation_scores_point_forecast_idx
)
# Covers available_valid_times query: WHERE band_mhz SELECT DISTINCT valid_time
# Already covered by propagation_scores_band_mhz_valid_time_index, but adding
# the prune query: DELETE WHERE valid_time < cutoff (covered by valid_time_index)
end
end