Sha256: 2f7d2d7ef536452830d022172aa3ada7062b6b000a56b56fd7548fef873d5131

Contents?: true

Size: 797 Bytes

Versions: 4

Compression:

Stored size: 797 Bytes

Contents

require 'active_record/connection_adapters/abstract_mysql_adapter'

class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
  def add_index_with_alter(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
  alias_method_chain :add_index, :alter

  def remove_index_with_alter!(table_name, index_name)
    execute "ALTER TABLE #{quote_table_name(table_name)} DROP INDEX #{quote_column_name(index_name)}"
  end
  alias_method_chain :remove_index!, :alter
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ridgepole-0.6.4.beta5 lib/ridgepole/ext/abstract_mysql_adapter.rb
ridgepole-0.6.4.beta4 lib/ridgepole/ext/abstract_mysql_adapter.rb
ridgepole-0.6.4.beta3 lib/ridgepole/ext/abstract_mysql_adapter.rb
ridgepole-0.6.4.beta2 lib/ridgepole/ext/abstract_mysql_adapter.rb