analytics/lib/mix/tasks/clean_clickhouse.ex

11 lines
335 B
Elixir
Raw Normal View History

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