Personal I'm trying to create an installation script for magento module, but the problem is that he's not running my script and not save the core_resource table, anyone have any idea why that is?
I followed the following tutorial Magento – Install, install upgrade, data and data upgrade scripts
enter image description here
Config:
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_DBScript>
<version>3.1.5.6</version>
</Inchoo_DBScript>
</modules>
<global>
<models>
<inchoo_dbscript>
<class>Inchoo_DBScript_Model</class>
<resourceModel>inchoo_dbscript_resource</resourceModel>
</inchoo_dbscript>
<inchoo_dbscript_resource>
<class>Inchoo_DBScript_Model_Resource</class>
<entities>
<ticket>
<table>inchoo_dbscript_ticket</table>
</ticket>
<comment>
<table>inchoo_dbscript_comment</table>
</comment>
</entities>
</inchoo_dbscript_resource>
</models>
<resources>
<inchoo_dbscript_setup>
<setup>
<module>Inchoo_DBScript</module>
</setup>
</inchoo_dbscript_setup>
</resources>
</global>
</config>
sql\inchoo_dbscript_setup\install-3.1.5.6.php:
$installer = $this;
$installer->startSetup();
$table = $installer->getConnection()
->newTable($installer->getTable('inchoo_dbscript/ticket'))
->addColumn('ticket_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true,
), 'Id')
->addColumn('title', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
'nullable' => false,
), 'Title')
->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
'nullable' => false,
), 'Description');
$installer->getConnection()->createTable($table);
$table = $installer->getConnection()
->newTable($installer->getTable('inchoo_dbscript/comment'))
->addColumn('comment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true,
), 'Id')
->addColumn('comment', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
'nullable' => false,
), 'Comment');
$installer->getConnection()->createTable($table);
$installer->endSetup();
app\etc\modules\Inchoo_DBScript.xml:
<config>
<modules>
<Inchoo_DBScript>
<active>true</active>
<codePool>community</codePool>
</Inchoo_DBScript>
</modules>
</config>
1 Answer 1
This script working fine. May be you have some mistake. Check again following issue.
- Clear cache
- Your module need have proper permission(like read+write+execute permission)
Now run!
Enjoy coding :)
-
I cleared the cache but did not work on the file permissions would be?Jonatan Ribeiro dos Santos– Jonatan Ribeiro dos Santos2013年12月20日 16:26:07 +00:00Commented Dec 20, 2013 at 16:26
-
Can you check your file and folder name spelling.Sohel Rana– Sohel Rana2013年12月20日 16:29:19 +00:00Commented Dec 20, 2013 at 16:29
-
names checked and are correctJonatan Ribeiro dos Santos– Jonatan Ribeiro dos Santos2013年12月20日 17:37:40 +00:00Commented Dec 20, 2013 at 17:37
core_resourcetable for your extension. If there's an entry in there for yourinchoo_dbscript_setupresource in means Magento already thinks its installed.