You are here

function panelizer_update_7102 in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 panelizer.install \panelizer_update_7102()

Add revision support.

File

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

Code

function panelizer_update_7102() {

  // Remove the primary key.
  db_drop_primary_key('panelizer_entity');

  // Add the revision ID field.
  $spec = array(
    'description' => 'The revision id of the entity.',
    'type' => 'int',
    'unsigned' => TRUE,
  );
  db_add_field('panelizer_entity', 'revision_id', $spec);
  db_query("UPDATE {panelizer_entity} pe LEFT JOIN {node} n ON pe.entity_id = n.nid SET pe.revision_id = n.vid");

  // Add the new index.
  db_add_primary_key('panelizer_entity', array(
    'entity_type',
    'entity_id',
    'revision_id',
  ));
  return t('Added revision support.');
}