migration to remove old cron jobs
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Fri, 11 Sep 2020 06:09:28 +0000 (09:09 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Fri, 11 Sep 2020 06:09:28 +0000 (09:09 +0300)
priv/repo/migrations/20200911055909_remove_cron_jobs.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20200911055909_remove_cron_jobs.exs b/priv/repo/migrations/20200911055909_remove_cron_jobs.exs
new file mode 100644 (file)
index 0000000..33897d1
--- /dev/null
@@ -0,0 +1,20 @@
+defmodule Pleroma.Repo.Migrations.RemoveCronJobs do
+  use Ecto.Migration
+
+  import Ecto.Query, only: [from: 2]
+
+  def up do
+    from(j in "oban_jobs",
+      where:
+        j.worker in ^[
+          "Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker",
+          "Pleroma.Workers.Cron.StatsWorker",
+          "Pleroma.Workers.Cron.ClearOauthTokenWorker"
+        ],
+      select: [:id]
+    )
+    |> Pleroma.Repo.delete_all()
+  end
+
+  def down, do: :ok
+end