view database/schema/admin.sql @ 56:42d7888272a0 default tip

Implement fetch_classifications().
author David A. Holland
date Sun, 10 Apr 2022 19:37:18 -0400
parents 40f64a96481f
children
line wrap: on
line source

--
-- 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,
	description text	not null
)
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 adminmailtypes VALUES ('locked', 'Comments on locked PRs');
INSERT INTO adminmailtypes VALUES ('nonexistent', 'Comments on nonexistent PRs');
INSERT INTO adminmailtypes VALUES ('fbounces', 'Feedback nag-mail bounces');
INSERT INTO adminmailtypes VALUES ('rbounces', 'Responsible nag-mail bounces');
INSERT INTO adminmailtypes VALUES ('bounces', 'Other bounces');
INSERT INTO adminmailtypes 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,
	userid bigint		null references users
)
WITHOUT OIDS;

-- adminmailtypes is fixed
-- adminmailqueue is append-only except to admins
GRANT SELECT, INSERT, UPDATE, DELETE ON adminmailqueue TO swallowtail_admin;
GRANT INSERT ON attachments TO swallowtail_writer;