makes dbs know source or target

@bryanduxbury @smparkes 

bugfix for the breakage around prefixing tables in the first couple commits. the others are just cleaning up silliness.