Remove some duplicate code from a merge in rb-site.

Some code from a backport of an rb-site change to 1.7 got merged back
into 2.0, causing a duplicate function and unused import. This removes
that code.
Handle all errors when checking if a diff dedup is needed on upgrade.

We were checking if an OperationalError was thrown when checking if a
diff dedup was needed during upgrade. Turns out, ProgrammingError can
also be thrown. We may find that more errors could be thrown in the
future.

We unit test that the unmigrated() function works, and Django's count()
should always work. So, trusting that, we're now just catching all
exceptions, instead of white-listing several exceptions. This will help
protect from new errors in the future (depending on database), and
ensure that the user will always be able to get through this (very
unimportant) part of the upgrade process.

Reviewed at https://reviews.reviewboard.org/r/6145/