删除core_资源条目后,Magento addAttribute重复

删除core_资源条目后,Magento addAttribute重复,magento,adminhtml,Magento,Adminhtml,如果删除core_resource.code='my_setup_module'并重新运行magento,则sql/文件中的所有内容都会重复。有没有办法防止这种情况?(就这样。剩下的是缓冲材料,让我提交。) 示例sql文件 $installer->addAttribute('catalog_product', 'googlemerchant_category', array( 'label' => 'Google Merchant category',

如果删除core_resource.code='my_setup_module'并重新运行magento,则sql/文件中的所有内容都会重复。有没有办法防止这种情况?(就这样。剩下的是缓冲材料,让我提交。)

示例sql文件

$installer->addAttribute('catalog_product', 'googlemerchant_category', array(
    'label'         => 'Google Merchant category',
    'type'          => 'varchar',
    'input'         => 'multiselect',
    'backend'       => 'eav/entity_attribute_backend_array',
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'group'         => 'Google Merchant',
    'visible'       => 1,
    'required'      => 0,
    'position'      => 2,
    'option' =>
        array (
            'value' =>
                array(
                    'option1' => array('Apparel & Accessories > Clothing'),
                    'option2' => array('Apparel & Accessories > Clothing > Activewear > Sweatshirts'),
                    'option3' => array('Apparel & Accessories > Clothing > Underwear & Socks > Socks'),
                    'option4' => array('Apparel & Accessories > Clothing Accessories'),
                    'option5' => array('Apparel & Accessories > Shoes'),
                    'option6' => array('Apparel & Accessories > Shoes > Athletic Shoes'),
                    'option7' => array('Apparel & Accessories > Shoes > Sneakers'),
                    'option8' => array('Apparel & Accessories > Clothing > Hats'),
                    'option9' => array('Apparel & Accessories > Clothing > Shorts'),
                    'option10' => array('Apparel & Accessories > Handbags'),
                    'option11' => array('Food, Beverages & Tobacco > Food Items'),
                    'option12' => array('Hardware > Flooring'),
                    'option13' => array('Health & Beauty > Health Care > Physical Therapy Equipment'),
                    'option14' => array('Media'),
                    'option15' => array('Media > Books'),
                    'option16' => array('Media > Books > Non-Fiction'),
                    'option17' => array('Media > Books > Non-Fiction > Body, Mind & Spirit Books'),
                    'option18' => array('Media > Books > Non-Fiction > Health & Fitness Books'),
                    'option19' => array('Media > DVDs & Videos'),
                    'option20' => array('Sporting Goods > Exercise & Fitness'),
                    'option21' => array('Sporting Goods > Exercise & Fitness > Abdominal Equipment'),
                    'option22' => array('Sporting Goods > Exercise & Fitness > Exercise Balls'),
                    'option23' => array('Sporting Goods > Exercise & Fitness > Exercise Bands'),
                    'option24' => array('Sporting Goods > Exercise & Fitness > Foam Rollers'),
                    'option25' => array('Sporting Goods > Exercise & Fitness > Free Weight Bars'),
                    'option26' => array('Sporting Goods > Exercise & Fitness > Gym Mats'),
                    'option27' => array('Sporting Goods > Exercise & Fitness > Jump Ropes'),
                    'option28' => array('Sporting Goods > Exercise & Fitness > Medicine Balls'),
                    'option29' => array('Sporting Goods > Exercise & Fitness > Stopwatches'),
                    'option30' => array('Sporting Goods > Exercise & Fitness > Weight Benches'),
                    'option31' => array('Sporting Goods > Exercise & Fitness > Weightlifting Belts'),
                    'option32' => array('Sporting Goods > Exercise & Fitness > Weightlifting Gloves'),
                    'option33' => array('Sporting Goods > Exercise & Fitness > Weightlifting Machine Accessories'),
                    'option34' => array('Sporting Goods > Gymnastics > Gymnastics Bars'),
                    'option35' => array('Sporting Goods > Gymnastics > Gymnastics Mats'),
                    'option36' => array('Sporting Goods > Gymnastics > Gymnastics Rings'),
                    'option37' => array('Sporting Goods > Jumping')
                )
        )
));

它显然会重复,因为当您删除模块的核心资源条目时,它会重新运行整个安装程序,并再次找到要执行的安装文件


记住,Magento只知道模块的设置是否由core_资源表运行。因此,如果在那里找不到您的模块条目,它只会运行您的安装文件,而不管它是否已经运行。

有什么方法可以“虚拟证明”这一点吗?请查看本文:谢谢。我想如果我真的想要,我可以执行一些SQL“select”语句并从那里开始。在信息复制的地方存在问题。我知道core_资源,但我想确定我没有遗漏任何边缘案例。谢谢