1

Updating database builder script to include station name

This commit is contained in:
Alex Yatskov 2015-01-05 15:49:54 +09:00
parent 3b6197b0f8
commit c351080c70

View File

@ -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
]);
}