i designing database keep number of different entities. 1 table each entity, instance post
, comment
, referral
, company
...
each entity have status associated it, such submitted
, draft
, withdrawn
, rejected
, other status have yet think of.
a simple solution single status
column on each entity. however, valid entity state may both submitted
and rejected
@ same time (or other combination).
the immediate answer above create columns each status, kind of flag either true or false. however, runs risk of entity having flags not compatible, i.e. published
, draft
(in theory publish draft, consider not possible sake of example)
- will application logic have deal it?
- do somehow group different possible status flags groups , single column?
initially sounds me question receive it depends type of answer. come down personal preference. however, these type of issues tend have known best-practices. entities more or less end same status flags logic can re-used?
you don't need create column each status, should absolutely define each column logically never need contain more single status.
it sounds need perform additional analysis. instance, define "rejected" having both been submitted , subsequently rejected -- rejected being latest status in workflow.
another approach have 2 columns: 1 represent workflow status of creation through submission, , contain result of submission -- such under review, on hold, accepted, or rejected.
either way, need perform additional analysis determine better fit needs. , user requirement should drive analysis.
Comments
Post a Comment