I have a (dummy) table structure as follows:
ticket id: int(11) PK name: varchar(255) status: ?????????
The question is, what data type should I use for status? Here are my options, as I see them:
- varchar representing the status - BAD because there's no integrity
- enum representing the status - BAD because to change the value, I'd have to alter the table, and then any code with dropdowns for the values, etc etc etc
- int FK to a status table - GOOD because it's dynamic, BAD because it's harder to inspect by sight (which may be useful)
- varchar FK to a status table - GOOD because it's dynamic, and visible on inspection. BAD because the keys are meaningful, which is generally frowned upon. Interestingly, in this case it's entirely possible for the status table to have just 1 column, making it a glorified enum
Have I got an accurate read of the situation? Is having a meaningful key really that bad? Because while it does give me goosebumps, I don't have any reason for it doing so...
Update: For option 4, the proposed structure would be status: char(4) FK, to a status table. So,
OPEN => "Open"
CLOS => "Closed"
"PEND" => "Pending Authorization"
"PROG" => "In Progress
What's the disadvantage in this case ? The only benefit I can see of using int over char in this case is slight performance.