prop/priv/repo/migrations/20260601202826_add_performance_indexes.exs
Graham McIntire d67186176f
fix: resolve all dialyzer type errors across project (46→0 project errors)
Type spec fixes:
- duct_usable_* return boolean→float (delegate to duct_usable_for_band)
- sanitize/1 spec includes :unicode error tuples
- match_delete/1 broadened from :ets.match_spec()
- telemetry_event local type replaces :telemetry.event/0
- wgrib2 parse_lon_val_segment corrected to tuple spec
- preloaded Ecto assoc types in get_mission/get_contact! specs

Unmatched returns:
- _ = prefix on Task.start, Oban.insert, Repo.query!, PubSub.subscribe,
  :ets.new, and if-expression returns across 18 files

Pattern match fixes:
- markdown: restructure acc!=[] guard as direct pattern match
- path_compute/pskr/skewt_location_resolver: remove dead clauses
- calibrate.aprs_144: remove unreachable format_float catch-all
- unused.ex: suppress MapSet.union no_opaque

Also: remove unused unicode_util_compat from mix.lock
2026-06-08 17:51:13 -05:00

43 lines
1.8 KiB
Elixir

defmodule Microwaveprop.Repo.Migrations.AddPerformanceIndexes do
use Ecto.Migration
def change do
# contacts.flagged_invalid — admin flagged-contacts page filters + sorts
create index(:contacts, [:flagged_invalid, :inserted_at, :id])
# contact_edits.inserted_at — ORDER BY DESC on list and per-contact queries
create index(:contact_edits, [:inserted_at])
# contact_edits(contact_id, user_id, status) — pending-edit lookup
create index(:contact_edits, [:contact_id, :user_id, :status])
# hrrr_profiles.surface_refractivity IS NULL — backfill query scans for nulls
create index(:hrrr_profiles, [:surface_refractivity],
where: "surface_refractivity IS NULL",
name: "hrrr_profiles_surface_refractivity_null_idx"
)
# hrrr_native_profiles.bulk_richardson IS NULL — derive task scans for nulls
create index(:hrrr_native_profiles, [:bulk_richardson],
where: "bulk_richardson IS NULL AND level_count > 2",
name: "hrrr_native_profiles_bulk_richardson_null_idx"
)
# grid_tasks.claimed_at for status='running' — reclaim-stale query
create index(:grid_tasks, [:claimed_at],
where: "status = 'running'",
name: "grid_tasks_running_claimed_at_idx"
)
# rover_mission_paths composite — worker lookup on all 4 columns
create index(:rover_mission_paths, [:mission_id, :rover_location_id, :station_id, :band_mhz],
name: "rover_mission_paths_lookup_idx"
)
# fixed_stations(user_id, position, inserted_at) — WHERE + ORDER BY
create index(:fixed_stations, [:user_id, :position, :inserted_at])
# beacons(user_id, inserted_at) — WHERE + ORDER BY
create index(:beacons, [:user_id, :inserted_at])
end
end