【发布时间】:2020-03-20 00:49:48
【问题描述】:
我正在尝试在 Magento 2 的报价表中添加另一列。
应用程序/代码/[公司名称]/[模块]/Setup/UpgradeSchema.php
这是我的代码:
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Quote\Setup\QuoteSetupFactory;
use Magento\Framework\DB\Ddl\Table;
use Magento\Quote\Setup\QuoteSetup;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$connection = $installer->getConnection();
$connection->addColumn($installer->getTable('quote'), 'can_ship_partially', [
'type' => Table::TYPE_SMALLINT,
'nullable' => true,
'comment' => 'Custom can ship partial'
]);
$installer->endSetup();
}
}//End of class
但是当我运行sudo php bin/magento setup:upgrade 时,can_ship_partially 列从未出现在报价表中。有人可以告诉我我做错了什么吗?谢谢
【问题讨论】:
标签: magento2