Skip to content

Create a rails generator for Batched Background Migrations

What does this MR do and why?

Creates below files needed for new batched background migrations (BBM).

  • Post Migration to Queue BBM
  • Spec file for the post-migration.
  • Batched Migration Job class.
  • Spec file for the above job.

How to set up and validate locally

  • bundle exec rails g batched_background_migration --help will provide usage info.
  • Eg: bundle exec rails g batched_background_migration my_batched_migration --table_name=notes --column_name=id --feature_category=database

O/P:

> bundle exec rails g batched_background_migration my_batched_migration --table_name=notes --column_name=id --feature_category=database
  -   create  db/post_migrate/20230214231008_queue_my_batched_migration.rb
      create  spec/migrations/20230214231008_queue_my_batched_migration_spec.rb
      create  lib/gitlab/background_migration/my_batched_migration.rb
      create  spec/lib/gitlab/background_migration/my_batched_migration_spec.rb

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #388301 (closed)

Edited by Prabakaran Murugesan

Merge request reports

Loading