implement db and test suite for db