diff --git a/lib/aprsme_web/live/map_live/index.ex b/lib/aprsme_web/live/map_live/index.ex index efd3edb..593cd66 100644 --- a/lib/aprsme_web/live/map_live/index.ex +++ b/lib/aprsme_web/live/map_live/index.ex @@ -153,6 +153,8 @@ defmodule AprsmeWeb.MapLive.Index do defp assign_defaults(socket, one_hour_ago) do assign(socket, packets: [], + all_packets: %{}, + visible_packets: %{}, page_title: "APRS Map", packet_state: PacketManager.init_packet_state(), station_popup_open: false, diff --git a/priv/repo/migrations/20250715155632_remove_duplicate_received_at_indexes.exs b/priv/repo/migrations/20250715155632_remove_duplicate_received_at_indexes.exs new file mode 100644 index 0000000..3fab734 --- /dev/null +++ b/priv/repo/migrations/20250715155632_remove_duplicate_received_at_indexes.exs @@ -0,0 +1,23 @@ +defmodule Aprsme.Repo.Migrations.RemoveDuplicateReceivedAtIndexes do + use Ecto.Migration + + def up do + # Remove duplicate indexes on received_at column + # Keep only packets_received_at_idx which is the most general purpose + drop_if_exists index(:packets, [:received_at], name: :packets_received_at_asc_idx) + drop_if_exists index(:packets, [:received_at], name: :packets_recent_hour_idx) + end + + def down do + # Recreate the removed indexes + create_if_not_exists index(:packets, [:received_at], + name: :packets_received_at_asc_idx, + comment: "Index for cleanup worker queries (ascending for old packets)" + ) + + create_if_not_exists index(:packets, [:received_at], + name: :packets_recent_hour_idx, + comment: "Index for recent packet queries" + ) + end +end