mirror of https://github.com/Icinga/icinga2.git
Add the unique_id for comments/downtimes next to legacy_id to DB IDO
fixes #10431
This commit is contained in:
parent
339c0b6d84
commit
1b9f0a8c77
|
@ -353,6 +353,7 @@ void DbEvents::AddCommentByType(const Comment::Ptr& comment, bool historical)
|
|||
return;
|
||||
}
|
||||
|
||||
fields1->Set("unique_id", comment->GetName());
|
||||
fields1->Set("comment_time", DbValue::FromTimestamp(entry_time)); /* same as entry_time */
|
||||
fields1->Set("author_name", comment->GetAuthor());
|
||||
fields1->Set("comment_data", comment->GetText());
|
||||
|
@ -487,6 +488,7 @@ void DbEvents::AddDowntimeByType(const Downtime::Ptr& downtime, bool historical)
|
|||
return;
|
||||
}
|
||||
|
||||
fields1->Set("unique_id", downtime->GetName());
|
||||
fields1->Set("author_name", downtime->GetAuthor());
|
||||
fields1->Set("comment_data", downtime->GetComment());
|
||||
fields1->Set("triggered_by_id", Downtime::GetByName(downtime->GetTriggeredBy()));
|
||||
|
|
|
@ -82,6 +82,7 @@ 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,
|
||||
unique_id TEXT 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';
|
||||
|
@ -108,6 +109,7 @@ CREATE TABLE IF NOT EXISTS icinga_comments (
|
|||
comment_source smallint default 0,
|
||||
expires smallint default 0,
|
||||
expiration_time timestamp default '0000-00-00 00:00:00',
|
||||
unique_id TEXT character set latin1 default NULL,
|
||||
PRIMARY KEY (comment_id),
|
||||
UNIQUE KEY instance_id (instance_id,object_id,comment_time,internal_comment_id)
|
||||
) ENGINE=InnoDB COMMENT='Usercomments on Icinga objects';
|
||||
|
@ -411,6 +413,7 @@ 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',
|
||||
unique_id TEXT 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';
|
||||
|
@ -972,6 +975,7 @@ CREATE TABLE IF NOT EXISTS icinga_scheduleddowntime (
|
|||
actual_start_time_usec int default 0,
|
||||
is_in_effect smallint default 0,
|
||||
trigger_time timestamp default '0000-00-00 00:00:00',
|
||||
unique_id TEXT character set latin1 default NULL,
|
||||
PRIMARY KEY (scheduleddowntime_id),
|
||||
UNIQUE KEY instance_id (instance_id,object_id,entry_time,internal_downtime_id)
|
||||
) ENGINE=InnoDB COMMENT='Current scheduled host and service downtime';
|
||||
|
|
|
@ -58,6 +58,16 @@ ALTER TABLE icinga_customvariablestatus ADD COLUMN session_token varchar(512) ch
|
|||
CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token);
|
||||
CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token);
|
||||
|
||||
-- -----------------------------------------
|
||||
-- #10431 comment/downtime unique id
|
||||
-- -----------------------------------------
|
||||
|
||||
ALTER TABLE icinga_comments ADD COLUMN unique_id TEXT character set latin1 default NULL;
|
||||
ALTER TABLE icinga_commenthistory ADD COLUMN unique_id TEXT character set latin1 default NULL;
|
||||
|
||||
ALTER TABLE icinga_scheduleddowntime ADD COLUMN unique_id TEXT character set latin1 default NULL;
|
||||
ALTER TABLE icinga_downtimehistory ADD COLUMN unique_id TEXT character set latin1 default NULL;
|
||||
|
||||
-- -----------------------------------------
|
||||
-- update dbversion
|
||||
-- -----------------------------------------
|
||||
|
|
|
@ -108,6 +108,7 @@ CREATE TABLE icinga_commenthistory (
|
|||
expiration_time timestamp with time zone default '1970-01-01 00:00:00+00',
|
||||
deletion_time timestamp with time zone default '1970-01-01 00:00:00+00',
|
||||
deletion_time_usec INTEGER default 0,
|
||||
unique_id TEXT default NULL,
|
||||
CONSTRAINT PK_commenthistory_id PRIMARY KEY (commenthistory_id) ,
|
||||
CONSTRAINT UQ_commenthistory UNIQUE (instance_id,object_id,comment_time,internal_comment_id)
|
||||
);
|
||||
|
@ -134,6 +135,7 @@ CREATE TABLE icinga_comments (
|
|||
comment_source INTEGER default 0,
|
||||
expires INTEGER default 0,
|
||||
expiration_time timestamp with time zone default '1970-01-01 00:00:00+00',
|
||||
unique_id TEXT default NULL,
|
||||
CONSTRAINT PK_comment_id PRIMARY KEY (comment_id) ,
|
||||
CONSTRAINT UQ_comments UNIQUE (instance_id,object_id,comment_time,internal_comment_id)
|
||||
) ;
|
||||
|
@ -438,6 +440,7 @@ 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+00',
|
||||
unique_id TEXT default NULL,
|
||||
CONSTRAINT PK_downtimehistory_id PRIMARY KEY (downtimehistory_id) ,
|
||||
CONSTRAINT UQ_downtimehistory UNIQUE (instance_id,object_id,entry_time,internal_downtime_id)
|
||||
) ;
|
||||
|
@ -999,6 +1002,7 @@ CREATE TABLE icinga_scheduleddowntime (
|
|||
actual_start_time_usec INTEGER default 0,
|
||||
is_in_effect INTEGER default 0,
|
||||
trigger_time timestamp with time zone default '1970-01-01 00:00:00+00',
|
||||
unique_id TEXT default NULL,
|
||||
CONSTRAINT PK_scheduleddowntime_id PRIMARY KEY (scheduleddowntime_id) ,
|
||||
CONSTRAINT UQ_scheduleddowntime UNIQUE (instance_id,object_id,entry_time,internal_downtime_id)
|
||||
) ;
|
||||
|
|
|
@ -154,18 +154,30 @@ CREATE TABLE icinga_zonestatus (
|
|||
-- -----------------------------------------
|
||||
-- #10392 original attributes
|
||||
-- -----------------------------------------
|
||||
|
||||
ALTER TABLE icinga_servicestatus ADD COLUMN original_attributes TEXT default NULL;
|
||||
ALTER TABLE icinga_hoststatus ADD COLUMN original_attributes TEXT default NULL;
|
||||
|
||||
-- -----------------------------------------
|
||||
-- #10436 deleted custom vars
|
||||
-- -----------------------------------------
|
||||
|
||||
ALTER TABLE icinga_customvariables ADD COLUMN session_token TEXT default NULL;
|
||||
ALTER TABLE icinga_customvariablestatus ADD COLUMN session_token TEXT default NULL;
|
||||
|
||||
CREATE INDEX cv_session_del_idx ON icinga_customvariables (session_token);
|
||||
CREATE INDEX cvs_session_del_idx ON icinga_customvariablestatus (session_token);
|
||||
|
||||
-- -----------------------------------------
|
||||
-- #10431 comment/downtime unique id
|
||||
-- -----------------------------------------
|
||||
|
||||
ALTER TABLE icinga_comments ADD COLUMN unique_id TEXT default NULL;
|
||||
ALTER TABLE icinga_commenthistory ADD COLUMN unique_id TEXT default NULL;
|
||||
|
||||
ALTER TABLE icinga_scheduleddowntime ADD COLUMN unique_id TEXT default NULL;
|
||||
ALTER TABLE icinga_downtimehistory ADD COLUMN unique_id TEXT default NULL;
|
||||
|
||||
-- -----------------------------------------
|
||||
-- update dbversion
|
||||
-- -----------------------------------------
|
||||
|
|
Loading…
Reference in New Issue