summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-03-13 14:46:15 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2017-03-13 14:46:15 -0700
commit1159b43e744f015dba8476927527d4ed3af205be (patch)
treefe1009d8f608e6da2bd623683dd0ad86ec87346c
parent88206d67c38e87685bbacc14cfd60ee9dc42ac7f (diff)
downloadgitlab-ce-perf/add-index-to-user-ghost.tar.gz
add an index to the ghost columnperf/add-index-to-user-ghost
-rw-r--r--db/migrate/20170313213916_add_index_to_user_ghost.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/db/migrate/20170313213916_add_index_to_user_ghost.rb b/db/migrate/20170313213916_add_index_to_user_ghost.rb
new file mode 100644
index 00000000000..b2d2e25cedb
--- /dev/null
+++ b/db/migrate/20170313213916_add_index_to_user_ghost.rb
@@ -0,0 +1,33 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIndexToUserGhost < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ # When a migration requires downtime you **must** uncomment the following
+ # constant and define a short and easy to understand explanation as to why the
+ # migration requires downtime.
+ # DOWNTIME_REASON = ''
+
+ # When using the methods "add_concurrent_index" or "add_column_with_default"
+ # you must disable the use of transactions as these methods can not run in an
+ # existing transaction. When using "add_concurrent_index" make sure that this
+ # method is the _only_ method called in the migration, any other changes
+ # should go in a separate migration. This ensures that upon failure _only_ the
+ # index creation fails and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ # disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :users, column: [:ghost]
+ end
+
+ def down
+ remove_index :users, column: [:ghost]
+ end
+end