# HG changeset patch
# User David A. Holland
# Date 1402870579 14400
# Node ID debc55088b4fc347f81e3ae54c33f724c4f389ac
# Parent  e1017d5564377420130c0ff865c5639ccbe8d185
add administrative queue

diff -r e1017d556437 -r debc55088b4f database/schema.sql
--- a/database/schema.sql	Sun Jun 15 18:16:12 2014 -0400
+++ b/database/schema.sql	Sun Jun 15 18:16:19 2014 -0400
@@ -16,6 +16,8 @@
 
 \ir schema/logs.sql
 
+\ir schema/admin.sql
+
 commit;
 
 
diff -r e1017d556437 -r debc55088b4f database/schema/admin.sql
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/database/schema/admin.sql	Sun Jun 15 18:16:19 2014 -0400
@@ -0,0 +1,34 @@
+--
+-- Queue of administrative requests.
+--
+-- The following things appear in the admin queue:
+--    * comments filed on locked PRs
+--    * bounce mail (for feedback messages, for other messages)
+--    * junk mail (unrecognized incoming mail)
+--
+-- These all are associated with incoming messages and refer to the
+-- rawmail table. The pr and user fields are not null if we can figure
+-- out what it's about, which we sometimes can but often can't.
+--
+
+CREATE TABLE adminmailtypes (
+	type text		primary key,
+	desc text
+)
+WITHOUT OIDS;
+
+-- this is not configurable as the logic for recognizing these is open-coded
+-- XXX should probably use an enum type for this instead
+INSERT INTO adminmaintypes VALUES ('locked', 'Comments on locked PRs');
+INSERT INTO adminmaintypes VALUES ('fbounces', 'Feedback nag-mail bounces');
+INSERT INTO adminmaintypes VALUES ('rbounces', 'Responsible nag-mail bounces');
+INSERT INTO adminmaintypes VALUES ('bounces', 'Other bounces');
+INSERT INTO adminmaintypes VALUES ('junk', 'Unrecognized mail traffic');
+
+CREATE TABLE adminmailqueue (
+	rawmsg bigint		not null references rawmail,
+	type text		not null references adminmailtypes,
+	pr bigint		null references PRs,
+	user bigint		null references users
+)
+WITHOUT OIDS;