Split database functionality into generic database and specific for (currently only backend) sqlite.
Fixes to users model.
Refactored fields for record introspection into fiedls_and_refs. From itwe canget fields_and_vals.
Fixes to make it compile. Do not work yet.