]> git.sesse.net Git - pr0n/commitdiff
Remember to do the width/height -1 => NULL change in the actual original schema
authorSteinar H. Gunderson <sesse@debian.org>
Tue, 21 Aug 2007 04:49:25 +0000 (06:49 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Tue, 21 Aug 2007 04:49:25 +0000 (06:49 +0200)
as well. Also remember to do deleted_images, not just images.

sql/pr0n.sql
sql/upgrade-v2.50.sql

index 0bca09ae79eb41c16ad6231f1c2bc06416171962..5fd04e7e9da4872719e7b1cbe9eaf257b0d53077 100644 (file)
@@ -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,
index 0d44ba3cd700b4135cb0cb9fcd5c1c5af8505d42..d59ee9e13497a838033cb34e1cb4236d1d1b3aaa 100644 (file)
@@ -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));