Refactor database spec