Fixes migration issues and the seltest command

There were a few dependencies that weren't enforced, so migrating from a clean db gave some issues. I added in some constraints and migrations where needed. This setup now migrates correctly from a clean db.

The migration fixes might conflict with Taylor's changes when we
get around to merging that. We should be sure to check ./manage.py
syncdb followed by ./manage.py migrate on a clean database to make
sure it works after the merge (which will likely be a manual one).

@pricem, @aseering -- Since you guys probably have the most experience with the DB migrations, can you take a look over these migration changes and let me know if they look reasonable?