preconditions on most db functions and unit tests covering most sane scenarios