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
d785295f
Commit
d785295f
authored
Jul 04, 2018
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed sql string splits
parent
e33c95cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
lib/gitlab/background_migration/fix_cross_project_label_links.rb
...lab/background_migration/fix_cross_project_label_links.rb
+6
-7
No files found.
lib/gitlab/background_migration/fix_cross_project_label_links.rb
View file @
d785295f
...
@@ -62,9 +62,9 @@ module Gitlab
...
@@ -62,9 +62,9 @@ module Gitlab
# b) a group label of a different group than issue's project group
# b) a group label of a different group than issue's project group
def
check_issues
(
project_ids
)
def
check_issues
(
project_ids
)
issue_ids
=
Label
issue_ids
=
Label
.
joins
(
'INNER JOIN label_links ON label_links.label_id = labels.id AND label_links.target_type = \'Issue\'
'
\
.
joins
(
'INNER JOIN label_links ON label_links.label_id = labels.id AND label_links.target_type = \'Issue\'
'INNER JOIN issues ON issues.id = label_links.target_id '
\
INNER JOIN issues ON issues.id = label_links.target_id
'
INNER JOIN projects ON projects.id = issues.project_id'
)
INNER JOIN projects ON projects.id = issues.project_id'
)
.
where
(
'issues.project_id in (?)'
,
project_ids
)
.
where
(
'issues.project_id in (?)'
,
project_ids
)
.
where
(
'(labels.project_id is not null and labels.project_id != issues.project_id) '
\
.
where
(
'(labels.project_id is not null and labels.project_id != issues.project_id) '
\
'or (labels.group_id is not null and labels.group_id != projects.namespace_id)'
)
'or (labels.group_id is not null and labels.group_id != projects.namespace_id)'
)
...
@@ -78,9 +78,9 @@ module Gitlab
...
@@ -78,9 +78,9 @@ module Gitlab
# b) a group label of a different group than MR's project group
# b) a group label of a different group than MR's project group
def
check_merge_requests
(
project_ids
)
def
check_merge_requests
(
project_ids
)
mr_ids
=
Label
mr_ids
=
Label
.
joins
(
'INNER JOIN label_links ON label_links.label_id = labels.id AND label_links.target_type = \'MergeRequest\'
'
\
.
joins
(
'INNER JOIN label_links ON label_links.label_id = labels.id AND label_links.target_type = \'MergeRequest\'
'INNER JOIN merge_requests ON merge_requests.id = label_links.target_id '
\
INNER JOIN merge_requests ON merge_requests.id = label_links.target_id
'
INNER JOIN projects ON projects.id = merge_requests.target_project_id'
)
INNER JOIN projects ON projects.id = merge_requests.target_project_id'
)
.
where
(
'merge_requests.target_project_id in (?)'
,
project_ids
)
.
where
(
'merge_requests.target_project_id in (?)'
,
project_ids
)
.
where
(
'(labels.project_id is not null and labels.project_id != merge_requests.target_project_id) '
\
.
where
(
'(labels.project_id is not null and labels.project_id != merge_requests.target_project_id) '
\
'or (labels.group_id is not null and labels.group_id != projects.namespace_id)'
)
'or (labels.group_id is not null and labels.group_id != projects.namespace_id)'
)
...
@@ -106,7 +106,6 @@ module Gitlab
...
@@ -106,7 +106,6 @@ module Gitlab
next
unless
matching_label
next
unless
matching_label
# puts "#{label.label_link_id};#{resource.class.name.demodulize};project:#{project_id};id:#{resource.id};label:#{label.title}: #{label.label_id} -> #{matching_label.id}"
LabelLink
.
find
(
label
.
label_link_id
).
update!
(
label_id:
matching_label
.
id
)
LabelLink
.
find
(
label
.
label_link_id
).
update!
(
label_id:
matching_label
.
id
)
end
end
end
end
...
...
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