adding connection parameter to check_pending for migrations