diff artifact-database/src/main/resources/sql/org-h2-driver.properties @ 229:328ef982d768

When an artifact is touched the collections which contain the artifact are touched, too. artifacts/trunk@1631 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 31 Mar 2011 08:58:42 +0000
parents a9c8fa38ba03
children 1ea35226a6de
line wrap: on
line diff
--- a/artifact-database/src/main/resources/sql/org-h2-driver.properties	Thu Mar 31 08:42:53 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties	Thu Mar 31 08:58:42 2011 +0000
@@ -84,6 +84,16 @@
     WHERE ci.collection_id IN (SELECT id FROM collections WHERE gid = ?)
 
 # COLLECTIONS
+
+collections.touch.trigger.function = \
+   UPDATE collections SET last_access = current_timestamp \
+   WHERE id IN \
+        (SELECT c.id FROM collections c \
+         INNER JOIN collection_items ci ON c.id = ci.collection_id  \
+         INNER JOIN artifacts a         ON a.id = ci.artifact_id \
+         WHERE a.id = ?)
+
+
 collections.touch.by.gid =\
     UPDATE collections SET last_access = CURRENT_TIMESTAMP \
         WHERE gid = ?

http://dive4elements.wald.intevation.org