Merge pull request 'Manually define PATH for Arch Linux users in systemd unit' (...
[akkoma] / priv / repo / migrations / 20200808173046_only_expire_creates.exs
1 defmodule Pleroma.Repo.Migrations.OnlyExpireCreates do
2 use Ecto.Migration
3
4 def up do
5 statement = """
6 DELETE FROM
7 activity_expirations a_exp USING activities a, objects o
8 WHERE
9 a_exp.activity_id = a.id AND (o.data->>'id') = COALESCE(a.data->'object'->>'id', a.data->>'object')
10 AND (a.data->>'type' != 'Create' OR o.data->>'type' != 'Note');
11 """
12
13 execute(statement)
14 end
15
16 def down do
17 :ok
18 end
19 end