forked from AkkomaGang/akkoma
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:
commit
00a4980c61
1 changed files with 5 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue