From ccae03056996fa54b2e3d6468a3c8f4f62667969 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 15 Jan 2026 07:29:49 -0600 Subject: [PATCH] Remove duplicate agent index migration Removed 20260115010756_add_agent_query_composite_indexes.exs which was a duplicate of 20260115010646_add_composite_indexes_for_agent_queries.exs. Both had already run but the duplicate one used create_if_not_exists so it didn't fail. Cleaned up to avoid confusion. --- ...0756_add_agent_query_composite_indexes.exs | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 priv/repo/migrations/20260115010756_add_agent_query_composite_indexes.exs diff --git a/priv/repo/migrations/20260115010756_add_agent_query_composite_indexes.exs b/priv/repo/migrations/20260115010756_add_agent_query_composite_indexes.exs deleted file mode 100644 index 17db037c..00000000 --- a/priv/repo/migrations/20260115010756_add_agent_query_composite_indexes.exs +++ /dev/null @@ -1,21 +0,0 @@ -defmodule Towerops.Repo.Migrations.AddAgentQueryCompositeIndexes do - use Ecto.Migration - - def change do - # Composite index for agent assignment queries that filter by both agent_token_id and enabled - # This improves queries like: WHERE agent_token_id = ? AND enabled = true - create_if_not_exists index(:agent_assignments, [:agent_token_id, :enabled]) - - # Composite index for filtering agents by organization and enabled status - # This improves queries like: WHERE organization_id = ? AND enabled = true - create_if_not_exists index(:agent_tokens, [:organization_id, :enabled]) - - # Composite index for finding online agents (organization + last_seen_at) - # This improves queries that filter by org and sort by last_seen_at - create_if_not_exists index(:agent_tokens, [:organization_id, :last_seen_at]) - - # Composite index for equipment assignment queries (equipment_id + enabled) - # This improves queries that check if equipment has an active assignment - create_if_not_exists index(:agent_assignments, [:equipment_id, :enabled]) - end -end