Sha256: 31c2254410c35f89ddda277d96f93289bbce8e7cef1f0cc6103df0948c5b5db2

Contents?: true

Size: 955 Bytes

Versions: 54

Compression:

Stored size: 955 Bytes

Contents

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, index_name)
          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

54 entries across 54 versions & 1 rubygems

Version Path
ridgepole-0.7.3.beta lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.2 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.2.beta lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.1 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.1.beta5 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.1.beta4 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.1.beta3 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.1.beta2 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.1.beta lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.rc1 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta22 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.6.6 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta21 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta20 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta19 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta18 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta17 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta16 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb
ridgepole-0.7.0.beta15 lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb