[Dbix-class] Enumerated type

Jess Robinson castaway at desert-island.demon.co.uk
Tue Nov 7 09:21:12 GMT 2006



On Mon, 6 Nov 2006, Josef Karthauser wrote:

> Is it possible to extract a list of possible values for an enumerated
> type using DBIx?  I think that this is possible in Class::DBI, so I
> expect it's possible here too, but I can't find it in the docs.
>

Not currently, but if you do add them, I suggest you use the format that 
SQL::Translator supports, in the column_info, so that deploy() just works.

-> add_columns( 'enumfieldname' => {
      data_type => 'enum',
      extra => { 'list' => ['red', 'green', 'blue'] }
    });

- Currently this is mysql-only, and if you're lucky, the other producers 
will convert mysql enum types to normal fields with constraints..

NB You can also set: 'binary', 'unsigned', 'zerofill', 'character set', 
'collate', 'on update' in the extras data for mysql.

Jess




More information about the Dbix-class mailing list