1

Updating database definitions

This commit is contained in:
Alex Yatskov 2014-09-19 10:22:21 +09:00
parent 0d7e19b882
commit 9b36165d10
2 changed files with 13 additions and 12 deletions

View File

@ -15,7 +15,7 @@ var conn = mysql.createConnection({
// //
conn.query('DROP TABLE IF EXISTS reviews'); 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) { for (var i = 0, count = data.length; i < count; ++i) {
var record = data[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('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 = { var keywords = {
'food': [1.0, 0.0, 0.0, 0.0], 'food': [1.0, 0.0, 0.0, 0.0],

View File

@ -24,10 +24,11 @@ DROP TABLE IF EXISTS `keywords`;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `keywords` ( CREATE TABLE `keywords` (
`name` varchar(50) NOT NULL, `name` varchar(50) NOT NULL,
`food` float DEFAULT NULL, `food` float NOT NULL,
`service` float DEFAULT NULL, `service` float NOT NULL,
`value` float DEFAULT NULL, `value` float NOT NULL,
`atmosphere` float DEFAULT NULL `atmosphere` float NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@ -37,7 +38,7 @@ CREATE TABLE `keywords` (
LOCK TABLES `keywords` WRITE; LOCK TABLES `keywords` WRITE;
/*!40000 ALTER TABLE `keywords` DISABLE KEYS */; /*!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 */; /*!40000 ALTER TABLE `keywords` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@ -51,10 +52,10 @@ DROP TABLE IF EXISTS `reviews`;
CREATE TABLE `reviews` ( CREATE TABLE `reviews` (
`name` varchar(100) NOT NULL, `name` varchar(100) NOT NULL,
`url` varchar(200) NOT NULL, `url` varchar(200) NOT NULL,
`food` float DEFAULT NULL, `food` float NOT NULL,
`service` float DEFAULT NULL, `service` float NOT NULL,
`value` float DEFAULT NULL, `value` float NOT NULL,
`atmosphere` float DEFAULT NULL `atmosphere` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@ -77,4 +78,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!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