Sha256: 2b8317c002f0dfc786e29cc053ef459e575d8d7277b8dc150bb0076522927321
Contents?: true
Size: 525 Bytes
Versions: 31
Compression:
Stored size: 525 Bytes
Contents
# frozen_string_literal: true module Spree module MigrationHelpers def safe_remove_index(table, column) remove_index(table, column) if index_exists?(table, column) end def safe_add_index(table, column, **options) if columns_exist?(table, column) && !index_exists?(table, column, **options) add_index(table, column, **options) end end private def columns_exist?(table, columns) Array.wrap(columns).all? { |column| column_exists?(table, column) } end end end
Version data entries
31 entries across 31 versions & 1 rubygems