You are here

function bean_admin_ui_update_7001 in Bean (for Drupal 7) 7

Add support for CTools exportables.

File

bean_admin_ui/bean_admin_ui.install, line 69
Install files

Code

function bean_admin_ui_update_7001() {
  db_drop_primary_key('bean_type');

  // Add a type_id column for use by CTools.
  $spec = array(
    'description' => 'The Type ID of this block. Only used internally by CTools',
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'no export' => TRUE,
  );
  $new_keys = array(
    'primary key' => array(
      'type_id',
    ),
  );
  db_add_field('bean_type', 'type_id', $spec, $new_keys);

  // Add the options column.
  $spec = array(
    'description' => 'Block content configuration.',
    'type' => 'text',
    'size' => 'big',
  );
  db_add_field('bean_type', 'options', $spec);

  // Adjust the type column so tat it doesn't clash with CTools.
  $spec = array(
    'description' => 'The machine-readable name of this bean type.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  );
  $new_keys = array(
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  db_change_field('bean_type', 'type', 'name', $spec, $new_keys);

  // Force a cache flush to ensure CTools plugins can be found and menus are rebuilt.
  cache_clear_all('*', 'cache', TRUE);
  return t('Added new fields required for CTools exportable support.');
}