Skip to content

Commit

Permalink
DB IDO: Clean schema.
Browse files Browse the repository at this point in the history
Refs #5636
  • Loading branch information
Michael Friedrich committed Mar 4, 2014
1 parent 7b29ebe commit 5e4152d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
17 changes: 3 additions & 14 deletions components/db_ido_mysql/schema/mysql.sql
Expand Up @@ -39,7 +39,6 @@ CREATE TABLE IF NOT EXISTS icinga_acknowledgements (
persistent_comment smallint default 0,
notify_contacts smallint default 0,
end_time timestamp default '0000-00-00 00:00:00',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (acknowledgement_id)
) ENGINE=InnoDB COMMENT='Current and historical host and service acknowledgements';

Expand Down Expand Up @@ -83,7 +82,6 @@ CREATE TABLE IF NOT EXISTS icinga_commenthistory (
expiration_time timestamp default '0000-00-00 00:00:00',
deletion_time timestamp default '0000-00-00 00:00:00',
deletion_time_usec int default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (commenthistory_id),
UNIQUE KEY instance_id (instance_id,object_id,comment_time,internal_comment_id)
) ENGINE=InnoDB COMMENT='Historical host and service comments';
Expand Down Expand Up @@ -234,7 +232,6 @@ CREATE TABLE IF NOT EXISTS icinga_contactnotifications (
start_time_usec int default 0,
end_time timestamp default '0000-00-00 00:00:00',
end_time_usec int default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (contactnotification_id),
UNIQUE KEY instance_id (instance_id,contact_object_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical record of contact notifications';
Expand Down Expand Up @@ -410,7 +407,6 @@ CREATE TABLE IF NOT EXISTS icinga_downtimehistory (
was_cancelled smallint default 0,
is_in_effect smallint default 0,
trigger_time timestamp default '0000-00-00 00:00:00',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (downtimehistory_id),
UNIQUE KEY instance_id (instance_id,object_id,entry_time,internal_downtime_id)
) ENGINE=InnoDB COMMENT='Historical scheduled host and service downtime';
Expand Down Expand Up @@ -441,7 +437,6 @@ CREATE TABLE IF NOT EXISTS icinga_eventhandlers (
return_code smallint default 0,
output TEXT character set latin1 default '',
long_output TEXT default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (eventhandler_id),
UNIQUE KEY instance_id (instance_id,object_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical host and service event handlers';
Expand All @@ -459,7 +454,6 @@ CREATE TABLE IF NOT EXISTS icinga_externalcommands (
command_type smallint default 0,
command_name varchar(128) character set latin1 default '',
command_args TEXT character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (externalcommand_id)
) ENGINE=InnoDB COMMENT='Historical record of processed external commands';

Expand All @@ -483,7 +477,6 @@ CREATE TABLE IF NOT EXISTS icinga_flappinghistory (
high_threshold double default '0',
comment_time timestamp default '0000-00-00 00:00:00',
internal_comment_id bigint unsigned default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (flappinghistory_id)
) ENGINE=InnoDB COMMENT='Current and historical record of host and service flapping';

Expand Down Expand Up @@ -518,7 +511,6 @@ CREATE TABLE IF NOT EXISTS icinga_hostchecks (
output TEXT character set latin1 default '',
long_output TEXT default '',
perfdata TEXT character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (hostcheck_id)
) ENGINE=InnoDB COMMENT='Historical host checks';

Expand Down Expand Up @@ -828,7 +820,6 @@ CREATE TABLE IF NOT EXISTS icinga_logentries (
realtime_data smallint default 0,
inferred_data_extracted smallint default 0,
object_id bigint unsigned default NULL,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (logentry_id)
) ENGINE=InnoDB COMMENT='Historical record of log entries';

Expand All @@ -853,7 +844,6 @@ CREATE TABLE IF NOT EXISTS icinga_notifications (
long_output TEXT default '',
escalated smallint default 0,
contacts_notified smallint default 0,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (notification_id),
UNIQUE KEY instance_id (instance_id,object_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical record of host and service notifications';
Expand Down Expand Up @@ -891,7 +881,6 @@ CREATE TABLE IF NOT EXISTS icinga_processevents (
program_name varchar(16) character set latin1 default '',
program_version varchar(20) character set latin1 default '',
program_date varchar(10) character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (processevent_id)
) ENGINE=InnoDB COMMENT='Historical Icinga process events';

Expand Down Expand Up @@ -1006,7 +995,6 @@ CREATE TABLE IF NOT EXISTS icinga_servicechecks (
output TEXT character set latin1 default '',
long_output TEXT default '',
perfdata TEXT character set latin1 default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (servicecheck_id)
) ENGINE=InnoDB COMMENT='Historical service checks';

Expand Down Expand Up @@ -1290,7 +1278,6 @@ CREATE TABLE IF NOT EXISTS icinga_statehistory (
output TEXT character set latin1 default '',
long_output TEXT default '',
check_source varchar(255) character set latin1 default NULL,
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (statehistory_id)
) ENGINE=InnoDB COMMENT='Historical host and service state changes';

Expand All @@ -1314,7 +1301,6 @@ CREATE TABLE IF NOT EXISTS icinga_systemcommands (
return_code smallint default 0,
output TEXT character set latin1 default '',
long_output TEXT default '',
icinga_node varchar(255) character set latin1 default NULL,
PRIMARY KEY (systemcommand_id),
UNIQUE KEY instance_id (instance_id,start_time,start_time_usec)
) ENGINE=InnoDB COMMENT='Historical system commands that are executed';
Expand Down Expand Up @@ -1352,6 +1338,8 @@ CREATE TABLE IF NOT EXISTS icinga_timeperiod_timeranges (
) ENGINE=InnoDB COMMENT='Timeperiod definitions';


-- --------------------------------------------------------
-- Icinga 2 specific schema extensions
-- --------------------------------------------------------

--
Expand Down Expand Up @@ -1404,6 +1392,7 @@ ALTER TABLE icinga_servicechecks ADD COLUMN endpoint_object_id bigint default NU
ALTER TABLE icinga_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;


-- -----------------------------------------
-- add index (delete)
-- -----------------------------------------
Expand Down
17 changes: 3 additions & 14 deletions components/db_ido_pgsql/schema/pgsql.sql
Expand Up @@ -65,7 +65,6 @@ CREATE TABLE icinga_acknowledgements (
persistent_comment INTEGER default 0,
notify_contacts INTEGER default 0,
end_time timestamp with time zone default '1970-01-01 00:00:00',
icinga_node text default NULL,
CONSTRAINT PK_acknowledgement_id PRIMARY KEY (acknowledgement_id)
) ;

Expand Down Expand Up @@ -109,7 +108,6 @@ CREATE TABLE icinga_commenthistory (
expiration_time timestamp with time zone default '1970-01-01 00:00:00',
deletion_time timestamp with time zone default '1970-01-01 00:00:00',
deletion_time_usec INTEGER default 0,
icinga_node text default NULL,
CONSTRAINT PK_commenthistory_id PRIMARY KEY (commenthistory_id) ,
CONSTRAINT UQ_commenthistory UNIQUE (instance_id,object_id,comment_time,internal_comment_id)
);
Expand Down Expand Up @@ -260,7 +258,6 @@ CREATE TABLE icinga_contactnotifications (
start_time_usec INTEGER default 0,
end_time timestamp with time zone default '1970-01-01 00:00:00',
end_time_usec INTEGER default 0,
icinga_node text default NULL,
CONSTRAINT PK_contactnotification_id PRIMARY KEY (contactnotification_id) ,
CONSTRAINT UQ_contactnotifications UNIQUE (instance_id,contact_object_id,start_time,start_time_usec)
) ;
Expand Down Expand Up @@ -437,7 +434,6 @@ CREATE TABLE icinga_downtimehistory (
was_cancelled INTEGER default 0,
is_in_effect INTEGER default 0,
trigger_time timestamp with time zone default '1970-01-01 00:00:00',
icinga_node text default NULL,
CONSTRAINT PK_downtimehistory_id PRIMARY KEY (downtimehistory_id) ,
CONSTRAINT UQ_downtimehistory UNIQUE (instance_id,object_id,entry_time,internal_downtime_id)
) ;
Expand Down Expand Up @@ -468,7 +464,6 @@ CREATE TABLE icinga_eventhandlers (
return_code INTEGER default 0,
output TEXT default '',
long_output TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_eventhandler_id PRIMARY KEY (eventhandler_id) ,
CONSTRAINT UQ_eventhandlers UNIQUE (instance_id,object_id,start_time,start_time_usec)
) ;
Expand All @@ -486,7 +481,6 @@ CREATE TABLE icinga_externalcommands (
command_type INTEGER default 0,
command_name TEXT default '',
command_args TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_externalcommand_id PRIMARY KEY (externalcommand_id)
) ;

Expand All @@ -510,7 +504,6 @@ CREATE TABLE icinga_flappinghistory (
high_threshold double precision default 0,
comment_time timestamp with time zone default '1970-01-01 00:00:00',
internal_comment_id bigint default 0,
icinga_node text default NULL,
CONSTRAINT PK_flappinghistory_id PRIMARY KEY (flappinghistory_id)
) ;

Expand Down Expand Up @@ -545,7 +538,6 @@ CREATE TABLE icinga_hostchecks (
output TEXT default '',
long_output TEXT default '',
perfdata TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_hostcheck_id PRIMARY KEY (hostcheck_id)
) ;

Expand Down Expand Up @@ -854,7 +846,6 @@ CREATE TABLE icinga_logentries (
realtime_data INTEGER default 0,
inferred_data_extracted INTEGER default 0,
object_id bigint default NULL,
icinga_node text default NULL,
CONSTRAINT PK_logentry_id PRIMARY KEY (logentry_id)
) ;

Expand All @@ -879,7 +870,6 @@ CREATE TABLE icinga_notifications (
long_output TEXT default '',
escalated INTEGER default 0,
contacts_notified INTEGER default 0,
icinga_node text default NULL,
CONSTRAINT PK_notification_id PRIMARY KEY (notification_id) ,
CONSTRAINT UQ_notifications UNIQUE (instance_id,object_id,start_time,start_time_usec)
) ;
Expand Down Expand Up @@ -918,7 +908,6 @@ CREATE TABLE icinga_processevents (
program_name TEXT default '',
program_version TEXT default '',
program_date TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_processevent_id PRIMARY KEY (processevent_id)
) ;

Expand Down Expand Up @@ -1033,7 +1022,6 @@ CREATE TABLE icinga_servicechecks (
output TEXT default '',
long_output TEXT default '',
perfdata TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_servicecheck_id PRIMARY KEY (servicecheck_id)
) ;

Expand Down Expand Up @@ -1316,7 +1304,6 @@ CREATE TABLE icinga_statehistory (
output TEXT default '',
long_output TEXT default '',
check_source varchar(255) default NULL,
icinga_node text default NULL,
CONSTRAINT PK_statehistory_id PRIMARY KEY (statehistory_id)
) ;

Expand All @@ -1340,7 +1327,6 @@ CREATE TABLE icinga_systemcommands (
return_code INTEGER default 0,
output TEXT default '',
long_output TEXT default '',
icinga_node text default NULL,
CONSTRAINT PK_systemcommand_id PRIMARY KEY (systemcommand_id) ,
CONSTRAINT UQ_systemcommands UNIQUE (instance_id,start_time,start_time_usec)
) ;
Expand Down Expand Up @@ -1378,6 +1364,8 @@ CREATE TABLE icinga_timeperiod_timeranges (
) ;


-- --------------------------------------------------------
-- Icinga 2 specific schema extensions
-- --------------------------------------------------------

--
Expand Down Expand Up @@ -1432,6 +1420,7 @@ ALTER TABLE icinga_servicechecks ADD COLUMN endpoint_object_id bigint default NU
ALTER TABLE icinga_statehistory ADD COLUMN endpoint_object_id bigint default NULL;
ALTER TABLE icinga_systemcommands ADD COLUMN endpoint_object_id bigint default NULL;


-- -----------------------------------------
-- add index (delete)
-- -----------------------------------------
Expand Down

0 comments on commit 5e4152d

Please sign in to comment.