fix for issue #2288

pulling database setup and two following parts on hierarchical level up as they don't belong to templates section