When your module uses a custom database table, you need to make certain changes to the database to deploy your module on a staging or production server. Magento has a way to automatically trigger and install or update scripts when the code is in the right place.
In this recipe, we will extend the Packt_Helloworld
module with the install
script. This install
script will add an attribute to all products.
For this recipe, we have to work in the module's folder and the database. Open your database client and go to your code in the Packt_Helloworld
module.
The following steps describe the procedure to create and install scripts for your module:
Initialize the setup procedures for the module by adding the following code in the
<resources>
tag of theconfig.xml
file:<helloworld_setup> <setup> <module>Packt_Helloworld</module> <class>Mage_Eav_Model_Entity_Setup</class> <...