Updated Pipeline unit testing.

Still need to maybe stub query/viskovisualizer to make it a real unit test.
Added code for testing QueryManager (database stages)

Also tweaked constraints in database to cascade, which is rarely relevant for normal use, but nice for testing.