Reputation: 751
I'm faced with the task:
Input: Data model, that presents huge entity via 20 - 30 relational tables (SQL DB). There are a lot of constraints + reference data links.
Tasks: Add a draft mode support, this means that I can save object in any state (without filling all necessary fields, breaking a constraints etc.) When I publish object I must validate it against all constraints.
Does anybody know about good approach how to implement draft mode? Non-Relational DB isn't the case because of my contract with client.
I've been thinking on: Duplicate tables, remove validations from the all duplicates and on publish move rows to original tables in the same transaction. This approach smells a lot. All Objects are serializable into XML in my system, I can save their state into DB wile draft mode, again smells not good.
Upvotes: 1
Views: 55
Reputation: 26464
Simple answer:
CHECK (is_draft OR (condition_one AND condition_two AND condition_three))
Upvotes: 1