Improve deletion of batched background migration
Problem
For migrations that have many jobs and transition logs, the DELETE query generated by delete_batched_background_migration may have execution time close to the statement timeout (because of the cascading deletes triggered by the FKs). For example - !138574 (comment 1677679706).
Proposal
Change the helper so that the associated batched_background_migration_jobs records are deleted (preferably in batches) before the batched_background_migrations record is deleted.
Edited by Krasimir Angelov