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'.
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'.