diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-11-28 10:19:13 -0800 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-11-28 10:19:13 -0800 |
commit | cca71659b7027c7206749f2e35e8a235033fe287 (patch) | |
tree | 569e10327b3fa75aecc7f3c85eb5c09678bfd36d /activerecord/lib | |
parent | 0ff2d2603e0a6554118cd48e25e94e9ffcbbb8cc (diff) | |
parent | a9771ddba5fa75632b264af80f95ef463a882548 (diff) | |
download | rails-cca71659b7027c7206749f2e35e8a235033fe287.tar.gz rails-cca71659b7027c7206749f2e35e8a235033fe287.tar.bz2 rails-cca71659b7027c7206749f2e35e8a235033fe287.zip |
Merge pull request #13038 from ccutrer/mysql_rename_index
implement rename_index natively for MySQL > 5.7
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index dcbc3466b2..3aa4604912 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -487,6 +487,14 @@ module ActiveRecord rename_table_indexes(table_name, new_name) end + def rename_index(table_name, old_name, new_name) + if version[0] >= 5 && version[1] >= 7 + execute "ALTER TABLE #{quote_table_name(table_name)} RENAME INDEX #{quote_table_name(old_name)} TO #{quote_table_name(new_name)}" + else + super + end + end + def change_column_default(table_name, column_name, default) column = column_for(table_name, column_name) change_column table_name, column_name, column.sql_type, :default => default |