Skip to content

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

Only delete google auth if it exists

Uku Taht8397944a11d5
diff --git a/lib/plausible_web/controllers/site_controller.ex b/lib/plausible_web/controllers/site_controller.ex
index 1f4f1d844e..fb9a1cedbe 100644
--- a/lib/plausible_web/controllers/site_controller.ex
+++ b/lib/plausible_web/controllers/site_controller.ex
@@ -69,7 +69,9 @@ defmodule PlausibleWeb.SiteController do
Repo.delete_all(from sm in "site_memberships", where: sm.site_id == ^site.id)
Repo.delete_all(from p in "pageviews", where: p.hostname == ^site.domain)
- Repo.delete!(site.google_auth)
+ if site.google_auth do
+ Repo.delete!(site.google_auth)
+ end
Repo.delete!(site)
conn