aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
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;