summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authoryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-08-01 10:35:11 +0000
committeryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-08-01 10:35:11 +0000
commitb274ff8a37e90a90c7613b47a84bad1cdc6ddf5f (patch)
tree13798abeee6d3893af98093312ae8d694a404619 /util
parent68d66b006656ed90e08187a2d5ceb95b08e4f279 (diff)
Added wishlist feature and re-added "my profile" link to user menu
git-svn-id: svn://vndb.org/vndb@77 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
Diffstat (limited to 'util')
-rw-r--r--util/dump.sql10
-rw-r--r--util/updates/update_1.20.sql19
2 files changed, 29 insertions, 0 deletions
diff --git a/util/dump.sql b/util/dump.sql
index 54dd9f6b..884c06e8 100644
--- a/util/dump.sql
+++ b/util/dump.sql
@@ -233,6 +233,14 @@ CREATE TABLE votes (
PRIMARY KEY(vid, uid)
);
+-- wlists
+CREATE TABLE wlists (
+ uid integer NOT NULL DEFAULT 0,
+ vid integer NOT NULL DEFAULT 0,
+ wstat smallint NOT NULL DEFAULT 0,
+ added bigint NOT NULL DEFAULT DATE_PART('epoch', NOW()),
+ PRIMARY KEY(uid, vid)
+);
@@ -274,6 +282,8 @@ ALTER TABLE vnlists ADD FOREIGN KEY (uid) REFERENCES users
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;
ALTER TABLE votes ADD FOREIGN KEY (vid) REFERENCES vn (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE wlists ADD FOREIGN KEY (uid) REFERENCES users (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE wlists ADD FOREIGN KEY (vid) REFERENCES vn (id) DEFERRABLE INITIALLY DEFERRED;
diff --git a/util/updates/update_1.20.sql b/util/updates/update_1.20.sql
index 4abd2211..ee155f48 100644
--- a/util/updates/update_1.20.sql
+++ b/util/updates/update_1.20.sql
@@ -15,3 +15,22 @@ CREATE TABLE rlists (
PRIMARY KEY(uid, rid)
) WITHOUT OIDS;
+
+-- wishlist
+CREATE TABLE wlists (
+ uid integer NOT NULL DEFAULT 0 REFERENCES users (id) DEFERRABLE INITIALLY DEFERRED,
+ vid integer NOT NULL DEFAULT 0 REFERENCES vn (id) DEFERRABLE INITIALLY DEFERRED,
+ wstat smallint NOT NULL DEFAULT 0,
+ added bigint NOT NULL DEFAULT DATE_PART('epoch', NOW()),
+ PRIMARY KEY(uid, vid)
+) WITHOUT OIDS;
+
+
+-- move 'Wishlist' and 'Blacklist' statuses of the old VNList to the new wishlist
+INSERT INTO wlists (uid, vid, wstat, added)
+ (SELECT uid, vid, CASE WHEN status = 0 THEN 1 ELSE 3 END, date
+ FROM vnlists
+ WHERE status < 2);
+
+DELETE FROM vnlists WHERE status < 2 AND comments = '';
+