From 48cc8207bf88beaaedd21ef271b1d012f3e18686 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <archlinux@cryptocrack.de>
Date: Thu, 19 Jun 2014 14:00:12 +0200
Subject: Add support for filing package requests

Add a new entry to the package actions box that allows for filing
deletion and orphan requests. When choosing that action, the user is
redirected to a new page that allows for selecting a request type and
entering a comment. When submitting the request, a new entry in the
request database is created and an email is sent to a configurable
mailing list (defaults to aur-general).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
---
 schema/aur-schema.sql | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

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

diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index 0efae93..88f9974 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -288,6 +288,34 @@ CREATE TABLE PackageBlacklist (
 	UNIQUE (Name)
 ) ENGINE = InnoDB;
 
+-- Define package request types
+--
+CREATE TABLE RequestTypes (
+	ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
+	Name VARCHAR(32) NOT NULL DEFAULT '',
+	PRIMARY KEY (ID)
+) ENGINE = InnoDB;
+INSERT INTO RequestTypes VALUES (1, 'deletion');
+INSERT INTO RequestTypes VALUES (2, 'orphan');
+
+-- Package requests
+--
+CREATE TABLE PackageRequests (
+	ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
+	ReqTypeID TINYINT UNSIGNED NOT NULL,
+	PackageBaseID INTEGER UNSIGNED NULL,
+	PackageBaseName VARCHAR(255) NOT NULL,
+	UsersID INTEGER UNSIGNED NULL DEFAULT NULL,
+	Comments TEXT NOT NULL DEFAULT '',
+	RequestTS BIGINT UNSIGNED NOT NULL DEFAULT 0,
+	PRIMARY KEY (ID),
+	INDEX (UsersID),
+	INDEX (PackageBaseID),
+	FOREIGN KEY (ReqTypeID) REFERENCES RequestTypes(ID) ON DELETE NO ACTION,
+	FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE SET NULL,
+	FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE SET NULL
+) ENGINE = InnoDB;
+
 -- Vote information
 --
 CREATE TABLE IF NOT EXISTS TU_VoteInfo (
-- 
cgit v1.3.1

