debian-mirror-gitlab/db/post_migrate/20210513155635_remove_temporary_package_index_for_nuget_data_migration.rb
2021-06-08 01:23:25 +05:30

20 lines
652 B
Ruby

# frozen_string_literal: true
class RemoveTemporaryPackageIndexForNugetDataMigration < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
INDEX_NAME = 'tmp_index_packages_on_id_where_nuget_default_temp_package'
INDEX_CONDITION = "package_type = 4 AND name = 'NuGet.Temporary.Package' AND status = 0"
disable_ddl_transaction!
def up
# this index was used in 20210513155546_backfill_nuget_temporary_packages_to_processing_status
remove_concurrent_index_by_name :packages_packages, INDEX_NAME
end
def down
add_concurrent_index :packages_packages, :id, where: INDEX_CONDITION, name: INDEX_NAME
end
end