aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-12-10 16:28:52 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-12-15 00:11:05 +0000
commitf82abb282f60191ee530c552bf025e509e2a57e8 (patch)
tree009ec8c702c77e5cd4e0b6a48542eee82538d4f5 /db
parent9486610ef67f031d80e70ec3cf1fea330858abd5 (diff)
Rename 'open311conf' database table to 'body'.
Diffstat (limited to 'db')
-rw-r--r--db/schema.sql6
-rw-r--r--db/schema_0027-rename_open311conf.sql12
2 files changed, 15 insertions, 3 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 6ebec5689..87b5102c7 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -447,12 +447,12 @@ create table admin_log (
whenedited timestamp not null default ms_current_timestamp()
);
--- Record open 311 configuration details
+-- Record details of reporting bodies, including open311 configuration details
-create table open311conf (
+create table body (
id serial primary key,
area_id integer not null unique,
- endpoint text not null,
+ endpoint text,
jurisdiction text,
api_key text,
send_method text,
diff --git a/db/schema_0027-rename_open311conf.sql b/db/schema_0027-rename_open311conf.sql
new file mode 100644
index 000000000..cef020648
--- /dev/null
+++ b/db/schema_0027-rename_open311conf.sql
@@ -0,0 +1,12 @@
+begin;
+
+ALTER TABLE open311conf RENAME TO body;
+ALTER INDEX open311conf_pkey RENAME TO body_pkey;
+ALTER INDEX open311conf_area_id_key RENAME TO body_area_id_key;
+ALTER TABLE body ALTER COLUMN endpoint DROP NOT NULL;
+ALTER TABLE body DROP CONSTRAINT open311conf_comment_user_id_fkey;
+ALTER TABLE body ADD CONSTRAINT body_comment_user_id_fkey
+ FOREIGN KEY (comment_user_id) REFERENCES users(id);
+ALTER SEQUENCE open311conf_id_seq RENAME TO body_id_seq;
+
+commit;