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
6864c1f2
Commit
6864c1f2
authored
Jan 07, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use union to get distinct project ids
parent
5d91db5b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
ee/db/post_migrate/20181204040404_migrate_project_approvers.rb
.../post_migrate/20181204040404_migrate_project_approvers.rb
+9
-4
No files found.
ee/db/post_migrate/20181204040404_migrate_project_approvers.rb
View file @
6864c1f2
...
...
@@ -36,9 +36,14 @@ class MigrateProjectApprovers < ActiveRecord::Migration[5.0]
private
def
get_project_ids
project_ids
=
Approver
.
where
(
'target_type = ?'
,
'Project'
).
pluck
(
:target_id
)
project_ids
+=
ApproverGroup
.
where
(
'target_type = ?'
,
'Project'
).
pluck
(
:target_id
)
project_ids
.
uniq!
project_ids
results
=
ActiveRecord
::
Base
.
connection
.
exec_query
<<~
SQL
SELECT DISTINCT target_id FROM (
SELECT target_id FROM approvers WHERE target_type='Project'
UNION
SELECT target_id FROM approver_groups WHERE target_type='Project'
) t
SQL
results
.
rows
.
flatten
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