Skip to content

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

Migration: add country rules (#3834)

hq1b7b5dcf4c98a
diff --git a/config/.env.dev b/config/.env.dev
index db52322d91..c4bc28dee1 100644
--- a/config/.env.dev
+++ b/config/.env.dev
@@ -8,7 +8,7 @@ TOTP_VAULT_KEY=Q3BD4nddbkVJIPXgHuo5NthGKSIH0yesRfG05J88HIo=
ENVIRONMENT=dev
MAILER_ADAPTER=Bamboo.LocalAdapter
LOG_LEVEL=debug
-SELFHOST=false
+SELFHOST=true
DISABLE_CRON=true
ADMIN_USER_IDS=1
SHOW_CITIES=true
diff --git a/priv/repo/migrations/20240221122626_shield_country_rules.exs b/priv/repo/migrations/20240221122626_shield_country_rules.exs
new file mode 100644
index 0000000000..38cf15109b
--- /dev/null
+++ b/priv/repo/migrations/20240221122626_shield_country_rules.exs
@@ -0,0 +1,16 @@
+defmodule Plausible.Repo.Migrations.ShieldCountryRules do
+ use Ecto.Migration
+
+ def change do
+ create table(:shield_rules_country, primary_key: false) do
+ add(:id, :uuid, primary_key: true)
+ add :site_id, references(:sites, on_delete: :delete_all), null: false
+ add :country_code, :text, null: false
+ add :action, :string, default: "deny", null: false
+ add :added_by, :string
+ timestamps()
+ end
+
+ create unique_index(:shield_rules_country, [:site_id, :country_code])
+ end
+end