The essence of the task is to initialize the database, more precisely, the ds_news_entities table. I work with magento for the first time, that's why there was a problem ( Full Release - ver 1.9.2.4 version Full Release - ver 1.9.2.4 ).
In the app/code/local/TestModule directory app/code/local/TestModule create the directory of my News module
Immediately in the config app/code/local/TestModule/News/etc/config.xml set the settings:
<?xml version="1.0" encoding="UTF-8" ?> <config> <modules> <TestModule_News> <version>0.0.1</version> </TestModule_News> </modules> </config> The next step is to create a config in app/etc/modules/TestModule_News.xml :
<?xml version="1.0" encoding="UTF-8" ?> <config> <modules> <TestModule_News> <active>true</active> <codePool>local</codePool> </TestModule_News> </modules> </config> Then in the app/code/local/TestModule/News/sql testmodulenews_setup create the testmodulenews_setup subdirectory and install-0.0.1.php installation file in it:
$installer = $this; $installer->startSetup(); $installer->run("CREATE TABLE ds_news_entities ( `news_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, `content` TEXT NOT NULL, `created` DATETIME, PRIMARY KEY (`news_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $installer->endSetup(); After this, I edit the previously created configuration file app/etc/modules/TestModule_News.xml:
<?xml version="1.0" encoding="UTF-8" ?> <config> <modules> <TestModule_News> <active>true</active> <codePool>local</codePool> </TestModule_News> </modules> <global> <resources> <testmodulenews_setup> <setup> <module>TestModule_News</module> </setup> </testmodulenews_setup> </resources> </global> </config> According to the idea, after updating the page, an entry should be created in the core_resource table corresponding to the name of the table being created.
But after reloading the page, an error occurs:
0 /home/vitaliy/hosts/magento.dev/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement-> execute (Array) # 1
/home/vitaliy/hosts/magento.dev/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo -> _ execute (Array) # 2 /home/vitaliy/hosts/magento.dev/app/ code / core / Zend / Db / Statement.php (291): Varien_Db_Statement_Pdo_Mysql -> _ execute (Array) # 3 /home/vitaliy/hosts/magento.dev/lib/Zend/Db/Adapter/Abstract.php (480): Zend_Db_Statement-> execute (Array) # 4 /home/vitaliy/hosts/magento.dev/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-> query ('CREATE TABLE ds ...' , Array) # 5 /home/vitaliy/hosts/magento.dev/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract-> query ('CREATE TABLE ds ...', Array) # 6 /home/vitaliy/hosts/magento.dev/lib/Varien/Db/Adapter/Pdo/Mysql.php(423): Varien_Db_Adapter_Pdo_Mysql-> query ('CREATE TABLE ds ...') # 7 / home / vitaliy / hosts / magento.dev / lib / Varien / Db / Adapter / Pdo / Mysql.php (693): Varien_Db_Adapter_Pdo_Mysql-> raw_query ('CREATE TABLE ds ...') # 8 /home/vitaliy/hosts/magento.dev/ lib / Varien / Db / Adapter / Pdo / Mysql.php (675): Varien_Db_Adapter_Pdo_M ysql-> multi_query ('CREATE TABLE ds ...') # 9 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/Model/Resource/Setup.php(932): Varien_Db_Adapter_Pdo_Mysql- > multiQuery ('CREATE TABLE ds ...') # 10 /home/vitaliy/hosts/magento.dev/app/code/local/TestModule/News/sql/testmodulenews_setup/install-0.0.1.php(17): Mage_Core_Model_Resource_Setup-> run ('CREATE TABLE ds ...') # 11 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/Model/Resource/Setup.php(66): include ( '/ home / vitaliy / h ...') # 12 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup -> _ modifyResourceDb ('install', '', '0.0.1') # 13 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup- > _installResourceDb ('0.0.1') # 14 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup-> applyUpdates () # 15 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/ Model / App.php (428): Mage_Core_Model_Resource_Setup :: applyAllUpdates () # 16 /home/vitaliy/hosts/magento.dev/app/code/core/Mage/Core/Model/App.php (3535): Mage_Core_Model_App _initModules () # 17 /home/vitaliy/hosts/magento.dev/app/Mage.php(683): ​​Mage_Core_Model_App-> run (Array) # 18 /home/vitaliy/hosts/magento.dev/index.php(83 ): Mage :: run ('', 'store')
19 {main} errord
What am I wrong? Or doing something wrong?
Please hints (