Merge branch 'storageareas' into zma_to_thread
This commit is contained in:
commit
41c52f25b7
|
@ -1,32 +0,0 @@
|
|||
|
||||
ALTER TABLE `Frames` MODIFY `Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `Events` MODIFY `Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `Frames` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `Stats` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
ALTER TABLE `Events_Hour` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE='FOREIGN KEY'
|
||||
AND table_name = 'Events'
|
||||
AND column_name = 'Locked'
|
||||
) > 0,
|
||||
"SELECT 'Column Locked already exists in Events'",
|
||||
"ALTER TABLE `Events` ADD `Locked` BOOLEAN NOT NULL default false AFTER `Scheme`"
|
||||
));
|
||||
ALTER TABLE `Events_Hour` ADD CONSTRAINT Events_Hour_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Events_Day` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `Events_Day` ADD CONSTRAINT Events_Day_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Events_Week` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `Events_Week` ADD CONSTRAINT Events_Week_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Events_Month` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `Events_Month` ADD CONSTRAINT Events_Month_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Events_Archived` MODIFY `EventId` BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE `Events_Archived` ADD CONSTRAINT Events_Archived_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE `Stats` ADD CONSTRAINT Stats_MonitorId_fk FOREIGN KEY (`MonitorId`) REFERENCES `Monitors`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Stats` ADD CONSTRAINT Stats_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Stats` ADD CONSTRAINT Stats_ZoneId_fk FOREIGN KEY (`ZoneId`) REFERENCES `Zones`(`Id`) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE `Frames` ADD CONSTRAINT Frames_EventId_fk FOREIGN KEY (`EventId`) REFERENCES `Events`(`Id`) ON DELETE CASCADE;
|
||||
ALTER TABLE `Frames` DROP INDEX `Type`;
|
||||
|
|
@ -131,8 +131,9 @@ sub Execute {
|
|||
|
||||
sub Sql {
|
||||
my $self = $_[0];
|
||||
$$self{Sql} = shift if @_;;
|
||||
if ( ! $$self{Sql} ) {
|
||||
my $filter_expr = ZoneMinder::General::jsonDecode( $self->{Query} );
|
||||
my $filter_expr = ZoneMinder::General::jsonDecode($self->{Query});
|
||||
my $sql = 'SELECT E.*,
|
||||
unix_timestamp(E.StartTime) as Time,
|
||||
M.Name as MonitorName,
|
||||
|
|
|
@ -239,7 +239,8 @@ sub getFilters {
|
|||
FILTER: while( my $db_filter = $sth->fetchrow_hashref() ) {
|
||||
my $filter = new ZoneMinder::Filter( $$db_filter{Id}, $db_filter );
|
||||
Debug( "Found filter '$db_filter->{Name}'\n" );
|
||||
my $filter_sql = $filter->Sql();
|
||||
# The undef here is to make sure the Sql gets regenerated because the Filter object may be cached
|
||||
my $filter_sql = $filter->Sql(undef);
|
||||
|
||||
if ( ! $filter_sql ) {
|
||||
Error( "Error parsing Sql. skipping filter '$db_filter->{Name}'\n" );
|
||||
|
|
Loading…
Reference in New Issue