Refactor view for changed db