Skip to content

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

Drop old (unused) time-on-page columns from imported_pages (#5185)

Karl-Aksel Puulmannc7ed5971da4a
diff --git a/priv/ingest_repo/migrations/20250312063938_imported_pages_remove_old_time_on_page_columns.exs b/priv/ingest_repo/migrations/20250312063938_imported_pages_remove_old_time_on_page_columns.exs
new file mode 100644
index 0000000000..69b1411621
--- /dev/null
+++ b/priv/ingest_repo/migrations/20250312063938_imported_pages_remove_old_time_on_page_columns.exs
@@ -0,0 +1,23 @@
+defmodule Plausible.IngestRepo.Migrations.ImportedPagesRemoveOldTimeOnPageColumns do
+ use Ecto.Migration
+
+ def up do
+ on_cluster = Plausible.MigrationUtils.on_cluster_statement("imported_pages")
+
+ execute """
+ ALTER TABLE imported_pages
+ #{on_cluster}
+ DROP COLUMN IF EXISTS time_on_page
+ """
+
+ execute """
+ ALTER TABLE imported_pages
+ #{on_cluster}
+ DROP COLUMN IF EXISTS active_visitors
+ """
+ end
+
+ def down do
+ raise "Irreversible"
+ end
+end