sql - What is the proper way to deal with non-unique rows that will become unique -
i'm building database archery tournament shoots. 1 of tables holds work shifts volunteers working it.
it looks this:
+-------+---------+--------+---------+-------+-----+ | jobid | shiftid | userid | eventid | hours | day | +-------+---------+--------+---------+-------+-----+ | 10 | 9 | 1125 | 6 | null | 1 | | 11 | 9 | 0 | 6 | null | 1 | +-------+---------+--------+---------+-------+-----+
jobid links jobs i.e. registration, kitchen.
shiftid links hours of shift i.e. 7-9 (hours there @ request of event owner shift may run long).
userid links volunteer...
eventid links specific event.
day day of event, events span multiple days.
the entries populated events, , users added. allows unique constraint placed on concatenated columns (jobid, shiftid, userid, eventid).
however, event owner wants able have multiple shifts in event @ same time. entries unique after user has been registered.
what proper way deal this? these solutions thought of, none of them felt right:
- making new shift.
- making new job.
- making new table pending jobshifts.
- removing unique constraint on table.
- adding column deal duplicate shifts.
your concern constraints.
one method of fitting multiple shifts current schema "invent" place-holder users. if needed support 2 shifts @ same time, can set user
null , constraint ok. more 2 shifts, create new user ids -- perhaps negative ids obvious -- mean "there no user shift yet".
Comments
Post a Comment