Module: Spree::MigrationHelpers

Defined in:
lib/spree/migration_helpers.rb

Instance Method Summary collapse

Instance Method Details

#safe_add_index(table, column, options = {}) ⇒ Object



7
8
9
10
11
# File 'lib/spree/migration_helpers.rb', line 7

def safe_add_index(table, column, options = {})
  if columns_exist?(table, column) && !index_exists?(table, column, options)
    add_index(table, column, options)
  end
end

#safe_remove_index(table, column) ⇒ Object



3
4
5
# File 'lib/spree/migration_helpers.rb', line 3

def safe_remove_index(table, column)
  remove_index(table, column) if index_exists?(table, column)
end