0

Hi I'm trying to rewrite or extend all database update sql's files from core to local without success, until now I have:

CORE:

+core
 +Mage
  +Mymodule
   +...
   +etc
    -config.xml
   +sql
    +mymodule_setup
     -mysql4-install-0.1.0.php
     -mysql4-install-0.1.0-0.1.1.php
     -...

LOCAL:

+local
 +Mage
  +Mynamespace
   +Mymodule
    +...
    +etc
     -config.xml
    +sql
     +mymodule_setup
      -mysql4-install-0.1.0.php
      -mysql4-install-0.1.0-0.1.1.php
      -...

So my question is to avoid problems when upgrading Magento how show I configure the config.xml in core and local, rewrite Block, Model, I did with success, but not for sql, until now I have:

LOCAL

    <?xml version="1.0"?>
<config>
    <modules>
        <Mage_Mymodule>
            <version>0.1.1</version>
        </Mage_Mymodule>
    </modules>
    <global>
        <resources>
            <mynamespace_mymodule_setup>
                <setup>
                    <module>Mynamespace_Mymodule</module>
                    <class>Mage_Mymodule_Model_Resource_Eav_Mysql4_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </mynamespace_mymodule_setup>
        </resources>
        <models>
            <Mymodule>
                <rewrite>
                    <abc>Mynamespace_Mymodule_Model_Abc</abc>
                </rewrite>
            </Mymodule>
        </models>
    </global>
</config>

Thanks in advance for any help.

1
  • I don't understand, why are you using local/Mage/Mynamespace/Mymodule/? Sure the Mage part is superfluous. Mar 1, 2011 at 15:43

3 Answers 3

1

There's no way to override install/update scripts. You have to: 1. Set dependency for your module, it must be installed last. 2. In your install script you may use anything. You'd better use Varien_Db_Adapter_Pdo_Mysql methods.

0

I think the problem is that you've changed the class in the resource setup to a class that probably doesn't exist. Try :

<setup>
   <module>Mynamespace_Mymodule</module>
   <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
0

You could make some hack, like in your setup class overwrite the protected method _getAvailableDbFiles and rewriting it using dirname(FILE) instead of Mage::getModuleDir (Mage_Core_Model_Resource_Setup~480)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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