Add a database migration class

This implements a slightly cruder version the database schema defined in
www/lib/config.php, along with a function to create the required tables.