Question

following is my config file

<config>
    <modules>
        <Opco_Planner>
            <version>1.0.0.0</version>
        </Opco_Planner>
    </modules>
    <global>
        <models>
            <planner>
                <class>Opco_Planner_Model</class>
                <resourceModel>planner_resource</resourceModel>
            </planner>

            <planner_resource>
                <class>Opco_Planner_Model_Resource</class>
                <entities>
                    <theme>
                        <table>planner_theme</table>
                    </theme>
                </entities>
            </planner_resource>
        </models>
        <helpers>
            <planner>
                <class>opco_Planner_Helper</class>
            </planner>
        </helpers>
        <blocks>
            <planner>
                <class>opco_Planner_Block</class>
            </planner>
        </blocks>

        <resources>
            <planner_setup>
                <setup>
                    <module>Opco_Planner</module>
                    <class>Opco_Planner_Model_Resource_Setup</class>
                </setup>
            </planner_setup>
        </resources>

    </global>
    <frontend>
        <routers>
            <planner>
                <use>standard</use>
                <args>
                    <module>Opco_Planner</module>
                    <frontName>planner</frontName>
                </args>
            </planner>
        </routers>
    </frontend>
</config>

I named folder inside sql planner_setup under this folder I create install-1.0.0.0.php. so file path will opco/planner/sql/planner_setup/install-1.0.0.0.php. Installer file look like this

<?php

 echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
 die("Exit for now");

It does not echo any thing. Please help me its my second question. I also create setup file at location opco/planner/model/resource/setup.php but not success.

Was it helpful?

Solution

I think your script has already run. I am not sure, but I strongly believe echo wont work while installing script.

When you run the script, it would be wise to log, to check if it has worked. But remember if it runs smoothly, then this script wont run again. Have this on your install-1.0.0.php

<?php
    Mage::log('Installing script.', null, 'my_log.log');

This will create a file called my_log.log in your var/log folder.

What if the script has run already?

Go to your database and check core_resource table and then find planner_setup, now check version and data version part, if data version matches with your version then your script has already run, you need to run update script to run another script.

Just update <version>1.0.0.0</version> in your config.xml to 1.0.0.1 and then create another file in opco/planner/sql/planner_setup/update-1.0.0.0-1.0.0.1.php and have this content again.

<?php
    Mage::log('updating script.', null, 'my_log.log');

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top