如何根据Magento的方式在表上创建索引?


Answers:


16

在“资源设置”中,创建带有一些列的表。

$table->addIndex(
  $installer->getIdxName(
    'your_namespace/your_table',
    array(
      'column1',
      'column2',
      'column3',
    ),
    Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
  ),
  array(
    'column1',
    'column2',
    'column3',
  ),
  array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)
)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.