Add a migration to clean up activity_expirations table
authorMark Felder <feld@FreeBSD.org>
Tue, 4 Aug 2020 18:12:23 +0000 (13:12 -0500)
committerMark Felder <feld@FreeBSD.org>
Tue, 4 Aug 2020 19:58:42 +0000 (14:58 -0500)
priv/repo/migrations/20200804180322_remove_nonlocal_expirations.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20200804180322_remove_nonlocal_expirations.exs b/priv/repo/migrations/20200804180322_remove_nonlocal_expirations.exs
new file mode 100644 (file)
index 0000000..389935f
--- /dev/null
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.RemoveNonlocalExpirations 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;
+    """
+
+    execute(statement)
+  end
+
+  def down do
+    :ok
+  end
+end