aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-10-09 13:10:23 +0100
committerStruan Donald <struan@exo.org.uk>2012-10-09 13:10:23 +0100
commitde3ec1fbef726e3794096d99cb1f3ca7066a5768 (patch)
tree8c6b94caa9b033477e87557865066d94d30b5057 /db
parent2b0fc3749e9cf5d210718c0082606640b3148ae1 (diff)
set interest_count default to 0 as null + 1 = null in postgres :(
tests for the ui for interest_count as well
Diffstat (limited to 'db')
-rw-r--r--db/schema.sql2
-rw-r--r--db/schema_0026-change_interest_count_default.sql9
2 files changed, 10 insertions, 1 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 8757cf80e..7cb2f3257 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -217,7 +217,7 @@ create table problem (
external_source_id text,
-- number of me toos
- interest_count integer
+ interest_count integer default 0
);
create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude);
create index problem_user_id_idx on problem ( user_id );
diff --git a/db/schema_0026-change_interest_count_default.sql b/db/schema_0026-change_interest_count_default.sql
new file mode 100644
index 000000000..7c78f6fe8
--- /dev/null
+++ b/db/schema_0026-change_interest_count_default.sql
@@ -0,0 +1,9 @@
+BEGIN;
+
+ ALTER TABLE problem
+ ALTER COLUMN interest_count SET DEFAULT 0;
+
+ UPDATE problem SET interest_count = 0
+ WHERE interest_count IS NULL;
+
+COMMIT;