summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2020-08-08 12:33:37 -0500
committerMark Felder <feld@FreeBSD.org>2020-08-08 12:33:37 -0500
commit2e7c5fe2ded095c95f8596970d8fc3aaf0128f1b (patch)
tree47f923125af5eb82b222e60ed3adb718201fcfab /priv
parentad29a4f2cf4496aaa9463e11d94b35364e9cddae (diff)
Add migration to remove invalid activity expirations
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20200808173046_only_expire_creates.exs20
1 files changed, 20 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..5a34dc7c1
--- /dev/null
+++ b/priv/repo/migrations/20200808173046_only_expire_creates.exs
@@ -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