analytics/lib/mix/tasks/clean_clickhouse.ex
Uku Taht 4b36bb7138
Use clickhouse_ecto for db connection (#317)
* Use clickhouse-ecto for stats

* Use clickhouse ecto instead of low-level clickhousex

* Remove defaults from event schema

* Remove all references to Clickhousex

* Document configuration change

* Ensure createdb and migrations can be run in a release

* Remove config added for debug

* Update plausible_variables.sample.env
2020-09-17 16:36:01 +03:00

11 lines
335 B
Elixir

defmodule Mix.Tasks.CleanClickhouse do
use Mix.Task
def run(_) do
clean_events = "ALTER TABLE events DELETE WHERE 1"
clean_sessions = "ALTER TABLE sessions DELETE WHERE 1"
Ecto.Adapters.SQL.query!(Plausible.ClickhouseRepo, clean_events)
Ecto.Adapters.SQL.query!(Plausible.ClickhouseRepo, clean_sessions)
end
end