diff --git a/priv/repo/migrations/20251025183718_add_callsign_search_indexes.exs b/priv/repo/migrations/20251025183718_add_callsign_search_indexes.exs index 0d14115..194eb13 100644 --- a/priv/repo/migrations/20251025183718_add_callsign_search_indexes.exs +++ b/priv/repo/migrations/20251025183718_add_callsign_search_indexes.exs @@ -1,10 +1,19 @@ defmodule Aprsme.Repo.Migrations.AddCallsignSearchIndexes do use Ecto.Migration + @disable_ddl_transaction true + @disable_migration_lock true def up do - # In test environment, skip index creation to avoid timeout issues - # Indexes will be created in production where the table has actual data - if Mix.env() != :test do + # Check if we're in a test environment by looking at the repo config + # In test, the pool is Ecto.Adapters.SQL.Sandbox which doesn't support CONCURRENTLY + pool_module = Aprsme.Repo.config()[:pool] + + if pool_module == Ecto.Adapters.SQL.Sandbox do + # Test environment - skip index creation to avoid timeout issues + # The test database is empty anyway + :ok + else + # Production/dev environment - create indexes with CONCURRENTLY # Add index on sender for pattern matching searches # Using text_pattern_ops for LIKE/ILIKE queries via raw SQL execute """