I just came across a requirement of labeling a user as 1 of 3 different rol开发者_运维知识库es. Normally I have used an id, but the roles don't really relate to each other at all.
I had a look at the set datatype, and I added the 3 different options.
Will the database internally just store the index of the set, e.g. if the set is
set('a', 'b', 'c')
and I choosea
, will it storea
or the index0
?I haven't seen this datatype used before when looking at other people's databases. Is it bad practice? Is using an id (perhaps
role_id
which maps to a tableroles
) a better idea?
Thanks
They're roles - that's how they relate to one another.
精彩评论