1 defmodule Pleroma.Repo.Migrations.FillRecipientsInActivities do
3 alias Pleroma.{Repo, Activity}
6 max = Repo.aggregate(Activity, :max, :id)
9 IO.puts("#{max} activities")
10 chunks = 0..round(max / 10_000)
12 Enum.each(chunks, fn i ->
17 update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{