【发布时间】:2021-05-22 05:51:35
【问题描述】:
我安装了这个免费的 magento 扩展,它显示 mysql 错误,我搜索了很多教程不知道如何修复它。 mysql 8.0版
https://store.belvg.com/colors-sizes-and-materials-swatch-pro.html
a:5:{i:0;s:686:"Error in file: "/var/www/magento/app/code/community/Belvg/Attricons/sql/attricons_setup/mysql4-upgrade-1.0.0-1.1.3.php" - SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead, query was: CREATE TABLE `belvg_attricons_attrsettings` (
`attribute_id` smallint UNSIGNED NULL COMMENT 'Attribute_id' ,
`image_width` smallint NULL COMMENT 'Image_width' ,
`image_height` smallint NULL COMMENT 'Image_height' ,
`selected_marker` smallint NULL COMMENT 'Selected_marker' ,
PRIMARY KEY (`attribute_id`)
) COMMENT='belvg_attricons_attrsettings' ENGINE=InnoDB charset=utf8 COLLATE=utf8_general_ci";i:1;s:889:"#0 /var/www/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(641): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /var/www/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(422): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.0.0', '1.1.3')
#2 /var/www/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb('1.1.3')
#3 /var/www/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /var/www/magento/app/code/core/Mage/Core/Model/App.php(444): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /var/www/magento/app/code/core/Mage/Core/Model/App.php(370): Mage_Core_Model_App->_initModules()
#6 /var/www/magento/app/Mage.php(752): Mage_Core_Model_App->run(Array)
#7 /var/www/magento/index.php(72): Mage::run('', 'store')
#8 {main}";s:3:"url";s:65:"/index.php/8090/cache/index/key/f8eeba255bd1f4bfeabaea072e98ffdd/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
这里是mysql4-upgrade-1.0.0-1.1.3.php:
$installer = $this;
$installer->startSetup();
if (!$this->tableExists($this->getTable('attricons/attrsettings'))) {
$table = new Varien_Db_Ddl_Table();
$table->setName($this->getTable('attricons/attrsettings'));
$table->addColumn('attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'primary' => true));
$table->addColumn('image_width', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'primary' => true));
$table->addColumn('image_height', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'primary' => true));
$table->addColumn('selected_marker', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'not null' => TRUE, 'primary' => true));
$table->setOption('type', 'InnoDB');
$table->setOption('charset', 'utf8');
$this->getConnection()->createTable($table);
}
$installer->endSetup();
我正在自学,不知道如何设置,任何想法都非常感谢。
【问题讨论】:
-
这个插件好像不兼容mysql 5.7或以上版本:stackoverflow.com/a/49121242/2915086