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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-10 15:06:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-10 15:06:19 +0300
commit69849c280c5525d132ebaddb1200c390a42ecc06 (patch)
tree2c6ffc6fd6dc4fa719305f25b475391730389747 /db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb
parentc157f963db87a40a3ba7b94b339530ee83194bc8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb')
-rw-r--r--db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb b/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb
new file mode 100644
index 00000000000..0cd24da50d0
--- /dev/null
+++ b/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class SchedulePagesMetadataMigration < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ BATCH_SIZE = 10_000
+ MIGRATION = 'MigratePagesMetadata'
+
+ disable_ddl_transaction!
+
+ class Project < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'projects'
+ end
+
+ def up
+ say "Scheduling `#{MIGRATION}` jobs"
+
+ # At the time of writing there are ~10_669_292 records to be inserted for GitLab.com,
+ # batches of 10_000 with delay interval of 2 minutes gives us an estimate of close to 36 hours.
+ queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end