/[drupal]/drupal/modules/profile/profile.install
ViewVC logotype

Contents of /drupal/modules/profile/profile.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.22 - (show annotations) (download) (as text)
Tue Sep 29 15:13:56 2009 UTC (8 weeks, 3 days ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.21: +3 -5 lines
File MIME type: text/x-php
- Patch #570900 by Crell | asimmonds: Changed Destroy remnants of update_sql().
1 <?php
2 // $Id: profile.install,v 1.21 2009/09/10 06:38:19 dries Exp $
3
4 /**
5 * @file
6 * Install, update and uninstall functions for the profile module.
7 */
8
9 /**
10 * Implement hook_uninstall().
11 */
12 function profile_uninstall() {
13 variable_del('profile_block_author_fields');
14 }
15
16 /**
17 * Implement hook_schema().
18 */
19 function profile_schema() {
20 $schema['profile_field'] = array(
21 'description' => 'Stores profile field information.',
22 'fields' => array(
23 'fid' => array(
24 'type' => 'serial',
25 'not null' => TRUE,
26 'description' => 'Primary Key: Unique profile field ID.',
27 ),
28 'title' => array(
29 'type' => 'varchar',
30 'length' => 255,
31 'not null' => FALSE,
32 'description' => 'Title of the field shown to the end user.',
33 ),
34 'name' => array(
35 'type' => 'varchar',
36 'length' => 128,
37 'not null' => TRUE,
38 'default' => '',
39 'description' => 'Internal name of the field used in the form HTML and URLs.',
40 ),
41 'explanation' => array(
42 'type' => 'text',
43 'not null' => FALSE,
44 'description' => 'Explanation of the field to end users.',
45 ),
46 'category' => array(
47 'type' => 'varchar',
48 'length' => 255,
49 'not null' => FALSE,
50 'description' => 'Profile category that the field will be grouped under.',
51 ),
52 'page' => array(
53 'type' => 'varchar',
54 'length' => 255,
55 'not null' => FALSE,
56 'description' => "Title of page used for browsing by the field's value",
57 ),
58 'type' => array(
59 'type' => 'varchar',
60 'length' => 128,
61 'not null' => FALSE,
62 'description' => 'Type of form field.',
63 ),
64 'weight' => array(
65 'type' => 'int',
66 'not null' => TRUE,
67 'default' => 0,
68 'size' => 'tiny',
69 'description' => 'Weight of field in relation to other profile fields.',
70 ),
71 'required' => array(
72 'type' => 'int',
73 'not null' => TRUE,
74 'default' => 0,
75 'size' => 'tiny',
76 'description' => 'Whether the user is required to enter a value. (0 = no, 1 = yes)',
77 ),
78 'register' => array(
79 'type' => 'int',
80 'not null' => TRUE,
81 'default' => 0,
82 'size' => 'tiny',
83 'description' => 'Whether the field is visible in the user registration form. (1 = yes, 0 = no)',
84 ),
85 'visibility' => array(
86 'type' => 'int',
87 'not null' => TRUE,
88 'default' => 0,
89 'size' => 'tiny',
90 'description' => '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)',
91 ),
92 'autocomplete' => array(
93 'type' => 'int',
94 'not null' => TRUE,
95 'default' => 0,
96 'size' => 'tiny',
97 'description' => 'Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)',
98 ),
99 'options' => array(
100 'type' => 'text',
101 'not null' => FALSE,
102 'description' => 'List of options to be used in a list selection field.',
103 ),
104 ),
105 'indexes' => array(
106 'category' => array('category'),
107 ),
108 'unique keys' => array(
109 'name' => array('name'),
110 ),
111 'primary key' => array('fid'),
112 );
113
114 $schema['profile_value'] = array(
115 'description' => 'Stores values for profile fields.',
116 'fields' => array(
117 'fid' => array(
118 'type' => 'int',
119 'unsigned' => TRUE,
120 'not null' => TRUE,
121 'default' => 0,
122 'description' => 'The {profile_field}.fid of the field.',
123 ),
124 'uid' => array(
125 'type' => 'int',
126 'unsigned' => TRUE,
127 'not null' => TRUE,
128 'default' => 0,
129 'description' => 'The {users}.uid of the profile user.',
130 ),
131 'value' => array(
132 'type' => 'text',
133 'not null' => FALSE,
134 'description' => 'The value for the field.',
135 ),
136 ),
137 'primary key' => array('uid', 'fid'),
138 'indexes' => array(
139 'fid' => array('fid'),
140 ),
141 'foreign keys' => array(
142 'fid' => array('profile_field' => 'fid'),
143 'uid' => array('users' => 'uid'),
144 ),
145 );
146
147 return $schema;
148 }
149
150 /**
151 * Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
152 */
153 function profile_update_7001() {
154 db_rename_table('profile_fields', 'profile_field');
155 db_rename_table('profile_values', 'profile_value');
156 }

  ViewVC Help
Powered by ViewVC 1.1.2