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
540dface
Commit
540dface
authored
Aug 03, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make package migrations reversible
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
78514b79
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
ee/db/migrate/20180720120726_create_packages_package_files.rb
...b/migrate/20180720120726_create_packages_package_files.rb
+11
-1
ee/db/migrate/20180720121404_create_packages_maven_metadata.rb
.../migrate/20180720121404_create_packages_maven_metadata.rb
+11
-1
ee/spec/requests/api/maven_packages_spec.rb
ee/spec/requests/api/maven_packages_spec.rb
+2
-2
No files found.
ee/db/migrate/20180720120726_create_packages_package_files.rb
View file @
540dface
...
...
@@ -5,7 +5,7 @@ class CreatePackagesPackageFiles < ActiveRecord::Migration
disable_ddl_transaction!
def
change
def
up
create_table
:packages_package_files
do
|
t
|
t
.
references
:package
,
index:
true
,
null:
false
t
.
string
:file
...
...
@@ -23,4 +23,14 @@ class CreatePackagesPackageFiles < ActiveRecord::Migration
column: :package_id
,
on_delete: :cascade
end
def
down
if
foreign_keys_for
(
:packages_package_files
,
:package_id
).
any?
remove_foreign_key
:packages_package_files
,
column: :package_id
end
if
table_exists?
(
:packages_package_files
)
drop_table
:packages_package_files
end
end
end
ee/db/migrate/20180720121404_create_packages_maven_metadata.rb
View file @
540dface
...
...
@@ -5,7 +5,7 @@ class CreatePackagesMavenMetadata < ActiveRecord::Migration
disable_ddl_transaction!
def
change
def
up
create_table
:packages_maven_metadata
do
|
t
|
t
.
references
:package
,
index:
true
,
null:
false
t
.
string
:app_group
,
null:
false
...
...
@@ -19,4 +19,14 @@ class CreatePackagesMavenMetadata < ActiveRecord::Migration
column: :package_id
,
on_delete: :cascade
end
def
down
if
foreign_keys_for
(
:packages_maven_metadata
,
:package_id
).
any?
remove_foreign_key
:packages_maven_metadata
,
column: :package_id
end
if
table_exists?
(
:packages_maven_metadata
)
drop_table
:packages_maven_metadata
end
end
end
ee/spec/requests/api/maven_packages_spec.rb
View file @
540dface
...
...
@@ -123,8 +123,8 @@ describe API::MavenPackages do
it
'creates package and stores package file'
do
expect
{
upload_file_with_token
(
params
)
}.
to
change
{
project
.
packages
.
count
}.
by
(
1
)
#
.and change { Packages::MavenMetadatum.count }.by(1)
#
.and change { Packages::PackageFile.count }.by(1)
.
and
change
{
Packages
::
MavenMetadatum
.
count
}.
by
(
1
)
.
and
change
{
Packages
::
PackageFile
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
package_file
.
original_filename
).
to
eq
(
file_upload
.
original_filename
)
...
...
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