Skip to content
privatemsg.install 4.1 KiB
Newer Older
// $Id$

/**
 * @file
 * Install file for privatemsg.module
 */

litwol's avatar
litwol committed
function privatemsg_schema() {
  $schema = array();
  $schema['pm_index'] = array(
    'description'       => '{pm_index} holds indexing information about messages and recepients for fast retrieval',
litwol's avatar
litwol committed
    'fields'        => array(
litwol's avatar
litwol committed
      'mid'    => array(
        'description'   => 'Private Message ID',
litwol's avatar
litwol committed
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'thread_id'     => array(
        'description'   => 'Messages thread ID',
litwol's avatar
litwol committed
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
litwol's avatar
litwol committed
      'uid'     => array(
        'description'   => 'UID of either the author or the recipient',
litwol's avatar
litwol committed
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
litwol's avatar
litwol committed
      'is_new'     => array(
        'description'   => 'Whether the user has read this message',
litwol's avatar
litwol committed
        'type'          => 'int',
litwol's avatar
litwol committed
        'default'       => 1,
litwol's avatar
litwol committed
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
litwol's avatar
litwol committed
      'deleted' => array(
        'description'   => 'Whether the user has deleted this message',
litwol's avatar
litwol committed
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0
litwol's avatar
litwol committed
      ),
litwol's avatar
litwol committed

litwol's avatar
litwol committed
    ),
    'indexes'         => array(
litwol's avatar
litwol committed
      'mid'               => array('mid'),
      'thread_id'         => array('thread_id'),
      'uid'         => array('uid'),
      'is_new'              => array('mid', 'uid', 'is_new', ),
litwol's avatar
litwol committed
    ),
  );
litwol's avatar
litwol committed
  $schema['pm_message'] = array(
    'description'       => '{pm_messages} holds the message information',
litwol's avatar
litwol committed
    'fields'        => array(
litwol's avatar
litwol committed
      'mid'    => array(
        'description'   => 'Private Message ID',
litwol's avatar
litwol committed
        'type'          => 'serial',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'author'     => array(
        'description'   => 'UID of the author',
litwol's avatar
litwol committed
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'subject'     => array(
        'description'   => 'Subject text of the message',
litwol's avatar
litwol committed
        'type'          => 'varchar',
        'length'        => 255,
        'not null'      => TRUE,
      ),
      'body'     => array(
        'description'   => 'Body of the message',
litwol's avatar
litwol committed
        'type'          => 'text',
        'not null'      => TRUE,
        'size'          => 'big',
      ),
      'format'        => array(
        'type'          => 'int',
        'size'          => 'small',
        'not null'      => TRUE,
        'default'       => 0,
        'description'   => 'The {filter_formats}.format of the message text.',
      ),
litwol's avatar
litwol committed
      'timestamp'     => array(
        'description'   => 'Time when the message was sent',
litwol's avatar
litwol committed
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
litwol's avatar
litwol committed
    ),
litwol's avatar
litwol committed
    'primary key'     => array('mid'),
litwol's avatar
litwol committed
    'indexes'         => array(
litwol's avatar
litwol committed
      'author'            => array('author'),
      'subject'           => array(array('subject', 20)),
      'timestamp'         => array('timestamp'),
litwol's avatar
litwol committed
    ),
  );
  $schema['pm_disable'] = array(
    'description'       => '{pm_disable} holds the list of users that have disabled private messaging',
    'fields' => array(
      'uid'    => array(
        'description'   => 'ID of the user',
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
    ),
    'primary key'       => array('uid'),
  );
litwol's avatar
litwol committed
  return $schema;
}

function privatemsg_uninstall() {
  variable_del('private_message_view_template');
  variable_del('privatemsg_per_page');
  variable_del('privatemsg_display_loginmessage');
  variable_del('privatemsg_display_fields');
  variable_del('privatemsg_display_link_self');
  variable_del('privatemsg_view_default_amount');
  variable_del('privatemsg_view_max_amount');
  variable_del('privatemsg_view_use_max_as_default');
  variable_del('privatemsg_display_profile_links');
  variable_del('privatemsg_link_node_types');
  variable_del('privatemsg_display_on_teaser');
  variable_del('privatemsg_display_on_comments');