updated test_db script to be more useful, work on different schemas