20200802170532_fix_legacy_tags: chunk the user query
authorrinpatch <rinpatch@sdf.org>
Fri, 7 Aug 2020 19:10:09 +0000 (22:10 +0300)
committerrinpatch <rinpatch@sdf.org>
Mon, 10 Aug 2020 08:56:37 +0000 (11:56 +0300)
priv/repo/migrations/20200802170532_fix_legacy_tags.exs

index a84b5d0f63793b9e5967c55318d0a026a7bfe6c1..ca82fac4299ce8e05817bffe61f353a4d28c0a35 100644 (file)
@@ -22,7 +22,7 @@ defmodule Pleroma.Repo.Migrations.FixLegacyTags do
       where: fragment("? && ?", u.tags, ^legacy_tags),
       select: struct(u, [:tags, :id])
     )
-    |> Repo.all()
+    |> Repo.chunk_stream(100)
     |> Enum.each(fn user ->
       fix_tags_changeset(user)
       |> Repo.update()