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

Contents of /drupal/modules/field/field.install

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


Revision 1.16 - (show annotations) (download) (as text)
Thu Oct 15 12:44:34 2009 UTC (6 weeks ago) by dries
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.15: +8 -2 lines
File MIME type: text/x-php
- Patch #470242 by yched, bjaspan: fixed namespacing for bundle names to avoid users rendering their site unusable.
1 <?php
2 // $Id: field.install,v 1.15 2009/10/01 19:16:57 dries Exp $
3
4 /**
5 * @file
6 * Install, update and uninstall functions for the field module.
7 */
8
9 /**
10 * Implement hook_schema.
11 */
12 function field_schema() {
13 // Static (meta) tables.
14 $schema['field_config'] = array(
15 'fields' => array(
16 'id' => array(
17 'type' => 'serial',
18 'not null' => TRUE,
19 'description' => 'The primary identifier for a field',
20 ),
21 'field_name' => array(
22 'type' => 'varchar',
23 'length' => 32,
24 'not null' => TRUE,
25 'description' => 'The name of this field. Non-deleted field names are unique, but multiple deleted fields can have the same name.',
26 ),
27 'type' => array(
28 'type' => 'varchar',
29 'length' => 128,
30 'not null' => TRUE,
31 'description' => 'The type of this field.',
32 ),
33 'module' => array(
34 'type' => 'varchar',
35 'length' => 128,
36 'not null' => TRUE,
37 'default' => '',
38 'description' => 'The module that implements the field type.',
39 ),
40 'active' => array(
41 'type' => 'int',
42 'size' => 'tiny',
43 'not null' => TRUE,
44 'default' => 0,
45 'description' => 'Boolean indicating whether the module that implements the field type is enabled.',
46 ),
47 'storage_type' => array(
48 'type' => 'varchar',
49 'length' => 128,
50 'not null' => TRUE,
51 'description' => 'The storage backend for the field.',
52 ),
53 'storage_module' => array(
54 'type' => 'varchar',
55 'length' => 128,
56 'not null' => TRUE,
57 'default' => '',
58 'description' => 'The module that implements the storage backend.',
59 ),
60 'storage_active' => array(
61 'type' => 'int',
62 'size' => 'tiny',
63 'not null' => TRUE,
64 'default' => 0,
65 'description' => 'Boolean indicating whether the module that implements the storage backend is enabled.',
66 ),
67 'locked' => array(
68 'type' => 'int',
69 'size' => 'tiny',
70 'not null' => TRUE,
71 'default' => 0,
72 'description' => '@TODO',
73 ),
74 'data' => array(
75 'type' => 'text',
76 'size' => 'medium',
77 'not null' => TRUE,
78 'serialize' => TRUE,
79 'description' => 'Serialized data containing the field properties that do not warrant a dedicated column.',
80 ),
81 'cardinality' => array(
82 'type' => 'int',
83 'size' => 'tiny',
84 'not null' => TRUE,
85 'default' => 0,
86 ),
87 'translatable' => array(
88 'type' => 'int',
89 'size' => 'tiny',
90 'not null' => TRUE,
91 'default' => 0,
92 ),
93 'deleted' => array(
94 'type' => 'int',
95 'size' => 'tiny',
96 'not null' => TRUE,
97 'default' => 0,
98 ),
99 ),
100 'primary key' => array('id'),
101 'indexes' => array(
102 'field_name' => array('field_name'),
103 // Used by field_read_fields().
104 'active' => array('active'),
105 'storage_active' => array('storage_active'),
106 'deleted' => array('deleted'),
107 // Used by field_modules_disabled().
108 'module' => array('module'),
109 'storage_module' => array('storage_module'),
110 // Used by field_associate_fields().
111 'type' => array('type'),
112 'storage_type' => array('storage_type'),
113 ),
114 );
115 $schema['field_config_instance'] = array(
116 'fields' => array(
117 'id' => array(
118 'type' => 'serial',
119 'not null' => TRUE,
120 'description' => 'The primary identifier for a field instance',
121 ),
122 'field_id' => array(
123 'type' => 'int',
124 'not null' => TRUE,
125 'description' => 'The identifier of the field attached by this instance',
126 ),
127 'field_name' => array(
128 'type' => 'varchar',
129 'length' => 32,
130 'not null' => TRUE,
131 'default' => ''
132 ),
133 'object_type' => array(
134 'type' => 'varchar',
135 'length' => 32,
136 'not null' => TRUE,
137 'default' => ''
138 ),
139 'bundle' => array(
140 'type' => 'varchar',
141 'length' => 128,
142 'not null' => TRUE,
143 'default' => ''
144 ),
145 'data' => array(
146 'type' => 'text',
147 'size' => 'medium',
148 'not null' => TRUE,
149 'serialize' => TRUE,
150 ),
151 'deleted' => array(
152 'type' => 'int',
153 'size' => 'tiny',
154 'not null' => TRUE,
155 'default' => 0,
156 ),
157 ),
158 'primary key' => array('id'),
159 'indexes' => array(
160 // Used by field_delete_instance().
161 'field_name_bundle' => array('field_name', 'object_type', 'bundle'),
162 // Used by field_read_instances().
163 'deleted' => array('deleted'),
164 ),
165 );
166 $schema['cache_field'] = drupal_get_schema_unprocessed('system', 'cache');
167
168 return $schema;
169 }

  ViewVC Help
Powered by ViewVC 1.1.2