]> git.sesse.net Git - pr0n/blobdiff - sql/pr0n.sql
Support caching of the index pages. (Cache invalidation coming soon!)
[pr0n] / sql / pr0n.sql
index 5407ce812b1f043628044f760cdb8350dac15d79..583b00f287a3e444cbc8ebf103189af0bb4bf642 100644 (file)
@@ -3,11 +3,17 @@ CREATE TABLE events (
     date character varying NOT NULL,
     name character varying NOT NULL,
     vhost character varying NOT NULL,
-    last_picture timestamp without time zone DEFAULT '1970-01-01 00:00:00'::timestamp without time zone NOT NULL
+    last_update timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+-- In a separate table to avoid deadlocks.
+CREATE TABLE last_picture_cache ( 
+   event varchar PRIMARY KEY references events ( id ),
+   last_picture timestamp without time zone
 );
 
 CREATE TABLE images (
-    id integer serial NOT NULL PRIMARY KEY REFERENCES events(id),
+    id serial NOT NULL PRIMARY KEY REFERENCES events(id),
     event character varying NOT NULL,
     filename character varying NOT NULL,
     width integer DEFAULT -1 NOT NULL,