Describe the bug
In 3.0.0 the oauth2_provider.0012_add_token_checksum migration was added to add a new column to the access token table. This migration upgrades the table by looping over AccessToken._default_manager.all() which causes the entire table to be loaded in memory.
https://github.com/jazzband/django-oauth-toolkit/blob/907d70f08c1bef94a485bde8fd3edb51952aec03/oauth2_provider/migrations/0012_add_token_checksum.py#L12-L14
This does not work for systems with limited memory and large access token tables because the migrate process will be killed by the OOM killer.
This could be fixed by using an iterator: AccessToken._default_manager.iterator()
To Reproduce
Run ./manage.py migrate on a system with a large access token table.
Expected behavior
A successful migration.
Version
3.0.1