Fix upgrade to work with Postgresql, too