From 33074d2d554990621d6941f9c7bf02b7a8ffb18a Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Wed, 15 Jun 2011 15:22:38 +0100
Subject: update constraint on problem states

---
 db/schema.sql | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index 9c5b3d8fd..823a60485 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -165,7 +165,13 @@ create table problem (
     state text not null check (
         state = 'unconfirmed'
         or state = 'confirmed'
+        or state = 'investigating'
+        or state = 'planned'
+        or state = 'in progress'
+        or state = 'will not fix'
         or state = 'fixed'
+        or state = 'fixed - council'
+        or state = 'fixed - user'
         or state = 'hidden'
         or state = 'partial'
     ),
-- 
cgit v1.2.3


From 4d40d4632325a999b66dee1db36841dfeb60bcda Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Thu, 16 Jun 2011 12:40:39 +0100
Subject: rename will not fix to closed

---
 db/schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index 823a60485..bb720077b 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -168,7 +168,7 @@ create table problem (
         or state = 'investigating'
         or state = 'planned'
         or state = 'in progress'
-        or state = 'will not fix'
+        or state = 'closed'
         or state = 'fixed'
         or state = 'fixed - council'
         or state = 'fixed - user'
-- 
cgit v1.2.3


From fbabbc2c6fa978ee1476b5c559d6b7af0fe7760e Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Wed, 22 Jun 2011 17:42:02 +0100
Subject: add from_authority flag to users table for council employees etc

---
 db/schema.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index bb720077b..984ceb690 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -131,6 +131,7 @@ create table users (
     name            text,
     phone           text,
     password        text    not null default ''
+    from_authority  boolean not null default false -- users is from a council etc
 );
 
 -- Problems reported by users of site
-- 
cgit v1.2.3


From 41c7d068f954e062b4da0675b5782211b8ad10c3 Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Thu, 23 Jun 2011 14:26:26 +0100
Subject: add problem state_column to comment

---
 db/schema.sql | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index 984ceb690..21fc3371a 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -287,6 +287,16 @@ create table comment (
     cobrand_data text not null default '' check (cobrand_data ~* '^[a-z0-9]*$'), -- Extra data used in cobranded versions of the site
     mark_fixed boolean not null,
     mark_open boolean not null default 'f'
+    problem_state text check (
+        problem_state = 'confirmed'
+        or problem_state = 'investigating'
+        or problem_state = 'planned'
+        or problem_state = 'in progress'
+        or problem_state = 'closed'
+        or problem_state = 'fixed'
+        or problem_state = 'fixed - council'
+        or problem_state = 'fixed - user'
+    )
     -- other fields? one to indicate whether this was written by the council
     -- and should be highlighted in the display?
 );
-- 
cgit v1.2.3


From 8b4aa43fc9fe027fd4e418cc2cd49924fd3ddfa3 Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Mon, 27 Jun 2011 16:17:17 +0100
Subject: update users table to user from_council

---
 db/schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index 21fc3371a..22269e98d 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -131,7 +131,7 @@ create table users (
     name            text,
     phone           text,
     password        text    not null default ''
-    from_authority  boolean not null default false -- users is from a council etc
+    from_council    integer -- id of council user is from or null/0 if not
 );
 
 -- Problems reported by users of site
-- 
cgit v1.2.3


From a4405fe76ab6a86fe1dd1a8ffe02c21abe91a1e4 Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Mon, 27 Jun 2011 16:32:34 +0100
Subject: allow user changes to be logged

---
 db/schema.sql | 1 +
 1 file changed, 1 insertion(+)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index 22269e98d..bf019c7ec 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -395,6 +395,7 @@ create table admin_log (
     object_type text not null check (
       object_type = 'problem'
       or object_type = 'update'
+      or object_type = 'user'
     ),
     object_id integer not null,
     action text not null check (
-- 
cgit v1.2.3


From 8166f167f4446c1f419f17ae192405c80af8e2da Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Thu, 30 Jun 2011 17:59:13 +0100
Subject: syntax error

---
 db/schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index bf019c7ec..cad42fdcb 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -286,7 +286,7 @@ create table comment (
     lang text not null default 'en-gb',
     cobrand_data text not null default '' check (cobrand_data ~* '^[a-z0-9]*$'), -- Extra data used in cobranded versions of the site
     mark_fixed boolean not null,
-    mark_open boolean not null default 'f'
+    mark_open boolean not null default 'f',
     problem_state text check (
         problem_state = 'confirmed'
         or problem_state = 'investigating'
-- 
cgit v1.2.3


From 63809a2ec855076deeaf79fe5b57e7173b6a79f8 Mon Sep 17 00:00:00 2001
From: Struan Donald <struan@exo.org.uk>
Date: Thu, 30 Jun 2011 18:01:54 +0100
Subject: another syntax error

---
 db/schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'db/schema.sql')

diff --git a/db/schema.sql b/db/schema.sql
index cad42fdcb..5213e8a02 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -130,7 +130,7 @@ create table users (
     email           text    not null unique,
     name            text,
     phone           text,
-    password        text    not null default ''
+    password        text    not null default '',
     from_council    integer -- id of council user is from or null/0 if not
 );
 
-- 
cgit v1.2.3

