如果我删除core_resource.code ='my_setup_module'并重新运行magento,我的sql / files中的所有内容都会重复。有没有办法防止这种情况? (就是这样。剩下的就是缓冲材料了,所以stackoverflow让我提交。)
示例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')
)
)
));
答案 0 :(得分:1)
它显然会重复,因为当您删除模块的core_resource条目时,它将重新运行整个设置并再次找到您的安装文件来执行。
请记住,Magento只知道core_resource表是否运行了模块的设置。因此,如果它没有在那里找到您的模块条目,它将只运行您的安装文件,无论它是否已经运行。