forked from AkkomaGang/akkoma
Add migration to remove invalid activity expirations
This commit is contained in:
parent
ad29a4f2cf
commit
2e7c5fe2de
1 changed files with 20 additions and 0 deletions
20
priv/repo/migrations/20200808173046_only_expire_creates.exs
Normal file
20
priv/repo/migrations/20200808173046_only_expire_creates.exs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.OnlyExpireCreates do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
statement = """
|
||||||
|
DELETE FROM
|
||||||
|
activity_expirations A USING activities B
|
||||||
|
WHERE
|
||||||
|
A.activity_id = B.id
|
||||||
|
AND B.local = false
|
||||||
|
AND B.data->>'type' != 'Create';
|
||||||
|
"""
|
||||||
|
|
||||||
|
execute(statement)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue