4ebbfe5d3e
The st_commits and st_diffs columns on merge_request_diffs historically held the YAML-serialised data for a merge request diff, in a variety of formats. Since 9.5, these have been migrated in the background to two new tables: merge_request_diff_commits and merge_request_diff_files. That has the advantage that we can actually query the data (for instance, to find out how many commits we've stored), and that it can't be in a variety of formats, but must match the new schema. This is the final step of that journey, where we drop those columns and remove all references to them. This is a breaking change to the importer, because we can no longer import diffs created in the old format, and we cannot guarantee the export will be in the new format unless it was generated after this commit.
51 lines
1 KiB
Ruby
51 lines
1 KiB
Ruby
module Gitlab
|
|
module ImportExport
|
|
extend self
|
|
|
|
# For every version update, the version history in import_export.md has to be kept up to date.
|
|
VERSION = '0.2.1'.freeze
|
|
FILENAME_LIMIT = 50
|
|
|
|
def export_path(relative_path:)
|
|
File.join(storage_path, relative_path)
|
|
end
|
|
|
|
def storage_path
|
|
File.join(Settings.shared['path'], 'tmp/project_exports')
|
|
end
|
|
|
|
def import_upload_path(filename:)
|
|
File.join(storage_path, 'uploads', filename)
|
|
end
|
|
|
|
def project_filename
|
|
"project.json"
|
|
end
|
|
|
|
def project_bundle_filename
|
|
"project.bundle"
|
|
end
|
|
|
|
def config_file
|
|
Rails.root.join('lib/gitlab/import_export/import_export.yml')
|
|
end
|
|
|
|
def version_filename
|
|
'VERSION'
|
|
end
|
|
|
|
def export_filename(project:)
|
|
basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.full_path.tr('/', '_')}"
|
|
|
|
"#{basename[0..FILENAME_LIMIT]}_export.tar.gz"
|
|
end
|
|
|
|
def version
|
|
VERSION
|
|
end
|
|
|
|
def reset_tokens?
|
|
true
|
|
end
|
|
end
|
|
end
|