Commit 4ffcd427 authored by James Lopez's avatar James Lopez

import working!

parent dbf755ae
......@@ -74,9 +74,8 @@ module Projects
relation.values.flatten.each do |sub_relation|
relation_hash = relation_item[sub_relation.to_s]
next if relation_hash.blank?
relation_hash.merge!('project_id' => project.id) if sub_relation == :merge_requests
sub_relation_object = Projects::ImportExport::RelationFactory.create(
relation_sym: sub_relation, relation_hash: relation_hash, members_map: members_map)
relation_sym: sub_relation, relation_hash: relation_hash.merge!('project_id' => project.id), members_map: members_map)
relation_item[sub_relation.to_s] = sub_relation_object
end
end
......
......@@ -3,7 +3,7 @@ module Projects
module RelationFactory
extend self
OVERRIDES = { snippets: :project_snippets }.freeze
OVERRIDES = { snippets: :project_snippets, commit: 'Ci::Commit' }.freeze
USER_REFERENCES = %w(author_id assignee_id updated_by_id).freeze
def create(relation_sym:, relation_hash:, members_map:)
......@@ -11,6 +11,7 @@ module Projects
relation_sym = parse_relation_sym(relation_sym)
klass = relation_class(relation_sym)
relation_hash.delete('id') #screw IDs for now
relation_hash.delete('project_id') unless klass.column_names.include?(:project_id)
handle_merge_requests(relation_hash) if relation_sym == :merge_requests
update_user_references(relation_hash, members_map)
imported_object = klass.new(relation_hash)
......
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