Skip to content

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

Migrations for #3641 (#3644)

hq11678fa10f4ed
diff --git a/priv/repo/migrations/20231219083050_track_accept_traffic_until_notifcations.exs b/priv/repo/migrations/20231219083050_track_accept_traffic_until_notifcations.exs
new file mode 100644
index 0000000000..3f19be08ae
--- /dev/null
+++ b/priv/repo/migrations/20231219083050_track_accept_traffic_until_notifcations.exs
@@ -0,0 +1,12 @@
+defmodule Plausible.Repo.Migrations.TrackAcceptTrafficUntilNotifcations do
+ use Ecto.Migration
+
+ def change do
+ create table(:sent_accept_traffic_until_notifications) do
+ add :user_id, references(:users, on_delete: :delete_all), null: false
+ add :sent_on, :date, null: false
+ end
+
+ create unique_index(:sent_accept_traffic_until_notifications, [:user_id, :sent_on])
+ end
+end
diff --git a/priv/repo/migrations/20231220072829_add_accept_traffic_until_to_user.exs b/priv/repo/migrations/20231220072829_add_accept_traffic_until_to_user.exs
new file mode 100644
index 0000000000..34ece648e9
--- /dev/null
+++ b/priv/repo/migrations/20231220072829_add_accept_traffic_until_to_user.exs
@@ -0,0 +1,10 @@
+defmodule Plausible.Repo.Migrations.AddAcceptTrafficUntilToUser do
+ use Ecto.Migration
+
+ def change do
+ # deleting accept_traffic_until from sites table will come later, not to crash anything live right now
+ alter table(:users) do
+ add :accept_traffic_until, :date
+ end
+ end
+end