1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

improved test case for partial indices

This commit is contained in:
Marcelo Silveira 2012-02-09 19:04:07 -02:00
parent 7ef22fce7c
commit aaffc2acd5

View file

@ -169,14 +169,17 @@ module ActiveRecord
connection.add_index("testings", ["last_name", "first_name"], :order => :desc)
connection.remove_index("testings", ["last_name", "first_name"])
end
# Selected adapters support partial indices
if current_adapter?(:PostgreSQLAdapter)
connection.add_index("testings", ["last_name"], :where => "first_name = 'john doe'")
connection.remove_index("testings", ["last_name"])
end
end
def test_add_partial_index
skip 'only on pg' unless current_adapter?(:PostgreSQLAdapter)
connection.add_index("testings", "last_name", :where => "first_name = 'john doe'")
assert connection.index_exists?("testings", "last_name")
connection.remove_index("testings", "last_name")
assert !connection.index_exists?("testings", "last_name")
end
end
end
end