【发布时间】:2018-07-31 03:00:12
【问题描述】:
我是一个新的 Magento 用户,我正在尝试使用 UpgradeSchema.php 将基于 2 列的唯一数据库索引添加到自定义数据库表中。该表已经存在,我正在索引的列也是如此。这是我的代码部分:
$installer->getConnection()
->addIndex(
$installer->getIdxName(
$installer->getTable('ds_runs'),
['date_delivery', 'run'],
AdapterInterface::INDEX_TYPE_UNIQUE
),
['date_delivery', 'run'],
['type' => AdapterInterface::INDEX_TYPE_UNIQUE]
);
我在运行 setup:upgrade 时收到的错误是
Base table or view not found: 1146 Table 'doorstep.ds_runs_date_delivery_run_run_id'
doesn't exist,query was:DESCRIBE `DS_RUNS_DATE_DELIVERY_RUN_RUN_ID`
不知道我在这里做错了什么。我可以看到它正在根据表名和我要索引的列的串联来查找表。
【问题讨论】:
标签: magento magento2.2