You are here

function twitter_last_tweet_field_update_7500 in Twitter 7.6

Same name and namespace in other branches
  1. 7.5 twitter_last_tweet_field/twitter_last_tweet_field.install \twitter_last_tweet_field_update_7500()

Change the twitter_uid field to a BIGINT.

File

twitter_last_tweet_field/twitter_last_tweet_field.install, line 52
Install, update and uninstall functions for the twitter_last_tweet_field module.

Code

function twitter_last_tweet_field_update_7500() {

  // Get the list of fields.
  $types = array(
    'twitter_last_tweet',
  );
  $fields = array();
  foreach (field_info_fields() as $field) {
    if (in_array($field['type'], $types)) {
      $fields[] = $field;
    }
  }
  if (!empty($fields)) {
    $spec = array(
      'description' => 'The unique identifier of the {twitter_account}.',
      'type' => 'int',
      'unsigned' => TRUE,
      'size' => 'big',
      'not null' => TRUE,
      'default' => 0,
    );
    foreach ($fields as $field) {
      $tables = array(
        _field_sql_storage_tablename($field),
        _field_sql_storage_revision_tablename($field),
      );
      foreach ($tables as $table) {
        $column = $field['field_name'] . '_twitter_uid';
        db_change_field($table, $column, $column, $spec);
      }
    }
    return t('Converted the twitter_uid field to BIGINT.');
  }
}