logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 25cffffaf1685ef02cd318bdbd99bb325d295458
parent: 2411d092157e14caf45b3bc70cfc3b1c1478ac50
Author: kaniini <ariadne@dereferenced.org>
Date:   Sun,  6 Oct 2019 15:15:00 +0000

Merge branch 'fix/bad-migration' into 'develop'

Fix muted notification migration only working with a schema

See merge request pleroma/pleroma!1803

Diffstat:

Mpriv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs13+------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs b/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs @@ -1,19 +1,8 @@ defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do use Ecto.Migration - import Ecto.Query alias Pleroma.User def change do - 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 -> - info_cng = - Ecto.Changeset.cast(info, %{muted_notifications: mutes}, [:muted_notifications]) - - Ecto.Changeset.change(user) - |> Ecto.Changeset.put_embed(:info, info_cng) - |> Pleroma.Repo.update() - end) + execute("update users set info = jsonb_set(info, '{muted_notifications}', info->'mutes', true) where local = true") end end