From 1f778e0c11f76fb0a47289d759e491006ae12145 Mon Sep 17 00:00:00 2001 From: hq1 Date: Wed, 3 Apr 2024 09:42:47 +0200 Subject: [PATCH] CH Migration: exit page hostname on sessions_v2 (#3953) * CH Migration: exit/entry hostnames in sessions_v2 * Leave only exit_page_hostname, we already record hostnames * Use ClickHouse DDL in favour of ecto so that cluster is included * Compress with ZSTD(3) --- .../20240327085855_hostnames_in_sessions.exs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 priv/ingest_repo/migrations/20240327085855_hostnames_in_sessions.exs diff --git a/priv/ingest_repo/migrations/20240327085855_hostnames_in_sessions.exs b/priv/ingest_repo/migrations/20240327085855_hostnames_in_sessions.exs new file mode 100644 index 000000000..48c4ab28e --- /dev/null +++ b/priv/ingest_repo/migrations/20240327085855_hostnames_in_sessions.exs @@ -0,0 +1,19 @@ +defmodule Plausible.ClickhouseRepo.Migrations.HostnamesInSessions do + use Ecto.Migration + + def up do + execute """ + ALTER TABLE sessions_v2 + #{Plausible.MigrationUtils.on_cluster_statement("sessions_v2")} + ADD COLUMN exit_page_hostname String CODEC(ZSTD(3)) + """ + end + + def down do + execute """ + ALTER TABLE sessions_v2 + #{Plausible.MigrationUtils.on_cluster_statement("sessions_v2")} + DROP COLUMN exit_page_hostname + """ + end +end