Fixed script for creating test dabase schema.
Added database constraints. Closes #151.