aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorGrey Baker <greysteil@gmail.com>2015-12-18 09:07:06 +0000
committerGrey Baker <greysteil@gmail.com>2015-12-18 10:07:10 +0000
commitcda0c1f6a7101f17f27773b76c1da52bc524aa27 (patch)
tree332a1a9c3992781c33d7421b212d7dad65ca4140 /activerecord/test
parentcd53b05be8f74dfc9c872eb1e84cd024e754f48d (diff)
downloadrails-cda0c1f6a7101f17f27773b76c1da52bc524aa27.tar.gz
rails-cda0c1f6a7101f17f27773b76c1da52bc524aa27.tar.bz2
rails-cda0c1f6a7101f17f27773b76c1da52bc524aa27.zip
Handle specified schemas when removing a Postgres index
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb
index 542a68519c..4aeca4d709 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -334,6 +334,20 @@ class SchemaTest < ActiveRecord::PostgreSQLTestCase
end
end
+ def test_remove_index_when_schema_specified
+ @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)"
+ assert_nothing_raised { @connection.remove_index "things", name: "#{SCHEMA_NAME}.things_Index" }
+
+ @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)"
+ assert_nothing_raised { @connection.remove_index "#{SCHEMA_NAME}.things", name: "things_Index" }
+
+ @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)"
+ assert_nothing_raised { @connection.remove_index "#{SCHEMA_NAME}.things", name: "#{SCHEMA_NAME}.things_Index" }
+
+ @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)"
+ assert_raises(ArgumentError) { @connection.remove_index "#{SCHEMA2_NAME}.things", name: "#{SCHEMA_NAME}.things_Index" }
+ end
+
def test_primary_key_with_schema_specified
[
%("#{SCHEMA_NAME}"."#{PK_TABLE_NAME}"),