refactor db design