add upgrade, upgrade-db and internal self-upgrading mecanisms