Support unified database hierarchy
Add support for unified database hierarchy, which has a single template root and a single top document (index.yaml). Keep support for the original hierarchy for compatibility. To be removed after the database is transitioned.