From 7042fe2f8428b713894601a9bc9bdcdbcdbfb37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 2 Nov 2012 19:51:06 -0200 Subject: Deprecate passing a string as third argument of `add_index` This was there due historical reasons since 7dc45818dc43c163700efc9896a0f3feafa31138 to give the user the possibility to create unique indexes passing "UNIQUE" as the third argument --- .../active_record/connection_adapters/abstract/schema_statements.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb') 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 a606a5c775..2d7ec55d3e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -629,6 +629,12 @@ module ActiveRecord index_options = options[:where] ? " WHERE #{options[:where]}" : "" end else + message = "Passing a string as third argument of `add_index` is deprecated and will" + + " be removed in Rails 4.1." + + " Use add_index(#{table_name.inspect}, #{column_name.inspect}, unique: true) instead" + + ActiveSupport::Deprecation.warn message + index_type = options end -- cgit v1.2.3