aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema_0066-user-area-ids.sql
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2019-02-12 14:01:38 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2019-02-14 16:55:24 +0000
commitc2089e945132d36468f1d9a3bf08ae4d661cf44a (patch)
tree755780edf643ebd8babb910632eb259623fd8a24 /db/schema_0066-user-area-ids.sql
parent1825a09bbdfee97928a251a84534d859b1a43387 (diff)
Allow user to be associated with multiple areas.
Update database to store an array of IDs rather than only one; consequential changes to the admin and the dashboard to allow selection.
Diffstat (limited to 'db/schema_0066-user-area-ids.sql')
-rw-r--r--db/schema_0066-user-area-ids.sql7
1 files changed, 7 insertions, 0 deletions
diff --git a/db/schema_0066-user-area-ids.sql b/db/schema_0066-user-area-ids.sql
new file mode 100644
index 000000000..53ffc31f0
--- /dev/null
+++ b/db/schema_0066-user-area-ids.sql
@@ -0,0 +1,7 @@
+BEGIN;
+
+ALTER TABLE users ADD COLUMN area_ids integer ARRAY;
+UPDATE users SET area_ids = ARRAY[area_id] WHERE area_id IS NOT NULL;
+ALTER TABLE users DROP COLUMN area_id;
+
+COMMIT;