summaryrefslogtreecommitdiff
path: root/db/migrate/20200525114553_rename_user_type_index.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /db/migrate/20200525114553_rename_user_type_index.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'db/migrate/20200525114553_rename_user_type_index.rb')
-rw-r--r--db/migrate/20200525114553_rename_user_type_index.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20200525114553_rename_user_type_index.rb b/db/migrate/20200525114553_rename_user_type_index.rb
new file mode 100644
index 00000000000..44ce142ffcb
--- /dev/null
+++ b/db/migrate/20200525114553_rename_user_type_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RenameUserTypeIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :users, [:state, :user_type], name: 'index_users_on_state_and_user_type'
+ remove_concurrent_index_by_name :users, 'index_users_on_state_and_user_type_internal'
+ end
+
+ def down
+ add_concurrent_index :users, [:state, :user_type], where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_user_type_internal'
+ remove_concurrent_index_by_name :users, 'index_users_on_state_and_user_type'
+ end
+end