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
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
CREATE TABLE `callback` (
`taskid` varchar(40) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
`dateline` int(10) unsigned NOT NULL,
`cbfunction` varchar(16) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
`args` text NOT NULL,
PRIMARY KEY (`taskid`,`cbfunction`),
KEY `dateline` (`dateline`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cat_setting` (
`catid` int(10) unsigned NOT NULL,
`sortval` smallint(5) unsigned NOT NULL,
PRIMARY KEY (`catid`),
KEY `sortval` (`sortval`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `clientlog` (
`logid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL,
`logtypeid` varchar(30) NOT NULL,
`clientip` varchar(40) NOT NULL,
`description` varchar(255) NOT NULL,
`extra` text NOT NULL,
PRIMARY KEY (`logid`),
KEY `dateline` (`dateline`),
KEY `logtypeid` (`logtypeid`,`dateline`),
KEY `clientip` (`clientip`,`dateline`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `configtgz` (
`configid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL,
`filepath` varchar(255) NOT NULL,
`status` enum('OK','OUTDATED','MISSING') NOT NULL DEFAULT 'MISSING',
PRIMARY KEY (`configid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `configtgz_module` (
`moduleid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL,
`moduletype` varchar(16) NOT NULL,
`filepath` varchar(250) NOT NULL,
`contents` text NOT NULL,
`version` int(10) unsigned NOT NULL DEFAULT '0',
`status` enum('OK','MISSING','OUTDATED') NOT NULL DEFAULT 'MISSING',
PRIMARY KEY (`moduleid`),
KEY `title` (`title`),
KEY `moduletype` (`moduletype`,`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `configtgz_x_module` (
`configid` int(10) unsigned NOT NULL,
`moduleid` int(10) unsigned NOT NULL,
PRIMARY KEY (`configid`,`moduleid`),
KEY `moduleid` (`moduleid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `eventlog` (
`logid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL,
`logtypeid` varchar(30) NOT NULL,
`description` varchar(255) NOT NULL,
`extra` text NOT NULL,
PRIMARY KEY (`logid`),
KEY `dateline` (`dateline`),
KEY `logtypeid` (`logtypeid`,`dateline`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `news` (
`newsid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL,
`title` varchar(200) DEFAULT NULL,
`content` text,
PRIMARY KEY (`newsid`),
KEY `dateline` (`dateline`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `permission` (
`mask` int(10) unsigned NOT NULL,
`identifier` varchar(32) NOT NULL,
PRIMARY KEY (`mask`),
UNIQUE KEY `identifier` (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `property` (
`name` varchar(50) NOT NULL,
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`value` text NOT NULL,
PRIMARY KEY (`name`),
KEY `dateline` (`dateline`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `setting` (
`setting` varchar(28) NOT NULL,
`catid` int(10) unsigned NOT NULL,
`defaultvalue` text NOT NULL,
`permissions` int(10) unsigned NOT NULL,
`validator` varchar(250) NOT NULL DEFAULT '',
PRIMARY KEY (`setting`),
KEY `catid` (`catid`,`setting`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `setting_distro` (
`distroid` int(10) unsigned NOT NULL,
`setting` varchar(28) NOT NULL,
`value` text NOT NULL,
`displayvalue` text NOT NULL,
PRIMARY KEY (`distroid`,`setting`),
KEY `setting` (`setting`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `setting_global` (
`setting` varchar(28) NOT NULL,
`value` text NOT NULL,
`displayvalue` text NOT NULL,
PRIMARY KEY (`setting`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `statistic` (
`logid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`dateline` int(10) unsigned NOT NULL,
`typeid` varchar(30) NOT NULL,
`clientip` varchar(40) NOT NULL,
`username` varchar(255) NOT NULL,
`data` varchar(255) NOT NULL,
PRIMARY KEY (`logid`),
KEY `dateline` (`dateline`),
KEY `logtypeid` (`typeid`,`dateline`),
KEY `clientip` (`clientip`,`dateline`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `user` (
`userid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`login` varchar(100) NOT NULL,
`passwd` varchar(150) NOT NULL,
`fullname` varchar(100) DEFAULT NULL,
`phone` varchar(100) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`permissions` int(10) unsigned NOT NULL,
`lasteventid` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`userid`),
UNIQUE KEY `login` (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `configtgz_x_module`
ADD CONSTRAINT `configtgz_x_module_ibfk_1` FOREIGN KEY (`configid`) REFERENCES `configtgz` (`configid`) ON DELETE CASCADE,
ADD CONSTRAINT `configtgz_x_module_ibfk_2` FOREIGN KEY (`moduleid`) REFERENCES `configtgz_module` (`moduleid`);
ALTER TABLE `setting`
ADD CONSTRAINT `setting_ibfk_1` FOREIGN KEY (`catid`) REFERENCES `cat_setting` (`catid`) ON UPDATE CASCADE;
ALTER TABLE `setting_distro`
ADD CONSTRAINT `setting_distro_ibfk_1` FOREIGN KEY (`setting`) REFERENCES `setting` (`setting`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|