-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchallonge.install
More file actions
191 lines (182 loc) · 6.16 KB
/
challonge.install
File metadata and controls
191 lines (182 loc) · 6.16 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
/**
* Implementation of hook_schema
*/
function challonge_schema()
{
$schema['challonge_tournament'] = array(
'description' => 'The Challonge Tournament information to append to the respective node',
'fields' => array(
'id' => array(
'description' => 'The primary key',
'type' => 'serial',
'unsigned' => true,
'not null' => true
),
'nid' => array(
'description' => 'node id',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'tournament_id' => array(
'description' => 'The tournament id on Challonge.',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'tournament_type' => array(
'description' => 'The tournament type on Challonge.',
'type' => 'varchar',
'length' => 255,
'not null' => true
),
'url' => array(
'description' => 'The tournament url on Challonge.',
'type' => 'varchar',
'length' => 160,
'not null' => true
),
'subdomain' => array(
'description' => 'The tournament subdomain on Challonge.',
'type' => 'varchar',
'length' => 160,
'not null' => true
),
'is_started' => array(
'description' => 'Challonge variable to check if the tournament started.',
'type' => 'int',
'length' => 1,
'not null' => true,
'default' => 0
),
'is_published' => array(
'description' => 'Challonge variable to check if the tournament is published.',
'type' => 'int',
'length' => 1,
'not null' => true,
'default' => 0
),
),
'primary key' => array('id'),
'unique keys' => array(
'nid' => array('nid'),
'tournament_id' => array('tournament_id'),
'url_subdomain' => array('url', 'subdomain')
)
);
$schema['challonge_matches'] = array(
'description' => 'Matches that are in the Challonge tournament.',
'fields' => array(
'id' => array(
'description' => 'The primary key',
'type' => 'serial',
'unsigned' => true,
'not null' => true
),
'match_id' => array(
'description' => 'The match id from Challonge',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'tournament_id' => array(
'description' => 'The challonge id for the tournament cache',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
),
'foreign keys' => array(
'tournament' => array(
'table' => 'challonge_tournament',
'columns' => array('tournament_id' => 'tournament_id')
)
),
'primary key' => array('id'),
'unique keys' => array('match_id' => array('match_id'))
);
$schema['challonge_participants'] = array(
'fields' => array(
'id' => array(
'description' => 'The primary key',
'type' => 'serial',
'unsigned' => true,
'not null' => true
),
'participant_id' => array(
'description' => 'the key challonge gives us',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'tournament_id' => array(
'description' => 'the match the participant belongs to.',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'name' => array(
'description' => 'participant name according to Challonge',
'type' => 'varchar',
'length' => 255,
'not null' => true
)
),
'primary key' => array('id'),
);
$schema['match_participants'] = array(
'description' => 'Table to map a 0-N relationship between matches and participants.',
'fields' => array(
'id' => array(
'description' => 'The primary key',
'type' => 'serial',
'unsigned' => true,
'not null' => true
),
'participant_id' => array(
'description' => 'The id from the participant table',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'match_id' => array(
'description' => 'The id from the participant table',
'type' => 'int',
'unsigned' => true,
'not null' => true
),
'seed' => array(
'description' => 'the player seed.',
'type' => 'int',
'not null' => true
)
),
'foreign keys' => array(
'participant_id' => array(
'table' => 'challonge_participants',
'columns' => array('participant_id' => 'participant_id')
),
'match_id' => array(
'table' => 'challonge_matches',
'columns' => array('match_id' => 'match_id')
)
),
'primary key' => array('id'),
);
return $schema;
}
/**
* Implementation of hook_install
*/
function challonge_install()
{
drupal_install_schema('challonge');
}
/**
* Implementation of hook_uninstall
*/
function challonge_uninstall()
{
drupal_uninstall_schema('challonge');
}