Merge pull request 'Manually define PATH for Arch Linux users in systemd unit' (...
[akkoma] / priv / repo / migrations / 20200527163635_delete_notifications_from_invisible_users.exs
1 defmodule Pleroma.Repo.Migrations.DeleteNotificationsFromInvisibleUsers do
2 use Ecto.Migration
3
4 import Ecto.Query
5 alias Pleroma.Repo
6
7 def up do
8 Pleroma.Notification
9 |> join(:inner, [n], activity in assoc(n, :activity))
10 |> where(
11 [n, a],
12 fragment("? in (SELECT ap_id FROM users WHERE invisible = true)", a.actor)
13 )
14 |> Repo.delete_all()
15 end
16
17 def down, do: :ok
18 end