Module: Spree::MigrationHelpers

Defined in:
core/lib/spree/migration_helpers.rb

Instance Method Summary collapse

Instance Method Details

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



9
10
11
12
13
# File 'core/lib/spree/migration_helpers.rb', line 9

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



5
6
7
# File 'core/lib/spree/migration_helpers.rb', line 5

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