Refactor db initialization + clean schema upgrade path

This commit removes some legacy code like a binary blob with settings in
the db. Please review this carefully, if anything is broken it will
probably corrupt or clear people's db. Good thing we have XMPs. :-)