>>>>> "Richard" == Richard Antecki
> <rantecki@stripped> writes:
Richard> Hi,
Richard> I know one can add items to an ENUM safely, but is it safe to completely
Richard> change the elements in an ENUM.
Richard> For example, if I have an ENUM defined as:
Richard>
> enum('ACTIVE','EXPIRED','OVER_LIMIT','OVER_BALANCE','FROZEN','CLOSED','INVALID','ONHOLD')
Richard> I now realise that I don't really need OVER_LIMIT or OVER_BALANCE, so if I
Richard> alter the enum to be:
Richard> enum('ACTIVE','EXPIRED','FROZEN','CLOSED','INVALID','ONHOLD')
Richard> What happens to the columns set as FROZEN, CLOSED ... and what happens to
Richard> columns already set as OVER_LIMIT, OVER_BALANCE?
Richard> I guess this depends on the internal representation. If they are stored
Richard> internally as integers then any alterations like this will cause values to
Richard> change, am I correct?
Richard> Thanks,
Richard> Richard
Hi!
If you do an ALTER TABLE on an enum that changes, then MySQL converts
the enum to a string and then back to the new enum. This means that
all OVER_LIMIT and OVER_BALANCE items are simply set to 0 (= wrong
enum value)
Regards,
Monty