Skip to content
Snippets Groups Projects
Commit d8dd945a authored by lain's avatar lain
Browse files

Markers migration: Fix migration for very large list of markers

parent 768c18fa
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,13 @@ defp update_markers 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(1000)
|> Enum.each(fn marker_attrs ->
Repo.insert_all("markers", markers_attrs,
on_conflict: {:replace, [:last_read_id]},
conflict_target: [:user_id, :timeline]
)
end)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment