Sha256: fa2ff026c0603c365fce33fb026645b162f9891f1299c652f56705bf02320ca2

Contents?: true

Size: 937 Bytes

Versions: 19

Compression:

Stored size: 937 Bytes

Contents

class CreateScaptimonyArfReportBreakdowns < ActiveRecord::Migration
  def self.up
    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,
          scaptimony_xccdf_rule_results rule,
          scaptimony_xccdf_results result
        WHERE
          arf.id = rule.arf_report_id
          AND 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

Version Path
foreman_openscap-0.7.13 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.6 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.5 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.12 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.4 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.11 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.10 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.3 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.9 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.8 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.7 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.2 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.6 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.1 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.5 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.8.0 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.4 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.3 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
foreman_openscap-0.7.2 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb