20200802170532_fix_legacy_tags: Select only fields the migration needs

Selecting the full struct will break as soon as a new field is added.
This commit is contained in:
rinpatch 2020-08-07 22:05:17 +03:00
parent 0149dd0146
commit a818587467
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@ defmodule Pleroma.Repo.Migrations.FixLegacyTags do
def change do def change do
legacy_tags = Map.keys(@old_new_map) 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() |> Repo.all()
|> Enum.each(fn user -> |> Enum.each(fn user ->
fix_tags_changeset(user) fix_tags_changeset(user)