Sha256: 149c8586b68ef2846e966f6c88184141c5248a313bcbcfed17272b7e43a0b5f8
Contents?: true
Size: 1022 Bytes
Versions: 19
Compression:
Stored size: 1022 Bytes
Contents
class ReplaceArfReportBreakdownView < ActiveRecord::Migration def self.up execute 'DROP VIEW IF EXISTS scaptimony_arf_report_breakdowns' execute <<-SQL.strip_heredoc CREATE VIEW scaptimony_arf_report_breakdowns AS SELECT arf.id as arf_report_id, COUNT(CASE WHEN result.name IN ('pass','fixed') THEN 1 ELSE null END) as passed, COUNT(CASE result.name WHEN 'fail' THEN 1 ELSE null END) as failed, COUNT(CASE WHEN result.name NOT IN ('pass', 'fixed', 'fail', 'notselected', 'notapplicable') THEN 1 ELSE null END) as othered FROM scaptimony_arf_reports arf LEFT OUTER JOIN scaptimony_xccdf_rule_results rule ON arf.id = rule.arf_report_id LEFT OUTER JOIN scaptimony_xccdf_results result ON rule.xccdf_result_id = result.id GROUP BY arf.id; SQL end def self.down execute 'DROP VIEW scaptimony_arf_report_breakdowns' if table_exists? 'scaptimony_arf_report_breakdowns' end end
Version data entries
19 entries across 19 versions & 1 rubygems