diff --git a/logauth.sql b/logauth.sql index 602cdb7..4d09902 100644 --- a/logauth.sql +++ b/logauth.sql @@ -3,9 +3,9 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: May 09, 2017 at 05:00 PM --- Server version: 5.7.18-0ubuntu0.16.04.1 --- PHP Version: 7.0.15-0ubuntu0.16.04.4 +-- Generation Time: Sep 23, 2017 at 07:46 PM +-- Server version: 5.7.19-0ubuntu0.16.04.1 +-- PHP Version: 7.0.22-0ubuntu0.16.04.1 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; @@ -19,6 +19,8 @@ SET time_zone = "+00:00"; -- -- Database: `logauth` -- +CREATE DATABASE IF NOT EXISTS `logauth` DEFAULT CHARACTER SET latin1 COLLATE latin1_bin; +USE `logauth`; -- -------------------------------------------------------- @@ -43,7 +45,8 @@ INSERT INTO `action` (`id_action`, `name`, `timeout`, `previous`, `action`) VALU (2, 'Signal', 1, 'XX0', '11X'), (3, 'Lock', 2, 'XX0', '001'), (4, 'Unlock', 0, 'XX1', '000'), -(5, 'Stop', 0, '1X0', '0XX'); +(5, 'Stop', 0, '1X0', '0XX'), +(6, 'Unsignal', 0, 'X10', 'X00'); -- -------------------------------------------------------- @@ -83,10 +86,10 @@ INSERT INTO `action_merge` (`id_action_merge`, `id_target`, `id_source`, `id_act (32, 5, 5, 2), (33, 5, 5, 3), (34, 5, 5, 5), -(35, 5, 6, 1), -(36, 5, 6, 2), -(37, 5, 6, 3), -(38, 5, 6, 5); +(38, 5, 6, 5), +(39, 4, 6, 6), +(40, 5, 6, 6), +(41, 5, 6, 1); -- -------------------------------------------------------- @@ -131,8 +134,7 @@ CREATE TABLE `chip` ( INSERT INTO `chip` (`id_chip`, `id_module`, `name`, `position`, `type`) VALUES (1, 1, 'led1', 0, 'SERIAL'), -(2, 2, 'relay1', 1, 'SERIAL'), -(3, 4, 'relay2', 2, 'SERIAL'); +(2, 1, 'relay1', 1, 'SERIAL'); -- -------------------------------------------------------- @@ -175,17 +177,24 @@ CREATE TABLE `history` ( -- INSERT INTO `history` (`id_history`, `timestamp`, `id_user`, `id_machine`, `id_action`) VALUES -(30, 1487583742, 206, 126, 1), -(31, 1487583743, 206, 126, 5), -(33, 1487583744, 206, 126, 1), -(34, 1487583745, 206, 126, 2), -(35, 1487583746, 206, 126, 5), -(36, 1487583747, 206, 126, 1), -(37, 1487583748, 206, 126, 4), -(38, 1487583749, 206, 126, 1), -(39, 1487583750, 206, 126, 3), -(40, 1487583751, 206, 126, 4), -(41, 1487583752, 206, 126, 1); +(139, 1491819479, 215, 127, 5), +(140, 1491819482, 215, 127, 1), +(141, 1491819484, 215, 127, 5), +(142, 1491819486, 215, 127, 1), +(143, 1491819487, 215, 127, 2), +(144, 1491819488, 215, 127, 3), +(145, 1491819497, 210, 127, 4), +(146, 1491819499, 210, 127, 1), +(147, 1491819501, 215, 127, 5), +(148, 1491819502, 215, 127, 2), +(149, 1491819506, 210, 127, 5), +(150, 1491819508, 215, 127, 1), +(151, 1491819511, 215, 127, 5), +(152, 1491819522, 215, 127, 1), +(153, 1491819522, 215, 127, 2), +(154, 1491819523, 215, 127, 3), +(155, 1491819526, 210, 127, 4), +(156, 1491819527, 215, 127, 1); -- -------------------------------------------------------- @@ -212,131 +221,133 @@ CREATE TABLE `machine` ( `id_warehouse` int(11) NOT NULL, `name` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, `token` varchar(128) DEFAULT NULL, - `unlock_code` varchar(128) DEFAULT NULL + `unlock_code` varchar(128) DEFAULT NULL, + `ap` varchar(30) DEFAULT NULL, + `ip` varchar(16) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `machine` -- -INSERT INTO `machine` (`id_machine`, `id_warehouse`, `name`, `token`, `unlock_code`) VALUES -(5, 7, 'HKSWS', NULL, NULL), -(6, 7, 'ASIFK', NULL, NULL), -(8, 7, 'KDVSJ', NULL, NULL), -(9, 7, 'VCEWY', NULL, NULL), -(10, 7, 'UKWVN', NULL, NULL), -(11, 7, 'FFJDJ', NULL, NULL), -(12, 7, 'NHCWO', NULL, NULL), -(13, 7, 'IBRFK', NULL, NULL), -(14, 7, 'FGLXK', NULL, NULL), -(15, 7, 'BUZRV', NULL, NULL), -(16, 7, 'WKNTM', NULL, NULL), -(17, 7, 'SPQOQ', NULL, NULL), -(18, 7, 'SSRWE', NULL, NULL), -(19, 7, 'TIBAH', NULL, NULL), -(20, 7, 'EKOFT', NULL, NULL), -(21, 7, 'GJTJW', NULL, NULL), -(22, 7, 'XIPNP', NULL, NULL), -(23, 7, 'FDFXQ', NULL, NULL), -(24, 7, 'HSCUZ', NULL, NULL), -(25, 7, 'BYKBF', NULL, NULL), -(26, 7, 'GNOKK', NULL, NULL), -(27, 7, 'WLSUB', NULL, NULL), -(28, 7, 'DMTTJ', NULL, NULL), -(29, 7, 'OCFWD', NULL, NULL), -(32, 7, 'OULIX', NULL, NULL), -(33, 7, 'XCDYM', NULL, NULL), -(34, 7, 'LREGF', NULL, NULL), -(35, 7, 'DDLSP', NULL, NULL), -(36, 7, 'DTGHG', NULL, NULL), -(37, 7, 'BZWUE', NULL, NULL), -(38, 7, 'LGDDS', NULL, NULL), -(39, 7, 'ERXMY', NULL, NULL), -(40, 7, 'VJGER', NULL, NULL), -(41, 7, 'LOXIE', NULL, NULL), -(42, 7, 'IHARA', NULL, NULL), -(43, 7, 'ZIQJQ', NULL, NULL), -(44, 7, 'ZKUEW', NULL, NULL), -(45, 7, 'BLDTO', NULL, NULL), -(46, 7, 'OZRQF', NULL, NULL), -(47, 7, 'NWPBM', NULL, NULL), -(48, 7, 'OZDYC', NULL, NULL), -(49, 7, 'ETUZU', NULL, NULL), -(50, 7, 'CNQAB', NULL, NULL), -(51, 7, 'OPIIW', NULL, NULL), -(53, 7, 'NMHYG', NULL, NULL), -(54, 7, 'ASKZD', NULL, NULL), -(55, 7, 'QMIJT', NULL, NULL), -(56, 7, 'BBDZL', NULL, NULL), -(57, 7, 'WKKYH', NULL, NULL), -(58, 7, 'AFHJH', '9c1b8b74a81b6f192c7ebe5df319d060a13acab5079fa8e1ee6e95544bdd6a89b81522127c29ce75eeb71d5d82161b0fc818ff11f4d749cc76062221e8e1dcf9', NULL), -(59, 7, 'CASXB', NULL, NULL), -(60, 7, 'LOXOZ', NULL, NULL), -(61, 7, 'ZTUNO', NULL, NULL), -(62, 7, 'QGQNK', NULL, NULL), -(63, 7, 'SVIBS', NULL, NULL), -(64, 7, 'RSVXL', NULL, NULL), -(65, 7, 'EMESC', NULL, NULL), -(66, 7, 'BBXON', NULL, NULL), -(67, 7, 'NGLBK', NULL, NULL), -(68, 7, 'MZHBC', NULL, NULL), -(69, 7, 'OYEPB', NULL, NULL), -(70, 7, 'RQFNK', NULL, NULL), -(71, 7, 'MRUUS', NULL, NULL), -(72, 7, 'DJDVW', NULL, NULL), -(73, 7, 'SOJEJ', NULL, NULL), -(74, 7, 'YYSRC', NULL, NULL), -(75, 7, 'AJNMI', NULL, NULL), -(76, 7, 'IVUSU', NULL, NULL), -(77, 7, 'VYPUB', NULL, NULL), -(78, 7, 'SJYUN', NULL, NULL), -(79, 7, 'QRGTG', NULL, NULL), -(80, 7, 'LXIFX', NULL, NULL), -(81, 7, 'YXWTP', NULL, NULL), -(82, 7, 'SMEFT', NULL, NULL), -(83, 7, 'HUTUW', NULL, NULL), -(84, 7, 'DYCLY', NULL, NULL), -(85, 7, 'VBJWP', NULL, NULL), -(86, 7, 'CZRPO', NULL, NULL), -(87, 7, 'JCNSP', NULL, NULL), -(88, 7, 'EOKCA', NULL, NULL), -(89, 7, 'PZEAK', NULL, NULL), -(90, 7, 'ERIMX', NULL, NULL), -(91, 7, 'NGVPC', NULL, NULL), -(92, 7, 'MVONW', NULL, NULL), -(93, 7, 'ZUHOD', NULL, NULL), -(94, 7, 'YIATG', NULL, NULL), -(95, 7, 'WFQGC', NULL, NULL), -(96, 7, 'NKZQL', NULL, NULL), -(97, 7, 'EMIWA', NULL, NULL), -(98, 7, 'WOYWY', NULL, NULL), -(99, 7, 'ZBLQG', NULL, NULL), -(100, 7, 'STQYS', NULL, NULL), -(101, 7, 'a', NULL, NULL), -(102, 7, 'machine1', NULL, NULL), -(103, 7, 'machine2', NULL, NULL), -(104, 7, 'machine3', NULL, NULL), -(105, 7, 'machine4', NULL, NULL), -(106, 7, 'machine5', NULL, NULL), -(107, 7, 'machine6', NULL, NULL), -(108, 7, 'machine7', NULL, NULL), -(109, 7, 'machine8', NULL, NULL), -(110, 7, 'machine9', NULL, NULL), -(111, 7, 'machine10', NULL, NULL), -(112, 7, 'machine11', NULL, NULL), -(113, 7, 'machine12', NULL, NULL), -(114, 7, 'b', NULL, NULL), -(115, 7, 'sd', NULL, NULL), -(116, 7, 'machine13', NULL, NULL), -(121, 7, 'dsad', NULL, NULL), -(122, 8, 'surgel1', NULL, NULL), -(123, 8, 'surgel2', NULL, NULL), -(124, 8, 'surgel3', NULL, NULL), -(125, 8, 'surgel4', NULL, NULL), -(126, 8, 'lait1', 'c7c1194a5b4ce0c03ed49c2c2d5f921fd8687a76c98edc0a43ddca73c5f0e87ae294c551ea6cde7bff10178f3e4b898fd6098c01d3068dbd9c323f41999929db', NULL), -(127, 8, 'lait2', NULL, 'blabla'), -(128, 8, 'lait3', NULL, NULL), -(129, 8, 'lait4', NULL, NULL); +INSERT INTO `machine` (`id_machine`, `id_warehouse`, `name`, `token`, `unlock_code`, `ap`, `ip`) VALUES +(5, 7, 'HKSWS', NULL, NULL, NULL, NULL), +(6, 7, 'ASIFK', NULL, NULL, NULL, NULL), +(8, 7, 'KDVSJ', NULL, NULL, NULL, NULL), +(9, 7, 'VCEWY', NULL, NULL, NULL, NULL), +(10, 7, 'UKWVN', NULL, NULL, NULL, NULL), +(11, 7, 'FFJDJ', NULL, NULL, NULL, NULL), +(12, 7, 'NHCWO', NULL, NULL, NULL, NULL), +(13, 7, 'IBRFK', NULL, NULL, NULL, NULL), +(14, 7, 'FGLXK', NULL, NULL, NULL, NULL), +(15, 7, 'BUZRV', NULL, NULL, NULL, NULL), +(16, 7, 'WKNTM', NULL, NULL, NULL, NULL), +(17, 7, 'SPQOQ', NULL, NULL, NULL, NULL), +(18, 7, 'SSRWE', NULL, NULL, NULL, NULL), +(19, 7, 'TIBAH', NULL, NULL, NULL, NULL), +(20, 7, 'EKOFT', NULL, NULL, NULL, NULL), +(21, 7, 'GJTJW', NULL, NULL, NULL, NULL), +(22, 7, 'XIPNP', NULL, NULL, NULL, NULL), +(23, 7, 'FDFXQ', NULL, NULL, NULL, NULL), +(24, 7, 'HSCUZ', NULL, NULL, NULL, NULL), +(25, 7, 'BYKBF', NULL, NULL, NULL, NULL), +(26, 7, 'GNOKK', NULL, NULL, NULL, NULL), +(27, 7, 'WLSUB', NULL, NULL, NULL, NULL), +(28, 7, 'DMTTJ', NULL, NULL, NULL, NULL), +(29, 7, 'OCFWD', NULL, NULL, NULL, NULL), +(32, 7, 'OULIX', NULL, NULL, NULL, NULL), +(33, 7, 'XCDYM', NULL, NULL, NULL, NULL), +(34, 7, 'LREGF', NULL, NULL, NULL, NULL), +(35, 7, 'DDLSP', NULL, NULL, NULL, NULL), +(36, 7, 'DTGHG', NULL, NULL, NULL, NULL), +(37, 7, 'BZWUE', NULL, NULL, NULL, NULL), +(38, 7, 'LGDDS', NULL, NULL, NULL, NULL), +(39, 7, 'ERXMY', NULL, NULL, NULL, NULL), +(40, 7, 'VJGER', NULL, NULL, NULL, NULL), +(41, 7, 'LOXIE', NULL, NULL, NULL, NULL), +(42, 7, 'IHARA', NULL, NULL, NULL, NULL), +(43, 7, 'ZIQJQ', NULL, NULL, NULL, NULL), +(44, 7, 'ZKUEW', NULL, NULL, NULL, NULL), +(45, 7, 'BLDTO', NULL, NULL, NULL, NULL), +(46, 7, 'OZRQF', NULL, NULL, NULL, NULL), +(47, 7, 'NWPBM', NULL, NULL, NULL, NULL), +(48, 7, 'OZDYC', NULL, NULL, NULL, NULL), +(49, 7, 'ETUZU', NULL, NULL, NULL, NULL), +(50, 7, 'CNQAB', NULL, NULL, NULL, NULL), +(51, 7, 'OPIIW', NULL, NULL, NULL, NULL), +(53, 7, 'NMHYG', NULL, NULL, NULL, NULL), +(54, 7, 'ASKZD', NULL, NULL, NULL, NULL), +(55, 7, 'QMIJT', NULL, NULL, NULL, NULL), +(56, 7, 'BBDZL', NULL, NULL, NULL, NULL), +(57, 7, 'WKKYH', NULL, NULL, NULL, NULL), +(58, 7, 'AFHJH', '9c1b8b74a81b6f192c7ebe5df319d060a13acab5079fa8e1ee6e95544bdd6a89b81522127c29ce75eeb71d5d82161b0fc818ff11f4d749cc76062221e8e1dcf9', NULL, NULL, NULL), +(59, 7, 'CASXB', NULL, NULL, NULL, NULL), +(60, 7, 'LOXOZ', NULL, NULL, NULL, NULL), +(61, 7, 'ZTUNO', NULL, NULL, NULL, NULL), +(62, 7, 'QGQNK', NULL, NULL, NULL, NULL), +(63, 7, 'SVIBS', NULL, NULL, NULL, NULL), +(64, 7, 'RSVXL', NULL, NULL, NULL, NULL), +(65, 7, 'EMESC', NULL, NULL, NULL, NULL), +(66, 7, 'BBXON', NULL, NULL, NULL, NULL), +(67, 7, 'NGLBK', NULL, NULL, NULL, NULL), +(68, 7, 'MZHBC', NULL, NULL, NULL, NULL), +(69, 7, 'OYEPB', NULL, NULL, NULL, NULL), +(70, 7, 'RQFNK', NULL, NULL, NULL, NULL), +(71, 7, 'MRUUS', NULL, NULL, NULL, NULL), +(72, 7, 'DJDVW', NULL, NULL, NULL, NULL), +(73, 7, 'SOJEJ', NULL, NULL, NULL, NULL), +(74, 7, 'YYSRC', NULL, NULL, NULL, NULL), +(75, 7, 'AJNMI', NULL, NULL, NULL, NULL), +(76, 7, 'IVUSU', NULL, NULL, NULL, NULL), +(77, 7, 'VYPUB', NULL, NULL, NULL, NULL), +(78, 7, 'SJYUN', NULL, NULL, NULL, NULL), +(79, 7, 'QRGTG', NULL, NULL, NULL, NULL), +(80, 7, 'LXIFX', NULL, NULL, NULL, NULL), +(81, 7, 'YXWTP', NULL, NULL, NULL, NULL), +(82, 7, 'SMEFT', NULL, NULL, NULL, NULL), +(83, 7, 'HUTUW', NULL, NULL, NULL, NULL), +(84, 7, 'DYCLY', NULL, NULL, NULL, NULL), +(85, 7, 'VBJWP', NULL, NULL, NULL, NULL), +(86, 7, 'CZRPO', NULL, NULL, NULL, NULL), +(87, 7, 'JCNSP', NULL, NULL, NULL, NULL), +(88, 7, 'EOKCA', NULL, NULL, NULL, NULL), +(89, 7, 'PZEAK', NULL, NULL, NULL, NULL), +(90, 7, 'ERIMX', NULL, NULL, NULL, NULL), +(91, 7, 'NGVPC', NULL, NULL, NULL, NULL), +(92, 7, 'MVONW', NULL, NULL, NULL, NULL), +(93, 7, 'ZUHOD', NULL, NULL, NULL, NULL), +(94, 7, 'YIATG', NULL, NULL, NULL, NULL), +(95, 7, 'WFQGC', NULL, NULL, NULL, NULL), +(96, 7, 'NKZQL', NULL, NULL, NULL, NULL), +(97, 7, 'EMIWA', NULL, NULL, NULL, NULL), +(98, 7, 'WOYWY', NULL, NULL, NULL, NULL), +(99, 7, 'ZBLQG', NULL, NULL, NULL, NULL), +(100, 7, 'STQYS', NULL, NULL, NULL, NULL), +(101, 7, 'a', NULL, NULL, NULL, NULL), +(102, 7, 'machine1', NULL, NULL, NULL, NULL), +(103, 7, 'machine2', NULL, NULL, NULL, NULL), +(104, 7, 'machine3', NULL, NULL, NULL, NULL), +(105, 7, 'machine4', NULL, NULL, NULL, NULL), +(106, 7, 'machine5', NULL, NULL, NULL, NULL), +(107, 7, 'machine6', NULL, NULL, NULL, NULL), +(108, 7, 'machine7', NULL, NULL, NULL, NULL), +(109, 7, 'machine8', NULL, NULL, NULL, NULL), +(110, 7, 'machine9', NULL, NULL, NULL, NULL), +(111, 7, 'machine10', NULL, NULL, NULL, NULL), +(112, 7, 'machine11', NULL, NULL, NULL, NULL), +(113, 7, 'machine12', NULL, NULL, NULL, NULL), +(114, 7, 'b', NULL, NULL, NULL, NULL), +(115, 7, 'sd', NULL, NULL, NULL, NULL), +(116, 7, 'machine13', NULL, NULL, NULL, NULL), +(121, 7, 'dsad', NULL, NULL, NULL, NULL), +(122, 8, 'surgel1', NULL, NULL, NULL, NULL), +(123, 8, 'surgel2', NULL, NULL, NULL, NULL), +(124, 8, 'surgel3', NULL, NULL, NULL, NULL), +(125, 8, 'surgel4', NULL, NULL, NULL, NULL), +(126, 8, 'lait1', NULL, '159050986ee4fdeb3ead38f83b12511ca2223c4bc1939ee47edd1549393b1b5cf829803a392b1ce3ef03f45c705a90a0c5b07f4a435ade50586d2b2c8e29d490', NULL, NULL), +(127, 8, 'lait2', '2daca1d493c3cb95d067827483b64bc3f5c20c168401c4d3f2096b3b458c3a84c18fb3008fd6f9fc434e554f930d5bf7a043aee1b58c7661c74bccfd384fa4e0', '0d7e99166c23eb7e56dfe331f7e92535c9b1f4bc9103ed2b2f9d72c55dfa3d1601e60ded996bc2c0e7a152286f1b49f0644534154910eb3d7efb5d8588b73369', NULL, NULL), +(128, 8, 'lait3', NULL, NULL, NULL, NULL), +(129, 8, 'lait4', NULL, NULL, NULL, NULL); -- -------------------------------------------------------- @@ -378,27 +389,10 @@ CREATE TABLE `machine_cluster_merge` ( -- INSERT INTO `machine_cluster_merge` (`id_machine_cluster_merge`, `id_machine_cluster`, `id_machine`) VALUES -(21, 1, 6), -(23, 1, 8), -(24, 1, 9), -(26, 1, 12), -(27, 1, 14), -(28, 1, 16), -(29, 1, 18), -(30, 1, 20), -(31, 1, 22), -(32, 1, 24), -(34, 1, 28), -(35, 1, 10), -(38, 4, 123), -(39, 4, 124), -(40, 4, 125), -(42, 5, 127), -(43, 5, 128), -(44, 5, 129), -(52, 1, 5), -(53, 2, 5), -(56, 5, 126); +(3, 1, 58), +(4, 2, 75), +(5, 3, 6), +(6, 2, 58); -- -------------------------------------------------------- @@ -416,10 +410,30 @@ CREATE TABLE `module` ( -- INSERT INTO `module` (`id_module`, `name`) VALUES -(1, 'module'), -(2, 'download'), -(3, 'upload'), -(4, 'testblabla'); +(1, 'motheure'), +(2, 'portail'), +(3, 'upload'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `module_availability` +-- + +CREATE TABLE `module_availability` ( + `id_warehouse` int(11) NOT NULL, + `id_module` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `module_availability` +-- + +INSERT INTO `module_availability` (`id_warehouse`, `id_module`) VALUES +(7, 1), +(8, 1), +(7, 2), +(8, 2); -- -------------------------------------------------------- @@ -428,19 +442,12 @@ INSERT INTO `module` (`id_module`, `name`) VALUES -- CREATE TABLE `module_merge` ( - `id_warehouse` int(11) NOT NULL, - `id_module` int(11) NOT NULL + `id_module_merge` int(11) NOT NULL, + `id_machine_cluster` int(11) NOT NULL, + `id_module` int(11) NOT NULL, + `id_warehouse` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Dumping data for table `module_merge` --- - -INSERT INTO `module_merge` (`id_warehouse`, `id_module`) VALUES -(7, 1), -(7, 2), -(7, 3); - -- -------------------------------------------------------- -- @@ -459,11 +466,10 @@ CREATE TABLE `pin_merge` ( -- INSERT INTO `pin_merge` (`id_pin_merge`, `id_chip`, `pin`, `type`) VALUES -(1, 1, 16, 'SERIAL'), -(2, 1, 20, 'SERIAL'), -(3, 1, 21, 'SERIAL'), -(4, 2, 4, 'SERIAL'), -(5, 3, 5, 'SERIAL'); +(1, 1, 4, 'SERIAL'), +(2, 1, 17, 'SERIAL'), +(3, 1, 27, 'SERIAL'), +(4, 2, 21, 'SERIAL'); -- -------------------------------------------------------- @@ -483,22 +489,20 @@ CREATE TABLE `state` ( -- INSERT INTO `state` (`id_state`, `id_pin_merge`, `state`, `value`) VALUES -(1, 1, '0', 0), -(2, 2, '0', 0), -(3, 3, '0', 0), -(4, 1, 'G', 0), -(5, 2, 'G', 1), -(6, 3, 'G', 0), -(7, 1, 'B', 0), -(8, 2, 'B', 0), -(9, 3, 'B', 1), -(10, 1, 'R', 1), -(11, 2, 'R', 0), -(12, 3, 'R', 0), +(1, 1, '0', 1), +(2, 2, '0', 1), +(3, 3, '0', 1), +(4, 1, 'G', 1), +(5, 2, 'G', 0), +(6, 3, 'G', 1), +(7, 1, 'B', 1), +(8, 2, 'B', 1), +(9, 3, 'B', 0), +(10, 1, 'R', 0), +(11, 2, 'R', 1), +(12, 3, 'R', 1), (13, 4, '0', 0), -(14, 4, '1', 1), -(15, 5, '0', 0), -(16, 5, '1', 1); +(14, 4, '1', 1); -- -------------------------------------------------------- @@ -608,8 +612,7 @@ INSERT INTO `user` (`id_user`, `id_warehouse`, `code`, `username`, `firstname`, (103, 7, '01-FB-DB-84', 'usernames', 'firstname', 'lastname', 'mail@mail.com'), (204, 7, 'A1-AD-CA-2D', 'user2x', 'firstname', 'lastnamex', 'mail2x@gmail.com'), (206, 8, 'FD-60-13-3B', 'Carte1', 'Carte', 'RFID1', 'brussal.alain@lk.fr'), -(207, 8, '22-22-22-22', 'jean.murit', 'Jean', 'Murit', 'murit.jean@br.fr'), -(208, 8, '33-33-33-33', 'lucas.mascaro', 'Lucas', 'Mascaro', 'mascaro.lucas@yahoo.fr'), +(208, 8, '33-33-33-35', 'lucas.mascaro', 'Lucas', 'Mascaro', 'mascaro.lucas@yahoo.fr'), (210, 8, '34-C2-A0-85', 'xdrm-brackets', 'Adrien', 'Ligou-Marquès', 'doowap31@gmail.com'), (214, 7, '66-66-66-66', 'lucas.mascaro', 'Lucas', 'Mascaro', 'mascaro.lucas@yahoo.fr'), (215, 8, 'F9-7D-5D-9E', 'Pass1', 'Pass', 'RFID', 'pass1@logauth.com'); @@ -775,11 +778,20 @@ ALTER TABLE `machine_cluster_merge` ALTER TABLE `module` ADD PRIMARY KEY (`id_module`); +-- +-- Indexes for table `module_availability` +-- +ALTER TABLE `module_availability` + ADD KEY `id_module` (`id_module`), + ADD KEY `id_warehouse` (`id_warehouse`); + -- -- Indexes for table `module_merge` -- ALTER TABLE `module_merge` - ADD KEY `id_module` (`id_module`), + ADD PRIMARY KEY (`id_module_merge`), + ADD KEY `id_machine_cluster` (`id_machine_cluster`), + ADD KEY `id_machine` (`id_module`), ADD KEY `id_warehouse` (`id_warehouse`); -- @@ -832,12 +844,12 @@ ALTER TABLE `warehouse` -- AUTO_INCREMENT for table `action` -- ALTER TABLE `action` - MODIFY `id_action` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; + MODIFY `id_action` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7; -- -- AUTO_INCREMENT for table `action_merge` -- ALTER TABLE `action_merge` - MODIFY `id_action_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39; + MODIFY `id_action_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42; -- -- AUTO_INCREMENT for table `admin` -- @@ -847,7 +859,7 @@ ALTER TABLE `admin` -- AUTO_INCREMENT for table `chip` -- ALTER TABLE `chip` - MODIFY `id_chip` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + MODIFY `id_chip` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `global_state` -- @@ -857,7 +869,7 @@ ALTER TABLE `global_state` -- AUTO_INCREMENT for table `history` -- ALTER TABLE `history` - MODIFY `id_history` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=221; + MODIFY `id_history` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=157; -- -- AUTO_INCREMENT for table `log` -- @@ -877,22 +889,27 @@ ALTER TABLE `machine_cluster` -- AUTO_INCREMENT for table `machine_cluster_merge` -- ALTER TABLE `machine_cluster_merge` - MODIFY `id_machine_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=57; + MODIFY `id_machine_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; -- -- AUTO_INCREMENT for table `module` -- ALTER TABLE `module` - MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; + MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; +-- +-- AUTO_INCREMENT for table `module_merge` +-- +ALTER TABLE `module_merge` + MODIFY `id_module_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59; -- -- AUTO_INCREMENT for table `pin_merge` -- ALTER TABLE `pin_merge` - MODIFY `id_pin_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; + MODIFY `id_pin_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `state` -- ALTER TABLE `state` - MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; + MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15; -- -- AUTO_INCREMENT for table `user` -- @@ -907,7 +924,7 @@ ALTER TABLE `user_cluster` -- AUTO_INCREMENT for table `user_cluster_merge` -- ALTER TABLE `user_cluster_merge` - MODIFY `id_user_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=88; + MODIFY `id_user_cluster_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89; -- -- AUTO_INCREMENT for table `warehouse` -- @@ -968,15 +985,23 @@ ALTER TABLE `machine_cluster` -- Constraints for table `machine_cluster_merge` -- ALTER TABLE `machine_cluster_merge` - ADD CONSTRAINT `machine_cluster_merge_id_machine` FOREIGN KEY (`id_machine`) REFERENCES `machine` (`id_machine`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `machine_cluster_merge_id_machine_cluster` FOREIGN KEY (`id_machine_cluster`) REFERENCES `machine_cluster` (`id_machine_cluster`) ON DELETE CASCADE ON UPDATE CASCADE; + ADD CONSTRAINT `fk_machine_cluster_merge_id_machine` FOREIGN KEY (`id_machine`) REFERENCES `machine` (`id_machine`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `fk_machine_cluster_merge_id_machine_cluster` FOREIGN KEY (`id_machine_cluster`) REFERENCES `machine_cluster` (`id_machine_cluster`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `module_availability` +-- +ALTER TABLE `module_availability` + ADD CONSTRAINT `module_merge_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `module_merge_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `module_merge` -- ALTER TABLE `module_merge` - ADD CONSTRAINT `module_merge_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `module_merge_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) 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; -- -- Constraints for table `pin_merge` @@ -1011,4 +1036,4 @@ ALTER TABLE `user_cluster_merge` /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; \ No newline at end of file