Created
July 22, 2014 09:44
-
-
Save herveguetin/903cdc6cdfaafaa3fcf6 to your computer and use it in GitHub Desktop.
The right way to add a column to an existing table in Magento.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$installer = $this->startSetup(); | |
$installer->getConnection() | |
->addColumn( | |
$installer->getTable('module/table_alias'), | |
'sql_column_name', | |
array( | |
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, // Or any other type from Varien_Db_Ddl_Table | |
'nullable' => true, // Or false... | |
'default' => null, // Or any default value | |
'comment' => 'Column Comment' | |
) | |
); | |
$installer->endSetup(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment