From 8397944a11d57b05c3c7179febe4ec5bf613611a Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Fri, 6 Sep 2019 10:50:46 +0100 Subject: [PATCH] Only delete google auth if it exists --- lib/plausible_web/controllers/site_controller.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/plausible_web/controllers/site_controller.ex b/lib/plausible_web/controllers/site_controller.ex index 1f4f1d844..fb9a1cedb 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