Skip to content

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

Add migration to add site_annotations feature to enterprise plans (#6482)

Artur Pata354e47ce3670
diff --git a/priv/repo/migrations/20260603124900_add_site_annotations_feature_to_enterprise_plans.exs b/priv/repo/migrations/20260603124900_add_site_annotations_feature_to_enterprise_plans.exs
new file mode 100644
index 0000000000..71ffe39e48
--- /dev/null
+++ b/priv/repo/migrations/20260603124900_add_site_annotations_feature_to_enterprise_plans.exs
@@ -0,0 +1,20 @@
+defmodule Plausible.Repo.Migrations.AddSiteAnnotationsFeatureToEnterprisePlans do
+ use Ecto.Migration
+
+ def up do
+ execute """
+ UPDATE enterprise_plans
+ SET features = array_append(features, 'site_annotations')
+ WHERE features @> ARRAY['props', 'stats_api', 'funnels', 'revenue_goals']::varchar[]
+ AND NOT (features @> ARRAY['site_annotations']::varchar[])
+ """
+ end
+
+ def down do
+ execute """
+ UPDATE enterprise_plans
+ SET features = array_remove(features, 'site_annotations')
+ WHERE features @> ARRAY['props', 'stats_api', 'funnels', 'revenue_goals', 'site_annotations']::varchar[]
+ """
+ end
+end