summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/database
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2017-05-25 12:10:34 +0100
committerNick Thomas <nick@gitlab.com>2017-05-25 18:12:42 +0100
commiteb21f93267f3d911b40cace81a4f63f857a1243a (patch)
treee6028fd948a6633f477f8c0a57941eab79aadd9d /spec/lib/gitlab/database
parent6ece9792666d5ac8670b4c275c42c6ec8998322d (diff)
downloadgitlab-ce-eb21f93267f3d911b40cace81a4f63f857a1243a.tar.gz
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.rb11
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