You are here

function twitter_update_6511 in Twitter 6.5

Change Twitter text field to blob to accommodate utf8mb4 characters.

@todo This schema update is a workaround and should be reverted as soon as Drupal's MySQL implementation properly supports the utf8mb4 character set. However, it's unlikely that D6 will be updated to support this.

See also

https://www.drupal.org/node/1910376

File

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

Code

function twitter_update_6511() {
  $ret = array();
  $spec = array(
    'description' => "The text of the {twitter} post.",
    // Using a blob instead of a text type make it possible for MySQL to
    // handle extended UTF8 characters, like emoji.
    // @see https://www.drupal.org/node/1910376
    'type' => 'blob',
    // Balance size vs performance. The August 2015 update allows for DMs
    // that are 10,000 characters in length, so in theory MySQL's default
    // blob length of 16KB should be enough.
    'size' => 'normal',
    'not null' => FALSE,
  );
  db_change_field($ret, 'twitter', 'text', 'text', $spec);
  return $ret;
}