Flag usages of `finalize_background_migration` method
What does this MR do and why?
Flags the usage of finalize_background_migration
method.
As finalize_background_migration
is part of Background Migrations (that is now deprecated), we should point the usage of the correct method ensure_batched_background_migration_is_finished
.
How to set up and validate locally
- Call
finalize_background_migration
from any migration indb/post_migration
:
I'm using db/post_migrate/20230623073906_prepare_async_index_for_ci_pipelines_bigint_id.rb
...
def up
finalize_background_migration('MyClass')
end
...
- Inspect the
db
folder:
❯ bundle exec rubocop ./db
Offenses:
db/post_migrate/20230623073906_prepare_async_index_for_ci_pipelines_bigint_id.rb:9:5: C: Migration/AvoidFinalizeBackgroundMigration: Prefer ensure_batched_background_migration_is_finished over finalize_background_migration in Batched Background Migrations. See https://docs.gitlab.com/ee/development/database/batched_background_migrations.html
finalize_background_migration('MyClass')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #393455 (closed)
Edited by Leonardo da Rosa