Rename column Id OF Monitor_Statuses to simplify JOINS.

This commit is contained in:
Isaac Connor 2018-01-26 13:39:37 -05:00
parent 2d9f9125aa
commit 456f29fcba
4 changed files with 12 additions and 4 deletions

View File

@ -644,11 +644,11 @@ CREATE INDEX `Monitors_ServerId_idx` ON `Monitors` (`ServerId`);
DROP TABLE IF EXISTS `Monitor_Status`;
CREATE TABLE `Monitor_Status` (
`Id` int(10) unsigned NOT NULL,
`MonitorId` int(10) unsigned NOT NULL,
`Status` enum('Unknown','NotRunning','Running','NoSignal','Signal') NOT NULL default 'Unknown',
`CaptureFPS` DECIMAL(10,2) NOT NULL default 0,
`AnalysisFPS` DECIMAL(5,2) NOT NULL default 0,
PRIMARY KEY (`Id`)
PRIMARY KEY (`MonitorId`)
) ENGINE=MEMORY;
--
-- Table structure for table `States`

8
db/zm_update-1.31.29.sql Normal file
View File

@ -0,0 +1,8 @@
DROP TABLE IF EXISTS `Monitor_Status`;
CREATE TABLE `Monitor_Status` (
`MonitorId` int(10) unsigned NOT NULL,
`Status` enum('Unknown','NotRunning','Running','NoSignal','Signal') NOT NULL default 'Unknown',
`CaptureFPS` DECIMAL(10,2) NOT NULL default 0,
`AnalysisFPS` DECIMAL(5,2) NOT NULL default 0,
PRIMARY KEY (`MonitorId`)
) ENGINE=MEMORY;

@ -1 +1 @@
Subproject commit ca91b87fda8e006e4fca2ed870f24f9a29c2905d
Subproject commit 7108489f218c54d36d235d3af91d6da2f8311237

View File

@ -89,7 +89,7 @@ if ( ! is_array( $selected_monitor_ids ) ) {
$values += $ids;
}
$sql = 'SELECT *,S.Status AS Status, S.CaptureFPS AS CaptureFPS FROM Monitors AS M LEFT JOIN Monitor_Status AS S ON S.Id=M.Id ' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
$sql = 'SELECT *,S.Status AS Status, S.CaptureFPS AS CaptureFPS FROM Monitors AS M LEFT JOIN Monitor_Status AS S ON MonitorId=Id ' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
$monitors = dbFetchAll( $sql, null, $values );
$displayMonitors = array();
$monitors_dropdown = array();