[Dbix-class] Enumerated type

Jess Robinson castaway at desert-island.demon.co.uk
Wed Nov 8 17:14:41 GMT 2006



On Tue, 7 Nov 2006, Josef Karthauser wrote:

> On Tue, Nov 07, 2006 at 09:21:12AM +0000, Jess Robinson wrote:
>>
>> 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.
>>
>
> Are you suggesting I just hard code the values into my class files
> using this syntax for now, and wait for the API to catch up?
>

That already is the API, for when you want to use deploy() to create your 
tables from your schema, so if we end up supporting automatic retrieving 
of enum values, that's probably where you'll be able to find them.

(So I guess that means "yes" ;)

Jess




More information about the Dbix-class mailing list