Skip to content

Commit

Permalink
Added extra query for log domains destroy events
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Tsoganov authored and Sergei Tsoganov committed Dec 21, 2023
1 parent 6e271a9 commit 7736e1c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/controllers/repp/v1/stats_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ def domains_by_registrar(date_to)
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
Expand Down

0 comments on commit 7736e1c

Please sign in to comment.