From 1678fa10f4ed24b22872a28d242bf37329be185a Mon Sep 17 00:00:00 2001 From: hq1 Date: Wed, 20 Dec 2023 15:40:39 +0100 Subject: [PATCH] Migrations for #3641 (#3644) * Migrations for #3641 * Fix typo --- ...83050_track_accept_traffic_until_notifcations.exs | 12 ++++++++++++ ...231220072829_add_accept_traffic_until_to_user.exs | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 priv/repo/migrations/20231219083050_track_accept_traffic_until_notifcations.exs create mode 100644 priv/repo/migrations/20231220072829_add_accept_traffic_until_to_user.exs 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 000000000..3f19be08a --- /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 000000000..34ece648e --- /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