comparison artifact-database/src/main/resources/sql/org-postgresql-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 = ?::uuid
32 users.select.gid=SELECT id, name, role FROM users WHERE gid = ?::uuid 33 users.select.gid=SELECT id, name, role FROM users WHERE gid = ?::uuid
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 artifacts.in.one.collection.only=\
51 SELECT artifact_id FROM collection_items\
52 WHERE collection_id = ? AND\
53 artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?)
54
55 outdate.artifacts.collection=UPDATE artifacts \
56 SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \
57 WHERE id IN \
58 (SELECT artifact_id FROM collection_items \
59 WHERE collection_id = ? AND \
60 artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?))
61
62 outdate.artifacts.user=UPDATE artifacts \
63 SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \
64 WHERE id IN \
65 (SELECT artifact_id FROM collection_items WHERE \
66 collection_id IN (SELECT id FROM collections WHERE owner_id = ?) \
67 AND artifact_id NOT IN \
68 (SELECT artifact_id FROM collection_items WHERE collection_id IN \
69 (SELECT id FROM collections WHERE owner_id <> ?)))
70

http://dive4elements.wald.intevation.org