我想添加一些新的类别属性以及一个新的类别属性组,将它们全部分组。
升级正在运行,没有错误,但它似乎没有运行代码,即使它看起来很完美。我错过了什么吗?
UpgradeData.php
class UpgradeData implements UpgradeDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory) {
$this->eavSetupFactory = $eavSetupFactory;
}
public function upgrade(ModuleDataSetupInterface $setup,ModuleContextInterface $context)
{
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.4', '<')) {
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttributeGroup(
Category::ENTITY,
$eavSetup->getDefaultAttributeSetId(Category::ENTITY),
'Thirdlight Settings',
99
);
$eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'thirdlight_banner', [
'type' => 'string',
'label' => 'Thirdlight Banner',
'input' => 'text',
'source' => '',
'visible' => true,
'default' => '',
'required' => false,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'group' => 'Thirdlight Settings',
]);
$setup->endSetup();
}
Module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Avery_Orderattribs" setup_version="1.0.4">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
</config>
答案 0 :(得分:1)
您是否检查了data_version
数据库表中的模块setup_module
列是否更新为1.0.4?