how do i use MySql ENUM type? (and is it right for a news feed)
Posted
by Haroldo
on Stack Overflow
See other posts from Stack Overflow
or by Haroldo
Published on 2010-06-07T09:23:21Z
Indexed on
2010/06/07
9:32 UTC
Read the original article
Hit count: 280
I'm creating a table called news_feed
, this will log all the actions a user performs.
Lets say I want to store
user1234 deleted article412 at midday
I then need a table like so
timestamp | user_id | subject_type | subject_id | method
.
there would be 5 potential methods to log,
methods = add/edit/delete/update/report
and lets say 2 possible subject_type
subjects = article/comment
I know i could make my own key where 0=add, 1=delete etc etc but this would make my queries cumbersome to use/write as i'd need to keep consulting the key. Is there a MySql type which can read lots of identially values quickly? is this ENUM
? how do i use it?!!
© Stack Overflow or respective owner