diff options
Diffstat (limited to 'db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb')
-rw-r--r-- | db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb b/db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb new file mode 100644 index 00000000000..76e4a0a95bb --- /dev/null +++ b/db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class ScheduleCleanupOrphanedLfsObjectsProjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + MIGRATION = 'CleanupOrphanedLfsObjectsProjects' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 50_000 + + disable_ddl_transaction! + + class LfsObjectsProject < ActiveRecord::Base + self.table_name = 'lfs_objects_projects' + + include ::EachBatch + end + + def up + queue_background_migration_jobs_by_range_at_intervals(LfsObjectsProject, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + end + + def down + # NOOP + end +end |