You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/lib/plausible/migration_utils.ex

13 lines
338 B
Elixir

defmodule Plausible.MigrationUtils do
@moduledoc """
Base module for to use in Clickhouse migrations
"""
def on_cluster_statement(table) do
case Plausible.IngestRepo.query("SELECT 1 FROM system.replicas WHERE table = '#{table}'") do
{:ok, %{rows: []}} -> ""
{:ok, _} -> "ON CLUSTER '{cluster}'"
end
end
end