2 event character varying NOT NULL,
3 "date" character varying NOT NULL,
4 name character varying NOT NULL,
5 vhost character varying NOT NULL,
7 PRIMARY KEY (vhost, event)
10 -- In a separate table to avoid deadlocks.
11 CREATE TABLE last_picture_cache (
12 vhost varchar NOT NULL,
13 event varchar NOT NULL,
14 last_picture timestamp without time zone,
15 last_update timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
17 PRIMARY KEY (vhost,event),
18 FOREIGN KEY (vhost,event) REFERENCES events(vhost,event)
21 CREATE SEQUENCE imageid_seq;
24 id integer DEFAULT nextval('imageid_seq') NOT NULL PRIMARY KEY,
25 vhost character varying NOT NULL,
26 event character varying NOT NULL,
27 filename character varying NOT NULL,
30 uploadedby character varying NOT NULL,
31 "date" timestamp without time zone,
32 takenby character varying NOT NULL,
33 selected boolean DEFAULT false,
34 model character varying,
35 lens character varying,
37 FOREIGN KEY (vhost,event) REFERENCES events (vhost,event)
39 CREATE UNIQUE INDEX unique_filenames ON images USING btree (vhost, event, filename);
41 CREATE TABLE deleted_images (
43 vhost character varying,
44 event character varying NOT NULL,
45 filename character varying NOT NULL,
48 uploadedby character varying,
49 "date" timestamp without time zone,
50 takenby character varying NOT NULL,
52 model character varying,
53 lens character varying
57 username character varying NOT NULL,
58 vhost character varying NOT NULL,
59 cryptpassword character varying NOT NULL
62 -- Mainly used for manual queries -- usually too slow to be very useful
63 -- for web views in the long run.
64 CREATE TABLE exif_info (
65 image integer NOT NULL REFERENCES images (id) ON DELETE CASCADE,
67 value varchar NOT NULL,
69 PRIMARY KEY ( image, key )
72 CREATE INDEX exif_info_key ON exif_info ( key );
73 CLUSTER exif_info_key ON exif_info;
75 GRANT INSERT ON TABLE deleted_images TO pr0n;
76 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE events TO pr0n;
77 GRANT SELECT,UPDATE ON TABLE imageid_seq TO pr0n;
78 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE images TO pr0n;
79 GRANT SELECT,UPDATE ON TABLE users TO pr0n;
80 GRANT SELECT,INSERT,DELETE ON TABLE exif_info TO pr0n;
81 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE last_picture_cache TO pr0n;