summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/dump.sql2
-rw-r--r--util/updates/update_1.22.sql5
2 files changed, 7 insertions, 0 deletions
diff --git a/util/dump.sql b/util/dump.sql
index cedd2518..39e74bad 100644
--- a/util/dump.sql
+++ b/util/dump.sql
@@ -233,6 +233,7 @@ CREATE TABLE vn_screenshots (
vid integer NOT NULL DEFAULT 0,
scr integer NOT NULL DEFAULT 0,
nsfw boolean NOT NULL DEFAULT FALSE,
+ rid integer DEFAULT NULL,
PRIMARY KEY(vid, scr)
);
@@ -305,6 +306,7 @@ ALTER TABLE vn_rev ADD FOREIGN KEY (id) REFERENCES changes
ALTER TABLE vn_rev ADD FOREIGN KEY (vid) REFERENCES vn (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE vn_screenshots ADD FOREIGN KEY (vid) REFERENCES vn_rev (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE vn_screenshots ADD FOREIGN KEY (scr) REFERENCES screenshots (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE vn_screenshots ADD FOREIGN KEY (rid) REFERENCES releases (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE vnlists ADD FOREIGN KEY (uid) REFERENCES users (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE vnlists ADD FOREIGN KEY (vid) REFERENCES vn (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE votes ADD FOREIGN KEY (uid) REFERENCES users (id) DEFERRABLE INITIALLY DEFERRED;
diff --git a/util/updates/update_1.22.sql b/util/updates/update_1.22.sql
index 9a81b2c6..897b0a2b 100644
--- a/util/updates/update_1.22.sql
+++ b/util/updates/update_1.22.sql
@@ -27,3 +27,8 @@ ALTER TABLE changes ADD FOREIGN KEY (causedby) REFERENCES changes (id) DEFERRABL
ALTER TABLE threads_posts ALTER COLUMN num TYPE smallint;
ALTER TABLE threads ADD FOREIGN KEY (id, count) REFERENCES threads_posts (tid, num) DEFERRABLE INITIALLY DEFERRED;
+
+-- screenshots now have a relation with releases
+ALTER TABLE vn_screenshots ADD COLUMN rid integer DEFAULT NULL REFERENCES releases (id) DEFERRABLE INITIALLY DEFERRED;
+
+