Skip to content

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

Page Scroll Goals: migration step 3 (#5036)

RobertJoonaseb984c363a31
diff --git a/priv/repo/migrations/20250130121019_drop_unique_page_path_constraint_from_goals.exs b/priv/repo/migrations/20250130121019_drop_unique_page_path_constraint_from_goals.exs
new file mode 100644
index 0000000000..aa4a86387f
--- /dev/null
+++ b/priv/repo/migrations/20250130121019_drop_unique_page_path_constraint_from_goals.exs
@@ -0,0 +1,22 @@
+defmodule Plausible.Repo.Migrations.DropUniquePagePathConstraintFromGoals do
+ use Ecto.Migration
+
+ @disable_ddl_transaction true
+ @disable_migration_lock true
+
+ # Plausible.Repo.Migrations.GoalsUnique
+ @old_index unique_index(
+ :goals,
+ [:site_id, :page_path],
+ where: "page_path IS NOT NULL",
+ name: :goals_page_path_unique
+ )
+
+ def up do
+ drop(@old_index)
+ end
+
+ def down do
+ create(@old_index)
+ end
+end