summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 06:07:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 06:07:51 +0000
commit00bd11b166a886742f04d38c0d2551e52ff51472 (patch)
treeaf0b118c5748fdaabda2f9c2a007969c1673d581 /db
parenta0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501 (diff)
downloadgitlab-ce-00bd11b166a886742f04d38c0d2551e52ff51472.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb b/db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb
new file mode 100644
index 00000000000..a7d1b42ef70
--- /dev/null
+++ b/db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class RescheduleLinkLfsObjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'LinkLfsObjects'
+ BATCH_SIZE = 1_000
+
+ disable_ddl_transaction!
+
+ def up
+ forks = Gitlab::BackgroundMigration::LinkLfsObjects::Project.with_non_existing_lfs_objects
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ forks,
+ 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