From 66d6f52d8c8c10698723bebb73ae02e996f8b977 Mon Sep 17 00:00:00 2001 From: jnix-unbound Date: Fri, 9 Nov 2012 17:02:01 -0800 Subject: [PATCH] Update crapmap_fb_db --- crapmap_fb_db | 81 ++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 50 deletions(-) diff --git a/crapmap_fb_db b/crapmap_fb_db index bb36462..702fd3b 100644 --- a/crapmap_fb_db +++ b/crapmap_fb_db @@ -1,83 +1,64 @@ - CREATE TABLE Pledges ( - pledge_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT, - pledge_text varchar(160), - pledge_create_timestamp timestamp, + id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT, + pledgetext varchar(160), + created timestamp ); CREATE TABLE FacebookUsers ( - fb_id int(50) unsigned NOT NULL PRIMARY KEY AUTOINCREMENT, + fb_id int(50) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, firstname varchar(30) NOT NULL, lastname varchar(30), - user_create_timestamp timestamp, + created timestamp ); CREATE TABLE Location ( - location_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT, - location_latitude decimal(7,5), - location_longitude decimal(8,5), - location_description varchar(1000), - location_name varchar(50), - location_create_timestamp timestamp, + id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT, + latitude decimal(7,5), + longitude decimal(8,5), + description varchar(1000), + name varchar(50), + created timestamp ); -CREATE TABLE PhoneNumbers +CREATE TABLE PhoneUsers ( - phone_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT, - phone_number varchar(20), - phone_number_create_timestamp timestamp, + id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT, + phonenumber varchar(20), + created timestamp ); CREATE TABLE CrapHistory ( - crap_history_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT, - crap_quantity_count int(1000), - crap_sighting_count int(1000), - location_id int(50), - phone_id int(50), - fb_id int(50), - crap_history_create_timestamp timestamp, + id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT, + quantity int, + sighting tinyint, + location_id int, + phoneuser_id int, + facebookuser_id int, + created timestamp ); CREATE TABLE PledgeLocations ( - pledge_locations_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT, - location_id int(50), - pledge_1 varchar(160), - pledge_2 varchar(160), - pledge_3 varchar(160), - pledge_locations_create_timestamp timestamp, + id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT, + location_id int, + pledge1 int, + pledge2 int, + pledge3 int, + created timestamp ); CREATE TABLE UserPledges ( - user_pledges_id int(50) NOT NULL PRIMARY KEY AUTOINCREMENT, + id int(50) NOT NULL PRIMARY KEY AUTO_INCREMENT, user_id int(50), location_id int(50), pledge_id int(50), - phone_id int(20), - user_pledges_create_timestamp timestamp, + phonenumber_id int(20), + created timestamp ); -================================== - -JSON API - -GET: from SMS app: - -request: /location/ -response: - success: crap sighting_count - see crap history table - failure: null - -POST: from SMS app: - -request: /location/ - phone_number - set in PhoneNumbers table - - -