diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 16:25:31 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 16:25:31 +0100 |
commit | 8c3f0fbfb4bcd33fa8dbc93c2ecb8e0f25ebf383 (patch) | |
tree | 0b596b32bc9248d10e6f4409e39d3285e957d40a /db/schema.sql | |
parent | 298db521933eb65591fafa218e78f5f4cdb547ad (diff) | |
parent | 426bc926a422af21ff39cebed836d34e46238500 (diff) |
Merge branch 'issues/forcouncils/192-unused-categories'
Diffstat (limited to 'db/schema.sql')
-rw-r--r-- | db/schema.sql | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/db/schema.sql b/db/schema.sql index 18c1533d9..d35071c0f 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -69,8 +69,12 @@ create table contacts ( body_id integer not null references body(id), category text not null default 'Other', email text not null, - confirmed boolean not null, - deleted boolean not null, + state text not null check ( + state = 'unconfirmed' + or state = 'confirmed' + or state = 'inactive' + or state = 'deleted' + ), -- last editor editor text not null, @@ -102,8 +106,12 @@ create table contacts_history ( body_id integer not null, category text not null default 'Other', email text not null, - confirmed boolean not null, - deleted boolean not null, + state text not null check ( + state = 'unconfirmed' + or state = 'confirmed' + or state = 'inactive' + or state = 'deleted' + ), -- editor editor text not null, @@ -118,7 +126,7 @@ create table contacts_history ( create function contacts_updated() returns trigger as ' begin - insert into contacts_history (contact_id, body_id, category, email, editor, whenedited, note, confirmed, deleted) values (new.id, new.body_id, new.category, new.email, new.editor, new.whenedited, new.note, new.confirmed, new.deleted); + insert into contacts_history (contact_id, body_id, category, email, editor, whenedited, note, state) values (new.id, new.body_id, new.category, new.email, new.editor, new.whenedited, new.note, new.state); return new; end; ' language 'plpgsql'; |