Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb')
-rw-r--r--db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb b/db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb
new file mode 100644
index 00000000000..d1ed53d8e70
--- /dev/null
+++ b/db/post_migrate/20200310075115_schedule_link_lfs_objects_projects.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class ScheduleLinkLfsObjectsProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'LinkLfsObjectsProjects'
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ def up
+ lfs_objects_projects = Gitlab::BackgroundMigration::LinkLfsObjectsProjects::LfsObjectsProject.linkable
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ lfs_objects_projects,
+ MIGRATION,
+ BackgroundMigrationWorker.minimum_interval,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # No-op. No need to make this reversible. In case the jobs enqueued runs and
+ # fails at some point, some records will be created. When rescheduled, those
+ # records won't be re-created. It's also hard to track which records to clean
+ # up if ever.
+ end
+end