Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Update hydrate command

Uku Tahtee4f604712ed
diff --git a/lib/mix/tasks/hydrate_clickhouse.ex b/lib/mix/tasks/hydrate_clickhouse.ex
index a8f9776bcd..1254baa8a8 100644
--- a/lib/mix/tasks/hydrate_clickhouse.ex
+++ b/lib/mix/tasks/hydrate_clickhouse.ex
@@ -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)