-
Notifications
You must be signed in to change notification settings - Fork 0
/
ogevents.install
90 lines (82 loc) · 2.62 KB
/
ogevents.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
// $Id$
/**
* @file Installation file for the ogevents module.
*/
function ogevents_install() {
drupal_install_schema('ogevents');
}
function ogevents_uninstall() {
drupal_uninstall_schema('ogevents');
}
/*
function ogevents_update_6001() {
return drupal_install_schema('ogevents');
}
*/
function ogevents_update_6003() {
$ret = drupal_install_schema('ogevents');
if (! _ogevents_build_results()) {
$ret['#abort'] = array('success' => FALSE, 'query' => 'Failed building results table.');
}
return $ret;
}
function ogevents_results_schema() {
return array(
'description' => 'Storage for the calculated challenge results.',
'fields' => array(
'rid' => array(
'description' => 'ID for this result.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'school_id' => array(
'description' => 'The school these results are for.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'event_id' => array(
'description' => 'The event these results are for.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'walk_total' => array(
'description' => 'The total number of walking trips at the given school during the given event',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'bike_total' => array(
'description' => 'The total number of biking trips at the given school during the given event',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'other_total' => array(
'description' => 'The total number of other trips at the given school during the given event',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'sum_total' => array(
'description' => 'The total number of all trips at the given school during the given event',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
'participation' => array(
'description' => 'The percent of students (range is 0-100) participating in the event.',
'type' => 'float',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0),
),
'primary key' => array('rid'),
);
}
function ogevents_schema() {
$schema['ogevents_results'] = ogevents_results_schema();
return $schema;
}