function privatemsg_schema in Privatemsg 6.2
Same name and namespace in other branches
- 6 privatemsg.install \privatemsg_schema()
- 7.2 privatemsg.install \privatemsg_schema()
- 7 privatemsg.install \privatemsg_schema()
Implements hook_schema().
File
- ./
privatemsg.install, line 11 - 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,
),
'recipient' => array(
'description' => 'ID of the recipient object, typically user',
'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,
),
'type' => array(
'description' => 'Type of recipient object',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'user',
),
),
'primary key' => array(
'mid',
'recipient',
'type',
),
'indexes' => array(
'list' => array(
'recipient',
'type',
'deleted',
'is_new',
),
'messages' => array(
'mid',
'recipient',
'type',
),
'participants' => array(
'thread_id',
'recipient',
'type',
'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',
),
);
$schema['pm_setting'] = array(
'description' => '{pm_setting} holds user specific (including defaults) settings',
'fields' => array(
'id' => array(
'description' => 'Together with type, associates a setting to a user, role, global default, ...',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'type' => array(
'description' => 'Together with id, associates a setting to a user, role, global default, ...',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'setting' => array(
'description' => 'The name of a setting',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'value' => array(
'description' => 'Holds the value of a given setting',
'type' => 'int',
),
),
'primary key' => array(
'id',
'type',
'setting',
),
);
return $schema;
}