The database I'm currently building is pretty traditional relational database stuff, but there is one requirement that is not clear to me how model appropriately.
There are many business rules which are translated into database consistency checks (i.e. date A must be between date B and C or this field must be not null when another field is a specific value). My problem arises because a user must be able to work on a "draft" version on the data, being allowed to save their changes even if the consistency checks fail.
Eventually, a user can commit their draft, but only once all the consistency checks pass.
The main reason the client wants this functionality is so that they can query the database directly for reports, and be sure that they are using the most recent version of the data that is "consistent", but not restrict the user from entering partial data.
I've played around with storing the changeset to the data in JSON in a document store, and then applying the changeset in code when dealing with the user is dealing with draft data, but this makes it hard to manage things like relationships and the creation/deletion of records.
Is there a common way to accomplish this goal? Or does anyone have any suggestions about how I may approach this problem differently?