You are here

function photos_update_7301 in Album Photos 7.3

Update {photos_image}.wid from tinyint to int. Rename {photos_vote} to {photos_comment}.

File

./photos.install, line 488
Install, update, and uninstall functions for the Album Photos module.

Code

function photos_update_7301() {

  // Update wid from tinyint to int.
  db_drop_index('photos_image', 'wid');
  $spec = array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
  );
  $index = array(
    'indexes' => array(
      'wid' => array(
        'wid',
      ),
    ),
  );
  db_change_field('photos_image', 'wid', 'wid', $spec, $index);

  // Rename photos_vote to photos_comment
  if (db_table_exists('photos_vote')) {
    if (db_table_exists('photos_comment')) {
      db_drop_table('photos_comment');
    }
    db_rename_table('photos_vote', 'photos_comment');
  }
  return t('Successfully updated image weight field!');
}