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 --- activerecord/test/cases/migration/index_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test/cases/migration') diff --git a/activerecord/test/cases/migration/index_test.rb b/activerecord/test/cases/migration/index_test.rb index bfa275fee2..0787414d8f 100644 --- a/activerecord/test/cases/migration/index_test.rb +++ b/activerecord/test/cases/migration/index_test.rb @@ -97,6 +97,16 @@ module ActiveRecord end end + def test_deprecated_type_argument + message = "Passing a string as third argument of `add_index` is deprecated and will" + + " be removed in Rails 4.1." + + " Use add_index(:testings, [:foo, :bar], unique: true) instead" + + assert_deprecated message do + connection.add_index :testings, [:foo, :bar], "UNIQUE" + end + end + def test_unique_index_exists connection.add_index :testings, :foo, :unique => true -- cgit v1.2.3