Skip to content

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

Update migration that failed to run (#5946)

Adam Rutkowskic78ddf6ba41a
diff --git a/priv/repo/migrations/20251211110619_goals_custom_props_default.exs b/priv/repo/migrations/20251211110619_goals_custom_props_default.exs
index e08ac4e235..e3b1dd0a91 100644
--- a/priv/repo/migrations/20251211110619_goals_custom_props_default.exs
+++ b/priv/repo/migrations/20251211110619_goals_custom_props_default.exs
@@ -2,8 +2,23 @@ defmodule Plausible.Repo.Migrations.GoalsCustomPropsDefault do
use Ecto.Migration
def change do
+ drop(
+ unique_index(:goals, [:site_id, :event_name, :custom_props],
+ where: "event_name IS NOT NULL",
+ name: :goals_event_config_unique
+ )
+ )
+
alter table(:goals) do
- modify(:custom_props, :map, null: false, default: %{})
+ remove :custom_props
+ add :custom_props, :map, null: false, default: %{}
end
+
+ create(
+ unique_index(:goals, [:site_id, :event_name, :custom_props],
+ where: "event_name IS NOT NULL",
+ name: :goals_event_config_unique
+ )
+ )
end
end