Skip to content

batches: add limit to subquery for updating `batch_specs.batch_change_id`

Created by: BolajiOlajide

Thanks, @courier-new for reporting this.

It's possible (in your dev environment) for a batch_spec to be associated with more than one batch_change, this results in an error when running the migration added by #38921. Adding a limit to the subquery that fetches the batch_change associated with a batch_spec solves this and also gives the added advantage of having a faster execution time as we end the search once we find a match.

Before After
CleanShot 2022-08-01 at 05 08 37@2x CleanShot 2022-08-01 at 05 12 47@2x

Test plan

Manually verified migrations run locally.

Merge request reports

Loading