how to create table in magento the below file is not able to execute
<?php
//This sql file which is created is executed when any magento page is opened in the browser
$installer = $this; //Getting Installer Class Object In A Variable
$installer->startSetup();//startSetup() runs the sql script
//here is the function used for table name $this->getTable(‘test’)
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('test')};
CREATE TABLE {$this->getTable('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`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$installer->endSetup();
?>
config file
<?xml version="1.0"?>
<config>
<!--declaring configration of our module-->
<modules>
<Excellence_Test>
<version>0.0.2</version>
<!-- Version of module -->
</Excellence_Test>
</modules>
<frontend>
<!--front end refers to magento area-->
<routers>
<!--routers will turn url into actioncontroller and method-->
<test><!--this should be lower case name of your module and this defines our route name-->
<use>standard</use>
<args>
<module>Excellence_Test</module>
<!--module will be used by the system to locate your Controller files.-->
<frontName>test123</frontName>
<!--this is the front name which will appear in url-->
</args>
</test>
</routers>
<layout><!--defining the layout of our web page-->
<updates>
<test>
<file>test123.xml</file><!-- This is name of the layout file for this module -->
</test>
</updates>
</layout>
</frontend>
<global>
<!--Enabling Model Resources in our Module-->
<models><!--Model are used to logical + data operations in MVC pattern
There are two parts to models in magento, 1st is the Model file and 2nd Model resource files. Models are used to for logical operation and resource files are used to perform actual database queries-->
<test><!--this is model group name , which should match your module name-->
<class>Excellence_Test_Model</class> <!-- Location of all model class files -->
<!--need to create our own resource, can't just use core_mysql4 -->
<resourceModel>test_mysql4</resourceModel> <!-- Location of resource model -->
<!--The <resourceModel /> tag indicates which Resource Model that test group Models should use-->
</test>
<test_mysql4>
<class>Excellence_Test_Model_Mysql4</class>
<entities>
<!--Here basically, we add a list of all our tables we would like to use in our module.
if more than one table is added then code should be like this
<entities>
<test>
<table>test_tablename</table>
</test>
<test2>
<table>test_tablename2</table>
</test2>
<test3>
<table>test_tablename3</table>
</test3>
</entities>
-->
<test><!--here we have added only one table iw pfay_test-->
<table>pfay_test</table> <!-- Actual table name in sql -->
</test>
</entities>
</test_mysql4>
</models>
<resources> <!-- These are resource setting giving access to module, read/write permission on database -->
<test_setup>
<setup>
<module>Excellence_Test</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</test_setup>
<test_write>
<connection>
<use>core_write</use>
</connection>
</test_write>
<test_read>
<connection>
<use>core_read</use>
</connection>
</test_read>
</resources>
<blocks>
<test>
<class>Excellence_Test_Block</class><!-- Path of the Block Folder, where all php files are located related to view -->
</test>
</blocks>
<helpers>
<test>
<class>Excellence_Test_Helper</class><!-- Path of Helper Files -->
</test>
</helpers>
</global>
</config>
config.xml
as well