debian-mirror-gitlab/db/migrate/20220617123135_drop_temp_index_on_projects_on_id_and_runners_token.rb
2022-08-13 15:12:31 +05:30

22 lines
623 B
Ruby

# frozen_string_literal: true
class DropTempIndexOnProjectsOnIdAndRunnersToken < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
TEMP_INDEX_NAME = 'tmp_index_projects_on_id_and_runners_token'
def up
finalize_background_migration 'ResetDuplicateCiRunnersTokenValuesOnProjects'
remove_concurrent_index_by_name :projects, TEMP_INDEX_NAME
end
def down
add_concurrent_index :projects,
[:id, :runners_token],
where: "runners_token IS NOT NULL",
unique: false,
name: TEMP_INDEX_NAME
end
end