Thursday, September 24, 2015

Magento - your extension's setup sql file is not being executed

This blog entry is relevant for  Magento 1.6.

If you are writing a Magento extension which needs to alter Magento database, and you don't see the db being changed after your logout / login to your admin panel, then make sure these settings are correct:

1. Your sql / [folder] needs to match [folder] inside config.xml file of your extensions
Example:

If your config is like this:

            <resources>
                    <cmsubtotals_setup>
                        <setup>
                            <module>GogiProductions_CMSubtotals</module>
                        </setup>
                    </cmsubtotals_setup>
             </resources>  

Then you should have your sql setup files in folder:
sql / cmsubtotals_setup

2. Your extension version needs to be exactly the same in both your config.xml and mysql*install.php filename:

Example:

 <modules>
        <GogiProductions_CMSubtotals>
            <version>1.0.0</version>
        </GogiProductions_CMSubtotals>
    </modules>

Must be matched with this filename:

sql/mysql4-install-1.0.0.php


You can confirm that your setup is being initialized by checking your core_resources Magento table for entry:

cmsubtotals_setup


No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...