Update hydrate command

This commit is contained in:
Uku Taht 2020-05-21 19:08:39 +03:00
parent 578523170f
commit ee4f604712

View File

@ -98,12 +98,13 @@ defmodule Mix.Tasks.HydrateClickhouse do
end
def hydrate_events(repo, _args \\ []) do
start_time = ~N[2020-05-01 00:00:00]
end_time = ~N[2020-05-21 10:46:51]
total = Repo.aggregate(from(e in Plausible.Event, where: e.timestamp < ^end_time), :count, :id)
total = Repo.aggregate(from(e in Plausible.Event, where: e.timestamp < ^end_time and e.timestamp >= ^start_time), :count, :id)
event_chunks = from(
e in Plausible.Event,
where: e.timestamp < ^end_time,
where: e.timestamp < ^end_time and e.timestamp >= ^start_time,
order_by: e.id
) |> chunk_query(50_000, repo)