Class: MetasploitDataModels::ChangeRequiredColumnsToNullFalse

Inherits:
Object
  • Object
show all
Defined in:
lib/metasploit_data_models/change_required_columns_to_null_false.rb

Overview

Changes all the COLUMNS in the table with TABLE_NAME that are required from the table's mode, but were previously :null => true, to :null => false.

@abstract Subclass and define COLUMNS as Array and TABLE_NAME as Symbol.

Instance Method Summary collapse

Instance Method Details

#downObject

Marks all the COLUMNS as :null => true


7
8
9
10
11
12
# File 'lib/metasploit_data_models/change_required_columns_to_null_false.rb', line 7

def down
  # Use self.class:: so constants are resolved in subclasses instead of this class.
  self.class::COLUMNS.each do |column|
    change_column_null(self.class::TABLE_NAME, column, true)
  end
end

#upObject

Marks all the COLUMNS as :null => false


15
16
17
18
19
20
# File 'lib/metasploit_data_models/change_required_columns_to_null_false.rb', line 15

def up
  # Use self.class:: so constants are resolved in subclasses instead of this class.
  self.class::COLUMNS.each do |column|
    change_column_null(self.class::TABLE_NAME, column, false)
  end
end