From 664c7bb361fa5dc5f8596256e714fae5b0f8b19a Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Thu, 28 Nov 2013 19:42:11 -0700 Subject: fix mysql version check in rename_index also clarify native rename_index support is >= 5.7, not > 5.7 --- activerecord/CHANGELOG.md | 2 +- .../lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 126464f81f..5fd0c63c1b 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,4 @@ -* Implement rename_index natively for MySQL > 5.7. +* Implement rename_index natively for MySQL >= 5.7. *Cody Cutrer* 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 3aa4604912..3d3c3ee79b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -488,7 +488,7 @@ module ActiveRecord end def rename_index(table_name, old_name, new_name) - if version[0] >= 5 && version[1] >= 7 + if (version[0] == 5 && version[1] >= 7) || version[0] >= 6 execute "ALTER TABLE #{quote_table_name(table_name)} RENAME INDEX #{quote_table_name(old_name)} TO #{quote_table_name(new_name)}" else super -- cgit v1.2.3