1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-12-25 04:53:06 +00:00

Merge branch 'fix/flaky-migration-episode-666' into 'develop'

20200802170532_fix_legacy_tags: Select only fields the migration needs

See merge request pleroma/pleroma!2863
This commit is contained in:
rinpatch 2020-08-10 09:17:08 +00:00
commit 00a4980c61

View file

@ -18,8 +18,11 @@ 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))
|> Repo.all()
from(u in User,
where: fragment("? && ?", u.tags, ^legacy_tags),
select: struct(u, [:tags, :id])
)
|> Repo.chunk_stream(100)
|> Enum.each(fn user ->
fix_tags_changeset(user)
|> Repo.update()