Cascade delete sent_renewal_notifications table when user is deleted (#2549)
* Cascade delete sent_renewal_notifications table when user is deleted This commit fixes a bug when deleting a user would trigger a constraint error. * Update CHANGELOG.mdpull/2558/head
parent
10a9767912
commit
b6d30019ef
@ -0,0 +1,11 @@
|
||||
defmodule Plausible.Repo.Migrations.CascadeDeleteSentRenewalNotifications do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
drop constraint("sent_renewal_notifications", "sent_renewal_notifications_user_id_fkey")
|
||||
|
||||
alter table(:sent_renewal_notifications) do
|
||||
modify :user_id, references(:users, on_delete: :delete_all), null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue