Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

add migration (#4932)

RobertJoonasc29b93f30c0a
diff --git a/priv/ingest_repo/migrations/20241231083407_add_pageleave_visitors_to_imported_pages.exs b/priv/ingest_repo/migrations/20241231083407_add_pageleave_visitors_to_imported_pages.exs
new file mode 100644
index 0000000000..64687c4322
--- /dev/null
+++ b/priv/ingest_repo/migrations/20241231083407_add_pageleave_visitors_to_imported_pages.exs
@@ -0,0 +1,21 @@
+defmodule Plausible.IngestRepo.Migrations.AddPageleaveVisitorsToImportedPages do
+ use Ecto.Migration
+
+ @on_cluster Plausible.MigrationUtils.on_cluster_statement("imported_pages")
+
+ def up do
+ execute """
+ ALTER TABLE imported_pages
+ #{@on_cluster}
+ ADD COLUMN pageleave_visitors UInt64
+ """
+ end
+
+ def down do
+ execute """
+ ALTER TABLE imported_pages
+ #{@on_cluster}
+ DROP COLUMN pageleave_visitors
+ """
+ end
+end