Commit 07dbd564 authored by Alexis Reigel's avatar Alexis Reigel

use Module#prepend instead of alias_method_chain

parent ecbc11a8
......@@ -2,12 +2,7 @@
# MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on
# binary columns.
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
module ActiveRecord
module ConnectionAdapters
class Mysql2Adapter < AbstractMysqlAdapter
alias_method :__gitlab_add_index2, :add_index
module MysqlSetLengthForBinaryIndex
def add_index(table_name, column_names, options = {})
Array(column_names).each do |column_name|
column = ActiveRecord::Base.connection.columns(table_name).find { |c| c.name == column_name }
......@@ -17,9 +12,10 @@ if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
end
end
__gitlab_add_index2(table_name, column_names, options)
end
end
end
super(table_name, column_names, options)
end
end
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, MysqlSetLengthForBinaryIndex)
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment