Skip to content

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

Migration: email suppressions (#6693)

Adam7af78a6300f9
diff --git a/priv/repo/migrations/20260916070000_create_email_suppressions.exs b/priv/repo/migrations/20260916070000_create_email_suppressions.exs
new file mode 100644
index 0000000000..dc8b73db29
--- /dev/null
+++ b/priv/repo/migrations/20260916070000_create_email_suppressions.exs
@@ -0,0 +1,26 @@
+defmodule Plausible.Repo.Migrations.CreateEmailSuppressions do
+ use Ecto.Migration
+
+ import Plausible.MigrationUtils
+
+ def change do
+ if enterprise_edition?() do
+ create table(:email_suppressions) do
+ add :email, :citext, null: false
+ add :reason, :string, null: false
+ add :source, :string, null: false
+ add :postmark_bounce_id, :bigint
+ add :postmark_inactive, :boolean, null: false, default: false
+ add :can_activate, :boolean, null: false, default: false
+ add :details, :text
+ add :reactivated_at, :naive_datetime
+ add :reactivated_by_user_id, references(:users, on_delete: :nilify_all)
+
+ timestamps()
+ end
+
+ create unique_index(:email_suppressions, [:email])
+ create index(:email_suppressions, [:reason])
+ end
+ end
+end