master/sql: add the DS states in the SQL db

Right now, it rereads the external Storable files. It's not very
efficient, but is mostly readable.

And it is compatible with the future standalone Storable2SQL tool
Merge branch 'json' into devel