Fix up some issues with oauth2_provider evolutions.

Review Request #14905 — Created March 14, 2026 and updated

Information

Review Board
master

Reviewers

When adding evolutions for oauth2_provider I got a little lazy and just
ignored the RunPython stuff in their migrations. It turns out that we
actually need to populate the token_checksum field in the same way that
they do, first creating the field as blank, populated it with hashes of
each of the items, and then finally fixing it to be non-blank.

This also adds a post-upgrade step to save application client_secret
fields, causing any unhashed items to be fixed.

Finally, I've set a couple additional flags on the conversion of the
token field to be a TextField, removing the max length and unique
parameters.

Did test upgrades from 4.0.6, 5.0.7, 6.0.2, and 7.0.4 schemas.
Previously I was getting failures on the 4.0.6 and 5.0.7 ones.

Summary ID
Fix up some issues with oauth2_provider evolutions.
When adding evolutions for oauth2_provider I got a little lazy and just ignored the `RunPython` stuff in their migrations. It turns out that we actually need to populate the token_checksum field in the same way that they do, first creating the field as blank, populated it with hashes of each of the items, and then finally fixing it to be non-blank. This also adds a post-upgrade step to save application `client_secret` fields, causing any unhashed items to be fixed. Finally, I've set a couple additional flags on the conversion of the `token` field to be a `TextField`, removing the max length and unique parameters. Testing Done: - Did test upgrades from 4.0.6, 5.0.7, 6.0.2, and 7.0.4 schemas. Previously I was getting failures on the 4.0.6 and 5.0.7 ones.
lwuwtszpxvmntxyumnryryxqxrruyptq
Checks run (2 succeeded)
flake8 passed.
JSHint passed.