v041 database and upgrade script