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 dbeabf92c9..e284ea06b4 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -694,7 +694,11 @@ module ActiveRecord end def supports_rename_index? - mariadb? ? false : database_version >= "5.7.6" + if mariadb? + database_version >= "10.5.2" + else + database_version >= "5.7.6" + end end def configure_connection diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb index 8b1b54c4ab..0bedb2f5ef 100644 --- a/activerecord/test/cases/migration/foreign_key_test.rb +++ b/activerecord/test/cases/migration/foreign_key_test.rb @@ -93,6 +93,10 @@ if ActiveRecord::Base.connection.supports_foreign_keys? end def test_rename_reference_column_of_child_table + if current_adapter?(:Mysql2Adapter) && !@connection.send(:supports_rename_index?) + skip "Cannot drop index, needed in a foreign key constraint" + end + rocket = Rocket.create!(name: "myrocket") rocket.astronauts << Astronaut.create!