Commit 7c5cef46 authored by George Koltsov's avatar George Koltsov

Do not export certain models when using Relations Export API

Changelog: added
parent ac7ce848
......@@ -30,7 +30,7 @@ module BulkImports
end
def portable_relations
import_export_config.dig(:tree, portable_class_sym).keys.map(&:to_s)
import_export_config.dig(:tree, portable_class_sym).keys.map(&:to_s) - skipped_relations
end
private
......@@ -66,6 +66,10 @@ module BulkImports
def base_export_path
raise NotImplementedError
end
def skipped_relations
[]
end
end
end
end
......@@ -10,6 +10,10 @@ module BulkImports
def import_export_yaml
::Gitlab::ImportExport.group_config_file
end
def skipped_relations
@skipped_relations ||= %w(members)
end
end
end
end
......@@ -10,6 +10,10 @@ module BulkImports
def import_export_yaml
::Gitlab::ImportExport.config_file
end
def skipped_relations
@skipped_relations ||= %w(project_members group_members)
end
end
end
end
......@@ -34,6 +34,10 @@ RSpec.describe BulkImports::FileTransfer::GroupConfig do
it 'returns a list of top level exportable relations' do
expect(subject.portable_relations).to include('milestones', 'badges', 'boards', 'labels')
end
it 'does not include skipped relations' do
expect(subject.portable_relations).not_to include('members')
end
end
describe '#top_relation_tree' do
......
......@@ -34,6 +34,10 @@ RSpec.describe BulkImports::FileTransfer::ProjectConfig do
it 'returns a list of top level exportable relations' do
expect(subject.portable_relations).to include('issues', 'labels', 'milestones', 'merge_requests')
end
it 'does not include skipped relations' do
expect(subject.portable_relations).not_to include('project_members', 'group_members')
end
end
describe '#top_relation_tree' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment