debian-mirror-gitlab/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
2020-01-01 13:55:28 +05:30

20 lines
575 B
Ruby

# frozen_string_literal: true
class AddIndexForCrossProjectsDependenciesToCiBuilds < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_builds, [:project_id, :name, :ref],
where: "type = 'Ci::Build' AND status = 'success' AND (retried = FALSE OR retried IS NULL)"
end
def down
remove_concurrent_index :ci_builds, [:project_id, :name, :ref],
where: "type = 'Ci::Build' AND status = 'success' AND (retried = FALSE OR retried IS NULL)"
end
end