Sha256: dcc9c3c9e561e8ecc67d1cae6a997e52b8a9a963b6b741d7165e2f412ebd8c71

Contents?: true

Size: 903 Bytes

Versions: 97

Compression:

Stored size: 903 Bytes

Contents

module MetasploitDataModels
  # 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<Symbol> and TABLE_NAME as Symbol.
  class ChangeRequiredColumnsToNullFalse < ActiveRecord::Migration
    # Marks all the COLUMNS as `:null => true`
    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

    # Marks all the COLUMNS as `:null => false`
    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
  end
end

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
metasploit_data_models-0.23.2 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.23.2-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.23.1 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.23.1-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.23.0 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.23.0-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.8 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.8-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.7 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.7-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.6 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.6-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.5 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.5-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.4 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.4-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.3 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.3-java lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.2 lib/metasploit_data_models/change_required_columns_to_null_false.rb
metasploit_data_models-0.22.2-java lib/metasploit_data_models/change_required_columns_to_null_false.rb