You are here

function commerce_line_item_update_7101 in Commerce Core 7

Add indexes to the commerce_line_item table on order_id and type.

File

modules/line_item/commerce_line_item.install, line 182

Code

function commerce_line_item_update_7101() {
  if (db_index_exists('commerce_line_item', 'order_id')) {
    db_drop_index('commerce_line_item', 'order_id');
  }
  if (db_index_exists('commerce_line_item', 'type')) {
    db_drop_index('commerce_line_item', 'type');
  }
  if (db_index_exists('commerce_line_item', 'line_item_type')) {
    db_drop_index('commerce_line_item', 'line_item_type');
  }
  db_add_index('commerce_line_item', 'order_id', array(
    'order_id',
  ));
  db_add_index('commerce_line_item', 'line_item_type', array(
    'type',
  ));
  return t('Database indexes added to the order_id and type columns of the commerce_line_item table.');
}