Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Migration: goal custom props + revamped unique constraints (#5940)
Adam Rutkowskib299aa352a19
diff --git a/priv/repo/migrations/20251209120138_goals_custom_props.exs b/priv/repo/migrations/20251209120138_goals_custom_props.exsnew file mode 100644index 0000000000..31ea4b5930--- /dev/null+++ b/priv/repo/migrations/20251209120138_goals_custom_props.exs@@ -0,0 +1,41 @@+defmodule Plausible.Repo.Migrations.GoalsCustomProps do+ use Ecto.Migration++ @disable_ddl_transaction true+ @disable_migration_lock true++ # adds custom_props to goals, but also updates unique constraints to guard for either display name+ # or broadly speaking "goal configuration"++ def change do+ drop(unique_index(:goals, [:site_id, :event_name], name: :goals_event_name_unique))++ drop(+ unique_index(:goals, [:site_id, :page_path, :scroll_threshold],+ name: :goals_page_path_and_scroll_threshold_unique+ )+ )++ drop(unique_index(:goals, [:site_id, :display_name], name: :goals_site_id_display_name_index))++ alter table(:goals) do+ add(:custom_props, :map)+ end++ create(+ unique_index(:goals, [:site_id, :event_name, :custom_props],+ where: "event_name IS NOT NULL",+ name: :goals_event_config_unique+ )+ )++ create(+ unique_index(:goals, [:site_id, :page_path, :scroll_threshold],+ where: "page_path IS NOT NULL",+ name: :goals_pageview_config_unique+ )+ )++ create(unique_index(:goals, [:site_id, :display_name], name: :goals_display_name_unique))+ end+end