summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200915095704_remove_background_jobs.exs
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations/20200915095704_remove_background_jobs.exs')
-rw-r--r--priv/repo/migrations/20200915095704_remove_background_jobs.exs22
1 files changed, 22 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200915095704_remove_background_jobs.exs b/priv/repo/migrations/20200915095704_remove_background_jobs.exs
new file mode 100644
index 000000000..9785bfb8a
--- /dev/null
+++ b/priv/repo/migrations/20200915095704_remove_background_jobs.exs
@@ -0,0 +1,22 @@
+defmodule Pleroma.Repo.Migrations.RemoveBackgroundJobs do
+ use Ecto.Migration
+
+ import Ecto.Query, only: [from: 2]
+
+ def up do
+ from(j in "oban_jobs",
+ where:
+ j.queue == ^"background" and
+ fragment("?->>'op'", j.args) in ^[
+ "fetch_data_for_activity",
+ "media_proxy_prefetch",
+ "media_proxy_preload"
+ ] and
+ j.worker == ^"Pleroma.Workers.BackgroundWorker",
+ select: [:id]
+ )
+ |> Pleroma.Repo.delete_all()
+ end
+
+ def down, do: :ok
+end