added database table for config repositories
[public/netxms.git] / sql / schema.in
1 /*
2 ** NetXMS Database Schema
3 **
4 ** ex: syntax=sql ts=2 sw=2 expandtab
5 */
6
7 /*
8 ** Metadata
9 */
10 CREATE TABLE metadata
11 (
12 var_name varchar(63) not null,
13 var_value varchar(255) not null,
14 PRIMARY KEY(var_name)
15 ) TABLE_TYPE;
16
17 COMMENT_TABLE(metadata, 'System meta data (DBMS type, schema version, etc.)')
18 COMMENT_COLUMN(metadata.var_name, 'Variable name')
19 COMMENT_COLUMN(metadata.var_value, 'Variable value')
20
21 /*
22 ** System configuration table
23 */
24 CREATE TABLE config
25 (
26 var_name varchar(63) not null,
27 var_value varchar(2000) null,
28 #ifdef DB_ORACLE
29 is_visible integer default 1 not null,
30 need_server_restart integer default 0 not null,
31 data_type char(1) default 'S' not null,
32 is_public char(1) default 'N' not null,
33 #else
34 is_visible integer not null default 1,
35 need_server_restart integer not null default 0,
36 data_type char(1) not null default 'S',
37 is_public char(1) not null default 'N',
38 #endif
39 description varchar(255) null,
40 possible_values SQL_TEXT null,
41 PRIMARY KEY(var_name)
42 ) TABLE_TYPE;
43
44 COMMENT_TABLE(config, 'Server configuration')
45 COMMENT_COLUMN(config.var_name, 'Parameter name')
46 COMMENT_COLUMN(config.var_value, 'Value')
47 COMMENT_COLUMN(config.is_visible, 'GUI visibility indicator')
48 COMMENT_COLUMN(config.need_server_restart, 'Change take effect after server restart')
49 COMMENT_COLUMN(config.data_type, 'Not used in current verion')
50 COMMENT_COLUMN(config.is_public, 'No used in current version')
51 COMMENT_COLUMN(config.description, 'Not used in current version')
52 COMMENT_COLUMN(config.possible_values, 'Not used in current version')
53
54 /*
55 ** System configuration data (for large data)
56 */
57 CREATE TABLE config_clob
58 (
59 var_name varchar(63) not null,
60 var_value SQL_TEXT null,
61 PRIMARY KEY(var_name)
62 ) TABLE_TYPE;
63
64 COMMENT_TABLE(config_clob, 'System configuration table for large data elements')
65 COMMENT_COLUMN(config_clob.var_name, 'Parameter name')
66 COMMENT_COLUMN(config_clob.var_value, 'Value')
67
68 /*
69 ** Users
70 */
71 CREATE TABLE users
72 (
73 id integer not null,
74 guid varchar(36) not null,
75 name varchar(63) not null,
76 password varchar(127) not null,
77 system_access SQL_INT64 not null,
78 flags integer not null,
79 full_name varchar(127) null,
80 description varchar(255) null,
81 grace_logins integer not null,
82 auth_method integer not null,
83 cert_mapping_method integer not null,
84 cert_mapping_data SQL_TEXT null,
85 auth_failures integer not null,
86 last_passwd_change integer not null,
87 min_passwd_length integer not null,
88 disabled_until integer not null,
89 last_login integer not null,
90 password_history SQL_TEXT null,
91 xmpp_id varchar(127) null,
92 ldap_dn SQL_TEXT null,
93 PRIMARY KEY(id)
94 ) TABLE_TYPE;
95
96 COMMENT_TABLE(users, 'System users')
97 COMMENT_COLUMN(users.id, 'User id')
98 COMMENT_COLUMN(users.guid, 'User guid')
99 COMMENT_COLUMN(users.name, 'Login name')
100 COMMENT_COLUMN(users.password, 'Hashed password')
101 COMMENT_COLUMN(users.system_access, 'Bit-mask of system access rights')
102 COMMENT_COLUMN(users.flags, 'Account flags (locked, password never expire etc.)')
103 COMMENT_COLUMN(users.full_name, 'Full name')
104 COMMENT_COLUMN(users.description, 'Description')
105 COMMENT_COLUMN(users.grace_logins, '')
106 COMMENT_COLUMN(users.auth_method, '')
107 COMMENT_COLUMN(users.cert_mapping_method, '')
108 COMMENT_COLUMN(users.cert_mapping_data, '')
109 COMMENT_COLUMN(users.auth_failures, '')
110 COMMENT_COLUMN(users.last_passwd_change, '')
111 COMMENT_COLUMN(users.min_passwd_length, '')
112 COMMENT_COLUMN(users.disabled_until, '')
113 COMMENT_COLUMN(users.last_login, '')
114 COMMENT_COLUMN(users.password_history, '')
115 COMMENT_COLUMN(users.xmpp_id, '')
116 COMMENT_COLUMN(users.ldap_dn, '')
117
118 /*
119 ** User groups
120 */
121
122 CREATE TABLE user_groups
123 (
124 id integer not null,
125 guid varchar(36) not null,
126 name varchar(63) not null,
127 system_access SQL_INT64 not null,
128 flags integer not null,
129 description varchar(255),
130 ldap_dn SQL_TEXT null,
131 PRIMARY KEY(id)
132 ) TABLE_TYPE;
133
134 COMMENT_TABLE(user_groups, 'System user groups')
135 COMMENT_COLUMN(user_groups.id, '')
136 COMMENT_COLUMN(user_groups.guid, '')
137 COMMENT_COLUMN(user_groups.name, '')
138 COMMENT_COLUMN(user_groups.system_access, '')
139 COMMENT_COLUMN(user_groups.flags, '')
140 COMMENT_COLUMN(user_groups.description, '')
141 COMMENT_COLUMN(user_groups.ldap_dn, '')
142
143 /*
144 ** Users to groups mapping
145 */
146
147 CREATE TABLE user_group_members
148 (
149 group_id integer not null,
150 user_id integer not null,
151 PRIMARY KEY(group_id,user_id)
152 ) TABLE_TYPE;
153
154 COMMENT_TABLE(user_group_members, 'Users and group relationships')
155 COMMENT_COLUMN(user_group_members.group_id, '')
156 COMMENT_COLUMN(user_group_members.user_id, '')
157
158 /*
159 ** User profiles
160 */
161
162 CREATE TABLE user_profiles
163 (
164 user_id integer not null,
165 var_name varchar(255) not null,
166 var_value SQL_TEXT not null,
167 PRIMARY KEY(user_id,var_name)
168 ) TABLE_TYPE;
169
170 COMMENT_TABLE(user_profiles, 'User profiles')
171 COMMENT_COLUMN(user_profiles.user_id, '')
172 COMMENT_COLUMN(user_profiles.var_name, '')
173 COMMENT_COLUMN(user_profiles.var_value, '')
174
175 /*
176 ** Custom attributes for user database objects
177 */
178
179 CREATE TABLE userdb_custom_attributes
180 (
181 object_id integer not null,
182 attr_name varchar(255) not null,
183 attr_value SQL_TEXT not null,
184 PRIMARY KEY(object_id,attr_name)
185 ) TABLE_TYPE;
186
187 COMMENT_TABLE(userdb_custom_attributes, '')
188 COMMENT_COLUMN(userdb_custom_attributes.object_id, '')
189 COMMENT_COLUMN(userdb_custom_attributes.attr_name, '')
190 COMMENT_COLUMN(userdb_custom_attributes.attr_value, '')
191
192 /*
193 ** Common object properties
194 */
195
196 CREATE TABLE object_properties
197 (
198 object_id integer not null,
199 guid varchar(36) not null,
200 name varchar(63) not null,
201 status integer not null,
202 is_deleted integer not null,
203 is_system integer not null,
204 last_modified integer not null,
205 inherit_access_rights integer not null,
206 status_calc_alg integer not null,
207 status_prop_alg integer not null,
208 status_fixed_val integer not null,
209 status_shift integer not null,
210 status_translation varchar(8) not null,
211 status_single_threshold integer not null,
212 status_thresholds varchar(8) not null,
213 comments SQL_TEXT null,
214 location_type integer not null,
215 latitude varchar(20),
216 longitude varchar(20),
217 location_accuracy integer not null,
218 location_timestamp integer not null,
219 image varchar(36) not null,
220 submap_id integer not null,
221 country varchar(63) null,
222 city varchar(63) null,
223 street_address varchar(255) null,
224 postcode varchar(31) null,
225 maint_mode char(1) not null,
226 maint_event_id SQL_INT64 not null,
227 PRIMARY KEY(object_id)
228 ) TABLE_TYPE;
229
230 COMMENT_TABLE(object_properties, '')
231 COMMENT_COLUMN(object_properties.object_id, '')
232 COMMENT_COLUMN(object_properties.guid, '')
233 COMMENT_COLUMN(object_properties.name, '')
234 COMMENT_COLUMN(object_properties.status, '')
235 COMMENT_COLUMN(object_properties.is_deleted, '')
236 COMMENT_COLUMN(object_properties.is_system, '')
237 COMMENT_COLUMN(object_properties.last_modified, '')
238 COMMENT_COLUMN(object_properties.inherit_access_rights, '')
239 COMMENT_COLUMN(object_properties.status_calc_alg, '')
240 COMMENT_COLUMN(object_properties.status_prop_alg, '')
241 COMMENT_COLUMN(object_properties.status_fixed_val, '')
242 COMMENT_COLUMN(object_properties.status_shift, '')
243 COMMENT_COLUMN(object_properties.status_translation, '')
244 COMMENT_COLUMN(object_properties.status_single_threshold, '')
245 COMMENT_COLUMN(object_properties.status_thresholds, '')
246 COMMENT_COLUMN(object_properties.comments, '')
247 COMMENT_COLUMN(object_properties.location_type, '')
248 COMMENT_COLUMN(object_properties.latitude, '')
249 COMMENT_COLUMN(object_properties.longitude, '')
250 COMMENT_COLUMN(object_properties.location_accuracy, '')
251 COMMENT_COLUMN(object_properties.location_timestamp, '')
252 COMMENT_COLUMN(object_properties.image, '')
253 COMMENT_COLUMN(object_properties.submap_id, '')
254 COMMENT_COLUMN(object_properties.country, '')
255 COMMENT_COLUMN(object_properties.city, '')
256 COMMENT_COLUMN(object_properties.street_address, '')
257 COMMENT_COLUMN(object_properties.postcode, '')
258 COMMENT_COLUMN(object_properties.maint_mode, '')
259 COMMENT_COLUMN(object_properties.maint_event_id, '')
260
261 /*
262 ** Object custom attributes
263 */
264 CREATE TABLE object_custom_attributes
265 (
266 object_id integer not null,
267 attr_name varchar(127) not null,
268 attr_value SQL_TEXT null,
269 PRIMARY KEY(object_id,attr_name)
270 ) TABLE_TYPE;
271
272 CREATE INDEX idx_ocattr_oid ON object_custom_attributes(object_id);
273
274 COMMENT_TABLE(object_custom_attributes, '')
275 COMMENT_COLUMN(object_custom_attributes.object_id, '')
276 COMMENT_COLUMN(object_custom_attributes.attr_name, '')
277 COMMENT_COLUMN(object_custom_attributes.attr_value, '')
278
279 /*
280 ** Zone objects
281 */
282 CREATE TABLE zones
283 (
284 id integer not null, // Zone object ID
285 zone_guid integer not null, // Globally unique ID for zone
286 agent_proxy integer not null,
287 snmp_proxy integer not null,
288 icmp_proxy integer not null,
289 PRIMARY KEY(id)
290 ) TABLE_TYPE;
291
292 COMMENT_TABLE(zones, '')
293 COMMENT_COLUMN(zones.id, '')
294 COMMENT_COLUMN(zones.zone_guid, '')
295 COMMENT_COLUMN(zones.agent_proxy, '')
296 COMMENT_COLUMN(zones.snmp_proxy, '')
297 COMMENT_COLUMN(zones.icmp_proxy, '')
298
299 /*
300 ** Mobile device objects
301 */
302 CREATE TABLE mobile_devices
303 (
304 id integer not null,
305 device_id varchar(64) not null,
306 vendor varchar(64) null,
307 model varchar(128) null,
308 serial_number varchar(64) null,
309 os_name varchar(32) null,
310 os_version varchar(64) null,
311 user_id varchar(64) null,
312 battery_level integer not null,
313 PRIMARY KEY(id)
314 ) TABLE_TYPE;
315
316 COMMENT_TABLE(mobile_devices, '')
317 COMMENT_COLUMN(mobile_devices.id, '')
318 COMMENT_COLUMN(mobile_devices.device_id, '')
319 COMMENT_COLUMN(mobile_devices.vendor, '')
320 COMMENT_COLUMN(mobile_devices.model, '')
321 COMMENT_COLUMN(mobile_devices.serial_number, '')
322 COMMENT_COLUMN(mobile_devices.os_name, '')
323 COMMENT_COLUMN(mobile_devices.os_version, '')
324 COMMENT_COLUMN(mobile_devices.user_id, '')
325 COMMENT_COLUMN(mobile_devices.battery_level, '')
326
327 /*
328 ** Access point objects
329 */
330 CREATE TABLE access_points
331 (
332 id integer not null,
333 node_id integer not null,
334 mac_address varchar(12) null,
335 vendor varchar(64) null,
336 model varchar(128) null,
337 serial_number varchar(64) null,
338 ap_state integer not null,
339 ap_index integer not null,
340 PRIMARY KEY(id)
341 ) TABLE_TYPE;
342
343 COMMENT_TABLE(access_points, '')
344 COMMENT_COLUMN(access_points.id, '')
345 COMMENT_COLUMN(access_points.node_id, '')
346 COMMENT_COLUMN(access_points.mac_address, '')
347 COMMENT_COLUMN(access_points.vendor, '')
348 COMMENT_COLUMN(access_points.model, '')
349 COMMENT_COLUMN(access_points.serial_number, '')
350 COMMENT_COLUMN(access_points.ap_state, '')
351 COMMENT_COLUMN(access_points.ap_index, '')
352
353 /*
354 ** Rack objects
355 */
356 CREATE TABLE racks
357 (
358 id integer not null,
359 height integer not null,
360 top_bottom_num char(1) not null,
361 PRIMARY KEY(id)
362 ) TABLE_TYPE;
363
364 COMMENT_TABLE(racks, '')
365 COMMENT_COLUMN(racks.id, '')
366 COMMENT_COLUMN(racks.height, '')
367 COMMENT_COLUMN(racks.top_bottom_num, '')
368
369 /*
370 ** Nodes information
371 */
372 CREATE TABLE nodes
373 (
374 id integer not null,
375 primary_name varchar(255) null,
376 primary_ip varchar(48) not null,
377 node_flags integer not null,
378 runtime_flags integer not null,
379 snmp_version integer not null,
380 snmp_port integer not null,
381 community varchar(127) null,
382 usm_auth_password varchar(127) null,
383 usm_priv_password varchar(127) null,
384 usm_methods integer not null,
385 snmp_oid varchar(255) null,
386 auth_method integer not null,
387 secret varchar(64) null,
388 agent_port integer not null,
389 status_poll_type integer not null,
390 agent_version varchar(63) null,
391 platform_name varchar(63) null,
392 poller_node_id integer not null,
393 zone_guid integer not null,
394 proxy_node integer not null,
395 snmp_proxy integer not null,
396 icmp_proxy integer not null,
397 required_polls integer not null,
398 uname varchar(255) null,
399 use_ifxtable integer not null,
400 snmp_sys_name varchar(127) null,
401 snmp_sys_contact varchar(127) null,
402 snmp_sys_location varchar(127) null,
403 bridge_base_addr varchar(15) null,
404 down_since integer not null,
405 boot_time integer not null,
406 driver_name varchar(32) null,
407 rack_image varchar(36) null,
408 rack_position integer not null,
409 rack_height integer not null,
410 rack_id integer not null,
411 agent_cache_mode char(1) not null,
412 last_agent_comm_time integer not null,
413 PRIMARY KEY(id)
414 ) TABLE_TYPE;
415
416 COMMENT_TABLE(nodes, '')
417 COMMENT_COLUMN(nodes.id, '')
418 COMMENT_COLUMN(nodes.primary_name, '')
419 COMMENT_COLUMN(nodes.primary_ip, '')
420 COMMENT_COLUMN(nodes.node_flags, '')
421 COMMENT_COLUMN(nodes.runtime_flags, '')
422 COMMENT_COLUMN(nodes.snmp_version, '')
423 COMMENT_COLUMN(nodes.snmp_port, '')
424 COMMENT_COLUMN(nodes.community, '')
425 COMMENT_COLUMN(nodes.usm_auth_password, '')
426 COMMENT_COLUMN(nodes.usm_priv_password, '')
427 COMMENT_COLUMN(nodes.usm_methods, '')
428 COMMENT_COLUMN(nodes.snmp_oid, '')
429 COMMENT_COLUMN(nodes.auth_method, '')
430 COMMENT_COLUMN(nodes.secret, '')
431 COMMENT_COLUMN(nodes.agent_port, '')
432 COMMENT_COLUMN(nodes.status_poll_type, '')
433 COMMENT_COLUMN(nodes.agent_version, '')
434 COMMENT_COLUMN(nodes.platform_name, '')
435 COMMENT_COLUMN(nodes.poller_node_id, '')
436 COMMENT_COLUMN(nodes.zone_guid, '')
437 COMMENT_COLUMN(nodes.proxy_node, '')
438 COMMENT_COLUMN(nodes.snmp_proxy, '')
439 COMMENT_COLUMN(nodes.icmp_proxy, '')
440 COMMENT_COLUMN(nodes.required_polls, '')
441 COMMENT_COLUMN(nodes.uname, '')
442 COMMENT_COLUMN(nodes.use_ifxtable, '')
443 COMMENT_COLUMN(nodes.snmp_sys_name, '')
444 COMMENT_COLUMN(nodes.snmp_sys_contact, '')
445 COMMENT_COLUMN(nodes.snmp_sys_location, '')
446 COMMENT_COLUMN(nodes.bridge_base_addr, '')
447 COMMENT_COLUMN(nodes.down_since, '')
448 COMMENT_COLUMN(nodes.boot_time, '')
449 COMMENT_COLUMN(nodes.driver_name, '')
450 COMMENT_COLUMN(nodes.rack_image, '')
451 COMMENT_COLUMN(nodes.rack_position, '')
452 COMMENT_COLUMN(nodes.rack_height, '')
453 COMMENT_COLUMN(nodes.rack_id, '')
454 COMMENT_COLUMN(nodes.agent_cache_mode, '')
455 COMMENT_COLUMN(nodes.last_agent_comm_time, '')
456
457 /*
458 ** Clusters information
459 */
460
461 CREATE TABLE clusters
462 (
463 id integer not null,
464 cluster_type integer not null,
465 zone_guid integer not null,
466 PRIMARY KEY(id)
467 ) TABLE_TYPE;
468
469 COMMENT_TABLE(clusters, '')
470 COMMENT_COLUMN(clusters.id, '')
471 COMMENT_COLUMN(clusters.cluster_type, '')
472 COMMENT_COLUMN(clusters.zone_guid, '')
473
474 /*
475 ** Cluster members
476 */
477
478 CREATE TABLE cluster_members
479 (
480 cluster_id integer not null,
481 node_id integer not null,
482 PRIMARY KEY(cluster_id,node_id)
483 ) TABLE_TYPE;
484
485 COMMENT_TABLE(cluster_members, '')
486 COMMENT_COLUMN(cluster_members.cluster_id, '')
487 COMMENT_COLUMN(cluster_members.node_id, '')
488
489 /*
490 ** Cluster interconnect subnets
491 */
492
493 CREATE TABLE cluster_sync_subnets
494 (
495 cluster_id integer not null,
496 subnet_addr varchar(48) not null,
497 subnet_mask integer not null,
498 PRIMARY KEY(cluster_id,subnet_addr)
499 ) TABLE_TYPE;
500
501 COMMENT_TABLE(cluster_sync_subnets, '')
502 COMMENT_COLUMN(cluster_sync_subnets.cluster_id, '')
503 COMMENT_COLUMN(cluster_sync_subnets.subnet_addr, '')
504 COMMENT_COLUMN(cluster_sync_subnets.subnet_mask, '')
505
506 /*
507 ** Cluster resources
508 */
509
510 CREATE TABLE cluster_resources
511 (
512 cluster_id integer not null,
513 resource_id integer not null,
514 resource_name varchar(255),
515 ip_addr varchar(48) not null,
516 current_owner integer not null,
517 PRIMARY KEY(cluster_id,resource_id)
518 ) TABLE_TYPE;
519
520 COMMENT_TABLE(cluster_resources, '')
521 COMMENT_COLUMN(cluster_resources.cluster_id, '')
522 COMMENT_COLUMN(cluster_resources.resource_id, '')
523 COMMENT_COLUMN(cluster_resources.resource_name, '')
524 COMMENT_COLUMN(cluster_resources.ip_addr, '')
525 COMMENT_COLUMN(cluster_resources.current_owner, '')
526
527 /*
528 ** Subnets
529 */
530 CREATE TABLE subnets
531 (
532 id integer not null,
533 ip_addr varchar(48) not null,
534 ip_netmask integer not null,
535 zone_guid integer not null,
536 synthetic_mask integer not null,
537 PRIMARY KEY(id)
538 ) TABLE_TYPE;
539
540 COMMENT_TABLE(subnets, '')
541
542 /*
543 ** Nodes' interfaces
544 */
545 CREATE TABLE interfaces
546 (
547 id integer not null,
548 node_id integer not null,
549 flags integer not null,
550 if_type integer not null,
551 if_index integer not null,
552 mtu integer not null,
553 speed SQL_INT64 not null,
554 bridge_port integer not null,
555 phy_slot integer not null,
556 phy_port integer not null,
557 peer_node_id integer not null,
558 peer_if_id integer not null,
559 peer_proto integer not null,
560 mac_addr varchar(12) not null,
561 required_polls integer not null,
562 admin_state integer not null,
563 oper_state integer not null,
564 dot1x_pae_state integer not null,
565 dot1x_backend_state integer not null,
566 description varchar(255) null,
567 alias varchar(255) null,
568 iftable_suffix varchar(127) null,
569 PRIMARY KEY(id)
570 ) TABLE_TYPE;
571
572 COMMENT_TABLE(interfaces, '')
573 COMMENT_COLUMN(interfaces.id, '')
574 COMMENT_COLUMN(interfaces.node_id, '')
575 COMMENT_COLUMN(interfaces.flags, '')
576 COMMENT_COLUMN(interfaces.if_type, '')
577 COMMENT_COLUMN(interfaces.if_index, '')
578 COMMENT_COLUMN(interfaces.mtu, '')
579 COMMENT_COLUMN(interfaces.speed, '')
580 COMMENT_COLUMN(interfaces.bridge_port, '')
581 COMMENT_COLUMN(interfaces.phy_slot, '')
582 COMMENT_COLUMN(interfaces.phy_port, '')
583 COMMENT_COLUMN(interfaces.peer_node_id, '')
584 COMMENT_COLUMN(interfaces.peer_if_id, '')
585 COMMENT_COLUMN(interfaces.peer_proto, '')
586 COMMENT_COLUMN(interfaces.mac_addr, '')
587 COMMENT_COLUMN(interfaces.required_polls, '')
588 COMMENT_COLUMN(interfaces.admin_state, '')
589 COMMENT_COLUMN(interfaces.oper_state, '')
590 COMMENT_COLUMN(interfaces.dot1x_pae_state, '')
591 COMMENT_COLUMN(interfaces.dot1x_backend_state, '')
592 COMMENT_COLUMN(interfaces.description, '')
593 COMMENT_COLUMN(interfaces.alias, '')
594 COMMENT_COLUMN(interfaces.iftable_suffix, '')
595
596 /*
597 ** Interface IP addresses
598 */
599 CREATE TABLE interface_address_list
600 (
601 iface_id integer not null,
602 ip_addr varchar(48) not null,
603 ip_netmask integer not null,
604 PRIMARY KEY(iface_id,ip_addr)
605 ) TABLE_TYPE;
606
607 COMMENT_TABLE(interface_address_list, '')
608 COMMENT_COLUMN(interface_address_list.iface_id, '')
609 COMMENT_COLUMN(interface_address_list.ip_addr, '')
610 COMMENT_COLUMN(interface_address_list.ip_netmask, '')
611
612 /*
613 ** Network services
614 */
615
616 CREATE TABLE network_services
617 (
618 id integer not null,
619 node_id integer not null,
620 service_type integer not null,
621 ip_bind_addr varchar(48) not null,
622 ip_proto integer not null,
623 ip_port integer not null,
624 check_request SQL_TEXT null,
625 check_responce SQL_TEXT null,
626 poller_node_id integer not null,
627 required_polls integer not null,
628 PRIMARY KEY(id)
629 ) TABLE_TYPE;
630
631 COMMENT_TABLE(network_services, '')
632 COMMENT_COLUMN(network_services.id, '')
633 COMMENT_COLUMN(network_services.node_id, '')
634 COMMENT_COLUMN(network_services.service_type, '')
635 COMMENT_COLUMN(network_services.ip_bind_addr, '')
636 COMMENT_COLUMN(network_services.ip_proto, '')
637 COMMENT_COLUMN(network_services.ip_port, '')
638 COMMENT_COLUMN(network_services.check_request, '')
639 COMMENT_COLUMN(network_services.check_responce, '')
640 COMMENT_COLUMN(network_services.poller_node_id, '')
641 COMMENT_COLUMN(network_services.required_polls, '')
642
643 /*
644 ** VPN connectors
645 */
646 CREATE TABLE vpn_connectors
647 (
648 id integer not null,
649 node_id integer not null,
650 peer_gateway integer not null,
651 PRIMARY KEY(id)
652 ) TABLE_TYPE;
653
654 COMMENT_TABLE(vpn_connectors, '')
655 COMMENT_COLUMN(vpn_connectors.id, '')
656 COMMENT_COLUMN(vpn_connectors.node_id, '')
657 COMMENT_COLUMN(vpn_connectors.peer_gateway, '')
658
659 /*
660 ** VPN connector networks
661 */
662 CREATE TABLE vpn_connector_networks
663 (
664 vpn_id integer not null,
665 network_type integer not null, // 0 == local, 1 == remote
666 ip_addr varchar(48) not null,
667 ip_netmask integer not null,
668 PRIMARY KEY(vpn_id,ip_addr)
669 ) TABLE_TYPE;
670
671 COMMENT_TABLE(vpn_connector_networks, '')
672 COMMENT_COLUMN(vpn_connector_networks.vpn_id, '')
673 COMMENT_COLUMN(vpn_connector_networks.network_type, '')
674 COMMENT_COLUMN(vpn_connector_networks.ip_addr, '')
675 COMMENT_COLUMN(vpn_connector_networks.ip_netmask, '')
676
677 /*
678 ** Container objects
679 */
680 CREATE TABLE object_containers
681 (
682 id integer not null,
683 object_class integer not null,
684 flags integer not null,
685 auto_bind_filter SQL_TEXT null,
686 PRIMARY KEY(id)
687 ) TABLE_TYPE;
688
689 COMMENT_TABLE(object_containers, '')
690 COMMENT_COLUMN(object_containers.id, '')
691 COMMENT_COLUMN(object_containers.object_class, '')
692 COMMENT_COLUMN(object_containers.flags, '')
693 COMMENT_COLUMN(object_containers.auto_bind_filter, '')
694
695 /*
696 ** Condition objects
697 */
698 CREATE TABLE conditions
699 (
700 id integer not null,
701 activation_event integer not null,
702 deactivation_event integer not null,
703 source_object integer not null,
704 active_status integer not null,
705 inactive_status integer not null,
706 script SQL_TEXT not null,
707 PRIMARY KEY(id)
708 ) TABLE_TYPE;
709
710 COMMENT_TABLE(conditions, '')
711 COMMENT_COLUMN(conditions.id, '')
712 COMMENT_COLUMN(conditions.activation_event, '')
713 COMMENT_COLUMN(conditions.deactivation_event, '')
714 COMMENT_COLUMN(conditions.source_object, '')
715 COMMENT_COLUMN(conditions.active_status, '')
716 COMMENT_COLUMN(conditions.inactive_status, '')
717 COMMENT_COLUMN(conditions.script, '')
718
719 /*
720 ** DCI to condition mapping
721 */
722 CREATE TABLE cond_dci_map
723 (
724 condition_id integer not null,
725 sequence_number integer not null,
726 dci_id integer not null,
727 node_id integer not null,
728 dci_func integer not null,
729 num_polls integer not null,
730 PRIMARY KEY(condition_id,sequence_number)
731 ) TABLE_TYPE;
732
733 COMMENT_TABLE(cond_dci_map, '')
734 COMMENT_COLUMN(cond_dci_map.condition_id, '')
735 COMMENT_COLUMN(cond_dci_map.sequence_number, '')
736 COMMENT_COLUMN(cond_dci_map.dci_id, '')
737 COMMENT_COLUMN(cond_dci_map.node_id, '')
738 COMMENT_COLUMN(cond_dci_map.dci_func, '')
739 COMMENT_COLUMN(cond_dci_map.num_polls, '')
740
741 /**
742 * Data collection templates
743 */
744 CREATE TABLE templates
745 (
746 id integer not null,
747 version integer not null,
748 flags integer not null,
749 apply_filter SQL_TEXT null,
750 PRIMARY KEY(id)
751 ) TABLE_TYPE;
752
753 COMMENT_TABLE(templates, '')
754 COMMENT_COLUMN(templates.id, '')
755 COMMENT_COLUMN(templates.version, '')
756 COMMENT_COLUMN(templates.flags, '')
757 COMMENT_COLUMN(templates.apply_filter, '')
758
759 /**
760 * Mapping hosts to templates
761 */
762 CREATE TABLE dct_node_map
763 (
764 template_id integer not null,
765 node_id integer not null,
766 PRIMARY KEY(template_id,node_id)
767 ) TABLE_TYPE;
768
769 COMMENT_TABLE(dct_node_map, '')
770 COMMENT_COLUMN(dct_node_map.template_id, '')
771 COMMENT_COLUMN(dct_node_map.node_id, '')
772
773 /**
774 * Nodes to subnets mapping
775 */
776 CREATE TABLE nsmap
777 (
778 subnet_id integer not null,
779 node_id integer not null,
780 PRIMARY KEY(subnet_id,node_id)
781 ) TABLE_TYPE;
782
783 COMMENT_TABLE(nsmap, '')
784 COMMENT_COLUMN(nsmap.subnet_id, '')
785 COMMENT_COLUMN(nsmap.node_id, '')
786
787 /**
788 * Container members
789 */
790 CREATE TABLE container_members
791 (
792 container_id integer not null,
793 object_id integer not null,
794 PRIMARY KEY(container_id,object_id)
795 ) TABLE_TYPE;
796
797 COMMENT_TABLE(container_members, '')
798 COMMENT_COLUMN(container_members.container_id, '')
799 COMMENT_COLUMN(container_members.object_id, '')
800
801 /**
802 * Objects' ACLs
803 */
804 CREATE TABLE acl
805 (
806 object_id integer not null,
807 user_id integer not null,
808 access_rights integer not null,
809 PRIMARY KEY(object_id,user_id)
810 ) TABLE_TYPE;
811
812 COMMENT_TABLE(acl, '')
813 COMMENT_COLUMN(acl.object_id, '')
814 COMMENT_COLUMN(acl.user_id, '')
815 COMMENT_COLUMN(acl.access_rights, '')
816
817 /**
818 * Trusted nodes - used for cross-node data collection
819 * Source object is an object providing data (it can be node or condition),
820 * and target node is a node owning DCI
821 */
822 CREATE TABLE trusted_nodes
823 (
824 source_object_id integer not null,
825 target_node_id integer not null,
826 PRIMARY KEY(source_object_id,target_node_id)
827 ) TABLE_TYPE;
828
829 COMMENT_TABLE(trusted_nodes, '')
830 COMMENT_COLUMN(trusted_nodes.source_object_id, '')
831 COMMENT_COLUMN(trusted_nodes.target_node_id, '')
832
833 /**
834 * Data collection items
835 *
836 * If node_id != 0, it's an item bound to node, and template_id points to
837 * the template used for creating this item. In this case, template_id = 0
838 * means that item was created manually.
839 * If node_id = 0, it's a template item, and template_id points to a template
840 * this item belongs to.
841 * If both node_id and template_id is 0, it's an error.
842 */
843 CREATE TABLE items
844 (
845 item_id integer not null,
846 node_id integer not null,
847 template_id integer not null,
848 template_item_id integer not null,
849 guid varchar(36) not null,
850 name varchar(1023) null,
851 description varchar(255) null,
852 flags integer not null,
853 source integer not null, // 0 for internal or 1 for native agent or 2 for SNMP
854 snmp_port integer not null,
855 datatype integer not null,
856 polling_interval integer not null,
857 retention_time integer not null,
858 status integer not null, // ACTIVE, DISABLED or NOT_SUPPORTED
859 snmp_raw_value_type integer not null,
860 delta_calculation integer not null,
861 transformation SQL_TEXT, // Transformation script
862 instance varchar(255) null, // Free form text which can be used in events
863 system_tag varchar(255) null, // System tag
864 resource_id integer not null, // associated cluster resource ID
865 proxy_node integer not null, // ID of proxy node (for SNMP and agent items)
866 base_units integer not null, // bytes, seconds, etc.
867 unit_multiplier integer not null, // kilo, mega, milli, etc.
868 custom_units_name varchar(63) null, // units name of base_units = CUSTOM
869 perftab_settings SQL_TEXT null, // Settings for displaying graph on performance tab
870 instd_method integer not null,
871 instd_data varchar(255) null,
872 instd_filter SQL_TEXT null,
873 samples integer not null,
874 comments SQL_TEXT null,
875 PRIMARY KEY(item_id)
876 ) TABLE_TYPE;
877
878 CREATE INDEX idx_items_node_id ON items(node_id);
879
880 COMMENT_TABLE(items, '')
881 COMMENT_COLUMN(items.item_id, '')
882 COMMENT_COLUMN(items.node_id, '')
883 COMMENT_COLUMN(items.template_id, '')
884 COMMENT_COLUMN(items.template_item_id, '')
885 COMMENT_COLUMN(items.guid, '')
886 COMMENT_COLUMN(items.name, '')
887 COMMENT_COLUMN(items.description, '')
888 COMMENT_COLUMN(items.flags, '')
889 COMMENT_COLUMN(items.source, '')
890 COMMENT_COLUMN(items.snmp_port, '')
891 COMMENT_COLUMN(items.datatype, '')
892 COMMENT_COLUMN(items.polling_interval, '')
893 COMMENT_COLUMN(items.retention_time, '')
894 COMMENT_COLUMN(items.status, '')
895 COMMENT_COLUMN(items.snmp_raw_value_type, '')
896 COMMENT_COLUMN(items.delta_calculation, '')
897 COMMENT_COLUMN(items.transformation, '')
898 COMMENT_COLUMN(items.instance, '')
899 COMMENT_COLUMN(items.system_tag, '')
900 COMMENT_COLUMN(items.resource_id, '')
901 COMMENT_COLUMN(items.proxy_node, '')
902 COMMENT_COLUMN(items.base_units, '')
903 COMMENT_COLUMN(items.unit_multiplier, '')
904 COMMENT_COLUMN(items.custom_units_name, '')
905 COMMENT_COLUMN(items.perftab_settings, '')
906 COMMENT_COLUMN(items.instd_method, '')
907 COMMENT_COLUMN(items.instd_data, '')
908 COMMENT_COLUMN(items.instd_filter, '')
909 COMMENT_COLUMN(items.samples, '')
910 COMMENT_COLUMN(items.comments, '')
911
912 /*
913 ** Data collection tables
914 */
915 CREATE TABLE dc_tables
916 (
917 item_id integer not null,
918 node_id integer not null,
919 template_id integer not null,
920 template_item_id integer not null,
921 guid varchar(36) not null,
922 name varchar(1023) null,
923 description varchar(255) null,
924 flags integer not null,
925 source integer not null, // 0 for internal or 1 for native agent or 2 for SNMP
926 snmp_port integer not null,
927 polling_interval integer not null,
928 retention_time integer not null,
929 status integer not null, // ACTIVE, DISABLED or NOT_SUPPORTED
930 system_tag varchar(255) null, // System tag
931 resource_id integer not null, // associated cluster resource ID
932 proxy_node integer not null, // ID of proxy node (for SNMP and agent items)
933 perftab_settings SQL_TEXT null, // Settings for displaying graph on performance tab
934 transformation_script SQL_TEXT null,
935 comments SQL_TEXT null,
936 PRIMARY KEY(item_id)
937 ) TABLE_TYPE;
938
939 CREATE INDEX idx_dc_tables_node_id ON dc_tables(node_id);
940
941 COMMENT_TABLE(dc_tables, '')
942 COMMENT_COLUMN(dc_tables.item_id, '')
943 COMMENT_COLUMN(dc_tables.node_id, '')
944 COMMENT_COLUMN(dc_tables.template_id, '')
945 COMMENT_COLUMN(dc_tables.template_item_id, '')
946 COMMENT_COLUMN(dc_tables.guid, '')
947 COMMENT_COLUMN(dc_tables.name, '')
948 COMMENT_COLUMN(dc_tables.description, '')
949 COMMENT_COLUMN(dc_tables.flags, '')
950 COMMENT_COLUMN(dc_tables.source, '')
951 COMMENT_COLUMN(dc_tables.snmp_port, '')
952 COMMENT_COLUMN(dc_tables.polling_interval, '')
953 COMMENT_COLUMN(dc_tables.retention_time, '')
954 COMMENT_COLUMN(dc_tables.status, '')
955 COMMENT_COLUMN(dc_tables.system_tag, '')
956 COMMENT_COLUMN(dc_tables.resource_id, '')
957 COMMENT_COLUMN(dc_tables.proxy_node, '')
958 COMMENT_COLUMN(dc_tables.perftab_settings, '')
959 COMMENT_COLUMN(dc_tables.transformation_script, '')
960 COMMENT_COLUMN(dc_tables.comments, '')
961
962 /*
963 ** Columns for data collection tables
964 */
965 CREATE TABLE dc_table_columns
966 (
967 table_id integer not null,
968 sequence_number integer not null,
969 column_name varchar(63) not null,
970 snmp_oid varchar(1023) null, // SNMP OID for this column, valid only for SNMP tables
971 flags integer not null,
972 display_name varchar(255) null,
973 PRIMARY KEY(table_id,column_name)
974 ) TABLE_TYPE;
975
976 COMMENT_TABLE(dc_table_columns, '')
977 COMMENT_COLUMN(dc_table_columns.table_id, '')
978 COMMENT_COLUMN(dc_table_columns.sequence_number, '')
979 COMMENT_COLUMN(dc_table_columns.column_name, '')
980 COMMENT_COLUMN(dc_table_columns.snmp_oid, '')
981 COMMENT_COLUMN(dc_table_columns.flags, '')
982 COMMENT_COLUMN(dc_table_columns.display_name, '')
983
984 /*
985 ** Column name dictionary
986 */
987 CREATE TABLE dct_column_names
988 (
989 column_id integer not null,
990 column_name varchar(63) not null,
991 PRIMARY KEY(column_id)
992 ) TABLE_TYPE;
993
994 COMMENT_TABLE(dct_column_names, '')
995 COMMENT_COLUMN(dct_column_names.column_id, '')
996 COMMENT_COLUMN(dct_column_names.column_name, '')
997
998 /*
999 ** Table thresholds
1000 */
1001 CREATE TABLE dct_thresholds
1002 (
1003 id integer not null,
1004 table_id integer not null,
1005 sequence_number integer not null,
1006 activation_event integer not null,
1007 deactivation_event integer not null,
1008 PRIMARY KEY(id)
1009 ) TABLE_TYPE;
1010
1011 COMMENT_TABLE(dct_thresholds, '')
1012 COMMENT_COLUMN(dct_thresholds.id, '')
1013 COMMENT_COLUMN(dct_thresholds.table_id, '')
1014 COMMENT_COLUMN(dct_thresholds.sequence_number, '')
1015 COMMENT_COLUMN(dct_thresholds.activation_event, '')
1016 COMMENT_COLUMN(dct_thresholds.deactivation_event, '')
1017
1018 /*
1019 ** Table threshold conditions
1020 */
1021 CREATE TABLE dct_threshold_conditions
1022 (
1023 threshold_id integer not null,
1024 group_id integer not null,
1025 sequence_number integer not null,
1026 column_name varchar(63) null,
1027 check_operation integer not null,
1028 check_value varchar(255) null,
1029 PRIMARY KEY(threshold_id,group_id,sequence_number)
1030 ) TABLE_TYPE;
1031
1032 COMMENT_TABLE(dct_threshold_conditions, '')
1033 COMMENT_COLUMN(dct_threshold_conditions.threshold_id, '')
1034 COMMENT_COLUMN(dct_threshold_conditions.group_id, '')
1035 COMMENT_COLUMN(dct_threshold_conditions.sequence_number, '')
1036 COMMENT_COLUMN(dct_threshold_conditions.column_name, '')
1037 COMMENT_COLUMN(dct_threshold_conditions.check_operation, '')
1038 COMMENT_COLUMN(dct_threshold_conditions.check_value, '')
1039
1040 /*
1041 ** Schedules for DCIs
1042 */
1043 CREATE TABLE dci_schedules
1044 (
1045 schedule_id integer not null,
1046 item_id integer not null,
1047 schedule varchar(255) null,
1048 PRIMARY KEY(item_id,schedule_id)
1049 ) TABLE_TYPE;
1050
1051 COMMENT_TABLE(dci_schedules, '')
1052 COMMENT_COLUMN(dci_schedules.schedule_id, '')
1053 COMMENT_COLUMN(dci_schedules.item_id, '')
1054 COMMENT_COLUMN(dci_schedules.schedule, '')
1055
1056 /*
1057 ** Latest raw values for all data collection items
1058 */
1059 CREATE TABLE raw_dci_values
1060 (
1061 item_id integer not null,
1062 raw_value varchar(255) null,
1063 transformed_value varchar(255) null,
1064 last_poll_time integer not null,
1065 PRIMARY KEY(item_id)
1066 ) TABLE_TYPE;
1067
1068 #if !defined(DB_ORACLE) && !defined(DB_DB2) && !defined(DB_POSTGRESQL)
1069 CREATE INDEX idx_raw_dci_values_item_id ON raw_dci_values(item_id);
1070 #endif
1071
1072 COMMENT_TABLE(raw_dci_values, '')
1073 COMMENT_COLUMN(raw_dci_values.item_id, '')
1074 COMMENT_COLUMN(raw_dci_values.raw_value, '')
1075 COMMENT_COLUMN(raw_dci_values.transformed_value, '')
1076 COMMENT_COLUMN(raw_dci_values.last_poll_time, '')
1077
1078 /*
1079 ** Events configuration
1080 */
1081 CREATE TABLE event_cfg
1082 (
1083 event_code integer not null,
1084 event_name varchar(63) not null, // Short event name
1085 guid varchar(36) not null,
1086 severity integer not null,
1087 flags integer not null,
1088 message varchar(2000) null, /* Message template */
1089 description SQL_TEXT null,
1090 PRIMARY KEY(event_code)
1091 ) TABLE_TYPE;
1092
1093 COMMENT_TABLE(event_cfg, 'Event templates')
1094 COMMENT_COLUMN(event_cfg.event_code, 'Event code (unique within system)')
1095 COMMENT_COLUMN(event_cfg.event_name, 'Event name')
1096 COMMENT_COLUMN(event_cfg.guid, 'Event template GUID')
1097 COMMENT_COLUMN(event_cfg.severity, 'Severity')
1098 COMMENT_COLUMN(event_cfg.flags, 'Flags')
1099 COMMENT_COLUMN(event_cfg.message, 'Message template')
1100 COMMENT_COLUMN(event_cfg.description, 'Event description')
1101
1102 /*
1103 ** Event log
1104 */
1105 CREATE TABLE event_log
1106 (
1107 event_id SQL_INT64 not null,
1108 event_code integer not null,
1109 event_timestamp integer not null,
1110 event_source integer not null, /* Source object ID */
1111 dci_id integer not null, /* ID of related DCI or 0 */
1112 event_severity integer not null,
1113 event_message varchar(2000) null,
1114 root_event_id SQL_INT64 not null, /* Non-zero if current event correlates to some other event */
1115 user_tag varchar(63) null,
1116 PRIMARY KEY(event_id)
1117 ) TABLE_TYPE;
1118
1119 CREATE INDEX idx_event_log_event_timestamp ON event_log(event_timestamp);
1120
1121 #if defined(DB_POSTGRESQL)
1122 CREATE INDEX idx_event_log_root_id ON event_log(root_event_id) WHERE root_event_id > 0;
1123 #elif defined(DB_ORACLE)
1124 CREATE OR REPLACE FUNCTION zero_to_null(id NUMBER)
1125 RETURN NUMBER
1126 DETERMINISTIC
1127 AS BEGIN
1128 IF id > 0 THEN
1129 RETURN id;
1130 ELSE
1131 RETURN NULL;
1132 END IF;
1133 END;
1134 /
1135 CREATE INDEX idx_event_log_root_id ON event_log(zero_to_null(root_event_id));
1136 #else
1137 CREATE INDEX idx_event_log_root_id ON event_log(root_event_id);
1138 #endif
1139
1140 COMMENT_TABLE(event_log, '')
1141 COMMENT_COLUMN(event_log.event_id, '')
1142 COMMENT_COLUMN(event_log.event_code, '')
1143 COMMENT_COLUMN(event_log.event_timestamp, '')
1144 COMMENT_COLUMN(event_log.event_source, '')
1145 COMMENT_COLUMN(event_log.dci_id, '')
1146 COMMENT_COLUMN(event_log.event_severity, '')
1147 COMMENT_COLUMN(event_log.event_message, '')
1148 COMMENT_COLUMN(event_log.root_event_id, '')
1149 COMMENT_COLUMN(event_log.user_tag, '')
1150
1151 /*
1152 ** Actions on events
1153 */
1154 CREATE TABLE actions
1155 (
1156 action_id integer not null,
1157 action_name varchar(63) not null,
1158 action_type integer not null,
1159 is_disabled integer not null,
1160 // Field "rcpt_addr" holds e-mail address for e-mail actions,
1161 // phone number for sms actions, and remote host address for
1162 // remote execution actions
1163 rcpt_addr varchar(255) null,
1164 email_subject varchar(255) null,
1165 // Field "action_data" holds message text for e-mail and sms actions,
1166 // command line for external command execution actions, or
1167 // action name with optional arguments for remote execution actions
1168 action_data SQL_TEXT null,
1169 PRIMARY KEY(action_id)
1170 ) TABLE_TYPE;
1171
1172 COMMENT_TABLE(actions, '')
1173 COMMENT_COLUMN(actions.action_id, '')
1174 COMMENT_COLUMN(actions.action_name, '')
1175 COMMENT_COLUMN(actions.action_type, '')
1176 COMMENT_COLUMN(actions.is_disabled, '')
1177 COMMENT_COLUMN(actions.rcpt_addr, '')
1178 COMMENT_COLUMN(actions.email_subject, '')
1179 COMMENT_COLUMN(actions.action_data, '')
1180
1181 /*
1182 ** Event groups
1183 */
1184 CREATE TABLE event_groups
1185 (
1186 id integer not null,
1187 name varchar(63) not null,
1188 description varchar(255) not null,
1189 range_start integer not null,
1190 range_end integer not null,
1191 PRIMARY KEY(id)
1192 ) TABLE_TYPE;
1193
1194 COMMENT_TABLE(event_groups, '')
1195 COMMENT_COLUMN(event_groups.id, '')
1196 COMMENT_COLUMN(event_groups.name, '')
1197 COMMENT_COLUMN(event_groups.description, '')
1198 COMMENT_COLUMN(event_groups.range_start, '')
1199 COMMENT_COLUMN(event_groups.range_end, '')
1200
1201 /*
1202 ** Event group members
1203 */
1204 CREATE TABLE event_group_members
1205 (
1206 group_id integer not null,
1207 event_code integer not null,
1208 PRIMARY KEY(group_id,event_code)
1209 ) TABLE_TYPE;
1210
1211 COMMENT_TABLE(event_group_members, '')
1212 COMMENT_COLUMN(event_group_members.group_id, '')
1213 COMMENT_COLUMN(event_group_members.event_code, '')
1214
1215 /*
1216 ** Event processing policy
1217 */
1218 CREATE TABLE event_policy
1219 (
1220 rule_id integer not null, // Rule number
1221 rule_guid varchar(36) not null,
1222 flags integer not null,
1223 comments SQL_TEXT null,
1224 script SQL_TEXT null,
1225 alarm_message varchar(2000) null,
1226 alarm_severity integer not null,
1227 alarm_key varchar(255) null, // Alarm key (used for auto termination)
1228 alarm_timeout integer not null, // Timeout before sending event
1229 alarm_timeout_event integer not null, // Event to be sent on timeout
1230 situation_id integer not null, // Situation to update
1231 situation_instance varchar(255) null,
1232 PRIMARY KEY(rule_id)
1233 ) TABLE_TYPE;
1234
1235 COMMENT_TABLE(event_policy, '')
1236 COMMENT_COLUMN(event_policy.rule_id, '')
1237 COMMENT_COLUMN(event_policy.rule_guid, '')
1238 COMMENT_COLUMN(event_policy.flags, '')
1239 COMMENT_COLUMN(event_policy.comments, '')
1240 COMMENT_COLUMN(event_policy.script, '')
1241 COMMENT_COLUMN(event_policy.alarm_message, '')
1242 COMMENT_COLUMN(event_policy.alarm_severity, '')
1243 COMMENT_COLUMN(event_policy.alarm_key, '')
1244 COMMENT_COLUMN(event_policy.alarm_timeout, '')
1245 COMMENT_COLUMN(event_policy.alarm_timeout_event, '')
1246 COMMENT_COLUMN(event_policy.situation_id, '')
1247 COMMENT_COLUMN(event_policy.situation_instance, '')
1248
1249 /**
1250 *
1251 */
1252 CREATE TABLE policy_source_list
1253 (
1254 rule_id integer not null,
1255 object_id integer not null,
1256 PRIMARY KEY(rule_id,object_id)
1257 ) TABLE_TYPE;
1258
1259 COMMENT_TABLE(policy_source_list, '')
1260 COMMENT_COLUMN(policy_source_list.rule_id, '')
1261 COMMENT_COLUMN(policy_source_list.object_id, '')
1262
1263 /**
1264 *
1265 */
1266 CREATE TABLE policy_event_list
1267 (
1268 rule_id integer not null,
1269 event_code integer not null,
1270 PRIMARY KEY(rule_id,event_code)
1271 ) TABLE_TYPE;
1272
1273 COMMENT_TABLE(policy_event_list, '')
1274 COMMENT_COLUMN(policy_event_list.rule_id, '')
1275 COMMENT_COLUMN(policy_event_list.event_code, '')
1276
1277 /**
1278 *
1279 */
1280 CREATE TABLE policy_action_list
1281 (
1282 rule_id integer not null,
1283 action_id integer not null,
1284 PRIMARY KEY(rule_id,action_id)
1285 ) TABLE_TYPE;
1286
1287 COMMENT_TABLE(policy_action_list, '')
1288 COMMENT_COLUMN(policy_action_list.rule_id, '')
1289 COMMENT_COLUMN(policy_action_list.action_id, '')
1290
1291 /**
1292 *
1293 */
1294 CREATE TABLE policy_time_range_list
1295 (
1296 rule_id integer not null,
1297 time_range_id integer not null,
1298 PRIMARY KEY(rule_id,time_range_id)
1299 ) TABLE_TYPE;
1300
1301 COMMENT_TABLE(policy_time_range_list, '')
1302 COMMENT_COLUMN(policy_time_range_list.rule_id, '')
1303 COMMENT_COLUMN(policy_time_range_list.time_range_id, '')
1304
1305 /**
1306 *
1307 */
1308 CREATE TABLE policy_situation_attr_list
1309 (
1310 rule_id integer not null,
1311 situation_id integer not null,
1312 attr_name varchar(255) not null,
1313 attr_value varchar(255) null,
1314 PRIMARY KEY(rule_id,situation_id,attr_name)
1315 ) TABLE_TYPE;
1316
1317 COMMENT_TABLE(policy_situation_attr_list, '')
1318 COMMENT_COLUMN(policy_situation_attr_list.rule_id, '')
1319 COMMENT_COLUMN(policy_situation_attr_list.situation_id, '')
1320 COMMENT_COLUMN(policy_situation_attr_list.attr_name, '')
1321 COMMENT_COLUMN(policy_situation_attr_list.attr_value, '')
1322
1323 /*
1324 ** Time range objects
1325 */
1326 CREATE TABLE time_ranges
1327 (
1328 time_range_id integer not null,
1329 wday_mask integer not null, // Bits 0 .. 6 for each day of week
1330 mday_mask integer not null, // Bits 0 .. 30 for each day of month
1331 month_mask integer not null, // Bits 0 .. 11 for each month
1332 time_range varchar(255) not null, // In format HHMMHHMM[,HHMMHHMM[,...]]
1333 PRIMARY KEY(time_range_id)
1334 ) TABLE_TYPE;
1335
1336 COMMENT_TABLE(time_ranges, '')
1337 COMMENT_COLUMN(time_ranges.time_range_id, '')
1338 COMMENT_COLUMN(time_ranges.wday_mask, '')
1339 COMMENT_COLUMN(time_ranges.mday_mask, '')
1340 COMMENT_COLUMN(time_ranges.month_mask, '')
1341 COMMENT_COLUMN(time_ranges.time_range, '')
1342
1343 /*
1344 ** Threshold checking rules
1345 */
1346 CREATE TABLE thresholds
1347 (
1348 threshold_id integer not null,
1349 item_id integer not null,
1350 sequence_number integer not null,
1351 fire_value varchar(255) null,
1352 rearm_value varchar(255) null,
1353 check_function integer not null,
1354 check_operation integer not null,
1355 sample_count integer not null,
1356 script SQL_TEXT null,
1357 event_code integer not null,
1358 rearm_event_code integer not null,
1359 repeat_interval integer not null,
1360 current_state integer not null,
1361 current_severity integer not null,
1362 match_count integer not null,
1363 last_event_timestamp integer not null,
1364 PRIMARY KEY(threshold_id)
1365 ) TABLE_TYPE;
1366
1367 CREATE INDEX idx_thresholds_item_id ON thresholds(item_id);
1368 CREATE INDEX idx_thresholds_sequence ON thresholds(sequence_number);
1369
1370 COMMENT_TABLE(thresholds, '')
1371 COMMENT_COLUMN(thresholds.threshold_id, '')
1372 COMMENT_COLUMN(thresholds.item_id, '')
1373 COMMENT_COLUMN(thresholds.sequence_number, '')
1374 COMMENT_COLUMN(thresholds.fire_value, '')
1375 COMMENT_COLUMN(thresholds.rearm_value, '')
1376 COMMENT_COLUMN(thresholds.check_function, '')
1377 COMMENT_COLUMN(thresholds.check_operation, '')
1378 COMMENT_COLUMN(thresholds.sample_count, '')
1379 COMMENT_COLUMN(thresholds.script, '')
1380 COMMENT_COLUMN(thresholds.event_code, '')
1381 COMMENT_COLUMN(thresholds.rearm_event_code, '')
1382 COMMENT_COLUMN(thresholds.repeat_interval, '')
1383 COMMENT_COLUMN(thresholds.current_state, '')
1384 COMMENT_COLUMN(thresholds.current_severity, '')
1385 COMMENT_COLUMN(thresholds.match_count, '')
1386 COMMENT_COLUMN(thresholds.last_event_timestamp, '')
1387
1388 /*
1389 ** Alarms
1390 */
1391 CREATE TABLE alarms
1392 (
1393 alarm_id integer not null, // Unique alarm identifier
1394 alarm_state integer not null,
1395 hd_state integer not null, // Help desk system state
1396 hd_ref varchar(63) null, // Help desk reference
1397 creation_time integer not null,
1398 last_change_time integer not null,
1399 source_object_id integer not null,
1400 source_event_code integer not null,
1401 source_event_id SQL_INT64 not null,
1402 dci_id integer not null,
1403 message varchar(2000) null,
1404 original_severity integer not null,
1405 current_severity integer not null,
1406 repeat_count integer not null,
1407 alarm_key varchar(255) null, // Alarm key (used for auto acknowlegment)
1408 ack_by integer not null, // ID of user who was acknowleged alarm
1409 resolved_by integer not null, // ID of user who was resolved alarm
1410 term_by integer not null, // ID of user who was terminated alarm
1411 timeout integer not null,
1412 timeout_event integer not null,
1413 ack_timeout integer not null,
1414 PRIMARY KEY(alarm_id)
1415 ) TABLE_TYPE;
1416
1417 COMMENT_TABLE(alarms, '')
1418 COMMENT_COLUMN(alarms.alarm_id, '')
1419 COMMENT_COLUMN(alarms.alarm_state, '')
1420 COMMENT_COLUMN(alarms.hd_state, '')
1421 COMMENT_COLUMN(alarms.hd_ref, '')
1422 COMMENT_COLUMN(alarms.creation_time, '')
1423 COMMENT_COLUMN(alarms.last_change_time, '')
1424 COMMENT_COLUMN(alarms.source_object_id, '')
1425 COMMENT_COLUMN(alarms.source_event_code, '')
1426 COMMENT_COLUMN(alarms.source_event_id, '')
1427 COMMENT_COLUMN(alarms.dci_id, '')
1428 COMMENT_COLUMN(alarms.message, '')
1429 COMMENT_COLUMN(alarms.original_severity, '')
1430 COMMENT_COLUMN(alarms.current_severity, '')
1431 COMMENT_COLUMN(alarms.repeat_count, '')
1432 COMMENT_COLUMN(alarms.alarm_key, '')
1433 COMMENT_COLUMN(alarms.ack_by, '')
1434 COMMENT_COLUMN(alarms.resolved_by, '')
1435 COMMENT_COLUMN(alarms.term_by, '')
1436 COMMENT_COLUMN(alarms.timeout, '')
1437 COMMENT_COLUMN(alarms.timeout_event, '')
1438 COMMENT_COLUMN(alarms.ack_timeout, '')
1439
1440 /*
1441 ** Alarm notes
1442 */
1443 CREATE TABLE alarm_notes
1444 (
1445 note_id integer not null,
1446 alarm_id integer not null,
1447 change_time integer not null,
1448 user_id integer not null, // Last edited by
1449 note_text SQL_TEXT null,
1450 PRIMARY KEY(note_id)
1451 ) TABLE_TYPE;
1452
1453 CREATE INDEX idx_alarm_notes_alarm_id ON alarm_notes(alarm_id);
1454
1455 COMMENT_TABLE(alarm_notes, '')
1456 COMMENT_COLUMN(alarm_notes.note_id, '')
1457 COMMENT_COLUMN(alarm_notes.alarm_id, '')
1458 COMMENT_COLUMN(alarm_notes.change_time, '')
1459 COMMENT_COLUMN(alarm_notes.user_id, '')
1460 COMMENT_COLUMN(alarm_notes.note_text, '')
1461
1462 /*
1463 ** Source events for alarms
1464 */
1465 CREATE TABLE alarm_events
1466 (
1467 alarm_id integer not null,
1468 event_id SQL_INT64 not null,
1469 event_code integer not null,
1470 event_name varchar(63) null,
1471 severity integer not null,
1472 source_object_id integer not null,
1473 event_timestamp integer not null,
1474 message varchar(2000) null,
1475 PRIMARY KEY(alarm_id,event_id)
1476 ) TABLE_TYPE;
1477
1478 CREATE INDEX idx_alarm_events_alarm_id ON alarm_events(alarm_id);
1479
1480 COMMENT_TABLE(alarm_events, '')
1481 COMMENT_COLUMN(alarm_events.alarm_id, '')
1482 COMMENT_COLUMN(alarm_events.event_id, '')
1483 COMMENT_COLUMN(alarm_events.event_code, '')
1484 COMMENT_COLUMN(alarm_events.event_name, '')
1485 COMMENT_COLUMN(alarm_events.severity, '')
1486 COMMENT_COLUMN(alarm_events.source_object_id, '')
1487 COMMENT_COLUMN(alarm_events.event_timestamp, '')
1488 COMMENT_COLUMN(alarm_events.message, '')
1489
1490 /*
1491 ** SNMP trap configuration
1492 */
1493
1494 CREATE TABLE snmp_trap_cfg
1495 (
1496 trap_id integer not null,
1497 snmp_oid varchar(255),
1498 event_code integer not null,
1499 user_tag varchar(63),
1500 description varchar(255),
1501 PRIMARY KEY(trap_id)
1502 ) TABLE_TYPE;
1503
1504 COMMENT_TABLE(snmp_trap_cfg, '')
1505 COMMENT_COLUMN(snmp_trap_cfg.trap_id, '')
1506 COMMENT_COLUMN(snmp_trap_cfg.snmp_oid, '')
1507 COMMENT_COLUMN(snmp_trap_cfg.event_code, '')
1508 COMMENT_COLUMN(snmp_trap_cfg.user_tag, '')
1509 COMMENT_COLUMN(snmp_trap_cfg.description, '')
1510
1511 /*
1512 ** SNMP trap parameters mapping
1513 */
1514 CREATE TABLE snmp_trap_pmap
1515 (
1516 trap_id integer not null,
1517 parameter integer not null,
1518 flags integer not null,
1519 snmp_oid varchar(255) null,
1520 description varchar(255) null,
1521 PRIMARY KEY(trap_id,parameter)
1522 ) TABLE_TYPE;
1523
1524 COMMENT_TABLE(snmp_trap_pmap, '')
1525 COMMENT_COLUMN(snmp_trap_pmap.trap_id, '')
1526 COMMENT_COLUMN(snmp_trap_pmap.parameter, '')
1527 COMMENT_COLUMN(snmp_trap_pmap.flags, '')
1528 COMMENT_COLUMN(snmp_trap_pmap.snmp_oid, '')
1529 COMMENT_COLUMN(snmp_trap_pmap.description, '')
1530
1531 /*
1532 ** Agent packages
1533 */
1534 CREATE TABLE agent_pkg
1535 (
1536 pkg_id integer not null,
1537 pkg_name varchar(63),
1538 version varchar(31),
1539 platform varchar(63),
1540 pkg_file varchar(255),
1541 description varchar(255),
1542 PRIMARY KEY(pkg_id)
1543 ) TABLE_TYPE;
1544
1545 COMMENT_TABLE(agent_pkg, '')
1546 COMMENT_COLUMN(agent_pkg.pkg_id, '')
1547 COMMENT_COLUMN(agent_pkg.pkg_name, '')
1548 COMMENT_COLUMN(agent_pkg.version, '')
1549 COMMENT_COLUMN(agent_pkg.platform, '')
1550 COMMENT_COLUMN(agent_pkg.pkg_file, '')
1551 COMMENT_COLUMN(agent_pkg.description, '')
1552
1553 /*
1554 ** Object tools
1555 */
1556 CREATE TABLE object_tools
1557 (
1558 tool_id integer not null,
1559 guid varchar(36) not null,
1560 tool_name varchar(255) null,
1561 tool_type integer not null,
1562 tool_data SQL_TEXT null,
1563 description varchar(255) null,
1564 flags integer not null,
1565 tool_filter SQL_TEXT null,
1566 confirmation_text varchar(255) null,
1567 command_name varchar(255) null,
1568 command_short_name varchar(31) null,
1569 icon SQL_TEXT null,
1570 PRIMARY KEY(tool_id)
1571 ) TABLE_TYPE;
1572
1573 COMMENT_TABLE(object_tools, '')
1574 COMMENT_COLUMN(object_tools.tool_id, '')
1575 COMMENT_COLUMN(object_tools.guid, '')
1576 COMMENT_COLUMN(object_tools.tool_name, '')
1577 COMMENT_COLUMN(object_tools.tool_type, '')
1578 COMMENT_COLUMN(object_tools.tool_data, '')
1579 COMMENT_COLUMN(object_tools.description, '')
1580 COMMENT_COLUMN(object_tools.flags, '')
1581 COMMENT_COLUMN(object_tools.tool_filter, '')
1582 COMMENT_COLUMN(object_tools.confirmation_text, '')
1583 COMMENT_COLUMN(object_tools.command_name, '')
1584 COMMENT_COLUMN(object_tools.command_short_name, '')
1585 COMMENT_COLUMN(object_tools.icon, '')
1586
1587 /*
1588 ** Access list for object tools
1589 */
1590 CREATE TABLE object_tools_acl
1591 (
1592 tool_id integer not null,
1593 user_id integer not null,
1594 PRIMARY KEY(tool_id,user_id)
1595 ) TABLE_TYPE;
1596
1597 COMMENT_TABLE(object_tools_acl, '')
1598 COMMENT_COLUMN(object_tools_acl.tool_id, '')
1599 COMMENT_COLUMN(object_tools_acl.user_id, '')
1600
1601 /*
1602 ** Configuration of columns for SNMP_TABLE and AGENT_TABLE type of object tools
1603 */
1604 CREATE TABLE object_tools_table_columns
1605 (
1606 tool_id integer not null,
1607 col_number integer not null,
1608 col_name varchar(255) null,
1609 col_oid varchar(255) null,
1610 col_format integer, // Column format (integer, string, etc.)
1611 col_substr integer, // Number of matching substring in regexp
1612 PRIMARY KEY(tool_id,col_number)
1613 ) TABLE_TYPE;
1614
1615 COMMENT_TABLE(object_tools_table_columns, '')
1616 COMMENT_COLUMN(object_tools_table_columns.tool_id, '')
1617 COMMENT_COLUMN(object_tools_table_columns.col_number, '')
1618 COMMENT_COLUMN(object_tools_table_columns.col_name, '')
1619 COMMENT_COLUMN(object_tools_table_columns.col_oid, '')
1620 COMMENT_COLUMN(object_tools_table_columns.col_format, '')
1621 COMMENT_COLUMN(object_tools_table_columns.col_substr, '')
1622
1623 /**
1624 * Input fields for object tools
1625 */
1626 CREATE TABLE object_tools_input_fields
1627 (
1628 tool_id integer not null,
1629 name varchar(31) not null,
1630 input_type char(1) not null,
1631 display_name varchar(127) null,
1632 sequence_num integer not null,
1633 config SQL_TEXT null,
1634 PRIMARY KEY(tool_id,name)
1635 ) TABLE_TYPE;
1636
1637 COMMENT_TABLE(object_tools_input_fields, '')
1638 COMMENT_COLUMN(object_tools_input_fields.tool_id, '')
1639 COMMENT_COLUMN(object_tools_input_fields.name, '')
1640 COMMENT_COLUMN(object_tools_input_fields.input_type, '')
1641 COMMENT_COLUMN(object_tools_input_fields.display_name, '')
1642 COMMENT_COLUMN(object_tools_input_fields.sequence_num, '')
1643 COMMENT_COLUMN(object_tools_input_fields.config, '')
1644
1645 /*
1646 ** Stored syslog messages
1647 */
1648 CREATE TABLE syslog
1649 (
1650 msg_id SQL_INT64 not null,
1651 msg_timestamp integer not null,
1652 facility integer not null,
1653 severity integer not null,
1654 source_object_id integer not null,
1655 hostname varchar(127) null,
1656 msg_tag varchar(32) null,
1657 msg_text SQL_TEXT null,
1658 PRIMARY KEY(msg_id)
1659 ) TABLE_TYPE;
1660
1661 CREATE INDEX idx_syslog_msg_timestamp ON syslog(msg_timestamp);
1662
1663 COMMENT_TABLE(syslog, '')
1664 COMMENT_COLUMN(syslog.msg_id, '')
1665 COMMENT_COLUMN(syslog.msg_timestamp, '')
1666 COMMENT_COLUMN(syslog.facility, '')
1667 COMMENT_COLUMN(syslog.severity, '')
1668 COMMENT_COLUMN(syslog.source_object_id, '')
1669 COMMENT_COLUMN(syslog.hostname, '')
1670 COMMENT_COLUMN(syslog.msg_tag, '')
1671 COMMENT_COLUMN(syslog.msg_text, '')
1672
1673 /*
1674 ** Script library
1675 */
1676 CREATE TABLE script_library
1677 (
1678 script_id integer not null,
1679 script_name varchar(255) not null,
1680 script_code SQL_TEXT null,
1681 PRIMARY KEY(script_id)
1682 ) TABLE_TYPE;
1683
1684 COMMENT_TABLE(script_library, '')
1685 COMMENT_COLUMN(script_library.script_id, '')
1686 COMMENT_COLUMN(script_library.script_name, '')
1687 COMMENT_COLUMN(script_library.script_code, '')
1688
1689 /*
1690 ** Extended SNMP trap log
1691 */
1692
1693 CREATE TABLE snmp_trap_log
1694 (
1695 trap_id SQL_INT64 not null,
1696 trap_timestamp integer not null,
1697 ip_addr varchar(48) not null,
1698 object_id integer not null,
1699 trap_oid varchar(255) not null,
1700 trap_varlist SQL_TEXT null,
1701 PRIMARY KEY(trap_id)
1702 ) TABLE_TYPE;
1703
1704 CREATE INDEX idx_snmp_trap_log_tt ON snmp_trap_log(trap_timestamp);
1705
1706 COMMENT_TABLE(snmp_trap_log, '')
1707 COMMENT_COLUMN(snmp_trap_log.trap_id, '')
1708 COMMENT_COLUMN(snmp_trap_log.trap_timestamp, '')
1709 COMMENT_COLUMN(snmp_trap_log.ip_addr, '')
1710 COMMENT_COLUMN(snmp_trap_log.object_id, '')
1711 COMMENT_COLUMN(snmp_trap_log.trap_oid, '')
1712 COMMENT_COLUMN(snmp_trap_log.trap_varlist, '')
1713
1714 /*
1715 ** Agent configurations
1716 */
1717 CREATE TABLE agent_configs
1718 (
1719 config_id integer not null,
1720 config_name varchar(255) not null,
1721 config_file SQL_TEXT not null,
1722 config_filter SQL_TEXT not null,
1723 sequence_number integer not null,
1724 PRIMARY KEY(config_id)
1725 ) TABLE_TYPE;
1726
1727 COMMENT_TABLE(agent_configs, '')
1728 COMMENT_COLUMN(agent_configs.config_id, '')
1729 COMMENT_COLUMN(agent_configs.config_name, '')
1730 COMMENT_COLUMN(agent_configs.config_file, '')
1731 COMMENT_COLUMN(agent_configs.config_filter, '')
1732 COMMENT_COLUMN(agent_configs.sequence_number, '')
1733
1734 /*
1735 ** Address lists
1736 */
1737 CREATE TABLE address_lists
1738 (
1739 list_type integer not null, // discovery filter, etc.
1740 community_id integer not null, // community id for snmp community addr list, otherwise 0
1741 addr_type integer not null, // 0 - addr/mask, 1 - address range
1742 addr1 varchar(48) not null,
1743 addr2 varchar(48) not null,
1744 PRIMARY KEY(list_type,community_id,addr_type,addr1,addr2)
1745 ) TABLE_TYPE;
1746
1747 CREATE INDEX idx_address_lists_list_type ON address_lists(list_type);
1748
1749 COMMENT_TABLE(address_lists, '')
1750 COMMENT_COLUMN(address_lists.list_type, '')
1751 COMMENT_COLUMN(address_lists.community_id, '')
1752 COMMENT_COLUMN(address_lists.addr_type, '')
1753 COMMENT_COLUMN(address_lists.addr1, '')
1754 COMMENT_COLUMN(address_lists.addr2, '')
1755
1756 /*
1757 ** Graphs
1758 */
1759 CREATE TABLE graphs
1760 (
1761 graph_id integer not null,
1762 owner_id integer not null,
1763 flags integer not null,
1764 name varchar(255) not null,
1765 config SQL_TEXT not null,
1766 filters SQL_TEXT not null,
1767 PRIMARY KEY(graph_id)
1768 ) TABLE_TYPE;
1769
1770 COMMENT_TABLE(graphs, '')
1771 COMMENT_COLUMN(graphs.graph_id, '')
1772 COMMENT_COLUMN(graphs.owner_id, '')
1773 COMMENT_COLUMN(graphs.flags, '')
1774 COMMENT_COLUMN(graphs.name, '')
1775 COMMENT_COLUMN(graphs.config, '')
1776 COMMENT_COLUMN(graphs.filters, '')
1777
1778 /*
1779 ** Graph access lists
1780 */
1781 CREATE TABLE graph_acl
1782 (
1783 graph_id integer not null,
1784 user_id integer not null,
1785 user_rights integer not null,
1786 PRIMARY KEY(graph_id,user_id)
1787 ) TABLE_TYPE;
1788
1789 COMMENT_TABLE(graph_acl, '')
1790 COMMENT_COLUMN(graph_acl.graph_id, '')
1791 COMMENT_COLUMN(graph_acl.user_id, '')
1792 COMMENT_COLUMN(graph_acl.user_rights, '')
1793
1794 /*
1795 ** Certificates
1796 */
1797
1798 CREATE TABLE certificates
1799 (
1800 cert_id integer not null,
1801 cert_type integer not null,
1802 cert_data SQL_TEXT not null, // Certificate in PEM format
1803 subject SQL_TEXT not null,
1804 comments SQL_TEXT not null,
1805 PRIMARY KEY(cert_id)
1806 ) TABLE_TYPE;
1807
1808 COMMENT_TABLE(certificates, '')
1809 COMMENT_COLUMN(certificates.cert_id, '')
1810 COMMENT_COLUMN(certificates.cert_type, '')
1811 COMMENT_COLUMN(certificates.cert_data, '')
1812 COMMENT_COLUMN(certificates.subject, '')
1813 COMMENT_COLUMN(certificates.comments, '')
1814
1815 /*
1816 ** Audit log
1817 */
1818 CREATE TABLE audit_log
1819 (
1820 record_id integer not null,
1821 timestamp integer not null,
1822 subsystem varchar(32) not null,
1823 success integer not null,
1824 user_id integer not null, // 0x7FFFFFFF for system
1825 workstation varchar(63) not null,
1826 session_id integer not null,
1827 object_id integer not null,
1828 message SQL_TEXT null,
1829 PRIMARY KEY(record_id)
1830 ) TABLE_TYPE;
1831
1832 COMMENT_TABLE(audit_log, '')
1833 COMMENT_COLUMN(audit_log.record_id, '')
1834 COMMENT_COLUMN(audit_log.timestamp, '')
1835 COMMENT_COLUMN(audit_log.subsystem, '')
1836 COMMENT_COLUMN(audit_log.success, '')
1837 COMMENT_COLUMN(audit_log.user_id, '')
1838 COMMENT_COLUMN(audit_log.workstation, '')
1839 COMMENT_COLUMN(audit_log.session_id, '')
1840 COMMENT_COLUMN(audit_log.object_id, '')
1841 COMMENT_COLUMN(audit_log.message, '')
1842
1843 /*
1844 ** Situations
1845 */
1846 CREATE TABLE situations
1847 (
1848 id integer not null,
1849 name varchar(127) not null,
1850 comments SQL_TEXT not null,
1851 PRIMARY KEY(id)
1852 ) TABLE_TYPE;
1853
1854 COMMENT_TABLE(situations, '')
1855 COMMENT_COLUMN(situations.id, '')
1856 COMMENT_COLUMN(situations.name, '')
1857 COMMENT_COLUMN(situations.comments, '')
1858
1859 /*
1860 ** List of possible community strings
1861 */
1862 CREATE TABLE snmp_communities
1863 (
1864 id integer not null,
1865 community varchar(255) null,
1866 PRIMARY KEY(id)
1867 ) TABLE_TYPE;
1868
1869 COMMENT_TABLE(snmp_communities, '')
1870 COMMENT_COLUMN(snmp_communities.id, '')
1871 COMMENT_COLUMN(snmp_communities.community, '')
1872
1873 /*
1874 ** Agent policies - common attributes
1875 */
1876 CREATE TABLE ap_common
1877 (
1878 id integer not null,
1879 policy_type integer not null,
1880 version integer not null,
1881 PRIMARY KEY(id)
1882 ) TABLE_TYPE;
1883
1884 COMMENT_TABLE(ap_common, 'Agent policies common attributes')
1885 COMMENT_COLUMN(ap_common.id, 'Unique policy identifier')
1886 COMMENT_COLUMN(ap_common.policy_type, 'Policy type')
1887 COMMENT_COLUMN(ap_common.version, 'Policy version')
1888
1889 /*
1890 ** Agent policies - node binding
1891 */
1892 CREATE TABLE ap_bindings
1893 (
1894 policy_id integer not null,
1895 node_id integer not null,
1896 PRIMARY KEY(policy_id,node_id)
1897 ) TABLE_TYPE;
1898
1899 COMMENT_TABLE(ap_bindings, 'Agent policies to node binding')
1900 COMMENT_COLUMN(ap_bindings.policy_id, 'Unique policy identifier')
1901 COMMENT_COLUMN(ap_bindings.node_id, 'Unique node identifier')
1902
1903 /*
1904 ** Agent policies - configuration files
1905 */
1906 CREATE TABLE ap_config_files
1907 (
1908 policy_id integer not null,
1909 file_content SQL_TEXT null,
1910 PRIMARY KEY(policy_id)
1911 ) TABLE_TYPE;
1912
1913 COMMENT_TABLE(ap_config_files, 'Agent policies configuration files')
1914 COMMENT_COLUMN(ap_config_files.policy_id, 'Unique policy identifier')
1915 COMMENT_COLUMN(ap_config_files.file_content, 'Policy file content')
1916
1917 /**
1918 ** Agent policies - log parser files
1919 */
1920 CREATE TABLE ap_log_parser
1921 (
1922 policy_id integer not null,
1923 file_content SQL_TEXT null,
1924 PRIMARY KEY(policy_id)
1925 ) TABLE_TYPE;
1926
1927 COMMENT_TABLE(ap_log_parser, 'Agent policies log parser files')
1928 COMMENT_COLUMN(ap_log_parser.policy_id, 'Unique policy identifier')
1929 COMMENT_COLUMN(ap_log_parser.file_content, 'Log parser policy file content')
1930
1931 /*
1932 ** Default SNMP v3 USM credentials
1933 */
1934 CREATE TABLE usm_credentials
1935 (
1936 id integer not null,
1937 user_name varchar(255) not null,
1938 auth_method integer not null,
1939 priv_method integer not null,
1940 auth_password varchar(255),
1941 priv_password varchar(255),
1942 PRIMARY KEY(id)
1943 ) TABLE_TYPE;
1944
1945 COMMENT_TABLE(usm_credentials, 'Default SNMP v3 USM credentials')
1946 COMMENT_COLUMN(usm_credentials.id, 'SNMP v3 USM credential unique identifier')
1947 COMMENT_COLUMN(usm_credentials.user_name, 'SNMP v3 USM username')
1948 COMMENT_COLUMN(usm_credentials.auth_method, 'SNMP v3 USM authentication method')
1949 COMMENT_COLUMN(usm_credentials.priv_method, 'SNMP v3 USM encryption method')
1950 COMMENT_COLUMN(usm_credentials.auth_password, 'SNMP v3 USM authentication password')
1951 COMMENT_COLUMN(usm_credentials.priv_password, 'SNMP v3 USM encryption password')
1952
1953 /*
1954 ** Network maps
1955 */
1956 CREATE TABLE network_maps
1957 (
1958 id integer not null,
1959 map_type integer not null,
1960 layout integer not null,
1961 seed integer not null,
1962 radius integer not null,
1963 background varchar(36) null,
1964 bg_latitude varchar(20) null,
1965 bg_longitude varchar(20) null,
1966 bg_zoom integer null,
1967 flags integer not null,
1968 bg_color integer not null,
1969 link_color integer not null,
1970 link_routing integer not null,
1971 object_display_mode integer not null,
1972 filter SQL_TEXT null,
1973 PRIMARY KEY(id)
1974 ) TABLE_TYPE;
1975
1976 COMMENT_TABLE(network_maps, '')
1977 COMMENT_COLUMN(network_maps.id, '')
1978 COMMENT_COLUMN(network_maps.map_type, '')
1979 COMMENT_COLUMN(network_maps.layout, '')
1980 COMMENT_COLUMN(network_maps.seed, '')
1981 COMMENT_COLUMN(network_maps.radius, '')
1982 COMMENT_COLUMN(network_maps.background, '')
1983 COMMENT_COLUMN(network_maps.bg_latitude, '')
1984 COMMENT_COLUMN(network_maps.bg_longitude, '')
1985 COMMENT_COLUMN(network_maps.bg_zoom, '')
1986 COMMENT_COLUMN(network_maps.flags, '')
1987 COMMENT_COLUMN(network_maps.bg_color, '')
1988 COMMENT_COLUMN(network_maps.link_color, '')
1989 COMMENT_COLUMN(network_maps.link_routing, '')
1990 COMMENT_COLUMN(network_maps.object_display_mode, '')
1991 COMMENT_COLUMN(network_maps.filter, '')
1992
1993 /**
1994 * Elements of network maps
1995 */
1996 CREATE TABLE network_map_elements
1997 (
1998 map_id integer not null,
1999 element_id integer not null,
2000 element_type integer not null,
2001 element_data SQL_TEXT not null,
2002 flags integer not null,
2003 PRIMARY KEY(map_id,element_id)
2004 ) TABLE_TYPE;
2005
2006 COMMENT_TABLE(network_map_elements, '')
2007 COMMENT_COLUMN(network_map_elements.map_id, '')
2008 COMMENT_COLUMN(network_map_elements.element_id, '')
2009 COMMENT_COLUMN(network_map_elements.element_type, '')
2010 COMMENT_COLUMN(network_map_elements.element_data, '')
2011 COMMENT_COLUMN(network_map_elements.flags, '')
2012
2013 /**
2014 * Links on network maps
2015 */
2016 CREATE TABLE network_map_links
2017 (
2018 map_id integer not null,
2019 element1 integer not null,
2020 element2 integer not null,
2021 link_type integer not null,
2022 link_name varchar(255) null,
2023 connector_name1 varchar(255) null,
2024 connector_name2 varchar(255) null,
2025 element_data SQL_TEXT null,
2026 flags integer not null
2027 ) TABLE_TYPE;
2028
2029 CREATE INDEX idx_network_map_links_map_id ON network_map_links(map_id);
2030
2031 COMMENT_TABLE(network_map_links, '')
2032 COMMENT_COLUMN(network_map_links.map_id, '')
2033 COMMENT_COLUMN(network_map_links.element1, '')
2034 COMMENT_COLUMN(network_map_links.element2, '')
2035 COMMENT_COLUMN(network_map_links.link_type, '')
2036 COMMENT_COLUMN(network_map_links.link_name, '')
2037 COMMENT_COLUMN(network_map_links.connector_name1, '')
2038 COMMENT_COLUMN(network_map_links.connector_name2, '')
2039 COMMENT_COLUMN(network_map_links.element_data, '')
2040 COMMENT_COLUMN(network_map_links.flags, '')
2041
2042 /**
2043 * Image Library
2044 */
2045 CREATE TABLE images
2046 (
2047 guid varchar(36) not null,
2048 name varchar(63) not null,
2049 category varchar(63) not null,
2050 mimetype varchar(32) not null,
2051 protected integer default 0,
2052 PRIMARY KEY(guid),
2053 UNIQUE(name, category)
2054 ) TABLE_TYPE;
2055
2056 COMMENT_TABLE(images, '')
2057 COMMENT_COLUMN(images.guid, '')
2058 COMMENT_COLUMN(images.name, '')
2059 COMMENT_COLUMN(images.category, '')
2060 COMMENT_COLUMN(images.mimetype, '')
2061 COMMENT_COLUMN(images.protected, '')
2062
2063 /**
2064 * Dashboards
2065 */
2066 CREATE TABLE dashboards
2067 (
2068 id integer not null,
2069 num_columns integer not null,
2070 options integer not null,
2071 PRIMARY KEY(id)
2072 ) TABLE_TYPE;
2073
2074 COMMENT_TABLE(dashboards, '')
2075 COMMENT_COLUMN(dashboards.id, '')
2076 COMMENT_COLUMN(dashboards.num_columns, '')
2077 COMMENT_COLUMN(dashboards.options, '')
2078
2079 /**
2080 * Dashboard elements
2081 */
2082 CREATE TABLE dashboard_elements
2083 (
2084 dashboard_id integer not null,
2085 element_id integer not null,
2086 element_type integer not null,
2087 element_data SQL_TEXT null,
2088 layout_data SQL_TEXT null,
2089 PRIMARY KEY(dashboard_id,element_id)
2090 ) TABLE_TYPE;
2091
2092 COMMENT_TABLE(dashboard_elements, '')
2093 COMMENT_COLUMN(dashboard_elements.dashboard_id, '')
2094 COMMENT_COLUMN(dashboard_elements.element_id, '')
2095 COMMENT_COLUMN(dashboard_elements.element_type, '')
2096 COMMENT_COLUMN(dashboard_elements.element_data, '')
2097 COMMENT_COLUMN(dashboard_elements.layout_data, '')
2098
2099 /**
2100 * Associations between dashboards and other objects
2101 */
2102 CREATE TABLE dashboard_associations
2103 (
2104 object_id integer not null,
2105 dashboard_id integer not null,
2106 PRIMARY KEY(object_id,dashboard_id)
2107 ) TABLE_TYPE;
2108
2109 COMMENT_TABLE(dashboard_associations, '')
2110 COMMENT_COLUMN(dashboard_associations.object_id, '')
2111 COMMENT_COLUMN(dashboard_associations.dashboard_id, '')
2112
2113 /**
2114 * SLA business services
2115 */
2116 CREATE TABLE business_services
2117 (
2118 service_id integer not null,
2119 PRIMARY KEY(service_id)
2120 ) TABLE_TYPE;
2121
2122 COMMENT_TABLE(business_services, '')
2123 COMMENT_COLUMN(business_services.service_id, '')
2124
2125 /**
2126 * SLA service checks
2127 */
2128 CREATE TABLE slm_checks
2129 (
2130 id integer not null,
2131 type integer not null, // 1 - threshold, 2 - script
2132 content SQL_TEXT null, // if type == 2
2133 threshold_id integer not null, // if type == 1; refers to thresholds.id
2134 reason varchar(255) null,
2135 is_template integer not null,
2136 template_id integer not null, // template check ID
2137 current_ticket integer not null,
2138 PRIMARY KEY(id)
2139 ) TABLE_TYPE;
2140
2141 COMMENT_TABLE(slm_checks, '')
2142 COMMENT_COLUMN(slm_checks.id, '')
2143 COMMENT_COLUMN(slm_checks.type, '')
2144 COMMENT_COLUMN(slm_checks.content, '')
2145 COMMENT_COLUMN(slm_checks.threshold_id, '')
2146 COMMENT_COLUMN(slm_checks.reason, '')
2147 COMMENT_COLUMN(slm_checks.is_template, '')
2148 COMMENT_COLUMN(slm_checks.template_id, '')
2149 COMMENT_COLUMN(slm_checks.current_ticket, '')
2150
2151 /*
2152 ** SLA node links
2153 */
2154 CREATE TABLE node_links
2155 (
2156 nodelink_id integer not null,
2157 node_id integer not null, // refers to node.id
2158 PRIMARY KEY(nodelink_id)
2159 ) TABLE_TYPE;
2160
2161 COMMENT_TABLE(node_links, '')
2162 COMMENT_COLUMN(node_links.nodelink_id, '')
2163 COMMENT_COLUMN(node_links.node_id, '')
2164
2165 /*
2166 ** SLA - agreements
2167 */
2168 CREATE TABLE slm_agreements
2169 (
2170 agreement_id integer not null,
2171 service_id integer not null,
2172 org_id integer not null,
2173 uptime varchar(63) not null, // required uptime, numeric(10,2) ?
2174 period integer not null, // 1 - day, 2 - month
2175 start_date integer not null, // date in YYYYMMDD format
2176 notes varchar(255),
2177 PRIMARY KEY(agreement_id)
2178 ) TABLE_TYPE;
2179
2180 COMMENT_TABLE(slm_agreements, '')
2181 COMMENT_COLUMN(slm_agreements.agreement_id, '')
2182 COMMENT_COLUMN(slm_agreements.service_id, '')
2183 COMMENT_COLUMN(slm_agreements.org_id, '')
2184 COMMENT_COLUMN(slm_agreements.uptime, '')
2185 COMMENT_COLUMN(slm_agreements.period, '')
2186 COMMENT_COLUMN(slm_agreements.start_date, '')
2187 COMMENT_COLUMN(slm_agreements.notes, '')
2188
2189 /*
2190 ** SLA tickets
2191 */
2192
2193 CREATE TABLE slm_tickets
2194 (
2195 ticket_id integer not null,
2196 service_id integer not null,
2197 check_id integer not null,
2198 create_timestamp integer not null,
2199 close_timestamp integer not null,
2200 reason varchar(255) null,
2201 PRIMARY KEY(ticket_id)
2202 ) TABLE_TYPE;
2203
2204 COMMENT_TABLE(slm_tickets, '')
2205 COMMENT_COLUMN(slm_tickets.ticket_id, '')
2206 COMMENT_COLUMN(slm_tickets.service_id, '')
2207 COMMENT_COLUMN(slm_tickets.check_id, '')
2208 COMMENT_COLUMN(slm_tickets.create_timestamp, '')
2209 COMMENT_COLUMN(slm_tickets.close_timestamp, '')
2210 COMMENT_COLUMN(slm_tickets.reason, '')
2211
2212 /*
2213 ** SLA service change log
2214 */
2215
2216 CREATE TABLE slm_service_history
2217 (
2218 record_id integer not null,
2219 service_id integer not null,
2220 change_timestamp integer not null,
2221 new_status integer not null,
2222 PRIMARY KEY(record_id)
2223 ) TABLE_TYPE;
2224
2225 COMMENT_TABLE(slm_service_history, '')
2226 COMMENT_COLUMN(slm_service_history.record_id, '')
2227 COMMENT_COLUMN(slm_service_history.service_id, '')
2228 COMMENT_COLUMN(slm_service_history.change_timestamp, '')
2229 COMMENT_COLUMN(slm_service_history.new_status, '')
2230
2231
2232 /*
2233 ** Organizations
2234 */
2235
2236 CREATE TABLE organizations
2237 (
2238 id integer not null,
2239 parent_id integer not null,
2240 org_type integer not null,
2241 name varchar(63) not null,
2242 description varchar(255),
2243 manager integer not null, // manager - id from "persons" table
2244 PRIMARY KEY(id)
2245 ) TABLE_TYPE;
2246
2247 COMMENT_TABLE(organizations, '')
2248 COMMENT_COLUMN(organizations.id, '')
2249 COMMENT_COLUMN(organizations.parent_id, '')
2250 COMMENT_COLUMN(organizations.org_type, '')
2251 COMMENT_COLUMN(organizations.name, '')
2252 COMMENT_COLUMN(organizations.description, '')
2253 COMMENT_COLUMN(organizations.manager, '')
2254
2255 /*
2256 ** Persons
2257 */
2258
2259 CREATE TABLE persons
2260 (
2261 id integer not null,
2262 org_id integer not null,
2263 first_name varchar(63),
2264 last_name varchar(63),
2265 title varchar(255),
2266 status integer not null,
2267 PRIMARY KEY(id)
2268 ) TABLE_TYPE;
2269
2270 COMMENT_TABLE(persons, '')
2271 COMMENT_COLUMN(persons.id, '')
2272 COMMENT_COLUMN(persons.org_id, '')
2273 COMMENT_COLUMN(persons.first_name, '')
2274 COMMENT_COLUMN(persons.last_name, '')
2275 COMMENT_COLUMN(persons.title, '')
2276 COMMENT_COLUMN(persons.status, '')
2277
2278 /*
2279 ** Job history
2280 */
2281 CREATE TABLE job_history
2282 (
2283 id integer not null,
2284 time_created integer not null,
2285 time_started integer not null,
2286 time_finished integer not null,
2287 job_type varchar(127) null,
2288 description varchar(255) null,
2289 additional_info varchar(255) null,
2290 node_id integer not null,
2291 user_id integer not null,
2292 status integer not null,
2293 failure_message varchar(255) null,
2294 PRIMARY KEY(id)
2295 ) TABLE_TYPE;
2296
2297 COMMENT_TABLE(job_history, '')
2298 COMMENT_COLUMN(job_history.id, '')
2299 COMMENT_COLUMN(job_history.time_created, '')
2300 COMMENT_COLUMN(job_history.time_started, '')
2301 COMMENT_COLUMN(job_history.time_finished, '')
2302 COMMENT_COLUMN(job_history.job_type, '')
2303 COMMENT_COLUMN(job_history.description, '')
2304 COMMENT_COLUMN(job_history.additional_info, '')
2305 COMMENT_COLUMN(job_history.node_id, '')
2306 COMMENT_COLUMN(job_history.user_id, '')
2307 COMMENT_COLUMN(job_history.status, '')
2308 COMMENT_COLUMN(job_history.failure_message, '')
2309
2310 /*
2311 ** License repository
2312 */
2313 CREATE TABLE licenses
2314 (
2315 id integer not null,
2316 content SQL_TEXT null,
2317 PRIMARY KEY(id)
2318 ) TABLE_TYPE;
2319
2320 COMMENT_TABLE(licenses, '')
2321 COMMENT_COLUMN(licenses.id, '')
2322 COMMENT_COLUMN(licenses.content, '')
2323
2324 /*
2325 ** Mapping tables
2326 */
2327 CREATE TABLE mapping_tables
2328 (
2329 id integer not null,
2330 name varchar(63) not null,
2331 flags integer not null,
2332 description SQL_TEXT4K null,
2333 PRIMARY KEY(id)
2334 ) TABLE_TYPE;
2335
2336 COMMENT_TABLE(mapping_tables, '')
2337 COMMENT_COLUMN(mapping_tables.id, '')
2338 COMMENT_COLUMN(mapping_tables.name, '')
2339 COMMENT_COLUMN(mapping_tables.flags, '')
2340 COMMENT_COLUMN(mapping_tables.description, '')
2341
2342 /*
2343 ** Mapping tables content
2344 */
2345 CREATE TABLE mapping_data
2346 (
2347 table_id integer not null,
2348 md_key varchar(63) not null,
2349 md_value varchar(255) null,
2350 description SQL_TEXT4K null,
2351 PRIMARY KEY(table_id,md_key)
2352 ) TABLE_TYPE;
2353
2354 COMMENT_TABLE(mapping_data, '')
2355 COMMENT_COLUMN(mapping_data.table_id, '')
2356 COMMENT_COLUMN(mapping_data.md_key, '')
2357 COMMENT_COLUMN(mapping_data.md_value, '')
2358 COMMENT_COLUMN(mapping_data.description, '')
2359
2360 /*
2361 ** DCI summary tables
2362 */
2363 CREATE TABLE dci_summary_tables
2364 (
2365 id integer not null,
2366 guid varchar(36) not null,
2367 menu_path varchar(255) not null,
2368 title varchar(127) null,
2369 node_filter SQL_TEXT null,
2370 flags integer not null,
2371 columns SQL_TEXT null,
2372 PRIMARY KEY(id)
2373 ) TABLE_TYPE;
2374
2375 COMMENT_TABLE(dci_summary_tables, '')
2376 COMMENT_COLUMN(dci_summary_tables.id, '')
2377 COMMENT_COLUMN(dci_summary_tables.guid, '')
2378 COMMENT_COLUMN(dci_summary_tables.menu_path, '')
2379 COMMENT_COLUMN(dci_summary_tables.title, '')
2380 COMMENT_COLUMN(dci_summary_tables.node_filter, '')
2381 COMMENT_COLUMN(dci_summary_tables.flags, '')
2382 COMMENT_COLUMN(dci_summary_tables.columns, '')
2383
2384 /*
2385 ** Scheduled tasks
2386 */
2387 CREATE TABLE scheduled_tasks
2388 (
2389 id integer not null,
2390 taskId varchar(255) null,
2391 schedule varchar(127) null,
2392 params varchar(1023) null,
2393 execution_time integer not null,
2394 last_execution_time integer not null,
2395 flags integer not null,
2396 owner integer not null,
2397 object_id integer not null,
2398 PRIMARY KEY(id)
2399 ) TABLE_TYPE;
2400
2401 COMMENT_TABLE(scheduled_tasks, '')
2402 COMMENT_COLUMN(scheduled_tasks.id, '')
2403 COMMENT_COLUMN(scheduled_tasks.taskId, '')
2404 COMMENT_COLUMN(scheduled_tasks.schedule, '')
2405 COMMENT_COLUMN(scheduled_tasks.params, '')
2406 COMMENT_COLUMN(scheduled_tasks.execution_time, '')
2407 COMMENT_COLUMN(scheduled_tasks.last_execution_time, '')
2408 COMMENT_COLUMN(scheduled_tasks.flags, '')
2409 COMMENT_COLUMN(scheduled_tasks.owner, '')
2410 COMMENT_COLUMN(scheduled_tasks.object_id, '')
2411
2412 /*
2413 ** ZMQ Subscriptions
2414 */
2415 CREATE TABLE zmq_subscription
2416 (
2417 object_id integer not null,
2418 subscription_type char(1) not null,
2419 ignore_items integer not null,
2420 items SQL_TEXT,
2421 PRIMARY KEY(object_id, subscription_type)
2422 ) TABLE_TYPE;
2423
2424 COMMENT_TABLE(zmq_subscription, '')
2425 COMMENT_COLUMN(zmq_subscription.object_id, '')
2426 COMMENT_COLUMN(zmq_subscription.subscription_type, '')
2427 COMMENT_COLUMN(zmq_subscription.ignore_items, '')
2428 COMMENT_COLUMN(zmq_subscription.items, '')
2429
2430 /*
2431 ** Currency codes
2432 */
2433 CREATE TABLE currency_codes
2434 (
2435 numeric_code char(3) not null,
2436 alpha_code char(3) not null,
2437 description varchar(127) not null,
2438 exponent integer not null,
2439 PRIMARY KEY(numeric_code)
2440 ) TABLE_TYPE;
2441
2442 COMMENT_TABLE(currency_codes, 'List of currency codes')
2443 COMMENT_COLUMN(currency_codes.numeric_code, 'Numeric ISO code')
2444 COMMENT_COLUMN(currency_codes.alpha_code, 'Alphabetical ISO code')
2445 COMMENT_COLUMN(currency_codes.description, 'Description')
2446 COMMENT_COLUMN(currency_codes.exponent, 'Exponent for minor units')
2447
2448 /*
2449 ** Country codes
2450 */
2451 CREATE TABLE country_codes
2452 (
2453 numeric_code char(3) not null,
2454 alpha_code char(2) not null,
2455 alpha3_code char(3) not null,
2456 name varchar(127) not null,
2457 PRIMARY KEY(numeric_code)
2458 ) TABLE_TYPE;
2459
2460 COMMENT_TABLE(country_codes, 'List of country codes')
2461 COMMENT_COLUMN(country_codes.numeric_code, 'Numeric ISO code')
2462 COMMENT_COLUMN(country_codes.alpha_code, 'Alphabetical 2 character ISO code')
2463 COMMENT_COLUMN(country_codes.alpha3_code, 'Alphabetical 3 character ISO code')
2464 COMMENT_COLUMN(country_codes.name, 'Country name')
2465
2466 /*
2467 ** Config repositories
2468 */
2469 CREATE TABLE config_repositories
2470 (
2471 id integer not null,
2472 url varchar(1023) not null,
2473 auth_token varchar(63) null,
2474 description varchar(1023) null,
2475 PRIMARY KEY(id)
2476 ) TABLE_TYPE;