summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-03-20 19:24:40 +0100
committerAndreas Brandl <abrandl@gitlab.com>2018-03-21 13:41:24 +0100
commit58a99463b6ee8f643541b42e61be15237ff35a03 (patch)
treefe07d30fcb4ce9a54480bd065dfca08555cd012e /db/migrate
parentaa2a97b545243f528f60fe74ed1c0374b920f97f (diff)
downloadgitlab-ce-58a99463b6ee8f643541b42e61be15237ff35a03.tar.gz
Add indexes for user activity queries.
Closes #44446.
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
new file mode 100644
index 00000000000..3232d5fe1e5
--- /dev/null
+++ b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
@@ -0,0 +1,17 @@
+class AddIndexesForUserActivityQueries < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :events, [:project_id, :author_id]
+ add_concurrent_index :user_interacted_projects, :user_id
+ end
+
+ def down
+ remove_concurrent_index :events, [:project_id, :author_id]
+ remove_concurrent_index :user_interacted_projects, :user_id
+ end
+end