summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2020-08-13 17:38:19 +0000
committerfeld <feld@feld.me>2020-08-13 17:38:19 +0000
commit14a06e63f661cc964a799a62c87103a00ba0c5e0 (patch)
treeb35b19c925a40b273f63ac00e18f8fa8645c7ad8 /priv
parentfbc220d09c25057edfc1eae539fdb68d0cc7a933 (diff)
parent29a7bcd5bbb3a39fe1b31c9f5ffc0077f23fc101 (diff)
Merge branch 'fix/activity-expirations-again' into 'develop'
Fix activity expirations again See merge request pleroma/pleroma!2866
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20200808173046_only_expire_creates.exs19
1 files changed, 19 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200808173046_only_expire_creates.exs b/priv/repo/migrations/20200808173046_only_expire_creates.exs
new file mode 100644
index 000000000..9df52956f
--- /dev/null
+++ b/priv/repo/migrations/20200808173046_only_expire_creates.exs
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.OnlyExpireCreates do
+ use Ecto.Migration
+
+ def up do
+ statement = """
+ DELETE FROM
+ activity_expirations a_exp USING activities a, objects o
+ WHERE
+ a_exp.activity_id = a.id AND (o.data->>'id') = COALESCE(a.data->'object'->>'id', a.data->>'object')
+ AND (a.data->>'type' != 'Create' OR o.data->>'type' != 'Note');
+ """
+
+ execute(statement)
+ end
+
+ def down do
+ :ok
+ end
+end