diff options
Diffstat (limited to 'db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb')
-rw-r--r-- | db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb b/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb new file mode 100644 index 00000000000..6e3f7ae34d1 --- /dev/null +++ b/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class MoveContainerRegistryEnabledToProjectFeatures2 < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + BATCH_SIZE = 21_000 + MIGRATION = 'MoveContainerRegistryEnabledToProjectFeature' + + disable_ddl_transaction! + + class Project < ActiveRecord::Base + include EachBatch + self.table_name = 'projects' + end + + def up + delete_queued_jobs('MoveContainerRegistryEnabledToProjectFeature') + + queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE, track_jobs: true) + end + + def down + # no-op + end +end |