You are here

function panelizer_update_7106 in Panelizer 7.3

Add the view_mode to the primary key for the {panelizer_entity} table.

File

./panelizer.install, line 532
Install, update and uninstall functions for the panelizer module.

Code

function panelizer_update_7106() {
  db_drop_primary_key('panelizer_entity');
  if (db_index_exists('panelizer_entity', 'PRIMARY')) {
    throw new DrupalUpdateException(t('Could not drop the panelizer_entity primary key in order to recreate it.'));
  }

  // Add the new index.
  db_add_primary_key('panelizer_entity', array(
    'entity_type',
    'entity_id',
    'revision_id',
    'view_mode',
  ));
  if (db_index_exists('panelizer_entity', 'PRIMARY')) {
    return t('The Panelizer database scheme has been updated.');
  }
  else {
    throw new DrupalUpdateException(t('There was a problem recreating the panelizer_entity primary key.'));
  }
}