mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
Fix user deletion
This commit is contained in:
parent
bbb6bae4a2
commit
9bbaa756b8
@ -0,0 +1,17 @@
|
|||||||
|
defmodule Plausible.Repo.Migrations.DeleteEmailRecordsWhenUserIsDeleted do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table(:create_site_emails) do
|
||||||
|
modify :user_id, references(:users, on_delete: :delete_all),
|
||||||
|
null: false,
|
||||||
|
from: references(:users)
|
||||||
|
end
|
||||||
|
|
||||||
|
alter table(:check_stats_emails) do
|
||||||
|
modify :user_id, references(:users, on_delete: :delete_all),
|
||||||
|
null: false,
|
||||||
|
from: references(:users)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -302,6 +302,20 @@ defmodule PlausibleWeb.AuthControllerTest do
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Repo.insert_all("create_site_emails", [
|
||||||
|
%{
|
||||||
|
user_id: user.id,
|
||||||
|
timestamp: NaiveDateTime.utc_now()
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
Repo.insert_all("check_stats_emails", [
|
||||||
|
%{
|
||||||
|
user_id: user.id,
|
||||||
|
timestamp: NaiveDateTime.utc_now()
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
insert(:google_auth, site: site, user: user)
|
insert(:google_auth, site: site, user: user)
|
||||||
insert(:subscription, user: user, status: "deleted")
|
insert(:subscription, user: user, status: "deleted")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user