/[drupal]/contributions/modules/docapi/docapi.install
ViewVC logotype

Contents of /contributions/modules/docapi/docapi.install

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


Revision 1.2 - (show annotations) (download) (as text)
Sat Jun 7 05:52:14 2008 UTC (17 months, 3 weeks ago) by bradfordcp
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--2
Changes since 1.1: +237 -84 lines
File MIME type: text/x-php
Finished the skeleton of a plugin module. This module returns valid sample data in the correct structure. I can use this to test hook calls and workflow without tryint o implement a parser this early on.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * This file contains tha installation information for the docapi module.
7 */
8
9 /**
10 * Implementation of hook_schema
11 */
12 function docapi_schema() {
13 $schema = array();
14
15 $schema['docapi_library'] = array(
16 'description' => t('Contains all of the imported data as parased by the respective plugin.'),
17 'fields' => array(
18 'doc_id' => array(
19 'description' => t('The identifying unique field for the particular record / upload'),
20 'type' => 'serial',
21 'unsigned' => true,
22 'not null' => true,
23 ),
24 'plugin_id' => array(
25 'description' => t('The identifier to link this particular item to a plugin.'),
26 'type' => 'int',
27 'unsigned' => true,
28 'not null' => true,
29 ),
30 'filemime' => array(
31 'description' => t('The mimetype of the file.'),
32 'type' => 'varchar',
33 'length' => '50',
34 'default' => 'text/plain',
35 'not null' => true,
36 ),
37 'filename' => array(
38 'description' => t('The filename of the file.'),
39 'type' => 'varchar',
40 'length' => '100',
41 'default' => t(''),
42 'not null' => true,
43 ),
44 'filepath' => array(
45 'description' => t('The path to the file on the server relative to the site root.'),
46 'type' => 'varchar',
47 'length' => '100',
48 'not null' => true,
49 ),
50 'filesize' => array(
51 'description' => t('The size of the file in bytes'),
52 'type' => 'int',
53 'unsigned' => true,
54 'not null' => true,
55 ),
56 'created' => array(
57 'description' => t('When the record was added to the database'),
58 'type' => 'datetime',
59 'not null' => true,
60
61 ),
62 'changed' => array(
63 'description' => t('The last time a change to the input file has been changed'),
64 'type' => 'datetime',
65 'not null' => true,
66 ),
67 ),
68 'indexes' => array(
69 'filepathfilename' => array('filepath', 'filename'),
70 ),
71 'unique keys' => array(
72 ),
73 'primary key' => array(
74 'doc_id',
75 ),
76 );
77
78 $schema['docapi_plugins'] = array(
79 'description' => t('Tracks which plugins are in use as well as their mimetype.'),
80 'fields' => array(
81 'plugin_id' => array(
82 'desciption' => t('Unique identifier for the plugin'),
83 'type' => 'serial',
84 'unsigned' => true,
85 'not null' => true,
86 ),
87 'name' => array(
88 'description' => t('The name of the plugin'),
89 'type' => 'varchar',
90 'length' => '100',
91 'not null' => true,
92 ),
93 ),
94 'indexes' => array(
95 ),
96 'unique keys' => array(
97 ),
98 'primary key' => array(
99 'plugin_id'
100 ),
101 );
102
103 $schema['docapi_plugin_mimetypes'] = array(
104 'description' => t('Keeps track of which mimetypes a particular plugin supports, as well as precedence'),
105 'fields' => array(
106 'plugin_id' => array(
107 'description' => t('The id of the plugin used to parse this mimetype'),
108 'type' => 'int',
109 'not null' => true,
110 ),
111 'mimetype' => array(
112 'description' => t('The mimetype the plugin parses'),
113 'type' => 'varchar',
114 'length' => '200',
115 'not null' => true,
116 ),
117 'weight' => array(
118 'description' => t('The precedence for which plugin should handle a particular mimetype'),
119 'type' => 'int',
120 'not null' => true,
121 ),
122 ),
123 'indexes' => array(
124 'plugin_idmimetype' => array('plugin_id', 'mimetype'),
125 ),
126 'unique keys' => array(
127 ),
128 'primary key' => array(
129 'mimetype',
130 'weight',
131 ),
132 );
133
134 $schema['docapi_metadata_map'] = array(
135 'description' => t('Maps each field within the metadata to a node\'s field'),
136 'fields' => array(
137 'metadata_map_id' => array(
138 'description' => t('The id of the mapping'),
139 'type' => 'serial',
140 'not null' => true,
141 ),
142 'nodetype' => array(
143 'description' => t('The type of node this map is for.'),
144 'type' => 'varchar',
145 'length' => '200',
146 'not null' => true,
147 ),
148 'node_field' => array(
149 'desciption' => t('The field the module is mapping to within the node.'),
150 'type' => 'varchar',
151 'length' => '200',
152 'not null' => true,
153 ),
154 'metadata_field' => array(
155 'description' => t('The field within the metadata table where the data will be pulled from.'),
156 'type' => 'varchar',
157 'length' => '200',
158 'not null' => true,
159 ),
160 ),
161 'indexes' => array(
162 ),
163 'unique keys' => array(
164 ),
165 'primary key' => array(
166 'metadata_map_id',
167 ),
168 );
169
170 $schema['docapi_metadata'] = array(
171 'description' => t('Contains the metadata for all documents in the library.'),
172 'fields' => array(
173 'doc_id' => array(
174 'description' => t('The id of the document this metadata applies to.'),
175 'type' => 'int',
176 'not null' => true,
177 ),
178 'field' => array(
179 'description' => t('The name of the metadata field.'),
180 'type' => 'varchar',
181 'length' => '200',
182 'not null' => true,
183 ),
184 'meta_value' => array(
185 'desciption' => t('The value of the metadata'),
186 'type' => 'varchar',
187 'length' => '200',
188 'not null' => true,
189 ),
190 ),
191 'indexes' => array(
192 ),
193 'unique keys' => array(
194 ),
195 'primary key' => array(
196 ),
197 );
198
199 $schema['docapi_doc_map'] = array(
200 'description' => t('Maps a document in the library to a specific node'),
201 'fields' => array(
202 'doc_id' => array(
203 'description' => t('The id of the document.'),
204 'type' => 'int',
205 'not null' => true,
206 ),
207 'nid' => array(
208 'description' => t('The node id where the document is mapped to.'),
209 'type' => 'int',
210 'not null' => true,
211 ),
212 ),
213 'indexes' => array(
214 ),
215 'unique keys' => array(
216 ),
217 'primary key' => array(
218 'doc_id',
219 'nid'
220 ),
221 );
222
223 return $schema;
224 }
225
226 /**
227 * Implementation of hook_install
228 */
229 function docapi_install() {
230 // Create the tables
231 drupal_install_schema('docapi');
232 }
233
234 /**
235 * Implementation of hook_uninstall
236 */
237 function docapi_uninstall() {
238 drupal_uninstall_schema('docapi');
239 }

  ViewVC Help
Powered by ViewVC 1.1.2