-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tables.txt
7 lines (4 loc) · 974 Bytes
/
Tables.txt
1
2
3
4
5
6
7
CREATE TABLE Threads (ThreadID INT UNSIGNED PRIMARY KEY, URL VARCHAR(255) NOT NULL, Item VARCHAR(255) NOT NULL, Content TEXT NOT NULL, Yes SMALLINT UNSIGNED NOT NULL DEFAULT 0, No SMALLINT UNSIGNED NOT NULL DEFAULT 0, Created INT UNSIGNED NOT NULL);
CREATE TABLE Posts (PostID INT UNSIGNED PRIMARY KEY, ThreadID INT UNSIGNED NOT NULL, Scores SMALLINT NOT NULL, Replies SMALLINT UNSIGNED NOT NULL, Views MEDIUMINT UNSIGNED NOT NULL, Content TEXT NOT NULL, Time INT UNSIGNED NOT NULL, FOREIGN KEY (ThreadID) REFERENCES Threads(ThreadID));
CREATE TABLE ThreadRates (ThreadRateID INT UNSIGNED PRIMARY KEY, ThreadID INT UNSIGNED NOT NULL, Scores SMALLINT NOT NULL, Replies SMALLINT UNSIGNED NOT NULL, Views MEDIUMINT UNSIGNED NOT NULL, Time INT UNSIGNED NOT NULL, FOREIGN KEY (ThreadID) REFERENCES Threads(ThreadID));
CREATE TABLE Votes (VoteID INT UNSIGNED NOT NULL, ThreadID INT UNSIGNED NOT NULL, Yes BOOLEAN NOT NULL, FOREIGN KEY (ThreadID) REFERENCES Threads(ThreadID));