fixed rating bugs introduced with commit c32a4b06

This commit is contained in:
following
2012-08-27 14:15:16 +02:00
parent 9fb4322bfc
commit 9bc361c3e3
6 changed files with 15 additions and 6 deletions
+4 -1
View File
@@ -668,11 +668,14 @@
INSERT IGNORE INTO `removed_objects` (`localId`, `uuid`, `type`, `node`) VALUES (OLD.`id`, OLD.`uuid`, 1, OLD.`node`);
END;");
// IF condition is defined to work with both, rating_date field may be NULL or not
sql_dropTrigger('cacheRatingBeforeInsert');
sql("CREATE TRIGGER `cacheRatingBeforeInsert` BEFORE INSERT ON `cache_rating`
FOR EACH ROW
BEGIN
SET NEW.`rating_date` = NOW();
IF ISNULL(NEW.`rating_date`) OR NEW.`rating_date` < '2000' THEN
SET NEW.`rating_date` = NOW();
END IF;
END;");
sql_dropTrigger('cacheRatingAfterInsert');