connect ssdb;

create table system(
	rec_key int null,	
	sys_id char(16) not null,
	sys_type int null,
	sys_serial varchar(16) not null,
	hostname varchar(64) not null,
	ip_addr char(16) not null,
	active smallint not null,
	local smallint null,
	time int unsigned null);

create table archive_list(
	dbname varchar(64),
	archive_date char(10));

create table event(
	sys_id char(16) not null,
	event_id integer auto_increment primary key,
	class_id int not null,
	type_id int not null,
	event_count int not null,
	event_start bigint not null,
	event_end bigint not null,
	event_time bigint,
	event_action smallint not null);

create table event_class(
	sys_id char(16) not null,
	class_id integer,
	class_desc varchar(128) not null);

create table event_type(
	sys_id char(16) not null,
	type_id int not null,
	class_id int not null,
	type_desc varchar(128) not null,
	throttled int not null,
	sehthrottle int unsigned not null,
	sehfrequency int unsigned not null,
	priority int not null,
	enabled int not null);

create table event_action(
	sys_id char(16) not null,
	action_id int auto_increment primary key,
	forward_hostname varchar(64) null,
	dsmthrottle int unsigned not null,
	dsmfrequency int unsigned not null,
	action varchar(255));

create table event_actionref(
	sys_id char(16) not null,
	ref_id int auto_increment primary key,
	class_id int not null,
	type_id int not null,
	action_id int not null);

create table actions_taken(
	sys_id char(16) not null,
	event_id int not null,
	action_taken_id int auto_increment primary key,
	action_id integer not null,
	action_time bigint not null,
	action_args varchar(255));

create table system_data(
	sys_id char(16) not null,
	sysdata_id int auto_increment primary key,
	event_id int not null,
	msg_string varchar(255));

create table test_data(
	sys_id char(16) not null,
	data_id int auto_increment primary key,
	event_id int not null,
	test_name varchar(128) not null,
	test_flag char not null);	

create table availdata(
	sys_id char(16) not null,
	avail_id int auto_increment primary key,
	event_id int not null,    
	event_time bigint null,
	lasttick bigint null,	
	prev_start bigint null,  
	start bigint null,  
	status_int int null,
	bounds int null,
	diag_type varchar(16) null,
	diag_file varchar(128) null,
	syslog varchar(128) null,
	hinvchange smallint null,
	verchange smallint null,
	metrics smallint null,
	flag smallint null,
	shutdowncomment varchar(80) null,
	summary varchar(255));

create table tool(
	tool_name varchar(32) not null,
        tool_option varchar(64) null,
        option_default varchar(255));
