blob: cbea18205ec7a9285256032982ff61764682e448 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
defmodule Pleroma.Repo.Migrations.PublisherJobChange do
use Ecto.Migration
alias Pleroma.Activity
alias Pleroma.Repo
import Ecto.Query
def up do
query =
from(j in Oban.Job,
where: j.worker == "Pleroma.Workers.PublisherWorker",
where: j.state in ["available", "retryable"]
)
jobs = Repo.all(query)
Enum.each(jobs, fn job ->
args = job.args
case Activity.get_by_ap_id(args["id"]) do
nil ->
:ok
%Activity{id: activity_id} ->
updated_args = Map.put(args, "activity_id", activity_id)
Pleroma.Workers.PublisherWorker.new(updated_args)
|> Oban.insert()
end
end)
end
end
|