From: rinpatch Date: Fri, 7 Aug 2020 19:05:17 +0000 (+0300) Subject: 20200802170532_fix_legacy_tags: Select only fields the migration needs X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=a818587467feb1f5d5ad1f9499e61dcd7184e864;p=akkoma 20200802170532_fix_legacy_tags: Select only fields the migration needs Selecting the full struct will break as soon as a new field is added. --- diff --git a/priv/repo/migrations/20200802170532_fix_legacy_tags.exs b/priv/repo/migrations/20200802170532_fix_legacy_tags.exs index f7274b44e..a84b5d0f6 100644 --- a/priv/repo/migrations/20200802170532_fix_legacy_tags.exs +++ b/priv/repo/migrations/20200802170532_fix_legacy_tags.exs @@ -18,7 +18,10 @@ defmodule Pleroma.Repo.Migrations.FixLegacyTags do def change do legacy_tags = Map.keys(@old_new_map) - from(u in User, where: fragment("? && ?", u.tags, ^legacy_tags)) + from(u in User, + where: fragment("? && ?", u.tags, ^legacy_tags), + select: struct(u, [:tags, :id]) + ) |> Repo.all() |> Enum.each(fn user -> fix_tags_changeset(user)