fix tables and added new table session

This commit is contained in:
root 2015-11-30 16:00:28 +01:00
parent a8c56a009f
commit 40518bf352

View File

@ -31,12 +31,12 @@ CREATE TABLE `nodes` (
`updated_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(36) NOT NULL, `uuid` varchar(36) NOT NULL,
`code` varchar(25) DEFAULT NULL, `code` varchar(25) NOT NULL,
`status` varchar(15) DEFAULT NULL, `status` varchar(15) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL,
`device` varchar(255) DEFAULT NULL, `device` varchar(255) NOT NULL,
`session` varchar(255) DEFAULT NULL, `session` varchar(255) DEFAULT NULL,
`mobile` tinyint(1) DEFAULT NULL, `mobile` tinyint(1) DEFAULT 0,
`extra` text, `extra` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `uuid` (`uuid`), UNIQUE KEY `uuid` (`uuid`),
@ -44,6 +44,23 @@ CREATE TABLE `nodes` (
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sessions` (
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`valid` tinyint(1) DEFAULT NULL,
`session_id` varchar(18) DEFAULT NULL,
`node_id` int(11) NOT NULL,
`node_uuid` varchar(36) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `session_id` (`session_id`),
CONSTRAINT `session_node_id` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`),
CONSTRAINT `session_node_uuid` FOREIGN KEY (`node_uuid`) REFERENCES `nodes` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `locations`; DROP TABLE IF EXISTS `locations`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
@ -55,10 +72,10 @@ CREATE TABLE `locations` (
`longitude` varchar(18) DEFAULT NULL, `longitude` varchar(18) DEFAULT NULL,
`latitude` varchar(18) DEFAULT NULL, `latitude` varchar(18) DEFAULT NULL,
`altitude` varchar(18) DEFAULT NULL, `altitude` varchar(18) DEFAULT NULL,
`node_id` int(11) DEFAULT NULL, `node_id` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `node_id` (`node_id`), KEY `node_id` (`node_id`),
CONSTRAINT `ports_ibfk_1` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) CONSTRAINT `location_ibfk_1` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;