2023-02-23 11:34:44 +03:00
|
|
|
defmodule Plausible.IngestRepo.Migrations.CreateIngestCountersTable do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create_if_not_exists table(:ingest_counters,
|
2023-03-21 11:55:59 +03:00
|
|
|
primary_key: false,
|
|
|
|
engine: "SummingMergeTree(value)",
|
|
|
|
options:
|
|
|
|
"ORDER BY (domain, toDate(event_timebucket), metric, toStartOfMinute(event_timebucket))"
|
|
|
|
) do
|
2023-02-23 11:34:44 +03:00
|
|
|
add(:event_timebucket, :utc_datetime)
|
|
|
|
add(:domain, :"LowCardinality(String)")
|
|
|
|
add(:site_id, :"Nullable(UInt64)")
|
|
|
|
add(:metric, :"LowCardinality(String)")
|
|
|
|
add(:value, :UInt64)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|