Reputation: 1135
I am trying to create a local module. Here regarding this there are lot of question. I have almost all of them followed. But it is never working.
Atlast I followed this: http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-6.html
But this is als not working. Here is my structure:
app/code/local/Mycompany/Hello/Model/Resource/Setup.php
<?php
class Mycompany_Hello_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
}
in app/code/local/Mycompany/Hello/sql/mycompany_hello_setup/install-0.1.0.php
<?php
echo 'Running This test: '.get_class($this)."\n <br /> \n";
die("Exit for now");
app/code/local/Mycompany/Hello/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Hello>
<version>0.1.0</version>
</Mycompany_Hello>
</modules>
<frontend>
<routers>
<hello>
<use>standard</use>
<args>
<module>Mycompany_Hello</module>
<frontName>hello</frontName>
</args>
</hello>
</routers>
</frontend>
<global>
<resources>
<Mycompany_Hello_setup>
<setup>
<module>Mycompany_Hello</module>
<class>Mycompany_Hello_Model_Resource_Setup</class>
</setup>
</Mycomapny_Hello_setup>
</resources>
</global>
Here the only issue I am facing is it never executes install script. My approches till now:
Renamed app/code/local/Mycompany/Hello/sql/mycompany_hello_setup/install-0.1.0.php to following names on each attempt app/code/local/Mycompany/Hello/sql/hello_setup/install-0.1.0.php, app/code/local/Mycompany/Hello/sql/hello_setup/mysql4-install-0.1.0.php, app/code/local/Mycompany/Hello/sql/mycompany_hello_setup/install-0.1.0.php, app/code/local/Mycompany/Hello/sql/Mycompany_hello_setup/mysql4-install-0.1.0.php
During every attempt I flush cache and delete the entry from core_resources table.
All my file permisson is 777 (for debugging purpose, later I will change it to 755). Actaully I placed a debugging code in install. Once it executed, I will replace this with my actual installer script.
But it seems something, I am missing something, as a result it is not working.
Please help. Thank you in advance.
Upvotes: 0
Views: 881
Reputation: 1
If it still doesn't work, check that there is no entry in the core_resource table ,delete it if there is one : This worked. As the table already had an entry of [module_name]_setup, I created new folder with the name [Namespace_name]_[module_name]_setup instead of deleting existing one and it worked.
Upvotes: 0
Reputation: 8587
in the resources
tag, the first level node has to match the name of the folder inside sql/, and it is case sensitive.
So it should look like this:
<resources>
<mycompany_hello_setup>
<setup>
<module>Mycompany_Hello</module>
<class>Mycompany_Hello_Model_Resource_Setup</class>
</setup>
</mycompany_hello_setup>
</resources>
And the setup script is in app/code/local/Mycompany/Hello/sql/mycompany_hello_setup/install-0.1.0.php
If it still doesn't work, check that there is no entry in the core_resource
table with code
= "mycompany_hello_setup" (delete it if there is one) and make sure that you have created the app/etc/modules/Mycompany_Hello.xml file, with content:
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Hello>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Hello>
</modules>
</config>
Upvotes: 0