From 060a5b4ac180ee7b694d9ffcc9d7fe034b6d4fd6 Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Fri, 9 Feb 2024 11:12:35 +0300 Subject: [PATCH] chore: add config_analysis_items and config_changes_items with config type Add views that will allow us to filter config insights and changes by type --- views/006_config_views.sql | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/views/006_config_views.sql b/views/006_config_views.sql index 0267b21a..7af9340f 100644 --- a/views/006_config_views.sql +++ b/views/006_config_views.sql @@ -423,4 +423,20 @@ CREATE OR REPLACE VIEW config_detail AS ON ci.id = config_changes.config_id LEFT JOIN (SELECT config_id, count(*) as playbook_runs_count FROM playbook_runs GROUP BY config_id) as playbook_runs - ON ci.id = playbook_runs.config_id; \ No newline at end of file + ON ci.id = playbook_runs.config_id; + +CREATE OR REPLACE VIEW config_analysis_items AS + SELECT + ca.*, + ci.type as config_type, + ci.config_class + FROM config_analysis as ca + LEFT JOIN config_items as ci ON ca.config_id = ci.id; + +CREATE OR REPLACE VIEW config_changes_items AS + SELECT + cc.*, + ci.type as config_type, + ci.config_class + FROM config_changes as cc + LEFT JOIN config_items as ci ON cc.config_id = ci.id; \ No newline at end of file