From c351080c7097e6b747266c2b433ef47c9b91a19a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 5 Jan 2015 15:49:54 +0900 Subject: [PATCH] Updating database builder script to include station name --- scrape/build_db.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 ]); }