You are here

function twitter_update_6005 in Twitter 6.3

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

Dear PHP, I hate you so bad. Love, Jeff.

Workaround for drupal_write_record(), which treats a DB bigint as a signed 32 bit int on 32 bit PHP builds. We can STORE bigints, and PHP automatically converts them to floats in memory while we work with them, but db_placeholders() always treats them as %d and casts them back to dumb signed ints.

See http://drupal.org/node/333788 for more info.

Instead we'll set the column type to 'string' which is a little like jumping off the Sears Tower because the elevator's broken. But that's life.

File

./twitter.install, line 398

Code

function twitter_update_6005() {
  $ret = array();

  // First clear out any borked statuses.
  $ret[] = update_sql("DELETE FROM {twitter} WHERE twitter_id = 2147483647");
  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' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ), array(
    'primary key' => array(
      'twitter_id',
    ),
  ));
  return $ret;
}