I am unable to find why the table is not getting created. I have cleared the cache and everything and checked for the solutions but everything seems good.

Here is my config.xml

<?xml version="1.0"?>
                <class>Abhi_Test_Model</class> <!-- Location of all model class files -->
                <resourceModel>test_mysql4</resourceModel> <!-- Location of resource model -->
                        <table>test_tablename</table> <!-- Actual table name in sql -->
        <resources> <!-- These are resource setting giving access to module, read/write permission on database -->

I have created a Model in


class Abhi_Test_Model_Test extends Mage_Core_Model_Abstract {
    public function _construct() {
        $this->_init('test/test');  //This is location of the resource file

I have created resource at


class Abhi_Test_Model_Mysql4_Test extends Mage_Core_Model_Mysql4_Abstract {
    public function _contruct() {
        $this->_init('test/test', 'test_id');   /*here test_id is the primary of the table test. And test/test, is the magento table name as mentioned in the config.xml */

I have created installer file at


$installer = $this;  //Getting Installer Class Object In A Variable
CREATE TABLE {$this->getTable('test/test')} (
  `test_id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `filename` varchar(255) NOT NULL default '',
  `content` text NOT NULL default '',
  `status` smallint(6) NOT NULL default '0',
  `created_time` datetime NULL,
  `update_time` datetime NULL,
  PRIMARY KEY (`test_id`)
  • check in core_resource table in the database, do you have any row there for test_setup? – Piyush Oct 17 '17 at 8:32
  • I ran this query on mysql SELECT * FROM core_resource WHERE code='test_setup'; and it returned 0 – Abhilash Narayan Oct 17 '17 at 8:37
  • it means that your sql file did not ran, check your module is enabled and have Abhi_Test.xml under app/etc directory – Piyush Oct 17 '17 at 8:40
  • @AbhilashNarayan why are you keeping quotes to column names? 'test_id', 'title' like this? – Teja Bhagavan Kollepara Oct 17 '17 at 8:41
  • I do have Abhi_Test.xml file in app/etc/modules/Abhi_Test.xml and its enabled. @Piyush – Abhilash Narayan Oct 17 '17 at 8:43

I found out what mistake I have done and here it is: I made a mistake in my config.xml file


I was missing the <Abhi_Test> tag.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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