Add support for anonymous comments

This allows for removing users without also removing the corresponding
comments. Instead, all comments from deleted users will be displayed as
"Anonymous comment".

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-02-04 18:39:49 +01:00
parent 6ee1321211
commit fb7bde3a6c
4 changed files with 33 additions and 8 deletions

View file

@ -161,14 +161,14 @@ CREATE UNIQUE INDEX VoteUsersIDPackageID ON PackageVotes (UsersID, PackageID);
CREATE TABLE PackageComments (
ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
PackageID INTEGER UNSIGNED NOT NULL,
UsersID INTEGER UNSIGNED NOT NULL,
UsersID INTEGER UNSIGNED NULL DEFAULT NULL,
Comments TEXT NOT NULL DEFAULT '',
CommentTS BIGINT UNSIGNED NOT NULL DEFAULT 0,
DelUsersID INTEGER UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (ID),
INDEX (UsersID),
INDEX (PackageID),
FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE,
FOREIGN KEY (UsersID) REFERENCES Users(ID) ON SET NULL,
FOREIGN KEY (DelUsersID) REFERENCES Users(ID) ON DELETE CASCADE,
FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE
) ENGINE = InnoDB;