From: Steinar H. Gunderson Date: Tue, 21 Aug 2007 04:49:25 +0000 (+0200) Subject: Remember to do the width/height -1 => NULL change in the actual original schema X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=4c7426477a73edd5ad88bfebda56575019d5ca06 Remember to do the width/height -1 => NULL change in the actual original schema as well. Also remember to do deleted_images, not just images. --- diff --git a/sql/pr0n.sql b/sql/pr0n.sql index 0bca09a..5fd04e7 100644 --- a/sql/pr0n.sql +++ b/sql/pr0n.sql @@ -23,8 +23,8 @@ CREATE TABLE images ( vhost character varying NOT NULL, event character varying NOT NULL, filename character varying NOT NULL, - width integer DEFAULT -1 NOT NULL, - height integer DEFAULT -1 NOT NULL, + width integer, + height integer, uploadedby character varying NOT NULL, "date" timestamp without time zone, takenby character varying NOT NULL, @@ -39,8 +39,8 @@ CREATE TABLE deleted_images ( vhost character varying, event character varying NOT NULL, filename character varying NOT NULL, - width integer DEFAULT -1 NOT NULL, - height integer DEFAULT -1 NOT NULL, + width integer, + height integer, uploadedby character varying, "date" timestamp without time zone, takenby character varying NOT NULL, diff --git a/sql/upgrade-v2.50.sql b/sql/upgrade-v2.50.sql index 0d44ba3..d59ee9e 100644 --- a/sql/upgrade-v2.50.sql +++ b/sql/upgrade-v2.50.sql @@ -24,3 +24,10 @@ ALTER TABLE images ALTER COLUMN width SET DEFAULT NULL; ALTER TABLE images ALTER COLUMN height SET DEFAULT NULL; UPDATE images SET width=NULL,height=NULL WHERE width=-1 OR height=-1; ALTER TABLE images ADD CONSTRAINT width_height_nullity CHECK ((width IS NULL) = (height IS NULL)); + +ALTER TABLE deleted_images ALTER COLUMN width DROP NOT NULL; +ALTER TABLE deleted_images ALTER COLUMN height DROP NOT NULL; +ALTER TABLE deleted_images ALTER COLUMN width SET DEFAULT NULL; +ALTER TABLE deleted_images ALTER COLUMN height SET DEFAULT NULL; +UPDATE deleted_images SET width=NULL,height=NULL WHERE width=-1 OR height=-1; +ALTER TABLE deleted_images ADD CONSTRAINT width_height_nullity CHECK ((width IS NULL) = (height IS NULL));