You are here

function twitter_post_field_schema in Twitter 7.6

Implement hook_field_schema().

File

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

Code

function twitter_post_field_schema($field) {
  $columns = array();
  $indexes = array();
  if ($field['type'] == 'twitter_post') {
    $columns = array(
      'status' => array(
        'description' => 'Control whether or not this entity will be tweeted.',
        'type' => 'int',
        'length' => 1,
        'not null' => TRUE,
        'size' => 'tiny',
        'default' => 0,
      ),
      'message' => 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,
      ),
      'account' => array(
        'description' => "Unique identifier for the {twitter_account} this tweet is posting from to.",
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'big',
        'not null' => FALSE,
        'default' => 0,
      ),
    );
    $indexes = array();
  }
  return array(
    'columns' => $columns,
    'indexes' => $indexes,
  );
}