diff options
author | Grey Baker <greysteil@gmail.com> | 2015-08-21 12:44:59 +0100 |
---|---|---|
committer | Grey Baker <greysteil@gmail.com> | 2015-09-05 17:04:03 +0100 |
commit | ce17e232a12861bce4bd950d7143df3fe0cd1991 (patch) | |
tree | f907768be0c7fafc367a228637815213dfee7969 /activerecord/test | |
parent | a8f4568f5396b68ae81eddc636604bb78bb6632a (diff) | |
download | rails-ce17e232a12861bce4bd950d7143df3fe0cd1991.tar.gz rails-ce17e232a12861bce4bd950d7143df3fe0cd1991.tar.bz2 rails-ce17e232a12861bce4bd950d7143df3fe0cd1991.zip |
Support dropping indexes concurrently in Postgres
See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html
for more details.
Diffstat (limited to 'activerecord/test')
-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 |