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:

  1. making new shift.
  2. making new job.
  3. making new table pending jobshifts.
  4. removing unique constraint on table.
  5. 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

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -