From bef2d6c7ceaeea88a1b5d4838674f37d905622cd Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 25 Sep 2017 16:37:59 +0200 Subject: [PATCH] Updated database --- logauth.sql | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/logauth.sql b/logauth.sql index d78106c..3c58abc 100644 --- a/logauth.sql +++ b/logauth.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Sep 24, 2017 at 07:44 PM +-- Generation Time: Sep 25, 2017 at 04:37 PM -- Server version: 5.7.19-0ubuntu0.16.04.1 -- PHP Version: 7.0.22-0ubuntu0.16.04.1 @@ -151,16 +151,17 @@ DROP TABLE IF EXISTS `etree`; CREATE TABLE `etree` ( `id_etree` int(11) NOT NULL, `id_module` int(11) NOT NULL, - `daemon` varchar(30) COLLATE latin1_bin NOT NULL, - `launcher` varchar(50) COLLATE latin1_bin DEFAULT NULL + `daemon` varchar(30) COLLATE latin1_bin NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin; -- -- Dumping data for table `etree` -- -INSERT INTO `etree` (`id_etree`, `id_module`, `daemon`, `launcher`) VALUES -(1, 1, 'mfrc522', NULL); +INSERT INTO `etree` (`id_etree`, `id_module`, `daemon`) VALUES +(1, 1, 'read'), +(2, 3, 'emitter'), +(3, 3, 'receiver'); -- -------------------------------------------------------- @@ -453,7 +454,8 @@ CREATE TABLE `module` ( INSERT INTO `module` (`id_module`, `name`) VALUES (1, 'rfid'), (2, 'motheure'), -(3, 'portail'); +(3, 'portail'), +(4, 'autostop'); -- -------------------------------------------------------- @@ -475,7 +477,8 @@ INSERT INTO `module_availability` (`id_warehouse`, `id_module`) VALUES (7, 1), (8, 1), (7, 2), -(8, 2); +(8, 2), +(8, 3); -- -------------------------------------------------------- @@ -487,7 +490,7 @@ DROP TABLE IF EXISTS `module_merge`; CREATE TABLE `module_merge` ( `id_module_merge` int(11) NOT NULL, `id_machine_cluster` int(11) NOT NULL, - `id_module` int(11) NOT NULL, + `id_etree` int(11) NOT NULL, `id_warehouse` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -495,9 +498,11 @@ CREATE TABLE `module_merge` ( -- Dumping data for table `module_merge` -- -INSERT INTO `module_merge` (`id_module_merge`, `id_machine_cluster`, `id_module`, `id_warehouse`) VALUES +INSERT INTO `module_merge` (`id_module_merge`, `id_machine_cluster`, `id_etree`, `id_warehouse`) VALUES (1, 4, 1, 8), -(2, 5, 1, 8); +(2, 5, 1, 8), +(3, 4, 2, 8), +(4, 5, 2, 8); -- -------------------------------------------------------- @@ -823,7 +828,7 @@ ALTER TABLE `module_availability` ALTER TABLE `module_merge` ADD PRIMARY KEY (`id_module_merge`), ADD KEY `id_machine_cluster` (`id_machine_cluster`), - ADD KEY `id_machine` (`id_module`), + ADD KEY `id_machine` (`id_etree`), ADD KEY `id_warehouse` (`id_warehouse`); -- @@ -889,7 +894,7 @@ ALTER TABLE `chip` -- AUTO_INCREMENT for table `etree` -- ALTER TABLE `etree` - MODIFY `id_etree` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + MODIFY `id_etree` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `global_state` -- @@ -924,12 +929,12 @@ ALTER TABLE `machine_cluster_merge` -- AUTO_INCREMENT for table `module` -- ALTER TABLE `module` - MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `module_merge` -- ALTER TABLE `module_merge` - MODIFY `id_module_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; + MODIFY `id_module_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; -- -- AUTO_INCREMENT for table `state` -- @@ -1030,8 +1035,8 @@ ALTER TABLE `module_availability` -- Constraints for table `module_merge` -- ALTER TABLE `module_merge` + ADD CONSTRAINT `fk_module_merge_id_etree` FOREIGN KEY (`id_etree`) REFERENCES `etree` (`id_etree`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_module_merge_id_machine_cluster` FOREIGN KEY (`id_machine_cluster`) REFERENCES `machine_cluster` (`id_machine_cluster`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `fk_module_merge_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_module_merge_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE; --