Upgrade file in custom module in Magento

If you want to add extra fields in database table then you have to create upgrade file as follows.

Give file name as higher version from previous version.

For example if you have “mysql4-install-0.1.0.php.” file then upgrade file would be “mysql4-upgrade-0.1.0-0.1.1.php”.

Add following code for add extra fields.


$installer = $this;



— DROP TABLE IF EXISTS {$this->getTable(‘news’)};
ALTER TABLE {$this->getTable(‘news’)} ADD (
`title1` varchar(255) NOT NULL default ”,
`title2` varchar(255) NOT NULL default ”



Please note that you have to change version from 0.1.0 to 0.1.1 into config.xml file.

Clear magento cache and show result. 



  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: