26 lines
937 B
Elixir
26 lines
937 B
Elixir
defmodule Aprsme.Repo.Migrations.DropPacketsNotifyTrigger do
|
|
use Ecto.Migration
|
|
|
|
@moduledoc """
|
|
Removes the per-row `packets_notify_insert` trigger. Packet broadcasts are
|
|
now produced directly from `Aprsme.PacketConsumer` after batch insert,
|
|
eliminating DB-side JSON serialization and LISTEN/NOTIFY overhead.
|
|
|
|
The `aprs_events` channel (for bad packets) is untouched.
|
|
"""
|
|
|
|
def up do
|
|
execute("SET LOCAL statement_timeout = '0'")
|
|
|
|
execute("DROP TRIGGER IF EXISTS packets_notify_insert ON packets")
|
|
execute("DROP FUNCTION IF EXISTS notify_packets_insert() CASCADE")
|
|
end
|
|
|
|
def down do
|
|
# Recreating the function/trigger here would require duplicating the full
|
|
# JSON payload definition from prior migrations. Leaving as a no-op; if a
|
|
# rollback is truly needed, restore from the prior migrations that defined
|
|
# it (e.g. 20250728230000_add_missing_fields_to_packet_notify.exs).
|
|
:ok
|
|
end
|
|
end
|