diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-13 16:40:26 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-13 16:40:26 +0300 |
commit | daa29729cc64c4c5ca150993bb2375f4c838b9f4 (patch) | |
tree | e339e549828294fbddd6b02b768941ddd3fd9ee4 /db/migrate | |
parent | 102537072bd56bac0e66533b8fa7166938687592 (diff) |
Add indexes concurrently on PostgreSQL
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20160412174954_add_ci_commit_indexes.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/db/migrate/20160412174954_add_ci_commit_indexes.rb b/db/migrate/20160412174954_add_ci_commit_indexes.rb index 49fbb3e9bdc..4cb61333178 100644 --- a/db/migrate/20160412174954_add_ci_commit_indexes.rb +++ b/db/migrate/20160412174954_add_ci_commit_indexes.rb @@ -1,7 +1,13 @@ class AddCiCommitIndexes < ActiveRecord::Migration + disable_ddl_transaction! + def change - add_index :ci_commits, [:gl_project_id, :sha] - add_index :ci_commits, [:gl_project_id, :status] - add_index :ci_commits, [:status] + add_index :ci_commits, [:gl_project_id, :sha], index_options + add_index :ci_commits, [:gl_project_id, :status], index_options + add_index :ci_commits, [:status], index_options + end + + def index_options + { algorithm: :concurrently } if Gitlab::Database.postgresql? end end |