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
path: root/db
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-04-27 08:46:03 +0300
committerShinya Maeda <shinya@gitlab.com>2018-05-28 08:50:10 +0300
commit4b85b4dc6d22eab375732123fe8a9fba5812000c (patch)
treef644200638654b994fe1e4cf26f714d152d14eae /db
parentc0b4f8ac3dea446d2b7bdd04eecf3456f79fe7e7 (diff)
Fix schema and refactoring migration file
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20180424151928_fill_file_store.rb.rb50
1 files changed, 26 insertions, 24 deletions
diff --git a/db/post_migrate/20180424151928_fill_file_store.rb.rb b/db/post_migrate/20180424151928_fill_file_store.rb.rb
index d7d53f5814b..e950d78e1dd 100644
--- a/db/post_migrate/20180424151928_fill_file_store.rb.rb
+++ b/db/post_migrate/20180424151928_fill_file_store.rb.rb
@@ -10,13 +10,8 @@ class FillFileStore < ActiveRecord::Migration
self.table_name = 'ci_job_artifacts'
BATCH_SIZE = 10_000
- def self.queue_background_migration
- self.class.where(file_store: nil).tap do |relation|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- 'FillFileStoreJobArtifact',
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
+ def self.params_for_background_migration
+ yield self.where(file_store: nil), 'FillFileStoreJobArtifact', 5.minutes, BATCH_SIZE
end
end
@@ -25,13 +20,8 @@ class FillFileStore < ActiveRecord::Migration
self.table_name = 'lfs_objects'
BATCH_SIZE = 10_000
- def self.queue_background_migration
- self.class.where(file_store: nil).tap do |relation|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- 'FillFileStoreLfsObject',
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
+ def self.params_for_background_migration
+ yield self.where(file_store: nil), 'FillFileStoreLfsObject', 5.minutes, BATCH_SIZE
end
end
@@ -40,13 +30,8 @@ class FillFileStore < ActiveRecord::Migration
self.table_name = 'uploads'
BATCH_SIZE = 10_000
- def self.queue_background_migration
- self.class.where(store: nil).tap do |relation|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- 'FillFileStoreUpload',
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
+ def self.params_for_background_migration
+ yield self.where(store: nil), 'FillFileStoreUpload', 5.minutes, BATCH_SIZE
end
end
@@ -60,9 +45,26 @@ class FillFileStore < ActiveRecord::Migration
# - lfs_objects.file_store
# - uploads.store
- FillFileStore::JobArtifact.queue_background_migration
- FillFileStore::LfsObject.queue_background_migration
- FillFileStore::Upload.queue_background_migration
+ FillFileStore::JobArtifact.params_for_background_migration do |relation, class_name, delay_interval, batch_size|
+ queue_background_migration_jobs_by_range_at_intervals(relation,
+ class_name,
+ delay_interval,
+ batch_size: batch_size)
+ end
+
+ FillFileStore::LfsObject.params_for_background_migration do |relation, class_name, delay_interval, batch_size|
+ queue_background_migration_jobs_by_range_at_intervals(relation,
+ class_name,
+ delay_interval,
+ batch_size: batch_size)
+ end
+
+ FillFileStore::Upload.params_for_background_migration do |relation, class_name, delay_interval, batch_size|
+ queue_background_migration_jobs_by_range_at_intervals(relation,
+ class_name,
+ delay_interval,
+ batch_size: batch_size)
+ end
end
def down