forked from Luis-J-Ianez/cubecomps.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inc_initdb.php
89 lines (82 loc) · 2.48 KB
/
inc_initdb.php
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
<?
require_once "lib.php";
$query = <<<EOT
CREATE TABLE IF NOT EXISTS $eventstable (
`id` tinyint(2) NOT NULL,
`timelimit` varchar(9) default NULL,
`r1` tinyint(1) NOT NULL,
`r1_format` tinyint(1) NOT NULL,
`r1_groupsize` smallint(3) NOT NULL,
`r1_open` tinyint(1) NOT NULL,
`r2` tinyint(1) NOT NULL,
`r2_format` tinyint(1) NOT NULL,
`r2_groupsize` smallint(3) NOT NULL,
`r2_open` tinyint(1) NOT NULL,
`r3` tinyint(1) NOT NULL,
`r3_format` tinyint(1) NOT NULL,
`r3_groupsize` smallint(3) NOT NULL,
`r3_open` tinyint(1) NOT NULL,
`r4` tinyint(1) NOT NULL,
`r4_format` tinyint(1) NOT NULL,
`r4_groupsize` smallint(3) NOT NULL,
`r4_open` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
)
EOT;
//<<< ENGINE=MyISAM AUTO_INCREMENT=44 DEFAULT CHARSET=utf8
$result = strict_mysql_query($query);
/*<<<
$query = <<<EOT
CREATE TABLE IF NOT EXISTS $compstable (
`id` SMALLINT( 3 ) NOT NULL AUTO_INCREMENT ,
`WCAid` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`name` VARCHAR( 80 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`country_id` VARCHAR( 2 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`birthday` DATE NOT NULL ,
`gender` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
PRIMARY KEY ( `id` ) ,
INDEX ( `WCAid` , `name` )
) TYPE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci
EOT;
*/
$query = <<<EOT
CREATE TABLE IF NOT EXISTS $compstable (
`id` SMALLINT( 3 ) NOT NULL AUTO_INCREMENT ,
`WCAid` VARCHAR( 10 ) ,
`name` VARCHAR( 80 ) ,
`country_id` VARCHAR( 2 ) ,
`birthday` DATE NOT NULL ,
`gender` VARCHAR( 1 ) ,
PRIMARY KEY ( `id` ) ,
INDEX ( `WCAid` , `name` )
)
EOT;
$result = strict_mysql_query($query);
$query = <<<EOT
CREATE TABLE IF NOT EXISTS $regstable (
`cat_id` tinyint(2) NOT NULL,
`round` tinyint(1) NOT NULL,
`comp_id` smallint(3) NOT NULL,
PRIMARY KEY (`cat_id`,`round`,`comp_id`)
)
EOT;
//<<< ENGINE=MyISAM DEFAULT CHARSET=utf8;
$result = strict_mysql_query($query);
$query = <<<EOT
CREATE TABLE IF NOT EXISTS $timestable (
`cat_id` tinyint(2) NOT NULL,
`round` tinyint(1) NOT NULL,
`comp_id` smallint(3) NOT NULL,
`t1` varchar(15) NOT NULL,
`t2` varchar(15) default NULL,
`t3` varchar(15) default NULL,
`t4` varchar(15) default NULL,
`t5` varchar(15) default NULL,
`average` varchar(15) default NULL,
`best` varchar(15) NOT NULL,
PRIMARY KEY (`cat_id`,`round`,`comp_id`)
)
EOT;
//<<< ENGINE=MyISAM DEFAULT CHARSET=utf8
$result = strict_mysql_query($query);
?>