summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-05-04 20:43:46 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-05-17 20:53:22 +0200
commit91c971bf987824df0e066c20ac341bb5e7485e95 (patch)
treeba8ad6bdb4562efc7b2dff7c0328bbcc54d2868e /db/migrate
parent53250d6d8a7f016e8a7f503509e489b444859429 (diff)
downloadgitlab-ce-91c971bf987824df0e066c20ac341bb5e7485e95.tar.gz
Index project_group_links.group_id
This column is used when refreshing authorizations and without the index leads to a sequence scan being performed on this table.
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170504182103_add_index_project_group_links_group_id.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20170504182103_add_index_project_group_links_group_id.rb b/db/migrate/20170504182103_add_index_project_group_links_group_id.rb
new file mode 100644
index 00000000000..62bf641daa6
--- /dev/null
+++ b/db/migrate/20170504182103_add_index_project_group_links_group_id.rb
@@ -0,0 +1,19 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIndexProjectGroupLinksGroupId < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :project_group_links, :group_id
+ end
+
+ def down
+ remove_concurrent_index :project_group_links, :group_id
+ end
+end