You are here

function block_class_update_7100 in Block Class 7.2

Same name and namespace in other branches
  1. 7 block_class.install \block_class_update_7100()

Alters the structure of {block_class} schema.

File

./block_class.install, line 55
Install, update and uninstall functions for the block_class module.

Code

function block_class_update_7100() {

  // Check if the block_class table exists to prevent installation profiles
  // from running this update for versions without the block_class table.
  if (db_table_exists('block_class')) {

    // Update the schema.
    db_drop_primary_key('block_class');
    db_change_field('block_class', 'module', 'module', array(
      'type' => 'varchar',
      'length' => '64',
      'not null' => TRUE,
      'default' => '',
      'description' => 'The module to which the block belongs.',
    ));
    db_change_field('block_class', 'delta', 'delta', array(
      'type' => 'varchar',
      'length' => '32',
      'not null' => TRUE,
      'default' => '',
      'description' => "The ID of the module's block.",
    ));
    db_change_field('block_class', 'css_class', 'css_class', array(
      'type' => 'varchar',
      'length' => '255',
      'not null' => TRUE,
      'default' => '',
      'description' => 'String containing the classes for the block.',
    ));

    // Restore the primary key.
    db_add_primary_key('block_class', array(
      'module',
      'delta',
    ));
  }
}