Code coverage for /20081101/modules/profile/profile.install

Line #Times calledCode
1
<?php
2
// $Id: profile.install,v 1.13 2008/03/15 12:31:29 dries Exp $
3
4
/**
5
 * Implementation of hook_install().
6
 */
75
function profile_install() {
8
  // Create tables.
95
  drupal_install_schema('profile');
105
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
155
function profile_uninstall() {
16
  // Remove tables
170
  drupal_uninstall_schema('profile');
18
190
  variable_del('profile_block_author_fields');
200
}
21
22
/**
23
 * Implementation of hook_schema().
24
 */
255
function profile_schema() {
265
  $schema['profile_fields'] = array(
275
    'description' => t('Stores profile field information.'),
28
    'fields' => array(
29
      'fid' => array(
305
        'type' => 'serial',
315
        'not null' => TRUE,
325
        'description' => t('Primary Key: Unique profile field ID.'),
335
      ),
34
      'title' => array(
355
        'type' => 'varchar',
365
        'length' => 255,
375
        'not null' => FALSE,
385
        'description' => t('Title of the field shown to the end user.'),
395
      ),
40
      'name' => array(
415
        'type' => 'varchar',
425
        'length' => 128,
435
        'not null' => TRUE,
445
        'default' => '',
455
        'description' => t('Internal name of the field used in the form
HTML and URLs.'),
465
      ),
47
      'explanation' => array(
485
        'type' => 'text',
495
        'not null' => FALSE,
505
        'description' => t('Explanation of the field to end users.'),
515
      ),
52
      'category' => array(
535
        'type' => 'varchar',
545
        'length' => 255,
555
        'not null' => FALSE,
565
        'description' => t('Profile category that the field will be grouped
under.'),
575
      ),
58
      'page' => array(
595
        'type' => 'varchar',
605
        'length' => 255,
615
        'not null' => FALSE,
625
        'description' => t("Title of page used for browsing by the field's
value"),
635
      ),
64
      'type' => array(
655
        'type' => 'varchar',
665
        'length' => 128,
675
        'not null' => FALSE,
685
        'description' => t('Type of form field.'),
695
      ),
70
      'weight' => array(
715
        'type' => 'int',
725
        'not null' => TRUE,
735
        'default' => 0,
745
        'size' => 'tiny',
755
        'description' => t('Weight of field in relation to other profile
fields.'),
765
      ),
77
      'required' => array(
785
        'type' => 'int',
795
        'not null' => TRUE,
805
        'default' => 0,
815
        'size' => 'tiny',
825
        'description' => t('Whether the user is required to enter a value.
(0 = no, 1 = yes)'),
835
      ),
84
      'register' => array(
855
        'type' => 'int',
865
        'not null' => TRUE,
875
        'default' => 0,
885
        'size' => 'tiny',
895
        'description' => t('Whether the field is visible in the user
registration form. (1 = yes, 0 = no)'),
905
      ),
91
      'visibility' => array(
925
        'type' => 'int',
935
        'not null' => TRUE,
945
        'default' => 0,
955
        'size' => 'tiny',
965
        'description' => t('The level of visibility for the field. (0 =
hidden, 1 = private, 2 = public on profile but not member list pages, 3 =
public on profile and list pages)'),
975
      ),
98
      'autocomplete' => array(
995
        'type' => 'int',
1005
        'not null' => TRUE,
1015
        'default' => 0,
1025
        'size' => 'tiny',
1035
        'description' => t('Whether form auto-completion is enabled. (0 =
disabled, 1 = enabled)'),
1045
      ),
105
      'options' => array(
1065
        'type' => 'text',
1075
        'not null' => FALSE,
1085
        'description' => t('List of options to be used in a list selection
field.'),
1095
      ),
1105
    ),
111
    'indexes' => array(
1125
      'category' => array('category'),
1135
    ),
114
    'unique keys' => array(
1155
      'name' => array('name'),
1165
    ),
1175
    'primary key' => array('fid'),
118
  );
119
1205
  $schema['profile_values'] = array(
1215
    'description' => t('Stores values for profile fields.'),
122
    'fields' => array(
123
      'fid' => array(
1245
        'type' => 'int',
1255
        'unsigned' => TRUE,
1265
        'not null' => TRUE,
1275
        'default' => 0,
1285
        'description' => t('The {profile_fields}.fid of the field.'),
1295
      ),
130
      'uid' => array(
1315
        'type' => 'int',
1325
        'unsigned' => TRUE,
1335
        'not null' => TRUE,
1345
        'default' => 0,
1355
        'description' => t('The {users}.uid of the profile user.'),
1365
      ),
137
      'value' => array(
1385
        'type' => 'text',
1395
        'not null' => FALSE,
1405
        'description' => t('The value for the field.'),
1415
      ),
1425
    ),
1435
    'primary key' => array('uid', 'fid'),
144
    'indexes' => array(
1455
      'fid' => array('fid'),
1465
    ),
147
  );
148
1495
  return $schema;
1500
}
1515