1 defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
4 import Ecto.Query, only: [from: 2]
7 Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
8 strategy: :one_for_one,
9 name: Pleroma.Supervisor
12 from(e in "activity_expirations",
13 select: %{id: e.id, activity_id: e.activity_id, scheduled_at: e.scheduled_at}
15 |> Pleroma.Repo.stream()
16 |> Stream.each(fn expiration ->
17 with {:ok, expires_at} <- DateTime.from_naive(expiration.scheduled_at, "Etc/UTC") do
18 Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
19 activity_id: FlakeId.to_string(expiration.activity_id),
20 expires_at: expires_at,