comparison artifact-database/src/main/resources/sql/org-h2-driver.properties @ 144:5369582d4fbf

Enable backend to delete users artifacts/trunk@1369 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 02 Mar 2011 17:43:25 +0000
parents 2950c6011afa
children db0d20440b92
comparison
equal deleted inserted replaced
143:7e20702a90ed 144:5369582d4fbf
27 27
28 users.id.nextval=SELECT NEXTVAL('USERS_ID_SEQ') 28 users.id.nextval=SELECT NEXTVAL('USERS_ID_SEQ')
29 29
30 users.insert=INSERT INTO USERS (id, gid, name, role) VALUES (?, ?, ?, ?) 30 users.insert=INSERT INTO USERS (id, gid, name, role) VALUES (?, ?, ?, ?)
31 31
32 users.select.id.by.gid=SELECT id FROM users WHERE gid = ?
32 users.select.gid=SELECT id, name, role FROM users WHERE gid = ? 33 users.select.gid=SELECT id, name, role FROM users WHERE gid = ?
33 34
34 users.delete.id=DELETE FROM users WHERE id = ? 35 users.delete.id=DELETE FROM users WHERE id = ?
35 36
36 users.delete.collections=DELETE FROM collections where owner_id = ? 37 users.delete.collections=DELETE FROM collections where owner_id = ?
37 38
38 users.select.all=SELECT id, gid, name, role FROM users 39 users.select.all=SELECT id, gid, name, role FROM users
40
41 # COLLECTIONS
42
43 delete.user.collection.items= \
44 DELETE FROM collection_items WHERE collection_id IN \
45 (SELECT id FROM collections WHERE owner_id = ?)
46
47 users.collections=SELECT collection_id, gid, name FROM collections WHERE owner_id = ?
48 users.collection.ids=SELECT collection_id FROM collections WHERE owner_id = ?
49
50 users.delete.all.collections=DELETE FROM collections WHERE owner_id = ?
51
52 artifacts.in.one.collection.only=\
53 SELECT artifact_id FROM collection_items\
54 WHERE collection_id = ? AND\
55 artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?)
56
57 outdate.artifacts.collection=UPDATE artifacts \
58 SET last_access = DATEADD('MILLISECOND', -2, CURRENT_TIMESTAMP), ttl = 1 \
59 WHERE id IN \
60 SELECT artifact_id FROM collection_items \
61 WHERE collection_id = ? AND \
62 artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?))
63
64 outdate.artifacts.user=UPDATE artifacts \
65 SET last_access = DATEADD('MILLISECOND', -2, CURRENT_TIMESTAMP), ttl = 1 \
66 WHERE id IN \
67 (SELECT artifact_id FROM collection_items WHERE \
68 collection_id IN (SELECT id FROM collections WHERE owner_id = ?) \
69 AND artifact_id NOT IN \
70 (SELECT artifact_id FROM collection_items WHERE collection_id IN \
71 (SELECT id FROM collections WHERE owner_id <> ?)))

http://dive4elements.wald.intevation.org