more complete db upgrade script