I am trying to add a few varchar fields to the sales/order_address table but am coming up against a column definition error.

I have the following code:

            'nullable' => false,
            'length' => 255,
            'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
            'comment' => 'Company Email Address'

This returns the error: [message:protected] => Invalid column definition data

If I change the code to use Varien_Db_Ddl_Table::TYPE_INTEGER then the code runs and the column is added. I have tried removing the length and nullable attributes but to no avail.


When updating the script is updated as follows then it works. Does anyone know what causes this error?

        Varien_Db_Ddl_Table::TYPE_VARCHAR . '(255)'

1 Answer 1


Use TYPE_TEXT. TYPE_VARCHAR is deprecated (@see Varien_Db_Adapter_Pdo_Mysql::$_ddlColumnTypes)

And don't worry about the storage space. If you specify type TYPE_TEXT but set length to lets say 255 Magento will create a MySQL column of VARCHAR type.

  • 2
    works ! ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array( 'nullable' => true, 'length' => 255, ), null) Mar 25, 2015 at 13:13
  • I'm surprised that it was this simple... The class says it would internally convert the deprecated types to non-deprecated, but I suppose that's for pre-existing values? Either way, plus one
    – scrowler
    Apr 20, 2015 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.