_gwm_zipcodes - GolfWithMe/Master GitHub Wiki
Description
This table holds the details of the known zipcodes. When someone new signs up, they have to enter their address and zip code. A regular cron job will go through all of the zipcodes in the user table and if it finds a new one, it will add it to this table with a status of 3.
That same cron job will then look for all zipcodes that are status 3, look up the latitude and longitude and update the zip code table. The status will be set to 2.
The same cron job will then look for any zipcodes that has a status of 2 or the next update time has passed. All of the zipcodes that match will be updated by calling the swingbyswing api and pulling all golf courses within 200 miles of the zip code.
Field Descriptions
uid
The unique record ID
zipcode
This is the zipcode that we need the lat, lon for.
LastUpdate
This is the date of the last pull from swingbyswing to get the golf courses within 200 miles.
NextUpdate
This is the date of the next update from swingbyswing. The cron job will check this value and if the value is in the past it will update the status to 2 for the next step to look up the courses.
Status
This is the status of the zip code.
- 3 - New zipcode, need to look up lat and lon
- 2 - Need to lookup golf courses from this location
- 1 - Good to go, waiting for next update
Lat
This is the latitude of the zip code
Lon
This is the longitude of the zip code
Table Layout
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| uid | int(11) | NO | PRI | NULL | auto_increment |
| zipcode | varchar(50) | YES | | NULL | |
| LastUpdate | datetime | YES | | NULL | |
| NextUpdate | datetime | YES | | NULL | |
| Status | int(11) | YES | | NULL | |
| Lat | float | YES | | NULL | |
| Lon | float | YES | | NULL | |
+------------+-------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)
Creation Script
create table _gwm_zipcodes (uid int auto_increment, zipcode varchar(50), LastUpdate datetime, NextUpdate datetime, Status int, Lat Float, Lon Float, primary key(uid));