1

My question is about creating update for a custom module extension that I have made.

I have no idea where to begin. So breafly here is what my module does

  • It create a database table
  • Stores data from a form
  • Show them backend in grid

Now the forms have to have more options. but my table dont have enough colums.

So my question is

How do i make an update for my module, that update my tables and update the output to my backend grid?

  • There is an easiest way: try to google some module creator for magento. It supports database upgrade script creation. – zhartaunik Feb 12 '16 at 14:37
2

so you have a version in config.xml. Something like <version>1.0.0</version>.
Replace below 1.0.0 with the version you actually have and 1.0.1 with your version but with the last number incremented.

You need to create the upgrade-1.0.0-1.0.1.php in the same folder you have install-1.0.0.php

<?php 
$installer = $this;
$connection = $installer->getConnection();
//do this for each column you want to add
$connection->addColumn($installer->getTable('your table name here'), 'your_column_name_here', array(
        'type'      => Varien_Db_Ddl_Table::TYPE_TEXT, //or any other type you need
        'comment'   => 'Column name here',
    ));

Then change the version in config.xml from <version>1.0.0</version> to <version>1.0.1</version> and clear the cache.

The upgrade script will add columns to your table and you can continue your work.

  • Can i make and package of some sort? I have to make the same change to meny shops – Patrick Knudsen Feb 12 '16 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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