Fix the use of queries with a schema in a migration

This commit is contained in:
rinpatch 2019-10-06 17:05:51 +03:00
parent fefbd31c6e
commit 125f96e706
1 changed files with 2 additions and 7 deletions

View File

@ -1,15 +1,10 @@
defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
use Ecto.Migration
import Ecto.Query
alias Pleroma.User
def change do
query =
User.Query.build(%{
local: true,
active: true,
order_by: :id
})
query = from(u in "users", where: fragment("not (?->'deactivated' @> 'true')", u.info), select: %{info: u.info}, where: u.local == true, order_by: u.id)
Pleroma.Repo.stream(query)
|> Enum.each(fn
%{info: %{mutes: mutes} = info} = user ->