1 defmodule Pleroma.Repo.Migrations.DeleteNotificationWithoutActivity do
9 q in Pleroma.Notification,
10 left_join: c in assoc(q, :activity),
11 select: %{id: type(q.id, :integer)},
14 |> Repo.chunk_stream(1_000, :bacthes)
15 |> Stream.each(fn records ->
16 notification_ids = Enum.map(records, fn %{id: id} -> id end)
19 from(n in "notifications",
20 where: n.id in ^notification_ids