[feature/migrations] Fix if method (and create a test for it)

PHPBB3-9737