Remove refresh instance triggers

There are not needed anymore, instances are always refreshed when adding
a new one, and we refresh periodically

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-05-06 12:52:39 +02:00
parent 2651f4cf40
commit 6a937d6ede
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -0,0 +1,33 @@
defmodule Mobilizon.Storage.Repo.Migrations.RemoveRefreshInstanceTriggers do
use Ecto.Migration
def up do
execute("""
DROP TRIGGER IF EXISTS refresh_instances_trigger_new ON actors;
""")
execute("""
DROP TRIGGER IF EXISTS refresh_instances_trigger_old ON actors;
""")
end
def down do
execute("""
CREATE TRIGGER refresh_instances_trigger_new
AFTER INSERT OR UPDATE
ON actors
FOR EACH ROW
WHEN (NEW.preferred_username = 'relay')
EXECUTE PROCEDURE refresh_instances();
""")
execute("""
CREATE TRIGGER refresh_instances_trigger_old
AFTER DELETE
ON actors
FOR EACH ROW
WHEN (OLD.preferred_username = 'relay')
EXECUTE PROCEDURE refresh_instances();
""")
end
end