diff --git a/scrape/build_db.js b/scrape/build_db.js index 29413ab..dc51f0e 100755 --- a/scrape/build_db.js +++ b/scrape/build_db.js @@ -36,11 +36,11 @@ var conn = mysql.createConnection({ // conn.query('DROP TABLE IF EXISTS reviews'); -conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, delicious FLOAT NOT NULL, accomodating FLOAT NOT NULL, affordable FLOAT NOT NULL, atmospheric FLOAT NOT NULL, latitude FLOAT NOT NULL, longitude FLOAT NOT NULL, distanceToStation FLOAT NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY)'); +conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, delicious FLOAT NOT NULL, accomodating FLOAT NOT NULL, affordable FLOAT NOT NULL, atmospheric FLOAT NOT NULL, latitude FLOAT NOT NULL, longitude FLOAT NOT NULL, distanceToStn FLOAT NOT NULL, closestStn VARCHAR(100) NOT NULL, id INT NOT NULL AUTO_INCREMENT PRIMARY KEY)'); for (var i = 0, count = data.length; i < count; ++i) { var record = data[i]; - conn.query('INSERT INTO reviews(name, url, delicious, accomodating, affordable, atmospheric, latitude, longitude, distanceToStation) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)', [ + conn.query('INSERT INTO reviews(name, url, delicious, accomodating, affordable, atmospheric, latitude, longitude, distanceToStn, closestStn) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [ record.name, record.relativeUrl, record.rating.food, @@ -49,7 +49,8 @@ for (var i = 0, count = data.length; i < count; ++i) { record.rating.atmosphere, record.geo.latitude, record.geo.longitude, - record.distanceToStation + record.distanceToStn, + record.closestStn ]); }