开发者

Rewrite sql module

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.


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.


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>


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜