You are here

function twitter_update_7508 in Twitter 7.5

Same name and namespace in other branches
  1. 7.6 twitter.install \twitter_update_7508()

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.

See also

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

File

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

Code

function twitter_update_7508() {
  if (db_field_exists('twitter', 'text')) {
    $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('twitter', 'text', 'text', $spec);
  }
}