defmodule Aprsme.Repo.Migrations.AddBaseCallsignTrigramIndex do
  use Ecto.Migration
  @disable_ddl_transaction true
  @disable_migration_lock true

  def up do
    execute """
    CREATE INDEX IF NOT EXISTS idx_packets_base_callsign_trgm
    ON packets USING gin (base_callsign gin_trgm_ops)
    WHERE base_callsign IS NOT NULL
    """
  end

  def down do
    execute "DROP INDEX IF EXISTS idx_packets_base_callsign_trgm"
  end
end
