Sha256: 8a8ce4e4b2c5cf35f90aa670f7c551fb59d98d4722b7cf621ce0d1cc0a5626c2

Contents?: true

Size: 858 Bytes

Versions: 143

Compression:

Stored size: 858 Bytes

Contents

class ValidMdmWebVulnParams < ActiveRecord::Migration
  # Don't put back the bad format because there's not way to figure our which of the [] were '' before {#up} and
  # which were `[]` before {#up}.
  #
  # @return [void]
  def down
  end

  # Changes any Mdm::WebVuln#params with value `''` to value `[]`.
  #
  # @return [void]
  def up
    # Can't search serialized columns, so have to load all the Mdm::WebVulns in memory
    Mdm::WebVuln.find_each do |web_vuln|
      if web_vuln.invalid?
        # cast nil, '' and {} to correct [].
        if web_vuln.params.blank?
          web_vuln.params = []
        end

        # If its still invalid have to destroy the Mdm::WebVuln or a different export error could occur.
        if web_vuln.invalid?
          web_vuln.destroy
        else
          web_vuln.save!
        end
      end
    end
  end
end

Version data entries

143 entries across 143 versions & 1 rubygems

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