【发布时间】:2025-11-26 22:30:01
【问题描述】:
SQLSTATE[42S02]:未找到基表或视图:1146 表“desbest_full2.showdown_matches”不存在
但是为什么,如果我在 app/code/local/Desbest/Showdown/sql/Showdown_setup/mysql4-install-1.php 中有一个 mysql 设置脚本
<?php
echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n"; die("Exit for now");
$installer = $this;
/* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
$installer->startSetup();
$installer->run("
CREATE TABLE {$this->getTable('showdown_matches')} (
--CREATE TABLE IF NOT EXISTS `showdown_matches` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstproductid` int(11) NOT NULL,
`secondproductid` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`datenumber` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8_general_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `showdown_votes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`matchid` int(11) NOT NULL,
`votedfor` varchar(10) NOT NULL,
`ip` varchar(50) NOT NULL,
`datenumber` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8_general_ci AUTO_INCREMENT=1 ;
");
$installer->endSetup();
该模块适用于我最初的 Magento 安装。
【问题讨论】:
-
您好,您的 config.xml 是什么样的?
-
注释行有效吗? --如果不存在则创建表
showdown_matches。您是否曾经收到该错误消息,然后修复它,然后刷新页面(并且错误仍然存在?)。如果是这样,请查看您的网址,如果您正在访问 'local.com/errors/report.php?id=....' -> 这就是问题所在。那是一个静态页面。我发现您的代码没有任何问题(如果我没有遗漏任何内容)。 -
我使用了注释行,但没有帮助。从我的角度来看,我的代码似乎也没有任何问题。很奇怪。
-
安装脚本没有运行的原因是它不应该运行。请参阅 mjohnsonperl 答案,检查 Magento 跟踪已安装模块和版本的 core_resource 表。
SELECT * FROMcore_resource` WHEREcodeLIKE '%showdown%'`
标签: magento