aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2015-12-19 02:48:23 +1030
committerMatthew Draper <matthew@trebex.net>2015-12-19 02:48:23 +1030
commitf07211f4f4404415693a3e526f60eb97ac598c22 (patch)
tree87e1669da482358606c699f3aed61baf27a67b34 /activerecord/test
parent905a2a176b0a512af9756df3970428749c4d5f41 (diff)
parentcda0c1f6a7101f17f27773b76c1da52bc524aa27 (diff)
downloadrails-f07211f4f4404415693a3e526f60eb97ac598c22.tar.gz
rails-f07211f4f4404415693a3e526f60eb97ac598c22.tar.bz2
rails-f07211f4f4404415693a3e526f60eb97ac598c22.zip
Merge pull request #22658 from greysteil/handle-specified-schema-in-index-remove
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}"),