aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-03-23 13:49:19 +0000
committerEdmund von der Burg <evdb@mysociety.org>2011-03-23 13:49:19 +0000
commitffb2911c93b08e35838c162ba9c2f917364a43c7 (patch)
tree4472e79a667a0b459a8df68268053afa48695f53 /db
parent3098cbbf0dedf14dea0a10e7bdcba248a394d195 (diff)
Move phone from problem to user
Diffstat (limited to 'db')
-rw-r--r--db/schema_0001-add_sessions_and_users_and_dbic_fields.sql1
-rw-r--r--db/schema_0002-create_users_from_problems_and_link.sql9
2 files changed, 9 insertions, 1 deletions
diff --git a/db/schema_0001-add_sessions_and_users_and_dbic_fields.sql b/db/schema_0001-add_sessions_and_users_and_dbic_fields.sql
index ad95f556f..315cf2fda 100644
--- a/db/schema_0001-add_sessions_and_users_and_dbic_fields.sql
+++ b/db/schema_0001-add_sessions_and_users_and_dbic_fields.sql
@@ -14,6 +14,7 @@ create table users (
id serial not null primary key,
email text not null unique,
name text,
+ phone text,
password text not null default ''
);
diff --git a/db/schema_0002-create_users_from_problems_and_link.sql b/db/schema_0002-create_users_from_problems_and_link.sql
index 73ec4a91e..bfb502a96 100644
--- a/db/schema_0002-create_users_from_problems_and_link.sql
+++ b/db/schema_0002-create_users_from_problems_and_link.sql
@@ -29,7 +29,12 @@ UPDATE users
SET name = (
select name from problem
where user_id = users.id
- and anonymous = false
+ order by created desc
+ limit 1
+ ),
+ phone = (
+ select phone from problem
+ where user_id = users.id
order by created desc
limit 1
);
@@ -42,5 +47,7 @@ ALTER TABLE problem
-- drop emails from the problems
ALTER TABLE problem
DROP COLUMN email;
+ALTER TABLE problem
+ DROP COLUMN phone;
commit;