Added database upgrade script

upgrade-database.py detects the version of the database, and upgrades it
if necessary.