r1374 + IPBonds, IPRanges and PortForwarding have been fixed wrt int signedness
[racktables] / install / init-structure.sql
CommitLineData
e673ee24
DO
1/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
2/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
3/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
4/*!40101 SET NAMES utf8 */;
5/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
6/*!40103 SET TIME_ZONE='+00:00' */;
7/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
8/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
9/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
10/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
11
12--
13-- Table structure for table `Atom`
14--
15
16DROP TABLE IF EXISTS `Atom`;
17CREATE TABLE `Atom` (
18 `molecule_id` int(10) unsigned default NULL,
19 `rack_id` int(10) unsigned default NULL,
20 `unit_no` int(10) unsigned default NULL,
21 `atom` enum('front','interior','rear') default NULL
22) ENGINE=MyISAM;
23
24--
25-- Table structure for table `Attribute`
26--
27
28DROP TABLE IF EXISTS `Attribute`;
29CREATE TABLE `Attribute` (
30 `attr_id` int(10) unsigned NOT NULL auto_increment,
31 `attr_type` enum('string','uint','float','dict') default NULL,
32 `attr_name` char(64) default NULL,
33 PRIMARY KEY (`attr_id`),
34 UNIQUE KEY `attr_name` (`attr_name`)
35) ENGINE=MyISAM AUTO_INCREMENT=10000;
36
37--
38-- Table structure for table `AttributeMap`
39--
40
41DROP TABLE IF EXISTS `AttributeMap`;
42CREATE TABLE `AttributeMap` (
43 `objtype_id` int(10) unsigned NOT NULL default '1',
44 `attr_id` int(10) unsigned NOT NULL default '1',
45 `chapter_no` int(10) unsigned NOT NULL,
46 UNIQUE KEY `objtype_id` (`objtype_id`,`attr_id`)
47) ENGINE=MyISAM;
48
49--
50-- Table structure for table `AttributeValue`
51--
52
53DROP TABLE IF EXISTS `AttributeValue`;
54CREATE TABLE `AttributeValue` (
55 `object_id` int(10) unsigned default NULL,
56 `attr_id` int(10) unsigned default NULL,
57 `string_value` char(128) default NULL,
58 `uint_value` int(10) unsigned default NULL,
59 `float_value` float default NULL,
60 UNIQUE KEY `object_id` (`object_id`,`attr_id`)
61) ENGINE=MyISAM;
62
63--
64-- Table structure for table `Chapter`
65--
66
67DROP TABLE IF EXISTS `Chapter`;
68CREATE TABLE `Chapter` (
69 `chapter_no` int(10) unsigned NOT NULL auto_increment,
70 `sticky` enum('yes','no') default 'no',
71 `chapter_name` char(128) NOT NULL,
72 PRIMARY KEY (`chapter_no`),
73 UNIQUE KEY `chapter_name` (`chapter_name`)
74) ENGINE=MyISAM AUTO_INCREMENT=10000;
75
76--
77-- Table structure for table `Dictionary`
78--
79
80DROP TABLE IF EXISTS `Dictionary`;
81CREATE TABLE `Dictionary` (
82 `chapter_no` int(10) unsigned NOT NULL,
83 `dict_key` int(10) unsigned NOT NULL auto_increment,
84 `dict_value` char(128) default NULL,
71dcbe12
DO
85 PRIMARY KEY (`dict_key`),
86 UNIQUE KEY `chap_to_key` (`chapter_no`,`dict_key`),
87 UNIQUE KEY `chap_to_val` (`chapter_no`,`dict_value`)
88) ENGINE=MyISAM AUTO_INCREMENT=50000;
e673ee24
DO
89
90--
91-- Table structure for table `IPAddress`
92--
93
94DROP TABLE IF EXISTS `IPAddress`;
95CREATE TABLE `IPAddress` (
96 `ip` int(10) unsigned NOT NULL,
97 `name` char(255) NOT NULL,
98 `reserved` enum('yes','no') default NULL,
99 PRIMARY KEY (`ip`)
100) ENGINE=MyISAM;
101
102--
103-- Table structure for table `IPBonds`
104--
105
106DROP TABLE IF EXISTS `IPBonds`;
107CREATE TABLE `IPBonds` (
ba1c6d42 108 `object_id` int(10) unsigned NOT NULL,
e673ee24
DO
109 `ip` int(10) unsigned NOT NULL,
110 `name` char(255) NOT NULL,
111 `type` enum('regular','shared','virtual') default NULL,
112 PRIMARY KEY (`object_id`,`ip`)
113) ENGINE=MyISAM;
114
115--
116-- Table structure for table `IPRanges`
117--
118
119DROP TABLE IF EXISTS `IPRanges`;
120CREATE TABLE `IPRanges` (
ba1c6d42 121 `id` int(10) unsigned NOT NULL auto_increment,
e673ee24 122 `ip` int(10) unsigned NOT NULL,
ba1c6d42 123 `mask` int(10) unsigned NOT NULL,
e673ee24
DO
124 `name` char(255) default NULL,
125 PRIMARY KEY (`id`)
126) ENGINE=MyISAM;
127
128--
129-- Table structure for table `Link`
130--
131
132DROP TABLE IF EXISTS `Link`;
133CREATE TABLE `Link` (
167df29b
DO
134 `porta` int(10) unsigned NOT NULL,
135 `portb` int(10) unsigned NOT NULL,
e673ee24
DO
136 PRIMARY KEY (`porta`,`portb`),
137 UNIQUE KEY `porta` (`porta`),
138 UNIQUE KEY `portb` (`portb`)
139) ENGINE=MyISAM;
140
141--
142-- Table structure for table `Molecule`
143--
144
145DROP TABLE IF EXISTS `Molecule`;
146CREATE TABLE `Molecule` (
147 `id` int(10) unsigned NOT NULL auto_increment,
148 PRIMARY KEY (`id`)
149) ENGINE=MyISAM;
150
151--
152-- Table structure for table `MountOperation`
153--
154
155DROP TABLE IF EXISTS `MountOperation`;
156CREATE TABLE `MountOperation` (
157 `id` int(10) unsigned NOT NULL auto_increment,
158 `object_id` int(10) unsigned NOT NULL,
159 `ctime` timestamp NOT NULL,
160 `user_name` char(64) default NULL,
161 `old_molecule_id` int(10) unsigned default NULL,
162 `new_molecule_id` int(10) unsigned default NULL,
163 `comment` text,
164 PRIMARY KEY (`id`)
165) ENGINE=MyISAM;
166
167--
168-- Table structure for table `Port`
169--
170
171DROP TABLE IF EXISTS `Port`;
172CREATE TABLE `Port` (
167df29b
DO
173 `id` int(10) unsigned NOT NULL auto_increment,
174 `object_id` int(10) unsigned NOT NULL,
e673ee24 175 `name` char(255) NOT NULL,
167df29b 176 `type` int(10) unsigned NOT NULL,
e673ee24
DO
177 `l2address` char(64) default NULL,
178 `reservation_comment` char(255) default NULL,
179 `label` char(255) default NULL,
180 PRIMARY KEY (`id`),
181 UNIQUE KEY `object_id` (`object_id`,`name`),
78f44cbc
DO
182 UNIQUE KEY `l2address` (`l2address`),
183 KEY `type` (`type`)
e673ee24
DO
184) ENGINE=MyISAM;
185
186--
187-- Table structure for table `PortCompat`
188--
189
190DROP TABLE IF EXISTS `PortCompat`;
191CREATE TABLE `PortCompat` (
71dcbe12 192 `type1` int(10) unsigned NOT NULL,
78f44cbc
DO
193 `type2` int(10) unsigned NOT NULL,
194 KEY `type1` (`type1`),
195 KEY `type2` (`type2`)
e673ee24
DO
196) ENGINE=MyISAM;
197
198--
199-- Table structure for table `PortForwarding`
200--
201
202DROP TABLE IF EXISTS `PortForwarding`;
203CREATE TABLE `PortForwarding` (
ba1c6d42 204 `object_id` int(10) unsigned NOT NULL,
e673ee24
DO
205 `proto` int(11) NOT NULL,
206 `localip` int(10) unsigned NOT NULL,
ba1c6d42 207 `localport` smallint(5) unsigned NOT NULL,
e673ee24 208 `remoteip` int(10) unsigned NOT NULL,
ba1c6d42 209 `remoteport` smallint(5) unsigned NOT NULL,
e673ee24
DO
210 `description` char(255) default NULL,
211 PRIMARY KEY (`object_id`,`proto`,`localip`,`localport`,`remoteip`,`remoteport`),
212 KEY `localip` (`localip`),
213 KEY `remoteip` (`remoteip`),
214 KEY `object_id` (`object_id`)
215) ENGINE=MyISAM;
216
217--
218-- Table structure for table `Rack`
219--
220
221DROP TABLE IF EXISTS `Rack`;
222CREATE TABLE `Rack` (
223 `id` int(10) unsigned NOT NULL auto_increment,
224 `name` char(255) default NULL,
225 `deleted` enum('yes','no') NOT NULL default 'no',
226 `row_id` int(10) unsigned NOT NULL default '1',
227 `height` int(10) unsigned NOT NULL default '42',
228 `comment` text,
229 PRIMARY KEY (`id`)
230) ENGINE=MyISAM;
231
232--
233-- Table structure for table `RackHistory`
234--
235
236DROP TABLE IF EXISTS `RackHistory`;
237CREATE TABLE `RackHistory` (
238 `id` int(10) unsigned default NULL,
239 `name` char(255) default NULL,
240 `deleted` enum('yes','no') default NULL,
241 `row_id` int(10) unsigned default NULL,
242 `height` int(10) unsigned default NULL,
243 `comment` text,
244 `ctime` timestamp NOT NULL,
245 `user_name` char(64) default NULL
246) ENGINE=MyISAM;
247
248--
249-- Table structure for table `RackObject`
250--
251
252DROP TABLE IF EXISTS `RackObject`;
253CREATE TABLE `RackObject` (
254 `id` int(10) unsigned NOT NULL auto_increment,
255 `name` char(255) default NULL,
256 `label` char(255) default NULL,
257 `barcode` char(16) default NULL,
258 `deleted` enum('yes','no') NOT NULL default 'no',
259 `objtype_id` int(10) unsigned NOT NULL default '1',
260 `asset_no` char(64) default NULL,
261 `has_problems` enum('yes','no') NOT NULL default 'no',
262 `comment` text,
263 PRIMARY KEY (`id`),
264 UNIQUE KEY `RackObject_asset_no` (`asset_no`),
265 UNIQUE KEY `name` (`name`),
266 UNIQUE KEY `barcode` (`barcode`)
267) ENGINE=MyISAM;
268
269--
270-- Table structure for table `RackObjectHistory`
271--
272
273DROP TABLE IF EXISTS `RackObjectHistory`;
274CREATE TABLE `RackObjectHistory` (
275 `id` int(10) unsigned default NULL,
276 `name` char(255) default NULL,
277 `label` char(255) default NULL,
278 `barcode` char(16) default NULL,
279 `deleted` enum('yes','no') default NULL,
280 `objtype_id` int(10) unsigned default NULL,
281 `asset_no` char(64) default NULL,
282 `has_problems` enum('yes','no') NOT NULL default 'no',
283 `comment` text,
284 `ctime` timestamp NOT NULL,
285 `user_name` char(64) default NULL
286) ENGINE=MyISAM;
287
288--
289-- Table structure for table `RackSpace`
290--
291
292DROP TABLE IF EXISTS `RackSpace`;
293CREATE TABLE `RackSpace` (
294 `rack_id` int(10) unsigned NOT NULL default '0',
295 `unit_no` int(10) unsigned NOT NULL default '0',
296 `atom` enum('front','interior','rear') NOT NULL default 'interior',
297 `state` enum('A','U','T','W') NOT NULL default 'A',
298 `object_id` int(10) unsigned default NULL,
299 `problem_id` int(10) unsigned default NULL,
300 PRIMARY KEY (`rack_id`,`unit_no`,`atom`)
301) ENGINE=MyISAM;
302
303--
304-- Table structure for table `UserAccount`
305--
306
307DROP TABLE IF EXISTS `UserAccount`;
308CREATE TABLE `UserAccount` (
309 `user_id` int(10) unsigned NOT NULL auto_increment,
310 `user_name` char(64) NOT NULL,
311 `user_enabled` enum('yes','no') NOT NULL default 'no',
312 `user_password_hash` char(128) default NULL,
313 `user_realname` char(64) default NULL,
314 PRIMARY KEY (`user_id`),
315 UNIQUE KEY `user_name` (`user_name`)
316) ENGINE=MyISAM AUTO_INCREMENT=10000;
317
318--
319-- Table structure for table `UserPermission`
320--
321
322DROP TABLE IF EXISTS `UserPermission`;
323CREATE TABLE `UserPermission` (
324 `user_id` int(10) unsigned NOT NULL default '0',
325 `page` char(64) NOT NULL default '%',
326 `tab` char(64) NOT NULL default '%',
327 `access` enum('yes','no') NOT NULL default 'no',
328 UNIQUE KEY `user_id` (`user_id`,`page`,`tab`)
329) ENGINE=MyISAM;
8d068153
DO
330
331--
332-- Table structure for table `Config`
333--
334
335DROP TABLE IF EXISTS `Config`;
336CREATE TABLE `Config` (
337 `varname` char(32) NOT NULL,
338 `varvalue` char(64) NOT NULL,
339 `vartype` enum('string','uint') NOT NULL default 'string',
340 `emptyok` enum('yes','no') NOT NULL default 'no',
341 `is_hidden` enum('yes','no') NOT NULL default 'yes',
342 `description` text,
343 PRIMARY KEY (`varname`)
344) ENGINE=MyISAM;
345
e673ee24
DO
346/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
347
348/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
349/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
350/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
351/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
352/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
353/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
354/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;