From b47a924a6c0d2101a70350c4af2e9e2b2d00ea0f Mon Sep 17 00:00:00 2001 From: Artur Pata Date: Fri, 3 Jul 2026 12:52:48 +0300 Subject: [PATCH] Add migration to add site_annotations feature to enterprise plans --- ...nnotations_feature_to_enterprise_plans.exs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 priv/repo/migrations/20260603124900_add_site_annotations_feature_to_enterprise_plans.exs 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 000000000000..71ffe39e48a7 --- /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