Today we will discuss here about how to upgrade the sql file in magento. This is very useful technique used in the magento based developed store. The requirement of this technique is mandatory when there are any changes regarding the content included in your sql file . The sql file in magento runs only once so this technique help us to run sql file multiple times due to any changes is necessary in sql file.
There are only two simple steps to upgrade the magento sql file listed as below:-
1) You have to make a new sql file under the app –>code –>local –>namespace –>modulename –>sql directory . Note one thing that this new sql file will include only new feature that you want to add like any attribute or table not the same one that you have added previously .
There are some naming standards of the new created sql file. Suppose if your existing sql file name is mysql4-install-0.1.0.php then you have to keep the name of newly generated file as mysql4-upgrade-0.1.0-0.1.1.php and same thing will repeated in same manner if you want to create any more upgrade file.
2) In the very next step you will have to write the latest version of module in the config.xml file of your module.
<config> <modules> <module_name> <version> put your latest version number </version> </module_name> </modules> </config>
In this file you have to put your latest module version number. So in this case if I will create only one upgrade file than I will write 0.1.1 between version tag and if there are two upgrade sql files than 0.1.2 and so on.
After performing this two steps you have to just reload your page in your browser and your changes will be reflected in your site.That’s it.
Hope this will help you….