2020-01-29 10:08:59 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class MergeRequestContextCommitDiffFile < ApplicationRecord
|
2021-01-27 07:09:01 -05:00
|
|
|
extend SuppressCompositePrimaryKeyWarning
|
|
|
|
|
2020-01-29 10:08:59 -05:00
|
|
|
include Gitlab::EncodingHelper
|
|
|
|
include ShaAttribute
|
|
|
|
include DiffFile
|
|
|
|
|
|
|
|
belongs_to :merge_request_context_commit, inverse_of: :diff_files
|
|
|
|
|
|
|
|
sha_attribute :sha
|
|
|
|
alias_attribute :id, :sha
|
|
|
|
|
|
|
|
# create MergeRequestContextCommitDiffFile by given diff file record(s)
|
|
|
|
def self.bulk_insert(*args)
|
2020-06-05 11:08:23 -04:00
|
|
|
Gitlab::Database.bulk_insert('merge_request_context_commit_diff_files', *args) # rubocop:disable Gitlab/BulkInsert
|
2020-01-29 10:08:59 -05:00
|
|
|
end
|
2021-04-29 11:10:07 -04:00
|
|
|
|
|
|
|
def path
|
|
|
|
new_path.presence || old_path
|
|
|
|
end
|
2020-01-29 10:08:59 -05:00
|
|
|
end
|