Description:
The clean_duplicate_history management command raises a ValueError when used with Django 5.1 and a PostgreSQL DB backend. This error occurs if QuerySet.iterator() is called after prefetch_related() without specifying a chunk_size.
Error:
ValueError: chunk_size must be provided when using QuerySet.iterator() after prefetch_related().
Location:
The error originates in the _process method within simple_history/management/commands/clean_duplicate_history.py.
Proposed Fix:
Specify a chunk_size when calling .iterator() on QuerySets that use prefetch_related().