Shutdown db after migration
Use mktemp command that works on centos 5
Consolidate logic of adding rels that cannot exist more than once