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
c4a09acc
Commit
c4a09acc
authored
Feb 10, 2020
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add package dependencies cleanup migration
Those with dependency_type 5 should be removed
parent
b4036a8f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
db/migrate/20200210135504_remove_packages_deprecated_dependencies.rb
...20200210135504_remove_packages_deprecated_dependencies.rb
+13
-0
ee/changelogs/unreleased/10io-remove-deprecated-package-dependencies.yml
...nreleased/10io-remove-deprecated-package-dependencies.yml
+5
-0
spec/migrations/remove_packages_deprecated_dependencies_spec.rb
...igrations/remove_packages_deprecated_dependencies_spec.rb
+30
-0
No files found.
db/migrate/20200210135504_remove_packages_deprecated_dependencies.rb
0 → 100644
View file @
c4a09acc
# frozen_string_literal: true
class
RemovePackagesDeprecatedDependencies
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
up
execute
(
'DELETE FROM packages_dependency_links WHERE dependency_type = 5'
)
end
def
down
# There is nothing to do to reverse this migration
end
end
ee/changelogs/unreleased/10io-remove-deprecated-package-dependencies.yml
0 → 100644
View file @
c4a09acc
---
title
:
Cleanup deprecated package dependency links
merge_request
:
24868
author
:
type
:
fixed
spec/migrations/remove_packages_deprecated_dependencies_spec.rb
0 → 100644
View file @
c4a09acc
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20200210135504_remove_packages_deprecated_dependencies.rb'
)
describe
RemovePackagesDeprecatedDependencies
,
:migration
do
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:packages
)
{
table
(
:packages_packages
)
}
let
(
:dependency_links
)
{
table
(
:packages_dependency_links
)
}
let
(
:dependencies
)
{
table
(
:packages_dependencies
)
}
before
do
projects
.
create!
(
id:
123
,
name:
'gitlab'
,
path:
'gitlab-org/gitlab-ce'
,
namespace_id:
1
)
packages
.
create!
(
id:
1
,
name:
'package'
,
version:
'1.0.0'
,
package_type:
4
,
project_id:
123
)
5
.
times
do
|
i
|
dependencies
.
create!
(
id:
i
,
name:
"pkg_dependency_
#{
i
}
"
,
version_pattern:
'~1.0.0'
)
dependency_links
.
create!
(
package_id:
1
,
dependency_id:
i
,
dependency_type:
5
)
end
dependencies
.
create!
(
id:
10
,
name:
'valid_pkg_dependency'
,
version_pattern:
'~2.5.0'
)
dependency_links
.
create!
(
package_id:
1
,
dependency_id:
10
,
dependency_type:
1
)
end
it
'removes all dependency links with type 5'
do
expect
(
dependency_links
.
count
).
to
eq
6
migrate!
expect
(
dependency_links
.
count
).
to
eq
1
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