debian-mirror-gitlab/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb
2021-09-30 23:02:18 +05:30

18 lines
407 B
Ruby

# frozen_string_literal: true
class AddPartialIndexForCiBuildsToken < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
NAME = 'index_ci_builds_on_token_partial'
def up
add_concurrent_index :ci_builds, :token, unique: true, where: 'token IS NOT NULL', name: NAME
end
def down
remove_concurrent_index_by_name :ci_builds, NAME
end
end