I have a system with three tables: shows, schedule, and channel. Shows are inserted into the schedule and assigned to a channel, so the relevant columns are something like:
shows:
id
name
channel_id
channels
id
name
schedule
id
show_id
start_time
end_time
Now, the user is able to build (via javascript) a block of shows and either insert it into the schedule, or insert it into the schedule at a later time. How would you recommend saving these lists? They need to be named (ie: "Sunday Line-up"). I was thinking of something like:
lists
show_id
list_name (this would be the primary key)
order
but that to me just feels wrong for some reason. What do you think?
db design - saving lists
Moderator: General Moderators
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Not quite what I meant. In the real world should the list name be unique?I made it the primary key... that ensures it will be unique all by itself doesn't it??
So if one user comes along and names their list "Sunday Line-up", then I come along, create a list and name it "Sunday Line-up" I'll get an error because someone else used up that name.
So maybe the primary key should be made up of
userid, list_name (so you would need a userid field in your lists table)
That way each users list names must be unique but it doesn't stop users creating a list name the same as some other users list name.
Just a thought.