Fix broken pending migration task check and improve testing
Can't show this merge request because the source branch fix-revert-deleted-migration is missing from project georgekoltsov-multiple-projects-test-4/imported-project-ef029319134ab099. Close this merge request or update the source branch.