rlandster
rlandster

Reputation: 7825

Symfony string field in schema results in MySQL TEXT field

I am using symfony 1.4 and have a field in a table with this definition:

subject: { type: string(300), fixed: false, notnull: true }

The migration generated from this is:

'subject' =>
            array(
             'type' => 'string',
             'fixed' => '0',
             'notnull' => '1',
             'length' => '300',
            ),

Running this migration creates MySQL DDL code which sets the subject field to be of type TEXT rather than varchar(300).

However, if I change the 300 to 200 the migration creates a field of type varchar(200).

Is there a way to force symfony/doctrine to create this field as a varchar(300)?

Upvotes: 0

Views: 625

Answers (1)

Maerlyn
Maerlyn

Reputation: 34107

Not without editing the code of doctrine.

Doctrine_Connection_Mysql says the maximum length of varchar fields is 255 characters. This is true for mysql before 5.0.3, and doctrine uses this value for compatibility reasons.

Upvotes: 1

Related Questions