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

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

/**
 * Implementation of hook_uninstall().
 */
function profile_uninstall() {
  // Remove tables
  drupal_uninstall_schema('profile');

  variable_del('profile_block_author_fields');
}

/**
 * Implementation of hook_schema().
 */
function profile_schema() {
  $schema['profile_fields'] = array(
    'fields' => array(
      'fid'          => array('type' => 'serial', 'not null' => TRUE),
      'title'        => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
      'name'         => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
      'explanation'  => array('type' => 'text', 'not null' => FALSE),
      'category'     => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
      'page'         => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
      'type'         => array('type' => 'varchar', 'length' => 128, 'not null' => FALSE),
      'weight'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'required'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'register'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'visibility'   => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'autocomplete' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
      'options'      => array('type' => 'text', 'not null' => FALSE)
    ),
    'indexes' => array('category' => array('category')),
    'unique keys' => array('name' => array('name')),
    'primary key' => array('fid'),
  );

  $schema['profile_values'] = array(
    'fields' => array(
      'fid'   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 0),
      'uid'   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'default' => 0),
      'value' => array('type' => 'text', 'not null' => FALSE)
    ),
    'indexes' => array(
      'fid' => array('fid'),
      'uid' => array('uid')
    ),
  );

  return $schema;
}