Added extra query for log domains destroy events

This commit is contained in:
Sergei Tsoganov 2023-12-21 12:00:55 +02:00
parent 6e271a9242
commit 7736e1c828

View file

@ -147,6 +147,22 @@ module Repp
log_domains
WHERE
event = 'destroy'
AND object_changes->'registrar_id' IS NOT NULL
AND created_at > :date_to
GROUP BY
registrar_id
UNION ALL
-- Query for 'destroy' events and count the number of domains destroyed associated with each registrar
SELECT
(object->'registrar_id')::text AS registrar_id,
COUNT(*) AS domain_count
FROM
log_domains
WHERE
event = 'destroy'
AND object_changes IS NULL
AND created_at > :date_to
GROUP BY
registrar_id