r1480 + IPRealServer: idem
[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
192c95ce
DO
115--
116-- Table structure for table `IPLoadBalancer`
117--
118
119DROP TABLE IF EXISTS `IPLoadBalancer`;
120CREATE TABLE `IPLoadBalancer` (
121 `object_id` int(10) unsigned default NULL,
122 `rspool_id` int(10) unsigned default NULL,
8d350975
DO
123 `vsconfig` text,
124 `rsconfig` text,
192c95ce
DO
125 UNIQUE KEY `object_id` (`object_id`,`rspool_id`)
126) ENGINE=MyISAM;
127
128--
129-- Table structure for table `IPRSPool`
130--
131
132DROP TABLE IF EXISTS `IPRSPool`;
133CREATE TABLE `IPRSPool` (
134 `id` int(10) unsigned NOT NULL auto_increment,
135 `vs_id` int(10) unsigned default NULL,
136 `name` char(255) default NULL,
137 `vsconfig` text,
138 `rsconfig` text,
139 PRIMARY KEY (`id`)
140) ENGINE=MyISAM;
141
e673ee24
DO
142--
143-- Table structure for table `IPRanges`
144--
145
146DROP TABLE IF EXISTS `IPRanges`;
147CREATE TABLE `IPRanges` (
ba1c6d42 148 `id` int(10) unsigned NOT NULL auto_increment,
e673ee24 149 `ip` int(10) unsigned NOT NULL,
ba1c6d42 150 `mask` int(10) unsigned NOT NULL,
e673ee24
DO
151 `name` char(255) default NULL,
152 PRIMARY KEY (`id`)
153) ENGINE=MyISAM;
154
192c95ce
DO
155--
156-- Table structure for table `IPRealServer`
157--
158
159DROP TABLE IF EXISTS `IPRealServer`;
160CREATE TABLE `IPRealServer` (
161 `id` int(10) unsigned NOT NULL auto_increment,
162 `rsip` int(10) unsigned default NULL,
163 `rsport` smallint(5) unsigned default NULL,
164 `rspool_id` int(10) unsigned default NULL,
ab82514d 165 `rsconfig` text,
192c95ce
DO
166 PRIMARY KEY (`id`)
167) ENGINE=MyISAM;
168
169--
170-- Table structure for table `IPVirtualService`
171--
172
173DROP TABLE IF EXISTS `IPVirtualService`;
174CREATE TABLE `IPVirtualService` (
175 `id` int(10) unsigned NOT NULL auto_increment,
176 `vip` int(10) unsigned default NULL,
177 `vport` smallint(5) unsigned default NULL,
178 `proto` enum('TCP','UDP') NOT NULL default 'TCP',
179 `name` char(255) default NULL,
9c3043f3
DO
180 `vsconfig` text,
181 `rsconfig` text,
192c95ce
DO
182 PRIMARY KEY (`id`),
183 UNIQUE KEY `endpoint` (`vip`,`vport`,`proto`)
184) ENGINE=MyISAM;
185
e673ee24
DO
186--
187-- Table structure for table `Link`
188--
189
190DROP TABLE IF EXISTS `Link`;
191CREATE TABLE `Link` (
167df29b
DO
192 `porta` int(10) unsigned NOT NULL,
193 `portb` int(10) unsigned NOT NULL,
e673ee24
DO
194 PRIMARY KEY (`porta`,`portb`),
195 UNIQUE KEY `porta` (`porta`),
196 UNIQUE KEY `portb` (`portb`)
197) ENGINE=MyISAM;
198
199--
200-- Table structure for table `Molecule`
201--
202
203DROP TABLE IF EXISTS `Molecule`;
204CREATE TABLE `Molecule` (
205 `id` int(10) unsigned NOT NULL auto_increment,
206 PRIMARY KEY (`id`)
207) ENGINE=MyISAM;
208
209--
210-- Table structure for table `MountOperation`
211--
212
213DROP TABLE IF EXISTS `MountOperation`;
214CREATE TABLE `MountOperation` (
215 `id` int(10) unsigned NOT NULL auto_increment,
216 `object_id` int(10) unsigned NOT NULL,
217 `ctime` timestamp NOT NULL,
218 `user_name` char(64) default NULL,
219 `old_molecule_id` int(10) unsigned default NULL,
220 `new_molecule_id` int(10) unsigned default NULL,
221 `comment` text,
222 PRIMARY KEY (`id`)
223) ENGINE=MyISAM;
224
225--
226-- Table structure for table `Port`
227--
228
229DROP TABLE IF EXISTS `Port`;
230CREATE TABLE `Port` (
167df29b
DO
231 `id` int(10) unsigned NOT NULL auto_increment,
232 `object_id` int(10) unsigned NOT NULL,
e673ee24 233 `name` char(255) NOT NULL,
167df29b 234 `type` int(10) unsigned NOT NULL,
e673ee24
DO
235 `l2address` char(64) default NULL,
236 `reservation_comment` char(255) default NULL,
237 `label` char(255) default NULL,
238 PRIMARY KEY (`id`),
239 UNIQUE KEY `object_id` (`object_id`,`name`),
78f44cbc
DO
240 UNIQUE KEY `l2address` (`l2address`),
241 KEY `type` (`type`)
e673ee24
DO
242) ENGINE=MyISAM;
243
244--
245-- Table structure for table `PortCompat`
246--
247
248DROP TABLE IF EXISTS `PortCompat`;
249CREATE TABLE `PortCompat` (
71dcbe12 250 `type1` int(10) unsigned NOT NULL,
78f44cbc
DO
251 `type2` int(10) unsigned NOT NULL,
252 KEY `type1` (`type1`),
253 KEY `type2` (`type2`)
e673ee24
DO
254) ENGINE=MyISAM;
255
256--
257-- Table structure for table `PortForwarding`
258--
259
260DROP TABLE IF EXISTS `PortForwarding`;
261CREATE TABLE `PortForwarding` (
ba1c6d42 262 `object_id` int(10) unsigned NOT NULL,
e673ee24
DO
263 `proto` int(11) NOT NULL,
264 `localip` int(10) unsigned NOT NULL,
ba1c6d42 265 `localport` smallint(5) unsigned NOT NULL,
e673ee24 266 `remoteip` int(10) unsigned NOT NULL,
ba1c6d42 267 `remoteport` smallint(5) unsigned NOT NULL,
e673ee24
DO
268 `description` char(255) default NULL,
269 PRIMARY KEY (`object_id`,`proto`,`localip`,`localport`,`remoteip`,`remoteport`),
270 KEY `localip` (`localip`),
271 KEY `remoteip` (`remoteip`),
272 KEY `object_id` (`object_id`)
273) ENGINE=MyISAM;
274
275--
276-- Table structure for table `Rack`
277--
278
279DROP TABLE IF EXISTS `Rack`;
280CREATE TABLE `Rack` (
281 `id` int(10) unsigned NOT NULL auto_increment,
282 `name` char(255) default NULL,
283 `deleted` enum('yes','no') NOT NULL default 'no',
284 `row_id` int(10) unsigned NOT NULL default '1',
0a7136d4 285 `height` tinyint(3) unsigned NOT NULL default '42',
e673ee24
DO
286 `comment` text,
287 PRIMARY KEY (`id`)
288) ENGINE=MyISAM;
289
290--
291-- Table structure for table `RackHistory`
292--
293
294DROP TABLE IF EXISTS `RackHistory`;
295CREATE TABLE `RackHistory` (
296 `id` int(10) unsigned default NULL,
297 `name` char(255) default NULL,
298 `deleted` enum('yes','no') default NULL,
299 `row_id` int(10) unsigned default NULL,
300 `height` int(10) unsigned default NULL,
301 `comment` text,
302 `ctime` timestamp NOT NULL,
303 `user_name` char(64) default NULL
304) ENGINE=MyISAM;
305
306--
307-- Table structure for table `RackObject`
308--
309
310DROP TABLE IF EXISTS `RackObject`;
311CREATE TABLE `RackObject` (
312 `id` int(10) unsigned NOT NULL auto_increment,
313 `name` char(255) default NULL,
314 `label` char(255) default NULL,
315 `barcode` char(16) default NULL,
316 `deleted` enum('yes','no') NOT NULL default 'no',
317 `objtype_id` int(10) unsigned NOT NULL default '1',
318 `asset_no` char(64) default NULL,
319 `has_problems` enum('yes','no') NOT NULL default 'no',
320 `comment` text,
321 PRIMARY KEY (`id`),
322 UNIQUE KEY `RackObject_asset_no` (`asset_no`),
323 UNIQUE KEY `name` (`name`),
324 UNIQUE KEY `barcode` (`barcode`)
325) ENGINE=MyISAM;
326
327--
328-- Table structure for table `RackObjectHistory`
329--
330
331DROP TABLE IF EXISTS `RackObjectHistory`;
332CREATE TABLE `RackObjectHistory` (
333 `id` int(10) unsigned default NULL,
334 `name` char(255) default NULL,
335 `label` char(255) default NULL,
336 `barcode` char(16) default NULL,
337 `deleted` enum('yes','no') default NULL,
338 `objtype_id` int(10) unsigned default NULL,
339 `asset_no` char(64) default NULL,
340 `has_problems` enum('yes','no') NOT NULL default 'no',
341 `comment` text,
342 `ctime` timestamp NOT NULL,
343 `user_name` char(64) default NULL
344) ENGINE=MyISAM;
345
346--
347-- Table structure for table `RackSpace`
348--
349
350DROP TABLE IF EXISTS `RackSpace`;
351CREATE TABLE `RackSpace` (
352 `rack_id` int(10) unsigned NOT NULL default '0',
353 `unit_no` int(10) unsigned NOT NULL default '0',
354 `atom` enum('front','interior','rear') NOT NULL default 'interior',
355 `state` enum('A','U','T','W') NOT NULL default 'A',
356 `object_id` int(10) unsigned default NULL,
357 `problem_id` int(10) unsigned default NULL,
358 PRIMARY KEY (`rack_id`,`unit_no`,`atom`)
359) ENGINE=MyISAM;
360
361--
362-- Table structure for table `UserAccount`
363--
364
365DROP TABLE IF EXISTS `UserAccount`;
366CREATE TABLE `UserAccount` (
367 `user_id` int(10) unsigned NOT NULL auto_increment,
368 `user_name` char(64) NOT NULL,
369 `user_enabled` enum('yes','no') NOT NULL default 'no',
370 `user_password_hash` char(128) default NULL,
371 `user_realname` char(64) default NULL,
372 PRIMARY KEY (`user_id`),
373 UNIQUE KEY `user_name` (`user_name`)
374) ENGINE=MyISAM AUTO_INCREMENT=10000;
375
376--
377-- Table structure for table `UserPermission`
378--
379
380DROP TABLE IF EXISTS `UserPermission`;
381CREATE TABLE `UserPermission` (
382 `user_id` int(10) unsigned NOT NULL default '0',
383 `page` char(64) NOT NULL default '%',
384 `tab` char(64) NOT NULL default '%',
385 `access` enum('yes','no') NOT NULL default 'no',
386 UNIQUE KEY `user_id` (`user_id`,`page`,`tab`)
387) ENGINE=MyISAM;
8d068153
DO
388
389--
390-- Table structure for table `Config`
391--
392
393DROP TABLE IF EXISTS `Config`;
394CREATE TABLE `Config` (
395 `varname` char(32) NOT NULL,
396 `varvalue` char(64) NOT NULL,
397 `vartype` enum('string','uint') NOT NULL default 'string',
398 `emptyok` enum('yes','no') NOT NULL default 'no',
399 `is_hidden` enum('yes','no') NOT NULL default 'yes',
400 `description` text,
401 PRIMARY KEY (`varname`)
402) ENGINE=MyISAM;
403
e673ee24
DO
404/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
405
406/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
407/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
408/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
409/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
410/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
411/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
412/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;