Hacker News new | past | comments | ask | show | jobs | submit login

Why do you need a user_id in todo_items

The primary key of the todo_lists table is "PRIMARY KEY (user_id, list_id)".

So the foreign key in todo_items should be (user_id, list_id), and it is.

"If users have the same list ID..." Why would they?

User 1 has a list 1, and User 2 has a list 1. Just as if User 1 had a list 'grocery', and User 2 had a list 'grocery'.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: