First
[anni] / priv / repo / migrations / 20200915095704_remove_background_jobs.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo.Migrations.RemoveBackgroundJobs do
6   use Ecto.Migration
7
8   import Ecto.Query, only: [from: 2]
9
10   def up do
11     from(j in "oban_jobs",
12       where:
13         j.queue == ^"background" and
14           fragment("?->>'op'", j.args) in ^[
15             "fetch_data_for_activity",
16             "media_proxy_prefetch",
17             "media_proxy_preload"
18           ] and
19           j.worker == ^"Pleroma.Workers.BackgroundWorker",
20       select: [:id]
21     )
22     |> Pleroma.Repo.delete_all()
23   end
24
25   def down, do: :ok
26 end