CORE-5386 Renamed template_group table to app_categories.

Renamed analysis_group_hierarchy function to app_category_hierarchy.
Renamed app_group_hierarchy_ids function to app_category_hierarchy_ids.
Renamed analysis_group_listing view to app_category_listing.
CORE-5386 Removed app_categories 'hid' field.
    
Made 'id' its primary key.
Refactored references to this key in other tables.