diff --git a/utils/dump.sql b/utils/dump.sql index 74e5436..e9f5ec7 100644 --- a/utils/dump.sql +++ b/utils/dump.sql @@ -31,12 +31,12 @@ CREATE TABLE `nodes` ( `updated_at` datetime DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, `uuid` varchar(36) NOT NULL, - `code` varchar(25) DEFAULT NULL, + `code` varchar(25) NOT NULL, `status` varchar(15) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, - `device` varchar(255) DEFAULT NULL, + `device` varchar(255) NOT NULL, `session` varchar(255) DEFAULT NULL, - `mobile` tinyint(1) DEFAULT NULL, + `mobile` tinyint(1) DEFAULT 0, `extra` text, PRIMARY KEY (`id`), UNIQUE KEY `uuid` (`uuid`), @@ -44,6 +44,23 @@ CREATE TABLE `nodes` ( ) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8; /*!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`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -55,10 +72,10 @@ CREATE TABLE `locations` ( `longitude` varchar(18) DEFAULT NULL, `latitude` varchar(18) DEFAULT NULL, `altitude` varchar(18) DEFAULT NULL, - `node_id` int(11) DEFAULT NULL, + `node_id` int(11) NOT NULL, PRIMARY KEY (`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; /*!40101 SET character_set_client = @saved_cs_client */;