Skip to content
Permalink
Browse files

Remove deprecated argument `default` from `index_name_exists?`

  • Loading branch information...
rafaelfranca committed Jul 17, 2017
1 parent 82472b3 commit 8f5b34df81175e30f68879479243fbce966122d7
@@ -1,3 +1,7 @@
* Remove deprecated argument `default` from `index_name_exists?`.

*Rafael Mendonça França*

* Remove deprecated support to `quoted_id` when typecasting an Active Record object.

*Rafael Mendonça França*
@@ -806,12 +806,7 @@ def index_name(table_name, options) #:nodoc:
end

# Verifies the existence of an index with a given name.
def index_name_exists?(table_name, index_name, default = nil)
unless default.nil?
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing default to #index_name_exists? is deprecated without replacement.
MSG
end
def index_name_exists?(table_name, index_name)
index_name = index_name.to_s
indexes(table_name).detect { |i| i.name == index_name }
end
@@ -66,12 +66,7 @@ def schema_exists?(name)
end

# Verifies existence of an index with a given name.
def index_name_exists?(table_name, index_name, default = nil)
unless default.nil?
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing default to #index_name_exists? is deprecated without replacement.
MSG
end
def index_name_exists?(table_name, index_name)
table = quoted_scope(table_name)
index = quoted_scope(index_name)

@@ -33,10 +33,8 @@ def test_rename_index
connection.add_index(table_name, [:foo], name: "old_idx")
connection.rename_index(table_name, "old_idx", "new_idx")

assert_deprecated do
assert_not connection.index_name_exists?(table_name, "old_idx", false)
assert connection.index_name_exists?(table_name, "new_idx", true)
end
assert_not connection.index_name_exists?(table_name, "old_idx")
assert connection.index_name_exists?(table_name, "new_idx")
end

def test_rename_index_too_long

0 comments on commit 8f5b34d

Please sign in to comment.
You can’t perform that action at this time.