summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200415181818_update_markers.exs
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations/20200415181818_update_markers.exs')
-rw-r--r--priv/repo/migrations/20200415181818_update_markers.exs12
1 files changed, 8 insertions, 4 deletions
diff --git a/priv/repo/migrations/20200415181818_update_markers.exs b/priv/repo/migrations/20200415181818_update_markers.exs
index 976363565..bb9d8e860 100644
--- a/priv/repo/migrations/20200415181818_update_markers.exs
+++ b/priv/repo/migrations/20200415181818_update_markers.exs
@@ -32,9 +32,13 @@ defmodule Pleroma.Repo.Migrations.UpdateMarkers do
|> Map.put_new(:updated_at, now)
end)
- Repo.insert_all("markers", markers_attrs,
- on_conflict: {:replace, [:last_read_id]},
- conflict_target: [:user_id, :timeline]
- )
+ markers_attrs
+ |> Enum.chunk_every(1000)
+ |> Enum.each(fn markers_attrs_chunked ->
+ Repo.insert_all("markers", markers_attrs_chunked,
+ on_conflict: {:replace, [:last_read_id]},
+ conflict_target: [:user_id, :timeline]
+ )
+ end)
end
end