Sha256: 45ce1736e8d14be18cb84d47fd10c48d6637d2d35ff0549ef0cabc0ced353741

Contents?: true

Size: 618 Bytes

Versions: 154

Compression:

Stored size: 618 Bytes

Contents

class AddCounterCachesToHosts < ActiveRecord::Migration

  def self.up
    add_column :hosts, :note_count, :integer, :default => 0
    add_column :hosts, :vuln_count, :integer, :default => 0
    add_column :hosts, :service_count, :integer, :default => 0
  
    Mdm::Host.reset_column_information
    Mdm::Host.all.each do |h|
      Mdm::Host.reset_counters h.id, :notes
      Mdm::Host.reset_counters h.id, :vulns
      Mdm::Host.reset_counters h.id, :services
    end
  end

  def self.down
    remove_column :hosts, :note_count
    remove_column :hosts, :vuln_count
    remove_column :hosts, :service_count
  end
end

Version data entries

154 entries across 154 versions & 1 rubygems

Version Path
metasploit_data_models-3.0.10 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.9 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.8 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.7 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.6 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.5 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.17 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.4 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.2 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.1 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-3.0.0 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.16 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.15 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.14 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.13 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.12 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.11 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.10 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.9 db/migrate/20120601152442_add_counter_caches_to_hosts.rb
metasploit_data_models-2.0.8 db/migrate/20120601152442_add_counter_caches_to_hosts.rb