1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
-- Messageboard
CREATE TABLE threads (
id SERIAL NOT NULL PRIMARY KEY,
title varchar(50) NOT NULL DEFAULT '',
count smallint NOT NULL DEFAULT 0,
locked smallint NOT NULL DEFAULT 0,
hidden smallint NOT NULL DEFAULT 0
) WITHOUT OIDS;
CREATE TABLE threads_tags (
tid integer NOT NULL DEFAULT 0 REFERENCES threads (id) DEFERRABLE INITIALLY DEFERRED,
type char(2) NOT NULL DEFAULT 0,
iid integer NOT NULL DEFAULT 0, -- references to (vn|releases|producers|users).id
PRIMARY KEY(tid, type, iid)
) WITHOUT OIDS;
CREATE TABLE threads_posts (
tid integer NOT NULL DEFAULT 0 REFERENCES threads (id) DEFERRABLE INITIALLY DEFERRED,
num integer NOT NULL DEFAULT 0,
uid integer NOT NULL DEFAULT 0 REFERENCES users (id) DEFERRABLE INITIALLY DEFERRED,
date bigint NOT NULL DEFAULT DATE_PART('epoch', NOW()),
edited bigint NOT NULL DEFAULT 0,
hidden smallint NOT NULL DEFAULT 0,
msg text NOT NULL DEFAULT '',
PRIMARY KEY(tid, num)
) WITHOUT OIDS;
-- Remove the rating/ranking system
ALTER TABLE vn DROP COLUMN c_votes;
DROP FUNCTION calculate_rating();
|