aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/schema.sql20
-rw-r--r--db/schema_0013-add_external_id_to_comment.sql6
-rw-r--r--db/schema_0013-add_send_method_column_to_open311conf.sql7
-rw-r--r--db/schema_0014-add_send_fail_columns_to_problem.sql10
-rw-r--r--db/schema_0015-add_extra_to_comment.sql6
-rw-r--r--db/schema_0016-add_whensent_and_send_fail_to_comment.sql11
-rw-r--r--db/schema_0017-add_send_comments_to_open311conf.sql6
-rw-r--r--db/schema_0018-add_comment_user_to_open311conf.sql6
8 files changed, 69 insertions, 3 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 395d1c07b..169939315 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -189,7 +189,12 @@ create table problem (
send_questionnaire boolean not null default 't',
extra text, -- extra fields required for open311
flagged boolean not null default 'f',
- geocode bytea
+ geocode bytea,
+
+ -- logging sending failures (used by webservices)
+ send_fail_count integer not null default 0,
+ send_fail_reason text,
+ send_fail_timestamp timestamp
);
create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude);
create index problem_user_id_idx on problem ( user_id );
@@ -303,9 +308,15 @@ create table comment (
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?
+ external_id text,
+ extra text,
+ send_fail_count integer not null default 0,
+ send_fail_reason text,
+ send_fail_timestamp timestamp,
+ whensent timestamp
);
create index comment_user_id_idx on comment(user_id);
@@ -419,5 +430,8 @@ create table open311conf (
area_id integer not null unique,
endpoint text not null,
jurisdiction text,
- api_key text
+ api_key text,
+ send_method text,
+ send_comments boolean not null default 'f',
+ comment_user_id int references users(id)
);
diff --git a/db/schema_0013-add_external_id_to_comment.sql b/db/schema_0013-add_external_id_to_comment.sql
new file mode 100644
index 000000000..a1cd11c3f
--- /dev/null
+++ b/db/schema_0013-add_external_id_to_comment.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER TABLE comment
+ ADD COLUMN external_id TEXT;
+
+commit;
diff --git a/db/schema_0013-add_send_method_column_to_open311conf.sql b/db/schema_0013-add_send_method_column_to_open311conf.sql
new file mode 100644
index 000000000..516fdd698
--- /dev/null
+++ b/db/schema_0013-add_send_method_column_to_open311conf.sql
@@ -0,0 +1,7 @@
+
+begin;
+
+ALTER table open311conf
+ ADD column send_method TEXT;
+
+commit;
diff --git a/db/schema_0014-add_send_fail_columns_to_problem.sql b/db/schema_0014-add_send_fail_columns_to_problem.sql
new file mode 100644
index 000000000..369c4118d
--- /dev/null
+++ b/db/schema_0014-add_send_fail_columns_to_problem.sql
@@ -0,0 +1,10 @@
+begin;
+
+ALTER table problem
+ ADD column send_fail_count integer not null default 0;
+ALTER table problem
+ ADD column send_fail_reason text;
+ALTER table problem
+ ADD column send_fail_timestamp timestamp;
+
+commit;
diff --git a/db/schema_0015-add_extra_to_comment.sql b/db/schema_0015-add_extra_to_comment.sql
new file mode 100644
index 000000000..5c1789ea2
--- /dev/null
+++ b/db/schema_0015-add_extra_to_comment.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER TABLE comment
+ ADD COLUMN extra TEXT;
+
+commit;
diff --git a/db/schema_0016-add_whensent_and_send_fail_to_comment.sql b/db/schema_0016-add_whensent_and_send_fail_to_comment.sql
new file mode 100644
index 000000000..792ff2e38
--- /dev/null
+++ b/db/schema_0016-add_whensent_and_send_fail_to_comment.sql
@@ -0,0 +1,11 @@
+begin;
+
+ALTER table comment
+ ADD column send_fail_count integer not null default 0;
+ALTER table comment
+ ADD column send_fail_reason text;
+ALTER table comment
+ ADD column send_fail_timestamp timestamp;
+ALTER table comment
+ ADD column whensent timestamp;
+commit;
diff --git a/db/schema_0017-add_send_comments_to_open311conf.sql b/db/schema_0017-add_send_comments_to_open311conf.sql
new file mode 100644
index 000000000..0ee015575
--- /dev/null
+++ b/db/schema_0017-add_send_comments_to_open311conf.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER table open311conf
+ ADD column send_comments BOOL NOT NULL DEFAULT 'f';
+
+commit;
diff --git a/db/schema_0018-add_comment_user_to_open311conf.sql b/db/schema_0018-add_comment_user_to_open311conf.sql
new file mode 100644
index 000000000..93851e2a3
--- /dev/null
+++ b/db/schema_0018-add_comment_user_to_open311conf.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER TABLE open311conf
+ ADD COLUMN comment_user_id INT REFERENCES users(id);
+
+commit;