Class: MetasploitDataModels::ChangeRequiredColumnsToNullFalse
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- MetasploitDataModels::ChangeRequiredColumnsToNullFalse
- 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
Instance Method Summary collapse
-
#down ⇒ Object
Marks all the COLUMNS as
:null => true
. -
#up ⇒ Object
Marks all the COLUMNS as
:null => false
.
Instance Method Details
#down ⇒ Object
Marks all the COLUMNS as :null => true
8 9 10 11 12 13 |
# File 'lib/metasploit_data_models/change_required_columns_to_null_false.rb', line 8 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 |
#up ⇒ Object
Marks all the COLUMNS as :null => false
16 17 18 19 20 21 |
# File 'lib/metasploit_data_models/change_required_columns_to_null_false.rb', line 16 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 |