From fb7bde3a6ca049700a691324c21005ae26782584 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <archlinux@cryptocrack.de>
Date: Tue, 4 Feb 2014 18:39:49 +0100
Subject: 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>
---
 support/schema/aur-schema.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'support/schema/aur-schema.sql')

diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql
index 25e828e..c01701c 100644
--- a/support/schema/aur-schema.sql
+++ b/support/schema/aur-schema.sql
@@ -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;
-- 
cgit v1.3.1

