Introduce (on-disc) store versioning and upgrade. See individual commits for details. Part of #162 (closed)