diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb')
-rw-r--r-- | db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb b/db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb new file mode 100644 index 00000000000..8124f94b519 --- /dev/null +++ b/db/post_migrate/20210513155546_backfill_nuget_temporary_packages_to_processing_status.rb @@ -0,0 +1,29 @@ +# 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 |