You are here

function privatemsg_schema in Privatemsg 6

Same name and namespace in other branches
  1. 6.2 privatemsg.install \privatemsg_schema()
  2. 7.2 privatemsg.install \privatemsg_schema()
  3. 7 privatemsg.install \privatemsg_schema()

@file Install file for privatemsg.module

File

./privatemsg.install, line 9
Install file for privatemsg.module

Code

function privatemsg_schema() {
  $schema = array();
  $schema['pm_index'] = array(
    'description' => '{pm_index} holds indexing information about messages and recepients for fast retrieval',
    'fields' => array(
      'mid' => array(
        'description' => 'Private Message ID',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'thread_id' => array(
        'description' => 'Messages thread ID',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'uid' => array(
        'description' => 'UID of either the author or the recipient',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'is_new' => array(
        'description' => 'Whether the user has read this message',
        'type' => 'int',
        'default' => 1,
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'deleted' => array(
        'description' => 'Whether the user has deleted this message',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'list' => array(
        'uid',
        'deleted',
        'is_new',
      ),
      'messages' => array(
        'mid',
        'uid',
      ),
      'participants' => array(
        'thread_id',
        'uid',
        'deleted',
      ),
    ),
  );
  $schema['pm_message'] = array(
    'description' => '{pm_messages} holds the message information',
    'fields' => array(
      'mid' => array(
        'description' => 'Private Message ID',
        'type' => 'serial',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'author' => array(
        'description' => 'UID of the author',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'subject' => array(
        'description' => 'Subject text of the message',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'body' => array(
        'description' => 'Body of the message',
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
      ),
      'format' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => FILTER_FORMAT_DEFAULT,
        'description' => 'The {filter_formats}.format of the message text.',
      ),
      'timestamp' => array(
        'description' => 'Time when the message was sent',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
    ),
    'primary key' => array(
      'mid',
    ),
  );
  return $schema;
}