You are here

function messaging_simple_schema in Messaging 7

Same name and namespace in other branches
  1. 6.4 messaging_simple/messaging_simple.install \messaging_simple_schema()
  2. 6.3 messaging_simple/messaging_simple.install \messaging_simple_schema()

Implementation of hook_schema().

File

messaging_simple/messaging_simple.install, line 6

Code

function messaging_simple_schema() {
  $schema['messaging_simple'] = array(
    'description' => 'Stores messages sent among site users.',
    'fields' => array(
      'mgid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique simple message id.',
      ),
      'msid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unique system message id.',
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Language code.',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {user}.uid for destination if it is a unique destination.',
      ),
      'sender' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {user}.uid who sent the message if any.',
      ),
      'subject' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Message subject, single text line.',
      ),
      'body' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Message body, multiple text line.',
      ),
      'sent' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unix timestamp, when the message was sent.',
      ),
      'timeread' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unix timestamp, when the message was read the first time.',
      ),
    ),
    'primary key' => array(
      'mgid',
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
  );
  return $schema;
}