Skip to content

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

Add site_segments feature to enterprise plans (#5149)

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