Refactor database schemas