Add support for retriving incidents within set time period

This commit is contained in:
2011-12-20 19:15:42 +00:00
parent 4b22dc5e70
commit 0c8c8a1cb4
3 changed files with 45 additions and 2 deletions

View File

@@ -159,13 +159,14 @@ CREATE VIEW `incidentstatus_current` AS (
);
--
-- Table structure for view `incidentstatus_open`
-- Table structure for view `incident_open`
--
DROP VIEW IF EXISTS `incident_open`;
CREATE VIEW `incident_open` AS (
SELECT
`i`.*
`i`.*,
`isc`.`ctime`
FROM
`incident` AS `i`
JOIN `incidentstatus_current` AS `isc`
@@ -174,6 +175,35 @@ CREATE VIEW `incident_open` AS (
`isc`.`status` IN (1,2,3,4)
);
--
-- Table structure for view `incident_closedtime`
--
DROP VIEW IF EXISTS `incident_closedtime`;
CREATE VIEW `incident_closedtime` AS (
SELECT
`incident` AS `incident`,
`ctime` AS `ctime`
FROM
`incidentstatus`
WHERE
`status` = 0
);
--
-- Table structure for view `incident_opentimes`
--
DROP VIEW IF EXISTS `incident_opentimes`;
CREATE VIEW `incident_opentimes` AS (
SELECT
`i`.*,
IFNULL(`t`.`ctime`, 0xffffffff+0) AS `ctime`
FROM
`incident` as `i`
LEFT JOIN `incident_closedtime` AS `t` ON `i`.`id`=`t`.`incident`
);
--
-- Table structure for table `user`
--