diff options
author | Nick Thomas <nick@gitlab.com> | 2017-05-25 14:10:34 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-05-25 20:12:42 +0300 |
commit | eb21f93267f3d911b40cace81a4f63f857a1243a (patch) | |
tree | e6028fd948a6633f477f8c0a57941eab79aadd9d /spec/lib/gitlab/database | |
parent | 6ece9792666d5ac8670b4c275c42c6ec8998322d (diff) |
Only use DROP INDEX CONCURRENTLY on postgreql 9.2+
Diffstat (limited to 'spec/lib/gitlab/database')
-rw-r--r-- | spec/lib/gitlab/database/migration_helpers_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index bd5ac6142be..3fdafd867da 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -66,16 +66,23 @@ describe Gitlab::Database::MigrationHelpers, lib: true do context 'using PostgreSQL' do before do - allow(Gitlab::Database).to receive(:postgresql?).and_return(true) + allow(model).to receive(:supports_drop_index_concurrently?).and_return(true) allow(model).to receive(:disable_statement_timeout) end - it 'removes the index concurrently' do + it 'removes the index concurrently by column name' do expect(model).to receive(:remove_index). with(:users, { algorithm: :concurrently, column: :foo }) model.remove_concurrent_index(:users, :foo) end + + it 'removes the index concurrently by index name' do + expect(model).to receive(:remove_index). + with(:users, { algorithm: :concurrently, name: "index_x_by_y" }) + + model.remove_concurrent_index_by_name(:users, "index_x_by_y") + end end context 'using MySQL' do |