Code coverage for /20080809/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
 */
74
function profile_install() {
8
  // Create tables.
94
  drupal_install_schema('profile');
104
}
11
12
/**
13
 * Implementation of hook_uninstall().
14
 */
154
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
 */
254
function profile_schema() {
264
  $schema['profile_fields'] = array(
274
    'description' => t('Stores profile field information.'),
28
    'fields' => array(
29
      'fid' => array(
304
        'type' => 'serial',
314
        'not null' => TRUE,
324
        'description' => t('Primary Key: Unique profile field ID.'),
334
      ),
34
      'title' => array(
354
        'type' => 'varchar',
364
        'length' => 255,
374
        'not null' => FALSE,
384
        'description' => t('Title of the field shown to the end user.'),
394
      ),
40
      'name' => array(
414
        'type' => 'varchar',
424
        'length' => 128,
434
        'not null' => TRUE,
444
        'default' => '',
454
        'description' => t('Internal name of the field used in the form
HTML and URLs.'),
464
      ),
47
      'explanation' => array(
484
        'type' => 'text',
494
        'not null' => FALSE,
504
        'description' => t('Explanation of the field to end users.'),
514
      ),
52
      'category' => array(
534
        'type' => 'varchar',
544
        'length' => 255,
554
        'not null' => FALSE,
564
        'description' => t('Profile category that the field will be grouped
under.'),
574
      ),
58
      'page' => array(
594
        'type' => 'varchar',
604
        'length' => 255,
614
        'not null' => FALSE,
624
        'description' => t("Title of page used for browsing by the field's
value"),
634
      ),
64
      'type' => array(
654
        'type' => 'varchar',
664
        'length' => 128,
674
        'not null' => FALSE,
684
        'description' => t('Type of form field.'),
694
      ),
70
      'weight' => array(
714
        'type' => 'int',
724
        'not null' => TRUE,
734
        'default' => 0,
744
        'size' => 'tiny',
754
        'description' => t('Weight of field in relation to other profile
fields.'),
764
      ),
77
      'required' => array(
784
        'type' => 'int',
794
        'not null' => TRUE,
804
        'default' => 0,
814
        'size' => 'tiny',
824
        'description' => t('Whether the user is required to enter a value.
(0 = no, 1 = yes)'),
834
      ),
84
      'register' => array(
854
        'type' => 'int',
864
        'not null' => TRUE,
874
        'default' => 0,
884
        'size' => 'tiny',
894
        'description' => t('Whether the field is visible in the user
registration form. (1 = yes, 0 = no)'),
904
      ),
91
      'visibility' => array(
924
        'type' => 'int',
934
        'not null' => TRUE,
944
        'default' => 0,
954
        'size' => 'tiny',
964
        '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)'),
974
      ),
98
      'autocomplete' => array(
994
        'type' => 'int',
1004
        'not null' => TRUE,
1014
        'default' => 0,
1024
        'size' => 'tiny',
1034
        'description' => t('Whether form auto-completion is enabled. (0 =
disabled, 1 = enabled)'),
1044
      ),
105
      'options' => array(
1064
        'type' => 'text',
1074
        'not null' => FALSE,
1084
        'description' => t('List of options to be used in a list selection
field.'),
1094
      ),
1104
    ),
111
    'indexes' => array(
1124
      'category' => array('category'),
1134
    ),
114
    'unique keys' => array(
1154
      'name' => array('name'),
1164
    ),
1174
    'primary key' => array('fid'),
118
  );
119
1204
  $schema['profile_values'] = array(
1214
    'description' => t('Stores values for profile fields.'),
122
    'fields' => array(
123
      'fid' => array(
1244
        'type' => 'int',
1254
        'unsigned' => TRUE,
1264
        'not null' => TRUE,
1274
        'default' => 0,
1284
        'description' => t('The {profile_fields}.fid of the field.'),
1294
      ),
130
      'uid' => array(
1314
        'type' => 'int',
1324
        'unsigned' => TRUE,
1334
        'not null' => TRUE,
1344
        'default' => 0,
1354
        'description' => t('The {users}.uid of the profile user.'),
1364
      ),
137
      'value' => array(
1384
        'type' => 'text',
1394
        'not null' => FALSE,
1404
        'description' => t('The value for the field.'),
1414
      ),
1424
    ),
1434
    'primary key' => array('uid', 'fid'),
144
    'indexes' => array(
1454
      'fid' => array('fid'),
1464
    ),
147
  );
148
1494
  return $schema;
1500
}
1514