gitlab-org--gitlab-foss/db/migrate/20190109153125_add_merge_request_external_diffs.rb
Mayra Cabrera 4706352416 Adds cop to enforce string limits on migrations
This cop will analyze migrations that add columns with string, and
report an offense if the string has no limit enforced

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/64505
2019-08-23 21:36:12 +00:00

25 lines
1 KiB
Ruby

# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddMergeRequestExternalDiffs < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
def change
# Allow the merge request diff to store details about an external file
add_column :merge_request_diffs, :external_diff, :string # rubocop:disable Migration/AddLimitToStringColumns
add_column :merge_request_diffs, :external_diff_store, :integer
add_column :merge_request_diffs, :stored_externally, :boolean
# The diff for each file is mapped to a range in the external file
add_column :merge_request_diff_files, :external_diff_offset, :integer
add_column :merge_request_diff_files, :external_diff_size, :integer
# If the diff is in object storage, it will be null in the database
change_column_null :merge_request_diff_files, :diff, true
end
end