
最近使用了magento的商品品牌插件,需要在此插件的数据库表中添加几个字段。
首先需要修改插件的版本号,以便magento发现插件版本升级了,运行升级脚本。
版本号在插件的ect/config.xml文件中,sql脚本示例mysql4-upgrade-0.1.0-0.1.1.php如下
<?php $installer = $this; $installer->startSetup(); $installer->getConnection()->addColumn( $installer->getTable('brand'), 'country', "varchar(255) NULL" ); $installer->getConnection()->addColumn( $installer->getTable('brand'), 'role', "varchar(255) NULL" ); $installer->endSetup();
版本号原先是0.1.0,原先的sql脚本的名字是mysql4-install-0.1.0.php。
版本号改成0.1.1后升级脚本的名字就是mysql4-upgrade-0.1.0-0.1.1.php 。
转载表明出处:www.hellokeykey.com