debian-mirror-gitlab/db/migrate/20200527135313_add_requirements_build_reference.rb

24 lines
712 B
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# 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
2021-01-03 14:25:43 +05:30
add_foreign_key :requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify
2020-06-23 00:09:42 +05:30
end
end
def down
with_lock_retries do
remove_column :requirements_management_test_reports, :build_id
end
end
end