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
5ea380ea
Commit
5ea380ea
authored
May 17, 2021
by
Steve Abrams
Committed by
Tiger Watson
May 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update old temporary NuGet packages to processing
parent
008b376c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
0 deletions
+109
-0
changelogs/unreleased/324206-processing-package-scope-removal.yml
...gs/unreleased/324206-processing-package-scope-removal.yml
+5
-0
db/post_migrate/20210513155447_add_temporary_package_index_for_nuget_data_migration.rb
...7_add_temporary_package_index_for_nuget_data_migration.rb
+19
-0
db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb
...backfill_nuget_temporary_packages_to_processing_status.rb
+29
-0
db/post_migrate/20210513155635_remove_temporary_package_index_for_nuget_data_migration.rb
...emove_temporary_package_index_for_nuget_data_migration.rb
+19
-0
db/schema_migrations/20210513155447
db/schema_migrations/20210513155447
+1
-0
db/schema_migrations/20210513155546
db/schema_migrations/20210513155546
+1
-0
db/schema_migrations/20210513155635
db/schema_migrations/20210513155635
+1
-0
spec/migrations/backfill_nuget_temporary_packages_to_processing_status_spec.rb
...ill_nuget_temporary_packages_to_processing_status_spec.rb
+34
-0
No files found.
changelogs/unreleased/324206-processing-package-scope-removal.yml
0 → 100644
View file @
5ea380ea
---
title
:
Update temporary NuGet packages to have processing status
merge_request
:
61724
author
:
type
:
other
db/post_migrate/20210513155447_add_temporary_package_index_for_nuget_data_migration.rb
0 → 100644
View file @
5ea380ea
# frozen_string_literal: true
class
AddTemporaryPackageIndexForNugetDataMigration
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
INDEX_NAME
=
'tmp_index_packages_on_id_where_nuget_default_temp_package'
INDEX_CONDITION
=
"package_type = 4 AND name = 'NuGet.Temporary.Package' AND status = 0"
disable_ddl_transaction!
def
up
# this index is used in 20210513155546_backfill_nuget_temporary_packages_to_processing_status
add_concurrent_index
:packages_packages
,
:id
,
where:
INDEX_CONDITION
,
name:
INDEX_NAME
end
def
down
remove_concurrent_index_by_name
:packages_packages
,
INDEX_NAME
end
end
db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb
0 → 100644
View file @
5ea380ea
# frozen_string_literal: true
class
BackfillNugetTemporaryPackagesToProcessingStatus
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
class
Package
<
ActiveRecord
::
Base
include
EachBatch
self
.
table_name
=
'packages_packages'
scope
:nuget_temporary_packages
,
->
do
# 4 is nuget package type, 0 is default status
where
(
package_type:
4
,
name:
'NuGet.Temporary.Package'
,
status:
0
)
end
end
def
up
Package
.
nuget_temporary_packages
.
each_batch
(
of:
100
)
do
|
batch
|
# 2 is processing status
batch
.
update_all
(
status:
2
)
end
end
def
down
# no-op
end
end
db/post_migrate/20210513155635_remove_temporary_package_index_for_nuget_data_migration.rb
0 → 100644
View file @
5ea380ea
# frozen_string_literal: true
class
RemoveTemporaryPackageIndexForNugetDataMigration
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
INDEX_NAME
=
'tmp_index_packages_on_id_where_nuget_default_temp_package'
INDEX_CONDITION
=
"package_type = 4 AND name = 'NuGet.Temporary.Package' AND status = 0"
disable_ddl_transaction!
def
up
# this index was used in 20210513155546_backfill_nuget_temporary_packages_to_processing_status
remove_concurrent_index_by_name
:packages_packages
,
INDEX_NAME
end
def
down
add_concurrent_index
:packages_packages
,
:id
,
where:
INDEX_CONDITION
,
name:
INDEX_NAME
end
end
db/schema_migrations/20210513155447
0 → 100644
View file @
5ea380ea
1f5ea8527107d4cffac535b9ae3e532a98ebd69a8711abdbe68b12fe005dfbb5
\ No newline at end of file
db/schema_migrations/20210513155546
0 → 100644
View file @
5ea380ea
44abbe007dae17982f923b1b15fd0534d3d3a7fd154cd9e4b5409f86030de2f7
\ No newline at end of file
db/schema_migrations/20210513155635
0 → 100644
View file @
5ea380ea
d1fccf214f2e237482fc4d9e2b5d5ea6e9241ad4ace8739e7b799555afafa215
\ No newline at end of file
spec/migrations/backfill_nuget_temporary_packages_to_processing_status_spec.rb
0 → 100644
View file @
5ea380ea
# frozen_string_literal: true
require
'spec_helper'
require_migration!
RSpec
.
describe
BackfillNugetTemporaryPackagesToProcessingStatus
,
:migration
do
let
(
:namespaces
)
{
table
(
:namespaces
)
}
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:packages
)
{
table
(
:packages_packages
)
}
before
do
namespace
=
namespaces
.
create!
(
id:
123
,
name:
'test_namespace'
,
path:
'test_namespace'
)
project
=
projects
.
create!
(
id:
111
,
name:
'sample_project'
,
path:
'sample_project'
,
namespace_id:
namespace
.
id
)
packages
.
create!
(
name:
'NuGet.Temporary.Package'
,
version:
'0.1.1'
,
package_type:
4
,
status:
0
,
project_id:
project
.
id
)
packages
.
create!
(
name:
'foo'
,
version:
'0.1.1'
,
package_type:
4
,
status:
0
,
project_id:
project
.
id
)
packages
.
create!
(
name:
'NuGet.Temporary.Package'
,
version:
'0.1.1'
,
package_type:
4
,
status:
2
,
project_id:
project
.
id
)
packages
.
create!
(
name:
'NuGet.Temporary.Package'
,
version:
'0.1.1'
,
package_type:
1
,
status:
2
,
project_id:
project
.
id
)
packages
.
create!
(
name:
'NuGet.Temporary.Package'
,
version:
'0.1.1'
,
package_type:
1
,
status:
0
,
project_id:
project
.
id
)
end
it
'updates the applicable packages to processing status'
,
:aggregate_failures
do
expect
(
packages
.
where
(
status:
0
).
count
).
to
eq
(
3
)
expect
(
packages
.
where
(
status:
2
).
count
).
to
eq
(
2
)
expect
(
packages
.
where
(
name:
'NuGet.Temporary.Package'
,
package_type:
4
,
status:
0
).
count
).
to
eq
(
1
)
migrate!
expect
(
packages
.
where
(
status:
0
).
count
).
to
eq
(
2
)
expect
(
packages
.
where
(
status:
2
).
count
).
to
eq
(
3
)
expect
(
packages
.
where
(
name:
'NuGet.Temporary.Package'
,
package_type:
4
,
status:
0
).
count
).
to
eq
(
0
)
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