Commit ebea90b9 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'cleanup_user_highest_roles_background_migration' into 'master'

Cleanup background migration for populating user_highest_roles table

See merge request gitlab-org/gitlab!31218
parents bdcb35b5 05fa0526
---
title: Cleanup background migration for populating user_highest_roles table
merge_request: 31218
author:
type: other
# frozen_string_literal: true
class CleanupUserHighestRolesPopulation < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_for_migrating_user_highest_roles_table'
disable_ddl_transaction!
def up
Gitlab::BackgroundMigration.steal('PopulateUserHighestRolesTable')
remove_concurrent_index(:users, :id, name: INDEX_NAME)
end
def down
add_concurrent_index(:users,
:id,
where: "state = 'active' AND user_type IS NULL AND bot_type IS NULL AND ghost IS NOT TRUE",
name: INDEX_NAME)
end
end
......@@ -9556,8 +9556,6 @@ CREATE UNIQUE INDEX index_feature_gates_on_feature_key_and_key_and_value ON publ
CREATE UNIQUE INDEX index_features_on_key ON public.features USING btree (key);
CREATE INDEX index_for_migrating_user_highest_roles_table ON public.users USING btree (id) WHERE (((state)::text = 'active'::text) AND (user_type IS NULL) AND (bot_type IS NULL) AND (ghost IS NOT TRUE));
CREATE INDEX index_for_resource_group ON public.ci_builds USING btree (resource_group_id, id) WHERE (resource_group_id IS NOT NULL);
CREATE INDEX index_for_status_per_branch_per_project ON public.merge_trains USING btree (target_project_id, target_branch, status);
......@@ -13709,5 +13707,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200429181335
20200429181955
20200429182245
20200506125731
\.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment