Magento: Upgrading mysql setup of a module
Suppose, you have a module called MyModule. Its version is 0.1.0. Now, you want to do some database changes for the module. You have the mysql setup file (mysql install file) mysql4-install-0.1.0.php in MyModule/sql/mymodule_setup folder of your module.
You don’t need to make direct changes to database. You can upgrade your module to make your necessary database changes. To do so,
1) You need to create a new mysql upgrade file inside MyModule/sql/mymodule_setup folder.
Let us suppose that you are going to change the version of your module from 0.1.0 to 0.1.1.
The mysql upgrade file name should be mysql4-upgrade-0.1.0-0.1.1.php
The upgrade format is like mysql4-upgrade-CURRENT_VERSION-UPGRADED_VERSION.php
2) Write necessary sql statements in the newly added mysql upgrade file.
3) You have to change the version in MyModule/etc/config.xml as well.
Change the version like
4) Reload your site. And you are done!
Related posts:
- Magento: Adding attribute from MySql setup file
- Magento: Set title, keywords and description in your module
- Magento: Access denied in admin of custom module
- Magento: Read Write XML
- MySQL Installation Problem
- Magento: How to get controller, module, action and router name?
- Magento: How to change Currency symbol by Model Override ?
- Backup and Recovery of MySQL database
- Magento: Helper Data not found error
- Magento: Fatal error: Call to a member function setSaveParametersInSession() on a non-object
