analytics/priv/repo/migrations/20200121091251_add_recipients.exs
Uku Taht c96f364ad8
Add and remove recipients for email reports (#28)
* Add and remove recipients for email reports

* Remove unused google_settings controller action

* Background job sends email reports to multiple recipients

* Add a way to unsubscribe for recipients who cannot log in

* Fix view on plausible link

* Include bounce rate in email report
2020-01-22 11:16:53 +02:00

29 lines
646 B
Elixir

defmodule Plausible.Repo.Migrations.AddRecipients do
use Ecto.Migration
def up do
alter table(:weekly_reports) do
add :recipients, {:array, :citext}, null: false, default: []
end
execute "UPDATE weekly_reports SET recipients = array_append(recipients, email)"
alter table(:weekly_reports) do
remove :email
end
alter table(:monthly_reports) do
add :recipients, {:array, :citext}, null: false, default: []
end
execute "UPDATE monthly_reports SET recipients = array_append(recipients, email)"
alter table(:monthly_reports) do
remove :email
end
end
def down do
end
end