display history of topic updates on topic details page
[websub-hub] / src / db / sqlite / sql / topic-publish-history.sql
diff --git a/src/db/sqlite/sql/topic-publish-history.sql b/src/db/sqlite/sql/topic-publish-history.sql
new file mode 100644 (file)
index 0000000..184c449
--- /dev/null
@@ -0,0 +1,12 @@
+--
+SELECT
+       (strftime('%s', 'now') - content_updated) / 86400 AS days_ago,
+       count(*) AS content_updates
+FROM topic_content_history
+WHERE
+       days_ago <= :daysAgo
+AND
+       (:topicId IS NULL OR topic_id = :topicId)
+GROUP BY days_ago
+ORDER BY days_ago
+;