Refactor configuration system (again) to allow for SQL-based configuration files.

This commit contains breaking, unmigrated changes to events.yml. There may be code to upgrade old files to the new format in the future, but there is none as of yet. You have been warned.