diff database/schema/bugs.sql @ 39:45bb7b516edb

document previous better
author David A. Holland
date Sun, 15 Jun 2014 17:28:02 -0400
parents 68a4f2d8930e
children 81851564f552
line wrap: on
line diff
--- a/database/schema/bugs.sql	Sun Jun 15 17:21:54 2014 -0400
+++ b/database/schema/bugs.sql	Sun Jun 15 17:28:02 2014 -0400
@@ -35,6 +35,14 @@
 	-- should be nulled.
 	timeout_date timestamp	null,
 	timeout_state text	null references states (name),
+	check (timestamp is null == timeout_state is null),
+
+	-- intended constraint:
+	-- select * from PRs, states where PRs.state = states.name
+	--    and states.timeout <> PRs.timeout_date is not null
+	-- should always return empty.
+	-- (All PRs in timeout states should have timeouts, and those
+	-- not in timeout states should not.)
 
 	-- fixed-size history
 	arrival_schemaversion int  not null,