akkoma/priv/repo/migrations/20220805123645_remove_remote_cancelled_follow_requests.exs
floatingghost 0ec3a11895
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
don't persist undo of follows (#149)
Reviewed-on: #149
2022-08-05 13:28:56 +00:00

35 lines
571 B
Elixir

defmodule Pleroma.Repo.Migrations.RemoveRemoteCancelledFollowRequests do
use Ecto.Migration
def up do
statement = """
DELETE FROM
activities
WHERE
(data->>'type') = 'Follow'
AND
(data->>'state') = 'cancelled'
AND
local = false;
"""
execute(statement)
statement = """
DELETE FROM
activities
WHERE
(data->>'type') = 'Undo'
AND
(data->'object'->>'type') = 'Follow'
AND
local = false;
"""
execute(statement)
end
def down do
:ok
end
end