diff options
author | Matthew Draper <matthew@trebex.net> | 2015-09-07 00:15:11 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-09-07 00:15:11 +0930 |
commit | 096252795341518c04e1bb47a32450ade7d7e169 (patch) | |
tree | 8e8e37c1e6713628311bb76347542fcf1b2ec04f /activerecord/test/cases | |
parent | e07b006d9c7b0a57c350d918259176089d6dedd6 (diff) | |
parent | ce17e232a12861bce4bd950d7143df3fe0cd1991 (diff) | |
download | rails-096252795341518c04e1bb47a32450ade7d7e169.tar.gz rails-096252795341518c04e1bb47a32450ade7d7e169.tar.bz2 rails-096252795341518c04e1bb47a32450ade7d7e169.zip |
Merge pull request #21317 from greysteil/support-postgres-drop-index-concurrently
Support dropping indexes concurrently in Postgres
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/active_schema_test.rb | 9 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/schema_test.rb | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb index dc7ba314c6..d0f5f56786 100644 --- a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb @@ -51,6 +51,15 @@ class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase assert_equal expected, add_index(:people, :last_name, :unique => true, :where => "state = 'active'", :using => :gist) end + def test_remove_index + expected = %(DROP INDEX CONCURRENTLY "index_people_on_last_name") + assert_equal expected, remove_index(:people, name: "index_people_on_last_name", algorithm: :concurrently) + + assert_raise ArgumentError do + add_index(:people, :last_name, algorithm: :copy) + end + end + private def method_missing(method_symbol, *arguments) ActiveRecord::Base.connection.send(method_symbol, *arguments) diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index ea7e5ac587..bee612d8d3 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -321,11 +321,11 @@ class SchemaTest < ActiveRecord::PostgreSQLTestCase def test_with_uppercase_index_name @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)" - assert_nothing_raised { @connection.remove_index! "things", "#{SCHEMA_NAME}.things_Index"} + assert_nothing_raised { @connection.remove_index "things", name: "#{SCHEMA_NAME}.things_Index"} @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)" with_schema_search_path SCHEMA_NAME do - assert_nothing_raised { @connection.remove_index! "things", "things_Index"} + assert_nothing_raised { @connection.remove_index "things", name: "things_Index"} end end |