I am doing a module in Magento (1.7.2). In that module, I want to create a database table. I have used all the codes properly. But still, I can't see the database table in phpMyAdmin.
In /app/etc/modules/Myfolder_Storeinfo.xml
the module info is like this :
<?xml version="1.0"?>
<config>
<modules>
<Myfolder_Storeinfo>
<active>true</active>
<codePool>community</codePool>
</Myfolder_Storeinfo>
</modules>
</config>
In IndexController.php
file inside path /app/code/community/Myfolder/Storeinfo/controllers/IndexController.php
is like this :
class Myfolder_Storeinfo_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
Now the module configuration file configuration XML (config.xml) the path is /app/code/community/Myfolder/Storeinfo/etc/config.xml
is like this :
<?xml version="1.0"?>
<config>
<modules>
<Myfolder_Storeinfo>
<version>0.1.1</version>
</Myfolder_Storeinfo>
</modules>
<frontend>
<routers>
<storeinfo>
<use>standard</use>
<args>
<module>Myfolder_Storeinfo</module>
<frontName>storeinfo</frontName>
</args>
</storeinfo>
</routers>
<translate>
<modules>
<Myfolder_Storeinfo>
<files>
<default>Myfolder_Storeinfo.csv</default>
</files>
</Myfolder_Storeinfo>
</modules>
</translate>
<layout>
<updates>
<question>
<file>storeinfo.xml</file>
</question>
</updates>
</layout>
</frontend>
<admin>
<routers>
<storeinfo>
<use>admin</use>
<args>
<module>Myfolder_Storeinfo</module>
<frontName>storeinfo</frontName>
</args>
</storeinfo>
</routers>
</admin>
<adminhtml>
<menu>
<storeinfo module="storeinfo">
<title>Storeinfo</title>
<sort_order>71</sort_order>
<children>
<items module="storeinfo">
<title>Storeinfo</title>
<sort_order>0</sort_order>
<action>storeinfo/adminhtml_storeinfo</action>
</items>
</children>
</storeinfo>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<Myfolder_Storeinfo>
<title>Storeinfo Module</title>
<sort_order>10</sort_order>
</Myfolder_Storeinfo>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<storeinfo>
<file>storeinfo.xml</file>
</storeinfo>
</updates>
</layout>
</adminhtml>
<global>
<models>
<storeinfo>
<class>Myfolder_Storeinfo_Model</class>
<resourceModel>storeinfo_mysql4</resourceModel>
</storeinfo>
<storeinfo_mysql4>
<class>Myfolder_Storeinfo_Model_Mysql4</class>
<entities>
<storeinfo>
<table>Myfolder_storeinfo</table>
</storeinfo>
</entities>
</storeinfo_mysql4>
</models>
<resources>
<storeinfo_setup>
<setup>
<module>Myfolder_Storeinfo</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</storeinfo_setup>
<storeinfo_write>
<connection>
<use>core_write</use>
</connection>
</storeinfo_write>
<storeinfo_read>
<connection>
<use>core_read</use>
</connection>
</storeinfo_read>
</resources>
<blocks>
<storeinfo>
<class>Myfolder_Storeinfo_Block</class>
</storeinfo>
</blocks>
<helpers>
<storeinfo>
<class>Myfolder_Storeinfo_Helper</class>
</storeinfo>
</helpers>
</global>
</config>
For creating database table my code for mysql4-install-0.1.0.php the path is /community/MyFolder/Storeinfo/sql/storeinfo_setup/mysql4-install-0.1.0.php
is like this :
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
DROP TABLE IF EXISTS {$this->getTable('Myfolder_storeinfo')};
CREATE TABLE {$this->getTable('Myfolder_storeinfo')} (
`storeinfo_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
`status` char(1) NOT NULL DEFAULT '0',
`created_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`storeinfo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
");
$installer->endSetup();
But after all, I can't see my module is creating any table. From Magento admin I can see my module is enabled from System->Configuration->Advanced->Advanced->Disable Modules Output->Myfolder_Storeinfo -> enable
. So can someone kindly tell me where is the wrong part then? Any help and suggestions will be really appreciable. Thanks
Best Answer
There are a few things you can check/ should do to make sure it works.
core_resources
if your extension was added and with what version<table>Myfolder_storeinfo</table>
is the actual MySQL table name please make it lowercase