summaryrefslogtreecommitdiff
path: root/modules/contact/contact.install
blob: c3ee3c8c9a1519763fefd99c3c4ebd76d2a801eb (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
<?php
// $Id$

/**
 * Implementation of hook_install().
 */
function contact_install() {
  // Create tables.
  drupal_install_schema('contact');
}

/**
 * Implementation of hook_uninstall().
 */
function contact_uninstall() {
  // Remove tables.
  drupal_uninstall_schema('contact');

  variable_del('contact_default_status');
  variable_del('contact_form_information');
  variable_del('contact_hourly_threshold');
}

/**
 * Implementation of hook_schema().
 */
function contact_schema() {
  $schema['contact'] = array(
    'description' => t('Contact form category settings.'),
    'fields' => array(
      'cid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => t('Primary Key: Unique category ID.'),
      ),
      'category' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => t('Category name.'),
      ),
      'recipients' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Comma-separated list of recipient e-mail addresses.'),
      ),
      'reply' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => t('Text of the auto-reply message.'),
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => t("The category's weight."),
      ),
      'selected' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => t('Flag to indicate whether or not category is selected by default. (1 = Yes, 0 = No)'),
      ),
    ),
    'primary key' => array('cid'),
    'unique keys' => array(
      'category' => array('category'),
    ),
    'indexes' => array(
      'list' => array('weight', 'category'),
    ),
  );

  return $schema;
}