diff --git a/lib/towerops_web/controllers/api/v1/geoip_controller.ex b/lib/towerops_web/controllers/api/v1/geoip_controller.ex index fd8b4043..5b8b16cc 100644 --- a/lib/towerops_web/controllers/api/v1/geoip_controller.ex +++ b/lib/towerops_web/controllers/api/v1/geoip_controller.ex @@ -88,10 +88,13 @@ defmodule ToweropsWeb.Api.V1.GeoipController do end defp import_batch("locations", data, truncate) do + alias Towerops.GeoIP.Block alias Towerops.GeoIP.Location alias Towerops.Repo if truncate do + # Must delete blocks first due to foreign key constraint + Repo.delete_all(Block) Repo.delete_all(Location) end