mirror of https://github.com/rails/rails
Add index existence tests for nulls_not_distinct
This commit is contained in:
parent
52eb5d9c56
commit
575a2e0ea7
|
@ -58,8 +58,8 @@ module ActiveRecord
|
|||
(name.nil? || self.name == name.to_s) &&
|
||||
(unique.nil? || self.unique == unique) &&
|
||||
(valid.nil? || self.valid == valid) &&
|
||||
(include.nil? || Array(self.include) == Array(include).map(&:to_s) &&
|
||||
(nulls_not_distinct.nil? || self.nulls_not_distinct == nulls_not_distinct))
|
||||
(include.nil? || Array(self.include) == Array(include).map(&:to_s)) &&
|
||||
(nulls_not_distinct.nil? || self.nulls_not_distinct == nulls_not_distinct)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -299,6 +299,16 @@ module ActiveRecord
|
|||
connection.remove_index("testings", "last_name")
|
||||
assert_not connection.index_exists?("testings", "last_name", include: :foo, where: "first_name = 'john doe'")
|
||||
end
|
||||
|
||||
def test_add_index_with_nulls_not_distinct_assert_exists_with_same_values
|
||||
connection.add_index("testings", "last_name", nulls_not_distinct: true)
|
||||
assert connection.index_exists?("testings", "last_name", nulls_not_distinct: true)
|
||||
end
|
||||
|
||||
def test_add_index_with_nulls_not_distinct_assert_exists_with_different_values
|
||||
connection.add_index("testings", "last_name", nulls_not_distinct: false)
|
||||
assert_not connection.index_exists?("testings", "last_name", nulls_not_distinct: true)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue