+ Our propagation model improves with real-world data. Each verified microwave contact
+ you submit is matched against atmospheric conditions at the time of your contact,
+ helping us calibrate predictions for all bands from 10 GHz to 241 GHz. The more contacts
+ we have, the better our forecasts get for everyone.
+
diff --git a/priv/repo/migrations/20260401154846_partition_hrrr_profiles.exs b/priv/repo/migrations/20260401154846_partition_hrrr_profiles.exs
index 9b7bac31..f5910683 100644
--- a/priv/repo/migrations/20260401154846_partition_hrrr_profiles.exs
+++ b/priv/repo/migrations/20260401154846_partition_hrrr_profiles.exs
@@ -5,6 +5,28 @@ defmodule Microwaveprop.Repo.Migrations.PartitionHrrrProfiles do
@disable_migration_lock true
def up do
+ # Clean up any partial previous run: drop the partitioned table and orphaned
+ # partition tables, then rename _old back so we can start fresh.
+ execute """
+ DO $$
+ DECLARE
+ tbl text;
+ BEGIN
+ IF EXISTS (SELECT 1 FROM pg_tables WHERE tablename = 'hrrr_profiles_old' AND schemaname = 'public') THEN
+ DROP TABLE IF EXISTS hrrr_profiles CASCADE;
+ -- Drop orphaned partition tables left behind after CASCADE
+ FOR tbl IN
+ SELECT tablename FROM pg_tables
+ WHERE schemaname = 'public' AND tablename LIKE 'hrrr_profiles_%'
+ AND tablename != 'hrrr_profiles_old'
+ LOOP
+ EXECUTE 'DROP TABLE IF EXISTS ' || tbl || ' CASCADE';
+ END LOOP;
+ ALTER TABLE hrrr_profiles_old RENAME TO hrrr_profiles;
+ END IF;
+ END $$
+ """
+
# 1. Rename old table
execute "ALTER TABLE hrrr_profiles RENAME TO hrrr_profiles_old"
@@ -31,7 +53,7 @@ defmodule Microwaveprop.Repo.Migrations.PartitionHrrrProfiles do
) PARTITION BY RANGE (valid_time)
"""
- # 3. Create partitions (quarterly for historical, monthly for recent/future)
+ # 3. Create partitions
partitions = [
{"2016-01-01", "2017-01-01"},
{"2017-01-01", "2018-01-01"},
@@ -74,18 +96,15 @@ defmodule Microwaveprop.Repo.Migrations.PartitionHrrrProfiles do
"""
end
- # 4. Drop old indexes (they reference the renamed table) and create new ones
+ # 4. Indexes on partitioned table
execute "DROP INDEX IF EXISTS hrrr_profiles_lat_lon_valid_time_index"
execute "DROP INDEX IF EXISTS hrrr_profiles_valid_time_index"
execute "CREATE UNIQUE INDEX hrrr_profiles_lat_lon_valid_time_index ON hrrr_profiles (lat, lon, valid_time)"
-
execute "CREATE INDEX hrrr_profiles_valid_time_index ON hrrr_profiles (valid_time)"
- # 5. Migrate data from old table in batches to avoid long locks
- execute """
- INSERT INTO hrrr_profiles SELECT * FROM hrrr_profiles_old
- """
+ # 5. Migrate data
+ execute "INSERT INTO hrrr_profiles SELECT * FROM hrrr_profiles_old"
# 6. Drop old table
execute "DROP TABLE hrrr_profiles_old"
@@ -120,7 +139,6 @@ defmodule Microwaveprop.Repo.Migrations.PartitionHrrrProfiles do
execute "ALTER TABLE hrrr_profiles_flat RENAME TO hrrr_profiles"
execute "CREATE UNIQUE INDEX hrrr_profiles_lat_lon_valid_time_index ON hrrr_profiles (lat, lon, valid_time)"
-
execute "CREATE INDEX hrrr_profiles_valid_time_index ON hrrr_profiles (valid_time)"
end
end
diff --git a/test/microwaveprop_web/live/map_live_test.exs b/test/microwaveprop_web/live/map_live_test.exs
index d2556364..4063c6bc 100644
--- a/test/microwaveprop_web/live/map_live_test.exs
+++ b/test/microwaveprop_web/live/map_live_test.exs
@@ -43,7 +43,7 @@ defmodule MicrowavepropWeb.MapLiveTest do
test "renders submit QSO link", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/map")
- assert html =~ "Submit a QSO"
+ assert html =~ "Submit a Contact"
assert html =~ ~s(/submit)
end
end