Build properties db

This is a full rewrite of #1380 (only the db part), as my git-foo is not good enough to let me do that kind of magic. So please review it carefully.

All data and process stuff has been left out.

I'm keeping #1380 around as reference.
Well, the 'yet another migration script' is a bit burned now ...