Add routine for database prep and upgrade. WIP.