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

Contents of /contributions/modules/thisdayinhistory/thisdayinhistory.install

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


Revision 1.2 - (show annotations) (download) (as text)
Tue Feb 10 19:40:01 2009 UTC (9 months, 2 weeks ago) by dmcgladdery
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1, DRUPAL-6--2, DRUPAL-7--1
Changes since 1.1: +176 -45 lines
File MIME type: text/x-php
Initial commit of the thisdayinhistory module Drupal 6 version
1 <?php
2 // $Id: thisdayinhistory.install,v 1.1.2.1 2008/02/02 00:48:37 dmcgladdery Exp $
3 /**
4 * @file
5 * Drupal schema and install/uninstall code
6 */
7
8 /**
9 * Implementation of hook_schema().
10 */
11 function thisdayinhistory_schema() {
12 $schema['thisdayinhistory'] = array(
13 'description' => t('TODO'),
14 'fields' => array(
15 'nid' => array(
16 'description' => t('Node ID'),
17 'type' => 'int',
18 'unsigned' => TRUE,
19 'not null' => TRUE,
20 ),
21 'vid' => array(
22 'description' => t('Node version ID'),
23 'type' => 'int',
24 'unsigned' => TRUE,
25 'not null' => TRUE,
26 'default' => 0,
27 ),
28 'month' => array(
29 'description' => t('Event month'),
30 'type' => 'int',
31 'unsigned' => TRUE,
32 'not null' => TRUE,
33 ),
34 'day' => array(
35 'description' => t('Event day'),
36 'type' => 'int',
37 'size' => 'tiny',
38 'unsigned' => 1,
39 'not null' => TRUE,
40 ),
41 'year' => array(
42 'description' => t('Event Year'),
43 'type' => 'int',
44 'unsigned' => TRUE,
45 'not null' => FALSE,
46 ),
47 'isodate' => array(
48 'description' => t('Event date'),
49 'type' => 'datetime',
50 'not null' => FALSE,
51 ),
52 'blockdisplay' => array(
53 'description' => t('Determines if event should be displayed in block'),
54 'type' => 'int',
55 'size' => 'tiny',
56 'not null' => TRUE,
57 'default' => 0,
58 ),
59 ),
60 'indexes' => array(
61 'thisdayinhistory_nid' => array('nid'),
62 ),
63 'primary key' => array('vid', 'nid'),
64 );
65
66 $schema['thisdayinhistory_blocks'] = array(
67 'description' => t('This Day in History Blocks table'),
68 'primary key' => array('bid'),
69 'unique keys' => array(
70 'name' => array('name')
71 ),
72 'fields' => array(
73 'bid' => array(
74 'description' => t('Unique Block ID'),
75 'type' => 'serial',
76 'not null' => TRUE,
77 ),
78 'name' => array(
79 'description' => t('Block name'),
80 'type' => 'varchar',
81 'length' => 255,
82 'not null' => TRUE,
83 ),
84 'header' => array(
85 'description' => t('TODO'),
86 'type' => 'varchar',
87 'length' => 255,
88 'not null' => FALSE,
89 ),
90 'header_format' => array(
91 'description' => t('TODO'),
92 'type' => 'int',
93 'size' => 'tiny',
94 'unsigned' => 1,
95 'not null' => TRUE,
96 ),
97 'block_type' => array(
98 'description' => t('TODO'),
99 'type' => 'int',
100 'size' => 'tiny',
101 'not null' => TRUE,
102 ),
103 'uid_filter' => array(
104 'description' => t('TODO'),
105 'type' => 'text',
106 'not null' => TRUE,
107 ),
108 'tid_filter' => array(
109 'description' => t('TODO'),
110 'type' => 'text',
111 'not null' => TRUE,
112 ),
113 'nid_filter' => array(
114 'description' => t('TODO'),
115 'type' => 'text',
116 'not null' => TRUE,
117 ),
118 'rid_filter' => array(
119 'description' => t('TODO'),
120 'type' => 'text',
121 'not null' => TRUE,
122 ),
123 'vid' => array(
124 'description' => t('TODO'),
125 'type' => 'int',
126 'not null' => TRUE,
127 ),
128 ),
129 );
130
131 return $schema;
132 }
133
134 /**
135 * Implementation of hook_install().
136 */
137 function thisdayinhistory_install() {
138 // Create tables.
139 drupal_install_schema('thisdayinhistory');
140 }
141
142 /**
143 * Implementation of hook_update_N().
144 *
145 * Update 600: Convert the module tables to the Drupal 6 Schema API based schema.
146 */
147 function thisdayinhistory_update_600() {
148 $status = array();
149
150 // Convert table: thisdayinhistory
151 db_drop_index($status, 'thisdayinhistory', 'node_thisdayinhistory_nid');
152 db_drop_primary_key($status, 'thisdayinhistory');
153 db_change_field($status, 'thisdayinhistory', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
154 db_change_field($status, 'thisdayinhistory', 'vid', 'vid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
155 db_change_field($status, 'thisdayinhistory', 'month', 'month', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE));
156 db_change_field($status, 'thisdayinhistory', 'day', 'day', array('type' => 'int', 'size' => 'tiny', 'unsigned' => 1, 'not null' => TRUE));
157 db_change_field($status, 'thisdayinhistory', 'year', 'year', array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE));
158 db_change_field($status, 'thisdayinhistory', 'isodate', 'isodate', array('type' => 'datetime', 'not null' => FALSE));
159 db_change_field($status, 'thisdayinhistory', 'promote', 'blockdisplay', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0));
160 db_add_primary_key($status, 'thisdayinhistory', array('vid', 'nid'));
161 db_add_index($status, 'thisdayinhistory', 'thisdayinhistory_nid', array('nid'));
162
163 // Convert table: thisdayinhistory_blocks
164 db_drop_primary_key($status, 'thisdayinhistory_blocks');
165 db_change_field($status, 'thisdayinhistory_blocks', 'bid', 'bid', array('type' => 'serial', 'not null' => TRUE), array('primary key' => array('bid')));
166 db_change_field($status, 'thisdayinhistory_blocks', 'name', 'name', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
167 db_change_field($status, 'thisdayinhistory_blocks', 'header', 'header', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE));
168 db_change_field($status, 'thisdayinhistory_blocks', 'header_format', 'header_format', array('type' => 'int', 'size' => 'tiny', 'unsigned' => 1, 'not null' => TRUE));
169 db_change_field($status, 'thisdayinhistory_blocks', 'block_type', 'block_type', array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE));
170 db_change_field($status, 'thisdayinhistory_blocks', 'uid_filter', 'uid_filter', array('type' => 'text', 'not null' => TRUE));
171 db_change_field($status, 'thisdayinhistory_blocks', 'tid_filter', 'tid_filter', array('type' => 'text', 'not null' => TRUE));
172 db_change_field($status, 'thisdayinhistory_blocks', 'nid_filter', 'nid_filter', array('type' => 'text', 'not null' => TRUE));
173 db_change_field($status, 'thisdayinhistory_blocks', 'rid_filter', 'rid_filter', array('type' => 'text', 'not null' => TRUE));
174 db_change_field($status, 'thisdayinhistory_blocks', 'vid', 'vid', array('type' => 'int', 'not null' => TRUE));
175
176 return $status;
177 }
178
179
180 /**
181 * Implementation of hook_uninstall().
182 */
183 function thisdayinhistory_uninstall() {
184 // Remove tables.
185 drupal_uninstall_schema('thisdayinhistory');
186 }

  ViewVC Help
Powered by ViewVC 1.1.2