Cleanup: Provided build versions are always integers

So avoid the conversion.
Bugfix: There is no flush_checks
Cleanup: Move code to upgrade management command

Since it is the only place where it is used it makes sense to be there.
This allows to keep the module __init__.py for code more focused on the
upgrade machinery internals.
Cleanups

To ease further refactoring and improve readability.
Cleanup: Now `buildversion_for_fn` always returns an int

So no need to convert the retrieved build version in other places.
Cleanup: Pass the function instead of the function name
Cleanup: `filter_upgrade_functions` already receives the function build

Still wondering why this code worked.
Cleanup: Just do the comparison instead of calling function
Cleanup: Remove intermediate upgrade function
Bugfix: Use the right build versions