I am not sure how this can best be cleaned up but this if statement seems very unwieldy as it stands now, would something like the following be better.

```python
is_bigauto = isinstance(rel_field, BigAutoField)
is_bigint = isinstance(rel_field, BigIntegerField)
matches_type = connection.features.related_fields_match_type

if (is_bigauto or (not matches_type and is_bigint)):
    ...
```