aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-11-04 04:06:50 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-02-13 12:35:30 +0900
commit28dc6d76ab302340e98fad7f8718c440e5b1e2d8 (patch)
treeeee792f3c08b74c7e13b640ee8dd7a0123c539de /activerecord/lib/active_record
parent5e67187979e56b9cad666abe40ca86a89f304f8f (diff)
downloadrails-28dc6d76ab302340e98fad7f8718c440e5b1e2d8.tar.gz
rails-28dc6d76ab302340e98fad7f8718c440e5b1e2d8.tar.bz2
rails-28dc6d76ab302340e98fad7f8718c440e5b1e2d8.zip
Deprecate passing `default` to `index_name_exists?`
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb5
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 54c4c62636..c61aae85d3 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -774,6 +774,11 @@ module ActiveRecord
# 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
index_name = index_name.to_s
indexes(table_name).detect { |i| i.name == index_name }
end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
index f9dffbe87b..eebc688686 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -133,6 +133,11 @@ module ActiveRecord
# 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
table = Utils.extract_schema_qualified_name(table_name.to_s)
index = Utils.extract_schema_qualified_name(index_name.to_s)