removed indexes
re-added foreign keys constraints
changed test logic, switched order of shutdown logic
fixed persistence and constraints on table keys
fixed tests