add support of automatic db upgrade