changeset 10:1720f45dd495

Replace insane handling of states with something more likely workable.
author David A. Holland
date Sun, 19 Feb 2012 20:21:51 -0500
parents efb427d8b704
children d42c0db81e28
files database/schema/bugs.sql database/schema/config.sql
diffstat 2 files changed, 35 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/database/schema/bugs.sql	Sun Feb 19 19:55:32 2012 -0500
+++ b/database/schema/bugs.sql	Sun Feb 19 20:21:51 2012 -0500
@@ -15,48 +15,14 @@
 	confidential boolean	not null,
 
 	-- states
-	--
-	-- there are 64 combinations but only these 15 are valid:
-	--    (un)locked closed			("closed")
-	--    (un)locked closed analyzed	("closed")
-	--    (un)locked closed invalid		("dead")
-	--    unlocked open			("open")
-	--    unlocked open analyzed		("analyzed")
-	--    unlocked open analyzed? feedback	("feedback")
-	--    unlocked open analyzed? suspended	("suspended")
-	--    unlocked open analyzed? feedback suspended ("stuck")
-	--    unlocked open invalid feedback	("incomplete")
-	--
-	-- gnats states map to: open	inval.	anal.	feedb.	susp.
-	--   open		open
-	--   analyzed		open analyzed
-	--   feedback		open feedback
-	--   (pullups-needed)	open (*)
-	--   pending-pullups	open (*)
-	--   suspended		open analyzed suspended
-	--   (stuck)		open feedback suspended
-	--   closed		-
-	--   dead		invalid
-	--
-	-- The cases marked (*) are distinguished from open by the
-	-- branchstate in the relevance table.
+	state text		not null references states (name);
+	locked boolean		not null,	-- deny modifications
 
-	locked boolean		not null,	-- deny modifications
-	open boolean		not null,	-- master switch
-
-	invalid boolean		not null,	-- report is no good
-	analyzed boolean	not null,	-- issue is believed understood
-	feedback boolean	not null,	-- feedback required
-	suspended boolean	not null,	-- work halted
-
-	-- feedback and suspended imply open
-	check NOT (NOT open AND (feedback OR suspended)),
-	-- invalid precludes analyzed and suspended
-	check NOT (invalid AND (analyzed OR suspended)),
-	-- open and invalid implies feedback
-	check NOT (NOT feedback AND open AND invalid),
-	-- locked implies not open
-	check NOT (open AND locked),
+	-- intended constraint:
+	-- select * from PRs, states where PRs.state = states.name
+	--    and states.closed = false and PRs.locked = true
+	-- should always return empty.
+	-- (no PR should be locked unless it is closed)
 
 	-- fixed-size history
 	arrival_schemaversion int  not null,
--- a/database/schema/config.sql	Sun Feb 19 19:55:32 2012 -0500
+++ b/database/schema/config.sql	Sun Feb 19 20:21:51 2012 -0500
@@ -24,16 +24,40 @@
 WITHOUT OIDS;
 
 -- Types of bugs (sw-bug, doc-bug, etc.)
-create table classes (
+CREATE TABLE classes (
 	name text		primary key,
 	obsolete boolean	not null,
 	description text
-) without oids;
+) WITHOUT OIDS;
 
 -- Categories of bugs (bin, kern, pkg, etc.)
-create table categories (
+CREATE TABLE categories (
 	name text		primary key,
 	obsolete boolean	not null,
 	description text	
-) without oids;
+) WITHOUT OIDS;
 
+-- States of bugs
+--
+-- The additional booleans govern the semantics of the defined states.
+--    closed		resolved (one way or another)
+--    nagresponsible	the "responsible" users should get nag-mail
+--    nagsubmitter	the "submitter" users should get nag-mail
+--
+-- It is reasonable for multiple states to have the same settings;
+-- such states presumably mean different things in ways the database
+-- doesn't need to know about.
+--
+-- For example: "open" might be defined as
+--     ("open", false, "bug is unresolved", false, true, false)
+-- and "feedback" as
+--     ("feedback", false, "awaiting submitter feedback", false, false, true)
+--
+CREATE TABLE states (
+       name text		primary key,
+       obsolete boolean		not null,
+       description text		,
+       closed boolean		not null,
+       nagresponsible boolean	not null,
+       nagsubmitter boolean	not null
+) WITHOUT OIDS;