You are here

function flag_update_6002 in Flag 6

Same name and namespace in other branches
  1. 6.2 flag.install \flag_update_6002()

Add a 'serial' primary key, fcid, to the flag_content table.

File

./flag.install, line 402
Flag module install/schema/update hooks.

Code

function flag_update_6002() {
  $ret = array();
  if (!_flag_column_exists('flag_content', 'fcid')) {
    db_drop_primary_key($ret, 'flag_content');
    db_add_field($ret, 'flag_content', 'fcid', array(
      'type' => 'serial',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ), array(
      'primary key' => array(
        'fcid',
      ),
    ));
    db_add_unique_key($ret, 'flag_content', 'fid_content_type_content_id_uid', array(
      'fid',
      'content_type',
      'content_id',
      'uid',
    ));
  }
  return $ret;
}