You are here

function twitter_update_6006 in Twitter 6.5

Same name and namespace in other branches
  1. 6.2 twitter.install \twitter_update_6006()
  2. 6.3 twitter.install \twitter_update_6006()
  3. 6.4 twitter.install \twitter_update_6006()

Dear PHP, I'm sorry baby. I know I said a lotta things last night, but I was angry. I didn't mean it, you know that. I'll use numbers from now on -- no! No, I'll use *decimals*. You'll like that, won't you, PHP? We're cool, right?

Yeah. Yeah, we're cool.

Also, while we're at it we'll add support for some of the additional Twitter API data for replies, and convert the twitter_uid field to a numeric type, too.

File

./twitter.install, line 516
Install, update and uninstall functions for the twitter module.

Code

function twitter_update_6006() {
  $ret = array();
  db_drop_primary_key($ret, 'twitter');
  db_change_field($ret, 'twitter', 'twitter_id', 'twitter_id', array(
    'description' => t("Unique identifier for each {twitter} post."),
    'type' => 'numeric',
    'unsigned' => TRUE,
    'precision' => 20,
    'scale' => 0,
    'not null' => TRUE,
    'default' => 0,
  ), array(
    'primary key' => array(
      'twitter_id',
    ),
  ));
  db_add_field($ret, 'twitter', 'in_reply_to_status_id', array(
    'description' => t("Unique identifier of a status this {twitter} post was replying to."),
    'type' => 'numeric',
    'precision' => 20,
    'scale' => 0,
    'unsigned' => TRUE,
    'not null' => FALSE,
  ));
  db_add_field($ret, 'twitter', 'in_reply_to_user_id', array(
    'description' => t("Unique identifier for the {twitter_account} this post was replying to."),
    'type' => 'numeric',
    'precision' => 20,
    'scale' => 0,
    'unsigned' => TRUE,
    'not null' => FALSE,
  ));
  db_add_field($ret, 'twitter', 'in_reply_to_screen_name', array(
    'description' => t("Screen name of the {twitter} user this post was replying to."),
    'type' => 'varchar',
    'length' => 255,
    'not null' => FALSE,
  ));
  db_add_field($ret, 'twitter', 'truncated', array(
    'description' => t("Boolean flag indicating whether the {twitter} status was cut off to fit in the 140 character limit."),
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_drop_primary_key($ret, 'twitter_account');
  db_change_field($ret, 'twitter_account', 'twitter_uid', 'twitter_uid', array(
    'description' => t("The unique identifier of the {twitter_account}."),
    'type' => 'numeric',
    'unsigned' => TRUE,
    'precision' => 20,
    'scale' => 0,
    'not null' => TRUE,
    'default' => 0,
  ), array(
    'primary key' => array(
      'twitter_uid',
    ),
  ));
  return $ret;
}