You are here

function _fieldblock_db_alter_block_delta_length in Field as Block 7

Legacy helper function to undo drupal core schema alter.

1 call to _fieldblock_db_alter_block_delta_length()
fieldblock_update_7100 in ./fieldblock.install
Update legacy fieldblock deltas to use md5 identifier. Reset drupal core block schema.

File

./fieldblock.install, line 29

Code

function _fieldblock_db_alter_block_delta_length($length) {

  // Alter block table.
  db_drop_unique_key('block', 'tmd');
  db_change_field('block', 'delta', 'delta', array(
    'type' => 'varchar',
    'length' => $length,
    'not null' => TRUE,
    'default' => '0',
    'description' => 'Unique ID for block within a module.',
  ), array(
    'unique keys' => array(
      'tmd' => array(
        'theme',
        'module',
        'delta',
      ),
    ),
  ));

  // Alter block_role table.
  db_drop_primary_key('block_role');
  db_change_field('block_role', 'delta', 'delta', array(
    'type' => 'varchar',
    'length' => $length,
    'not null' => TRUE,
    'description' => "The block's unique delta within module, from {block}.delta.",
  ), array(
    'primary key' => array(
      'module',
      'delta',
      'rid',
    ),
  ));

  // Alter block_node_type table.
  db_drop_primary_key('block_node_type');
  db_change_field('block_node_type', 'delta', 'delta', array(
    'type' => 'varchar',
    'length' => $length,
    'not null' => TRUE,
    'description' => "The block's unique delta within module, from {block}.delta.",
  ), array(
    'primary key' => array(
      'module',
      'delta',
      'type',
    ),
  ));
}