summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-04-04 12:05:17 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2017-04-04 12:05:17 +0000
commitc5dae616c25960a1176f4fb75728a5a8ca22c75a (patch)
tree0c69b27f17b934d26047d9fcdb0e4db701f21b14
parentae20a1a28d7e7609937e0924a3e8d14be58c6963 (diff)
parente3f88e689fc5c973f4b08f7d5c80e85d0795b961 (diff)
downloadgitlab-ce-c5dae616c25960a1176f4fb75728a5a8ca22c75a.tar.gz
Merge branch 'remove_index_for_users.current_sign_in_at' into 'master'
Remove index for users.current sign in at Closes #29523 See merge request !10401
-rw-r--r--changelogs/unreleased/remove_index_for_users-current_sign_in_at.yml4
-rw-r--r--db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb25
-rw-r--r--db/schema.rb3
3 files changed, 30 insertions, 2 deletions
diff --git a/changelogs/unreleased/remove_index_for_users-current_sign_in_at.yml b/changelogs/unreleased/remove_index_for_users-current_sign_in_at.yml
new file mode 100644
index 00000000000..ec3a2c8e2bf
--- /dev/null
+++ b/changelogs/unreleased/remove_index_for_users-current_sign_in_at.yml
@@ -0,0 +1,4 @@
+---
+title: Remove index for users.current sign in at
+merge_request: 10401
+author: blackst0ne
diff --git a/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb b/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
new file mode 100644
index 00000000000..8316ee9eb9f
--- /dev/null
+++ b/db/migrate/20170402231018_remove_index_for_users_current_sign_in_at.rb
@@ -0,0 +1,25 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class RemoveIndexForUsersCurrentSignInAt < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ if index_exists? :users, :current_sign_in_at
+ if Gitlab::Database.postgresql?
+ execute 'DROP INDEX CONCURRENTLY index_users_on_current_sign_in_at;'
+ else
+ remove_index :users, :current_sign_in_at
+ end
+ end
+ end
+
+ def down
+ add_concurrent_index :users, :current_sign_in_at
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 19aca4b941e..ccf18d07179 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170329124448) do
+ActiveRecord::Schema.define(version: 20170402231018) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -1252,7 +1252,6 @@ ActiveRecord::Schema.define(version: 20170329124448) do
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
add_index "users", ["created_at"], name: "index_users_on_created_at", using: :btree
- add_index "users", ["current_sign_in_at"], name: "index_users_on_current_sign_in_at", using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["email"], name: "index_users_on_email_trigram", using: :gin, opclasses: {"email"=>"gin_trgm_ops"}
add_index "users", ["ghost"], name: "index_users_on_ghost", using: :btree