This is a bit of a large commit that adds basic database migration support. It also alters the way user variables are stored in a way requiring manual migration of existing data. The first automated migration adds variable count in a new place.