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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
392e5df7
Commit
392e5df7
authored
Oct 08, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't create fork networks for root projects that are deleted
parent
91f1d652
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
lib/gitlab/background_migration/create_fork_network_memberships_range.rb
...ground_migration/create_fork_network_memberships_range.rb
+5
-0
lib/gitlab/background_migration/populate_fork_networks_range.rb
...tlab/background_migration/populate_fork_networks_range.rb
+5
-0
spec/lib/gitlab/background_migration/populate_fork_networks_range_spec.rb
...background_migration/populate_fork_networks_range_spec.rb
+8
-0
No files found.
lib/gitlab/background_migration/create_fork_network_memberships_range.rb
View file @
392e5df7
...
...
@@ -46,6 +46,11 @@ module Gitlab
FROM fork_network_members
WHERE fork_network_members.project_id = forked_project_links.forked_to_project_id
)
AND EXISTS (
SELECT true
FROM projects
WHERE forked_project_links.forked_from_project_id = projects.id
)
AND forked_project_links.id BETWEEN
#{
start_id
}
AND
#{
end_id
}
MISSING_MEMBERS
...
...
lib/gitlab/background_migration/populate_fork_networks_range.rb
View file @
392e5df7
...
...
@@ -20,6 +20,11 @@ module Gitlab
FROM fork_networks
WHERE forked_project_links.forked_from_project_id = fork_networks.root_project_id
)
AND EXISTS (
SELECT true
FROM projects
WHERE projects.id = forked_project_links.forked_from_project_id
)
AND forked_project_links.id BETWEEN
#{
start_id
}
AND
#{
end_id
}
INSERT_NETWORKS
...
...
spec/lib/gitlab/background_migration/populate_fork_networks_range_spec.rb
View file @
392e5df7
...
...
@@ -62,6 +62,14 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch
expect
(
base2_membership
).
not_to
be_nil
end
it
'skips links that had their source project deleted'
do
forked_project_links
.
create
(
id:
6
,
forked_from_project_id:
99999
,
forked_to_project_id:
create
(
:project
).
id
)
migration
.
perform
(
5
,
8
)
expect
(
fork_networks
.
find_by
(
root_project_id:
99999
)).
to
be_nil
end
it
'schedules a job for inserting memberships for forks-of-forks'
do
delay
=
Gitlab
::
BackgroundMigration
::
CreateForkNetworkMembershipsRange
::
RESCHEDULE_DELAY
...
...
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