Add some initial support for database upgrade. This isn't really needed yet, but it's there so that it's easy to add upgrade later on.