Skip to content

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

Migration: Add scroll_depth to imported_pages (#4908)

RobertJoonase82ae6599d08
diff --git a/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs b/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs
new file mode 100644
index 0000000000..d3a50e5dd7
--- /dev/null
+++ b/priv/ingest_repo/migrations/20241216133031_add_scroll_depth_to_imported_pages.exs
@@ -0,0 +1,21 @@
+defmodule Plausible.IngestRepo.Migrations.AddScrollDepthToImportedPages 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 scroll_depth UInt8 DEFAULT 255
+ """
+ end
+
+ def down do
+ execute """
+ ALTER TABLE imported_pages
+ #{@on_cluster}
+ DROP COLUMN scroll_depth
+ """
+ end
+end