Sha256: df1ae110fa7b7688d9dea3d2fc97a5a6affe1ae87e19b4d2f3fd5c16481a8038
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'active_record/connection_adapters/abstract_mysql_adapter' module Ridgepole module Ext module AbstractMysqlAdapter module UseAlterIndex def add_index(table_name, column_name, options = {}) index_name, index_type, index_columns, index_options, _index_algorithm, index_using = add_index_options(table_name, column_name, **options) # cannot specify index_algorithm execute "ALTER TABLE #{quote_table_name(table_name)} ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_options}" end def remove_index(table_name, options) index_name = index_name_for_remove(table_name, options) execute "ALTER TABLE #{quote_table_name(table_name)} DROP INDEX #{quote_column_name(index_name)}" end end end end end module ActiveRecord module ConnectionAdapters class AbstractMysqlAdapter prepend Ridgepole::Ext::AbstractMysqlAdapter::UseAlterIndex end end end
Version data entries
3 entries across 3 versions & 1 rubygems