From 9b36165d102e874bcb219ad81d1b4ba07fd4976a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 19 Sep 2014 10:22:21 +0900 Subject: [PATCH] Updating database definitions --- scrape/db.js | 4 ++-- scrape/hscd.sql | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/scrape/db.js b/scrape/db.js index 81e7b25..4185029 100755 --- a/scrape/db.js +++ b/scrape/db.js @@ -15,7 +15,7 @@ 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, food FLOAT, service FLOAT, value FLOAT, atmosphere FLOAT)'); +conn.query('CREATE TABLE reviews(name VARCHAR(100) NOT NULL, url VARCHAR(200) NOT NULL, food FLOAT NOT NULL, service FLOAT NOT NULL, value FLOAT NOT NULL, atmosphere FLOAT NOT NULL)'); for (var i = 0, count = data.length; i < count; ++i) { var record = data[i]; @@ -35,7 +35,7 @@ for (var i = 0, count = data.length; i < count; ++i) { // conn.query('DROP TABLE IF EXISTS keywords'); -conn.query('CREATE TABLE keywords(name VARCHAR(50) NOT NULL, food FLOAT, service FLOAT, value FLOAT, atmosphere FLOAT)'); +conn.query('CREATE TABLE keywords(name VARCHAR(50) NOT NULL, food FLOAT NOT NULL, service FLOAT NOT NULL, value FLOAT NOT NULL, atmosphere FLOAT NOT NULL, PRIMARY KEY(name))'); var keywords = { 'food': [1.0, 0.0, 0.0, 0.0], diff --git a/scrape/hscd.sql b/scrape/hscd.sql index 4a97fb0..4e312ed 100644 --- a/scrape/hscd.sql +++ b/scrape/hscd.sql @@ -24,10 +24,11 @@ DROP TABLE IF EXISTS `keywords`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `keywords` ( `name` varchar(50) NOT NULL, - `food` float DEFAULT NULL, - `service` float DEFAULT NULL, - `value` float DEFAULT NULL, - `atmosphere` float DEFAULT NULL + `food` float NOT NULL, + `service` float NOT NULL, + `value` float NOT NULL, + `atmosphere` float NOT NULL, + PRIMARY KEY (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37,7 +38,7 @@ CREATE TABLE `keywords` ( LOCK TABLES `keywords` WRITE; /*!40000 ALTER TABLE `keywords` DISABLE KEYS */; -INSERT INTO `keywords` VALUES ('food',1,0,0,0),('service',0,1,0,0),('value',0,0,1,0),('atmosphere',0,0,0,1); +INSERT INTO `keywords` VALUES ('atmosphere',0,0,0,1),('food',1,0,0,0),('service',0,1,0,0),('value',0,0,1,0); /*!40000 ALTER TABLE `keywords` ENABLE KEYS */; UNLOCK TABLES; @@ -51,10 +52,10 @@ DROP TABLE IF EXISTS `reviews`; CREATE TABLE `reviews` ( `name` varchar(100) NOT NULL, `url` varchar(200) NOT NULL, - `food` float DEFAULT NULL, - `service` float DEFAULT NULL, - `value` float DEFAULT NULL, - `atmosphere` float DEFAULT NULL + `food` float NOT NULL, + `service` float NOT NULL, + `value` float NOT NULL, + `atmosphere` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -77,4 +78,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2014-09-16 16:26:52 +-- Dump completed on 2014-09-19 10:22:03