X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=sql%2Fpr0n.sql;h=860fd475bf55fd9f2004bd535213907cacbb8b3e;hp=f3f2087e6ce7b8d7db298c1d60841d4d655868a4;hb=6c8c4bf3f1e3109523f9ec6117abfdf0e04a0d99;hpb=eac2adad0a49c50b3db6f96c3bd799e3ca2b8d24 diff --git a/sql/pr0n.sql b/sql/pr0n.sql index f3f2087..860fd47 100644 --- a/sql/pr0n.sql +++ b/sql/pr0n.sql @@ -34,8 +34,16 @@ CREATE TABLE images ( selected boolean DEFAULT false, model character varying, lens character varying, + is_render boolean NOT NULL DEFAULT false, -- Is this a render of another picture? (If so, don't show it separately.) + render_id integer, -- If not NULL, show this picture instead of ourselves for all JPEG-creation purposes. - FOREIGN KEY (vhost,event) REFERENCES events (vhost,event) + FOREIGN KEY (vhost,event) REFERENCES events (vhost,event), + FOREIGN KEY (vhost,event,render_id) REFERENCES images (vhost,event,id), + + -- Redundant with the primary key, but the foreign key needs it. + UNIQUE (vhost,event,id), + + CHECK (NOT (is_render AND (render_id IS NOT NULL))) ); CREATE UNIQUE INDEX unique_filenames ON images USING btree (vhost, event, filename); @@ -52,6 +60,8 @@ CREATE TABLE deleted_images ( selected boolean, model character varying, lens character varying + is_render boolean NOT NULL, + render_id integer, ); CREATE TABLE users (