Mercurial > dive4elements > framework
comparison artifact-database/doc/schema-pg.sql @ 199:face2302387c
Insert collection attribute into database, too.
Fixed broken SQL schema.
artifacts/trunk@1437 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 09 Mar 2011 11:14:21 +0000 |
parents | a85d889a1b0d |
children | 328ef982d768 |
comparison
equal
deleted
inserted
replaced
198:6370369412e9 | 199:face2302387c |
---|---|
22 | 22 |
23 CREATE TABLE users ( | 23 CREATE TABLE users ( |
24 id int PRIMARY KEY NOT NULL, | 24 id int PRIMARY KEY NOT NULL, |
25 gid uuid NOT NULL UNIQUE, | 25 gid uuid NOT NULL UNIQUE, |
26 name VARCHAR(256) NOT NULL UNIQUE, | 26 name VARCHAR(256) NOT NULL UNIQUE, |
27 role BINARY | 27 role bytea |
28 ); | 28 ); |
29 | 29 |
30 CREATE SEQUENCE COLLECTIONS_ID_SEQ; | 30 CREATE SEQUENCE COLLECTIONS_ID_SEQ; |
31 | 31 |
32 CREATE TABLE collections ( | 32 CREATE TABLE collections ( |
35 name VARCHAR(256) NOT NULL, | 35 name VARCHAR(256) NOT NULL, |
36 owner_id int NOT NULL REFERENCES users(id), | 36 owner_id int NOT NULL REFERENCES users(id), |
37 creation timestamp NOT NULL, | 37 creation timestamp NOT NULL, |
38 last_access timestamp NOT NULL, | 38 last_access timestamp NOT NULL, |
39 ttl bigint, -- NULL means eternal | 39 ttl bigint, -- NULL means eternal |
40 attribute bytea | |
40 ); | 41 ); |
41 | 42 |
42 CREATE SEQUENCE COLLECTION_ITEMS_ID_SEQ; | 43 CREATE SEQUENCE COLLECTION_ITEMS_ID_SEQ; |
43 | 44 |
44 CREATE TABLE collection_items ( | 45 CREATE TABLE collection_items ( |
45 id int PRIMARY KEY NOT NULL, | 46 id int PRIMARY KEY NOT NULL, |
46 collection_id int NOT NULL REFERENCES collections(id), | 47 collection_id int NOT NULL REFERENCES collections(id), |
47 artifact_id int NOT NULL REFERENCES artifacts(id), | 48 artifact_id int NOT NULL REFERENCES artifacts(id), |
48 attribute BINARY, | 49 attribute bytea, |
49 UNIQUE (collection_id, artifact_id) | 50 UNIQUE (collection_id, artifact_id) |
50 ); | 51 ); |
51 | 52 |
52 COMMIT; | 53 COMMIT; |