structure - MySQL table relationship layout (many-to-many with ambiguity) -
i have tables accounts, groups , projects. want describe access privileges of accounts , groups regarding accounts , projects. projects there read, write , no access while accounts there access , no access.
the first solution came mind create access table layout:
int accessed_account_or_project_id int accessor_account_or_group_id boolean accessed_is_project boolean accessor_is_group boolean canwrite
is structure or should create 2 separate tables project , account access privileges or possibly 4 different accessors?
i found general advice many-to-many relationships in case uncertain newbie because of ambiguity , canwrite.
you shouldn't have column represents 2 different sets of data _or_
, suggest go 4 table solution possible combinations of account/project/group permissions mappings. should make easy enforce constraints prevent conflicts in permissions.
the existence of entry in table can indicate access, projects
has additional access level. long don't think there more access levels introduced later, think canwrite
column on 2 projects tables fine. otherwise have link table set of permissions types.
Comments
Post a Comment