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:
parent
0149dd0146
commit
a818587467
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue