I'm using the following for an mysql update. It is adding the column correctly however it is not defining the default. It keeps it setting default to NULL. Any suggestions on where I am going wrong would be greatly appreciated.

$installer = $this;

$installer->getConnection()->addColumn($installer->getTable('admin/user'), 'enable_subclass', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
        'nullable'  => false,
        'default'   => '0',
        ), 'Admin Sub-Class Status');


1 Answer 1


You are calling addColumn in Varien_Db_Adapter_Pdo_Mysql

    $installer->getConnection()->addColumn($installer->getTable('admin/user'), 'enable_subclass', array(
        'type'      => Varien_Db_Ddl_Table::TYPE_SMALLINT,
        'unsigned'  => true,
        'nullable'  => false,
        'default'   => '0',
        'comment'   => 'Admin Sub-Class Status'

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.