This is a question that arose from the consequences of another question here: Is it better to have two separate user tables or one?
Assuming I have two types of users, an Author and a Reader, each stored in relational tables keyed to a main Accounts table like so:
TABLE Accounts {
id
email
password
salt
created
modified
}
TABLE reader {
id
user_id
...
}
TABLE author {
id
user_id
...
}
When an Author posts a blog, should I tag the blog with the unique id from the Authors table, or the unique id from the Accounts table? Same goes with reader comments - should I tag the comment with the Reader table unique id, or the Account table unique id?
So, basically either:
TABLE Blogs {
id
author_id
}
OR
TABLE Blogs {
id
account_id
}
Which is less likely to bite back later on?
Reader
orAuthor
table have a distinctid
anyway? – NathansonReader
andAuthor
id column be a foreign-key toAccounts
so that whichid
to use is irrelevant. – Vintner