I have one MySQL table, users
, with the following columns:
- user_id (PK)
- name
- password
To manage a roles system, would there be a downside to either of the following options?
Option 1:
Create a second table called roles
with three columns: role_id
(Primary key), name
, and description
, then associate users.user_id
with roles.role_id
as foreign keys in a third table called users_roles
?
Or...
Option 2:
Create a second table called roles
with two columns: user_id
(Foreign key from users.user_id
) and role
(ENUM)? The ENUM datatype column would allow for a short list of allowable roles to be inserted as values.
I've never used the ENUM datatype in MySQL before, so I'm just curious, as option 2 would mean one less table. I hope that makes sense, this is the first time I've attempted to describe MySQL tables in a forum.