Merge pull request #1075 from ZoneMinder/663-frames-primary-key

663 frames primary key
pull/1080/head
Andrew Bauer 2015-09-30 06:50:39 -05:00
commit 33f3cd50f0
6 changed files with 27 additions and 5 deletions

View File

@ -4,7 +4,7 @@
#
cmake_minimum_required (VERSION 2.6)
project (zoneminder)
set(zoneminder_VERSION "1.28.106")
set(zoneminder_VERSION "1.28.107")
# make API version a minor of ZM version
set(zoneminder_API_VERSION "${zoneminder_VERSION}.1")

View File

@ -3,7 +3,7 @@
# For instructions on building with cmake, please see INSTALL
#
AC_PREREQ(2.59)
AC_INIT(zm,1.28.106,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html)
AC_INIT(zm,1.28.107,[http://www.zoneminder.com/forums/ - Please check FAQ first],zoneminder,http://www.zoneminder.com/downloads.html)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR(src/zm.h)
AC_CONFIG_HEADERS(config.h)

View File

@ -236,13 +236,14 @@ CREATE TABLE `Filters` (
DROP TABLE IF EXISTS `Frames`;
CREATE TABLE `Frames` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`EventId` int(10) unsigned NOT NULL default '0',
`FrameId` int(10) unsigned NOT NULL default '0',
`Type` enum('Normal','Bulk','Alarm') NOT NULL default 'Normal',
`TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`Delta` decimal(8,2) NOT NULL default '0.00',
`Score` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`EventId`,`FrameId`),
PRIMARY KEY (`Id`),
KEY `Type` (`Type`),
KEY `TimeStamp` (`TimeStamp`)
) ENGINE=@ZM_MYSQL_ENGINE@;

21
db/zm_update-1.28.107.sql Normal file
View File

@ -0,0 +1,21 @@
--
-- This updates a 1.28.106 database to 1.28.107
--
--
-- Update Frame table to have a PrimaryKey of ID, insetad of a Composite Primary Key
-- Used primarially for compatibility with CakePHP
--
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Frames'
AND table_schema = DATABASE()
AND column_name = 'Id'
) > 0,
"SELECT 'Column ID already exists in Monitors'",
"ALTER TABLE `Frames` ADD COLUMN `Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST, DROP PRIMARY KEY, ADD PRIMARY KEY(`Id`)"
));
PREPARE stmt FROM @s;
EXECUTE stmt;

View File

@ -1 +1 @@
1.28.106
1.28.107

View File

@ -19,7 +19,7 @@ class Frame extends AppModel {
*
* @var string
*/
public $primaryKey = 'FrameId';
public $primaryKey = 'Id';
/**
* Validation rules