Added repair script to upgrade the legacy home storage ids

I'm tired of these legacy storage id issues when people move their homes, so here is the repair script.
Fixes #6493 

I've tested with MySQL:
- [x] correctly migrates legacy storage ids to home:: based ids
- [x] doesn't migrate existing home:: other storages
- [x] doesn't migrate "local::/path/to/datadir/" which I still wonder why it exists, some kind of root storage?

This needs to be tested on all DBs.

TODO:
- [x] Test on more DBs
- [x] Add unit tests containing a mix of legacy storage ids, home storage ids and external storage ids

@DeepDiver1975 @icewind1991 @karlitschek