Mercurial > dive4elements > river
comparison flys-artifacts/ChangeLog @ 1044:a007a4368768
Datacage: Added view to schema to select master artifacts.
flys-artifacts/trunk@2505 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 18 Aug 2011 14:19:30 +0000 |
parents | 9c0f981cd22d |
children | ba840385ad2e |
comparison
equal
deleted
inserted
replaced
1043:9c0f981cd22d | 1044:a007a4368768 |
---|---|
1 2011-08-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> | |
2 | |
3 * doc/conf/datacage.sql: Added view master_artifacts to select | |
4 the master artifacts of the collections more easily. | |
5 To upgrade existing database: | |
6 | |
7 CREATE VIEW master_artifacts AS | |
8 SELECT a2.id AS id, | |
9 a2.gid AS gid, | |
10 a2.state AS state, | |
11 a2.creation AS creation, | |
12 ci2.collection_id AS collection_id | |
13 FROM collection_items ci2 | |
14 JOIN artifacts a2 | |
15 ON ci2.artifact_id = a2.id | |
16 JOIN (SELECT ci.collection_id AS c_id, | |
17 MIN(a.creation) AS oldest_a | |
18 FROM collection_items ci | |
19 JOIN artifacts a | |
20 ON ci.artifact_id = a.id | |
21 GROUP BY ci.collection_id) o | |
22 ON o.c_id = ci2.collection_id | |
23 WHERE a2.creation = o.oldest_a; | |
24 | |
25 TODO: Use the view in the templates. | |
26 | |
1 2011-08-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> | 27 2011-08-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> |
2 | 28 |
3 * doc/conf/meta-data-user.xml: Removed state filter because it was broken. | 29 * doc/conf/meta-data-user.xml: Removed state filter because it was broken. |
4 Simplified by joining two contexts. | 30 Simplified by joining two contexts. |
5 | 31 |