Database: Refactor database conversion checks
This simplifies the version management by the use of macros.