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>2021-06-08 18:10:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-08 18:10:00 +0300
commit0ebbf19f2d2b87e1f2aca1c59efde1aa6a766cf6 (patch)
treeb45534e86659ab6fa97c240563651b2e03dfce4d /doc/development/background_migrations.md
parentccc2dc45a3e8fab3dfeda097be601b16c5beff13 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/background_migrations.md')
-rw-r--r--doc/development/background_migrations.md14
1 files changed, 2 insertions, 12 deletions
diff --git a/doc/development/background_migrations.md b/doc/development/background_migrations.md
index a96606719d0..fb1e61642d7 100644
--- a/doc/development/background_migrations.md
+++ b/doc/development/background_migrations.md
@@ -255,12 +255,8 @@ batches instead of doing this one by one:
class ScheduleExtractServicesUrl < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
- class Service < ActiveRecord::Base
- self.table_name = 'services'
- end
-
def up
- Service.select(:id).in_batches do |relation|
+ define_batchable_model('services').select(:id).in_batches do |relation|
jobs = relation.pluck(:id).map do |id|
['ExtractServicesUrl', [id]]
end
@@ -286,18 +282,12 @@ this:
class ConsumeRemainingExtractServicesUrlJobs < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
- class Service < ActiveRecord::Base
- include ::EachBatch
-
- self.table_name = 'services'
- end
-
def up
# This must be included
Gitlab::BackgroundMigration.steal('ExtractServicesUrl')
# This should be included, but can be skipped - see below
- Service.where(url: nil).each_batch(of: 50) do |batch|
+ define_batchable_model('services').where(url: nil).each_batch(of: 50) do |batch|
range = batch.pluck('MIN(id)', 'MAX(id)').first
Gitlab::BackgroundMigration::ExtractServicesUrl.new.perform(*range)