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
56 CREATE TABLE fake_files (
57 vhost character varying NOT NULL,
58 event character varying NOT NULL,
59 filename character varying NOT NULL,
60 expires_at timestamp without time zone NOT NULL,
62 PRIMARY KEY ( vhost, event, filename ),
63 FOREIGN KEY (vhost,event) REFERENCES events (vhost,event)
66 CREATE TABLE shadow_files (
67 vhost character varying NOT NULL,
68 event character varying NOT NULL,
69 filename character varying NOT NULL,
71 expires_at timestamp without time zone NOT NULL
75 username character varying NOT NULL,
76 sha1password character(27),
77 vhost character varying NOT NULL,
78 cryptpassword character varying
81 -- Mainly used for manual queries -- usually too slow to be very useful
82 -- for web views in the long run.
83 CREATE TABLE exif_info (
84 image integer NOT NULL REFERENCES images (id) ON DELETE CASCADE,
86 value varchar NOT NULL,
88 PRIMARY KEY ( image, key )
91 CREATE INDEX exif_info_key ON exif_info ( key );
92 CLUSTER exif_info_key ON exif_info;
94 GRANT INSERT ON TABLE deleted_images TO pr0n;
95 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE events TO pr0n;
96 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE fake_files TO pr0n;
97 GRANT SELECT,UPDATE ON TABLE imageid_seq TO pr0n;
98 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE images TO pr0n;
99 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE shadow_files TO pr0n;
100 GRANT SELECT,UPDATE ON TABLE users TO pr0n;
101 GRANT SELECT,INSERT,DELETE ON TABLE exif_info TO pr0n;
102 GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE last_picture_cache TO pr0n;