Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
72c3030f
Commit
72c3030f
authored
Oct 11, 2019
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce `UNIQUE_RELATIONS` in RelationFactory
parent
64b1af85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+5
-1
No files found.
lib/gitlab/import_export/relation_factory.rb
View file @
72c3030f
...
...
@@ -42,6 +42,9 @@ module Gitlab
TOKEN_RESET_MODELS
=
%i[Project Namespace Ci::Trigger Ci::Build Ci::Runner ProjectHook]
.
freeze
# This represents all relations that have unique key on `project_id`
UNIQUE_RELATIONS
=
%i[project_feature ProjectCiCdSetting]
.
freeze
def
self
.
create
(
*
args
)
new
(
*
args
).
create
end
...
...
@@ -324,7 +327,8 @@ module Gitlab
end
def
find_or_create_object!
return
relation_class
.
find_or_create_by
(
project_id:
@project
.
id
)
if
@relation_name
==
:project_feature
return
relation_class
.
find_or_create_by
(
project_id:
@project
.
id
)
if
UNIQUE_RELATIONS
.
include?
(
@relation_name
)
return
find_or_create_merge_request!
if
@relation_name
==
:merge_request
# Can't use IDs as validation exists calling `group` or `project` attributes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment