[eluser]Skinnpenal[/eluser]
Hi!
Most web apps has an "paying account" which all the data and "sub users" belongs to.
I wonder how this is best solved?
Does every table in the database have a column like "account_id" that has the id of the account the data belongs to?:
Code:
[TABLE: COMPANY]
id
account_id (what account id)
name
.
.
.
[TABLE: NOTES]
id
account_id (what account id)
title
text
.
.
.
Or.. Should one have a dedicated table for defining the relationship?:
Code:
[TABLE: ACCOUNT RELATIONS]
account_id (what account id)
data_id (what data id)
data_table (what table is the data in)
..But having the actual table name can't be a good solution?
Well.. as you see, I'm obviously lost :p Please share your views