2020-06-02 08:08:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AddRequirementsBuildReference < ActiveRecord::Migration[6.0]
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
INDEX_NAME = 'index_requirements_management_test_reports_on_build_id'
|
|
|
|
|
|
|
|
def up
|
|
|
|
add_column :requirements_management_test_reports, :build_id, :bigint
|
|
|
|
add_index :requirements_management_test_reports, :build_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex
|
|
|
|
|
|
|
|
with_lock_retries do
|
2020-10-06 08:08:38 -04:00
|
|
|
add_foreign_key :requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify
|
2020-06-02 08:08:33 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
with_lock_retries do
|
|
|
|
remove_column :requirements_management_test_reports, :build_id
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|