【发布时间】:2023-03-25 07:43:01
【问题描述】:
尝试构建我的第一个 magento 插件,但我对结构和编码仍然很陌生。现在的问题是我的数据库表没有被创建。我不知道为什么我的数据库表没有被创建。我尝试了许多教程和堆栈溢出,仍然无法弄清楚。任何帮助
这是我的 config.xml
<?xml version="1.0"?>
<config>
<modules>
<Envato_CustomConfig>
<version>0.0.1</version>
</Envato_CustomConfig>
</modules>
<global>
<helpers>
<customconfig>
<class>Envato_CustomConfig_Helper</class>
</customconfig>
</helpers>
<models>
<customconfig>
<class>Envato_CustomConfig_Model</class>
</customconfig>
</models>
</global>
<adminhtml>
<acl>
<resources>
<customconfig_setup>
<setup>
<module>Envato_CustomConfig</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</customconfig_setup>
<customconfig_write>
<connection>
<use>core_write</use>
</connection>
</customconfig_write>
<customconfig_read>
<connection>
<use>core_read</use>
</connection>
</customconfig_read>
<admin>
<children>
<system>
<children>
<config>
<children>
<customconfig_options>
<title>Email Configuration Section</title>
</customconfig_options>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
这是我的安装脚本
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('nfrsuper_awesome_example')};
CREATE TABLE {$this->getTable('nfrsuper_awesome_example')} (
`id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL,
`description` varchar(100) NOT NULL,
`other` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 1', 'Example One Description', 'This first example is reall awesome.');
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 2', 'Example Two Description', 'This second example is reall awesome.');
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 3', 'Example Three Description', 'This third example is reall awesome.');
INSERT INTO {$this->getTable('nfrsuper_awesome_example')} (name, description, other) values ('Example 4', 'Example Four Description', 'This fourth example is reall awesome.');
");
$installer->endSetup();
【问题讨论】: