prop/priv/repo/migrations/20260416142116_drop_era5_cds_jobs.exs
Graham McIntire 3604896726
Rename ERA5 → NARR across the codebase
- Schema: Era5Profile → NarrProfile; table renamed via migration
  rename_era5_profiles_to_narr_profiles (ALTER TABLE + rename indexes,
  atomic and instant, no row rewrite)
- Weather helpers: find_nearest_era5/era5_for_contact/era5_profiles_for_path
  → find_nearest_narr/narr_for_contact/narr_profiles_for_path
- BackfillEnqueueWorker: :era5 → :narr type (virtual, no narr_status column);
  reconcile_stale_queued_to_unavailable and status_priority_order now skip
  virtual types via @virtual_types. Fixes the prod crash where the cron tried
  to update a non-existent era5_status column.
- ContactWeatherEnqueueWorker: build_era5_jobs → build_narr_jobs,
  era5_jobs_for_contact → narr_jobs_for_contact
- ContactLive: @era5 → @narr, maybe_enqueue_era5 → maybe_enqueue_narr;
  UI label "ERA5 (0.25°)" → "NARR (32 km)"
- Cron (runtime.exs): args types list now "narr" instead of "era5"
- /status: progress row, status-by-type card, totals.narr_profiles, and
  table-count lookup all target narr_profiles
- Drop obsolete Era5CdsJob schema + era5_cds_jobs table (inspection
  artifact from the retired CDS pipeline; 34 orphan rows in prod)
- Misc docstring/comment cleanups (skew_t, about, wgrib2, propagation_train)

Includes a regression test for the virtual-type crash.
2026-04-16 09:22:23 -05:00

29 lines
977 B
Elixir

defmodule Microwaveprop.Repo.Migrations.DropEra5CdsJobs do
use Ecto.Migration
# The ERA5/CDS pipeline was retired in favor of NARR (see
# rename_era5_profiles_to_narr_profiles). Orphan rows in this table are
# useless without the workers that wrote them.
def up do
drop table(:era5_cds_jobs)
end
def down do
create table(:era5_cds_jobs, primary_key: false) do
add :id, :binary_id, primary_key: true
add :year, :integer, null: false
add :month, :integer, null: false
add :tile_lat, :integer, null: false
add :tile_lon, :integer, null: false
add :single_job_id, :string, null: false
add :pressure_job_id, :string, null: false
add :submitted_at, :utc_datetime, null: false
add :last_polled_at, :utc_datetime
add :poll_count, :integer, default: 0, null: false
timestamps(type: :utc_datetime)
end
create unique_index(:era5_cds_jobs, [:year, :month, :tile_lat, :tile_lon])
end
end