diff options
Diffstat (limited to 'db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb')
-rw-r--r-- | db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb b/db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb deleted file mode 100644 index 8e9838e1afb..00000000000 --- a/db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -# This migration adds temporary indexes to state_id column of issues -# and merge_requests tables. It will be used only to peform the scheduling -# for populating state_id in a post migrate and will be removed after it. -# Check: ScheduleSyncIssuablesStateIdWhereNil. - -class AddTemporaryIndexesToStateId < ActiveRecord::Migration[5.1] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - %w(issues merge_requests).each do |table| - add_concurrent_index( - table, - 'id', - name: index_name_for(table), - where: "state_id IS NULL" - ) - end - end - - def down - remove_concurrent_index_by_name(:issues, index_name_for("issues")) - remove_concurrent_index_by_name(:merge_requests, index_name_for("merge_requests")) - end - - def index_name_for(table) - "idx_on_#{table}_where_state_id_is_null" - end -end |