Permalink
Browse files

Merge pull request #14177 from yahonda/skip_tests_if_duplicate_index_…

…not_allowed

Skip test_migrate_revert_add_index_with_name for some databases
  • Loading branch information...
senny committed Feb 25, 2014
1 parent 0831aa5 commit e3f0f171c8493cba0854de995996a291f0ca783a
Showing with 13 additions and 10 deletions.
  1. +13 −10 activerecord/test/cases/invertible_migration_test.rb
@@ -271,16 +271,19 @@ def test_migrate_down_with_table_name_prefix
ActiveRecord::Base.table_name_prefix = ActiveRecord::Base.table_name_suffix = ''
end
- def test_migrate_revert_add_index_with_name
- RevertNamedIndexMigration1.new.migrate(:up)
- RevertNamedIndexMigration2.new.migrate(:up)
- RevertNamedIndexMigration2.new.migrate(:down)
-
- connection = ActiveRecord::Base.connection
- assert connection.index_exists?(:horses, :content),
- "index on content should exist"
- assert !connection.index_exists?(:horses, :content, name: "horses_index_named"),
- "horses_index_named index should not exist"
+ # MySQL 5.7 and Oracle do not allow to create duplicate indexes on the same columns
+ unless current_adapter?(:MysqlAdapter, :Mysql2Adapter, :OracleAdapter)
+ def test_migrate_revert_add_index_with_name
+ RevertNamedIndexMigration1.new.migrate(:up)
+ RevertNamedIndexMigration2.new.migrate(:up)
+ RevertNamedIndexMigration2.new.migrate(:down)
+
+ connection = ActiveRecord::Base.connection
+ assert connection.index_exists?(:horses, :content),
+ "index on content should exist"
+ assert !connection.index_exists?(:horses, :content, name: "horses_index_named"),
+ "horses_index_named index should not exist"
+ end
end
end

0 comments on commit e3f0f17

Please sign in to comment.