summaryrefslogtreecommitdiffstats
path: root/privatemsg.install
blob: c09441f687dc44a2e9c96d57e297b420c7efe0b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php

function privatemsg_schema() {
  $schema = array();
  $schema['pm_index'] = array(
    'description'       => t('{pm_index} holds indexing information about messages and recepients for fast retrieval'),
    'fields'        => array(
      'mid'    => array(
        'description'   => t('Private Message ID'),
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'thread_id'     => array(
        'description'   => t('Messages thread ID'),
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'recipient'     => array(
        'description'   => t('UID of the recipient'),
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'author'     => array(
        'description'   => t('UID of the author'),
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'timestamp'     => array(
        'description'   => t('Time when the message was sent'),
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'new'     => array(
        'description'   => t('Whether the user read his message'),
        'type'          => 'int',
        'default'       => 1,
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
    ),
    'indexes'         => array(
      '`mid`'               => array('`mid`'),
      '`author`'            => array('`author`'),
      '`thread_id`'         => array('`thread_id`'),
      '`recipient`'         => array('`recipient`'),
      '`timestamp`'         => array('`timestamp`'),
      '`new`'              => array('`mid`','`recipient`','`new`',),
    ),
  );
  
  $schema['pm_message'] = array(
    'description'       => t('{pm_messages} holds the message information'),
    'fields'        => array(
      'mid'    => array(
        'description'   => t('Private Message ID'),
        'type'          => 'serial',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'author'     => array(
        'description'   => t('UID of the author'),
        'type'          => 'int',
        'not null'      => TRUE,
        'unsigned'      => TRUE,
      ),
      'subject'     => array(
        'description'   => t('Subject text of the message'),
        'type'          => 'varchar',
        'length'        => 255,
        'not null'      => TRUE,
      ),
      'body'     => array(
        'description'   => t('Body of the message'),
        'type'          => 'text',
        'not null'      => TRUE,
        'size'          => 'big',
      ),
    ),
    'primary key'     => array('mid'),
    'indexes'         => array(
      '`author`'            => array('`author`'),
      '`subject`'           => array(array('`subject`', 20)),
    ),
  );
  
  
  return $schema;
}
function privatemsg_install() {
  drupal_install_schema('privatemsg');
  
}

function privatemsg_uninstall() {
  drupal_uninstall_schema('privatemsg');
}