Mercurial > dive4elements > river
comparison flys-artifacts/doc/conf/datacage.sql @ 979:2306340d7540
Added schema for datacage db
flys-artifacts/trunk@2406 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 26 Jul 2011 14:14:55 +0000 |
parents | |
children | f9a6a9cd918e |
comparison
equal
deleted
inserted
replaced
978:5e40fe173a53 | 979:2306340d7540 |
---|---|
1 BEGIN; | |
2 | |
3 CREATE TABLE users ( | |
4 id IDENTITY PRIMARY KEY NOT NULL, | |
5 gid UUID NOT NULL UNIQUE | |
6 ); | |
7 | |
8 CREATE TABLE collections ( | |
9 id IDENTITY PRIMARY KEY NOT NULL, | |
10 gid UUID NOT NULL UNIQUE, | |
11 user_id INT NOT NULL REFERENCES users(id), | |
12 name VARCHAR(256) NOT NULL | |
13 ); | |
14 | |
15 CREATE TABLE artifacts ( | |
16 id IDENTITY PRIMARY KEY NOT NULL, | |
17 gid UUID NOT NULL UNIQUE, | |
18 state VARCHAR(256) NOT NULL | |
19 ); | |
20 | |
21 CREATE TABLE collection_items ( | |
22 id IDENTITY PRIMARY KEY NOT NULL, | |
23 collection_id INT NOT NULL REFERENCES collections(id), | |
24 artifact_id INT NOT NULL REFERENCES artifacts(id) | |
25 ); | |
26 | |
27 CREATE TABLE artifact_data ( | |
28 id IDENTITY PRIMARY KEY NOT NULL, | |
29 artifact_id INT NOT NULL REFERENCES artifacts(id), | |
30 k VARCHAR(256) NOT NULL, | |
31 v VARCHAR(256), -- Maybe too short | |
32 UNIQUE (artifact_id, k) | |
33 ); | |
34 | |
35 CREATE TABLE facets ( | |
36 id IDENTITY PRIMARY KEY NOT NULL, | |
37 artifact_id INT NOT NULL REFERENCES artifacts(id), | |
38 name VARCHAR(256) NOT NULL, | |
39 num INT NOT NULL, | |
40 output VARCHAR(256) NOT NULL, | |
41 description VARCHAR(256), | |
42 UNIQUE (artifact_id, output, num, name) | |
43 ); | |
44 | |
45 COMMIT; |