diff --git a/grants.sql b/grants.sql new file mode 100644 index 0000000..5afb086 --- /dev/null +++ b/grants.sql @@ -0,0 +1,2 @@ +GRANT USAGE ON *.* TO 'sats-set-unlock'@'localhost'; +GRANT SELECT (id_machine), UPDATE (unlock_code) ON `logauth`.`machine` TO 'sats-set-unlock'@'localhost'; diff --git a/logauth.sql b/logauth.sql new file mode 100644 index 0000000..602cdb7 --- /dev/null +++ b/logauth.sql @@ -0,0 +1,1014 @@ +-- phpMyAdmin SQL Dump +-- version 4.5.4.1deb2ubuntu2 +-- 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 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `logauth` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `action` +-- + +CREATE TABLE `action` ( + `id_action` int(11) NOT NULL, + `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `timeout` int(11) NOT NULL, + `previous` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'started | signaled | locked', + `action` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'start | signal | lock' +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `action` +-- + +INSERT INTO `action` (`id_action`, `name`, `timeout`, `previous`, `action`) VALUES +(1, 'Start', 0, '0X0', '1XX'), +(2, 'Signal', 1, 'XX0', '11X'), +(3, 'Lock', 2, 'XX0', '001'), +(4, 'Unlock', 0, 'XX1', '000'), +(5, 'Stop', 0, '1X0', '0XX'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `action_merge` +-- + +CREATE TABLE `action_merge` ( + `id_action_merge` int(11) NOT NULL, + `id_target` int(11) NOT NULL, + `id_source` int(11) NOT NULL, + `id_action` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `action_merge` +-- + +INSERT INTO `action_merge` (`id_action_merge`, `id_target`, `id_source`, `id_action`) VALUES +(4, 1, 2, 5), +(6, 1, 2, 2), +(7, 1, 2, 3), +(8, 1, 2, 1), +(11, 1, 4, 4), +(14, 2, 2, 1), +(15, 2, 2, 2), +(16, 2, 4, 4), +(17, 2, 2, 3), +(18, 2, 2, 5), +(23, 4, 6, 4), +(26, 5, 6, 4), +(27, 4, 7, 1), +(28, 4, 7, 2), +(29, 4, 7, 3), +(30, 4, 7, 5), +(31, 5, 5, 1), +(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); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `admin` +-- + +CREATE TABLE `admin` ( + `id_admin` int(11) NOT NULL, + `id_warehouse` int(11) NOT NULL, + `username` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + `mail` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(128) COLLATE utf8_unicode_ci NOT NULL, + `token` varchar(128) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `admin` +-- + +INSERT INTO `admin` (`id_admin`, `id_warehouse`, `username`, `mail`, `password`, `token`) VALUES +(1, 7, 'adrien.marques', 'adminmail@gmail.com', 'eb35bccc794d3151b050285c3f6f6d084faadcc7345302b639fbb036cf623b7befcbf7ea08579c612f6201b22cdbc98d6d5d39354b3d31f51ba0426a5299371d', '434f3494ca228538463320eccf93ba67ca29e734073fbf7a9178ba7494b0e26365bb5ae2ead89428f515cdcb9ac75f0ec2200033c3911f4a49f133dfb6dd4aca'), +(2, 8, 'alexandre.marques', 'admin2mail@gmail.com', 'b70896036f6d717f938ca09f531364c17910fc6a2011166e2c2bac6f505bda52e8d8993fefb7a6fdf13b1fd5368280f064ff87e01ae74aadf7e14f582dede676', '287361328d110cbc2e78464563e005dc82a6a0d501b84cba6770dd3d173b65eef0b226fcb8326cc14fb4ee9dec5df6622a11fd8e6e8a6e518a7eca055e67e8c5'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `chip` +-- + +CREATE TABLE `chip` ( + `id_chip` int(11) NOT NULL, + `id_module` int(11) DEFAULT NULL, + `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `position` int(11) NOT NULL, + `type` varchar(10) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for 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'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `global_state` +-- + +CREATE TABLE `global_state` ( + `id_global_state` int(11) NOT NULL, + `global_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'started | signaled | locked', + `chips` varchar(30) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `global_state` +-- + +INSERT INTO `global_state` (`id_global_state`, `global_state`, `chips`) VALUES +(1, '0X0', '00x'), +(2, '100', 'G1x'), +(3, '110', 'B1x'), +(4, 'XX1', 'R0x'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `history` +-- + +CREATE TABLE `history` ( + `id_history` int(11) NOT NULL, + `timestamp` int(11) NOT NULL, + `id_user` int(11) NOT NULL, + `id_machine` int(11) NOT NULL, + `id_action` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for 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); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `log` +-- + +CREATE TABLE `log` ( + `id_log` int(11) NOT NULL, + `id_feature` int(11) NOT NULL, + `id_machine` int(11) NOT NULL, + `timestamp` int(11) NOT NULL, + `value` text COLLATE latin1_bin NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `machine` +-- + +CREATE TABLE `machine` ( + `id_machine` int(11) NOT NULL, + `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 +) 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); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `machine_cluster` +-- + +CREATE TABLE `machine_cluster` ( + `id_machine_cluster` int(11) NOT NULL, + `id_warehouse` int(11) NOT NULL, + `name` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `machine_cluster` +-- + +INSERT INTO `machine_cluster` (`id_machine_cluster`, `id_warehouse`, `name`) VALUES +(1, 7, 'surgelés'), +(2, 7, 'laitiers'), +(3, 7, 'fruits.legumes'), +(4, 8, 'Machines Surgelés'), +(5, 8, 'Machines Laitiers'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `machine_cluster_merge` +-- + +CREATE TABLE `machine_cluster_merge` ( + `id_machine_cluster_merge` int(11) NOT NULL, + `id_machine_cluster` int(11) NOT NULL, + `id_machine` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for 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); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `module` +-- + +CREATE TABLE `module` ( + `id_module` int(11) NOT NULL, + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `module` +-- + +INSERT INTO `module` (`id_module`, `name`) VALUES +(1, 'module'), +(2, 'download'), +(3, 'upload'), +(4, 'testblabla'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `module_merge` +-- + +CREATE TABLE `module_merge` ( + `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_merge` +-- + +INSERT INTO `module_merge` (`id_warehouse`, `id_module`) VALUES +(7, 1), +(7, 2), +(7, 3); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `pin_merge` +-- + +CREATE TABLE `pin_merge` ( + `id_pin_merge` int(11) NOT NULL, + `id_chip` int(11) NOT NULL, + `pin` int(11) NOT NULL, + `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for 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'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `state` +-- + +CREATE TABLE `state` ( + `id_state` int(11) NOT NULL, + `id_pin_merge` int(11) NOT NULL, + `state` varchar(1) COLLATE utf8_unicode_ci NOT NULL, + `value` smallint(4) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for 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), +(13, 4, '0', 0), +(14, 4, '1', 1), +(15, 5, '0', 0), +(16, 5, '1', 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + +CREATE TABLE `user` ( + `id_user` int(11) NOT NULL, + `id_warehouse` int(11) NOT NULL, + `code` varchar(20) NOT NULL, + `username` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + `firstname` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + `lastname` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + `mail` varchar(50) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `user` +-- + +INSERT INTO `user` (`id_user`, `id_warehouse`, `code`, `username`, `firstname`, `lastname`, `mail`) VALUES +(1, 7, '92-55-B9-B4', 'jufrenc', 'Juliana', 'French', 'julianafrench@core.com'), +(2, 7, '10-FE-BD-61', 'cuchurc', 'Curry', 'Church', 'currychurch@corecom.com'), +(3, 7, 'E0-11-41-DB', 'gediaz', 'Geneva', 'Diaz', 'genevadiaz@corecom.com'), +(7, 7, 'DB-A3-8A-D7', 'rogomez', 'bli', 'Gomez', 'rodriquezgomez@corecom.com'), +(8, 7, 'AF-BB-68-6B', 'beholde', 'Bender', 'Holder', 'benderholder@corecom.com'), +(9, 7, '39-DF-20-69', 'bemurra', 'Beck', 'Murray', 'beckmurray@corecom.com'), +(11, 7, '75-E1-A6-9E', 'phpears', 'Phoebe', 'Pearson', 'phoebepearson@corecom.com'), +(13, 7, 'E1-C8-AB-8C', 'shmcgow', 'Shepherd', 'Mcgowan', 'shepherdmcgowan@corecom.com'), +(14, 7, '7C-94-C4-9A', 'sawolfe', 'Sandoval', 'Wolfe', 'sandovalwolfe@corecom.com'), +(15, 7, '36-3C-BB-F4', 'jualvar', 'Julie', 'Alvarado', 'juliealvarado@corecom.com'), +(16, 7, 'E7-52-B2-35', 'erhayes', 'Erin', 'Hayes', 'erinhayes@corecom.com'), +(18, 7, '89-64-A2-C2', 'jamcgee', 'Janine', 'Mcgee', 'janinemcgee@corecom.com'), +(19, 7, 'AB-E2-19-73', 'jawilco', 'Janell', 'Wilcox', 'janellwilcox@corecom.com'), +(20, 7, '88-13-39-95', 'guhale', 'Gutierrez', 'Hale', 'gutierrezhale@corecom.com'), +(21, 7, '6A-8B-F5-05', 'loclark', 'Lowery', 'Clarke', 'loweryclarke@corecom.com'), +(23, 7, 'C2-97-8A-D1', 'docohen', 'Dorsey', 'Cohen', 'dorseycohen@corecom.com'), +(24, 7, 'D1-CD-18-D5', 'moallen', 'Mosley', 'Allen', 'mosleyallen@corecom.com'), +(25, 7, 'BF-18-2B-5A', 'gehenry', 'Georgia', 'Henry', 'georgiahenry@corecom.com'), +(26, 7, '3A-B9-55-4C', 'rodaugh', 'Rosetta', 'Daugherty', 'rosettadaugherty@corecom.com'), +(27, 7, '6C-90-5E-0A', 'adsmall', 'Adrian', 'Small', 'adriansmall@corecom.com'), +(28, 7, '3B-FE-71-B1', 'belong', 'Benton', 'Long', 'bentonlong@corecom.com'), +(29, 7, '94-B6-5A-D4', 'atriddl', 'Atkins', 'Riddle', 'atkinsriddle@corecom.com'), +(31, 7, '7D-2B-DB-BD', 'buluna', 'Bush', 'Luna', 'bushluna@corecom.com'), +(32, 7, 'D8-A3-FB-FC', 'frodom', 'Fran', 'Odom', 'franodom@corecom.com'), +(33, 7, 'D8-3D-79-D5', 'stvaugh', 'Stevens', 'Vaughan', 'stevensvaughan@corecom.com'), +(34, 7, 'CE-08-DB-1D', 'krgilli', 'Kristi', 'Gilliam', 'kristigilliam@corecom.com'), +(35, 7, 'F1-3C-AA-0D', 'trwolf', 'Trudy', 'Wolf', 'trudywolf@corecom.com'), +(36, 7, '86-EE-8D-B3', 'peharre', 'Penelope', 'Harrell', 'penelopeharrell@corecom.com'), +(37, 7, '34-1E-E7-CC', 'perober', 'Pena', 'Roberson', 'penaroberson@corecom.com'), +(38, 7, '36-E8-D6-7F', 'makeith', 'Maryann', 'Keith', 'maryannkeith@corecom.com'), +(39, 7, '23-77-0B-03', 'almatth', 'Allie', 'Matthews', 'alliematthews@corecom.com'), +(40, 7, '83-1B-E8-D4', 'gicarpe', 'Giles', 'Carpenter', 'gilescarpenter@corecom.com'), +(41, 7, '59-4F-13-7B', 'nemays', 'Newman', 'Mays', 'newmanmays@corecom.com'), +(43, 7, '5F-CA-AD-DC', 'laguthr', 'Larson', 'Guthrie', 'larsonguthrie@corecom.com'), +(45, 7, 'E9-61-60-8B', 'elgolde', 'Ella', 'Golden', 'ellagolden@corecom.com'), +(46, 7, '3B-27-8E-1F', 'cacasta', 'Cantrell', 'Castaneda', 'cantrellcastaneda@corecom.com'), +(47, 7, '49-DF-A5-C2', 'auwalla', 'Audrey', 'Wallace', 'audreywallace@corecom.com'), +(48, 7, 'B1-87-EA-BF', 'mcsavag', 'Mcmillan', 'Savage', 'mcmillansavage@corecom.com'), +(49, 7, '63-7F-09-29', 'shhicks', 'Shawna', 'Hicks', 'shawnahicks@corecom.com'), +(50, 7, 'C9-48-F7-62', 'lyroth', 'Lynn', 'Roth', 'lynnroth@corecom.com'), +(51, 7, 'DF-CD-42-C9', 'mitran', 'Minerva', 'Tran', 'minervatran@corecom.com'), +(53, 7, 'F5-AA-76-14', 'wrdelga', 'Wright', 'Delgado', 'wrightdelgado@corecom.com'), +(54, 7, 'A5-C8-50-F5', 'mamccon', 'May', 'Mcconnell', 'maymcconnell@corecom.com'), +(55, 7, 'A0-0E-D0-AC', 'heranda', 'Herrera', 'Randall', 'herrerarandall@corecom.com'), +(56, 7, 'FF-1F-FD-20', 'gwyates', 'Gwendolyn', 'Yates', 'gwendolynyates@corecom.com'), +(57, 7, '7D-0D-95-B1', 'rabento', 'Ramos', 'Benton', 'ramosbenton@corecom.com'), +(58, 7, '9D-5A-95-A9', 'grhorne', 'Graves', 'Horne', 'graveshorne@corecom.com'), +(59, 7, 'B9-3C-5A-74', 'malawre', 'Maribel', 'Lawrence', 'maribellawrence@corecom.com'), +(60, 7, 'E0-B9-0F-F5', 'pelinds', 'Peterson', 'Lindsey', 'petersonlindsey@corecom.com'), +(61, 7, 'BD-A1-69-F0', 'lechen', 'Lee', 'Chen', 'leechen@corecom.com'), +(62, 7, '81-8B-3B-DD', 'doramos', 'Doreen', 'Ramos', 'doreenramos@corecom.com'), +(64, 7, '12-74-96-57', 'kamarti', 'Kane', 'Martinez', 'kanemartinez@corecom.com'), +(65, 7, '5E-CA-06-D0', 'elmolin', 'Eleanor', 'Molina', 'eleanormolina@corecom.com'), +(66, 7, '46-D5-1C-58', 'pesimps', 'Pennington', 'Simpson', 'penningtonsimpson@corecom.com'), +(67, 7, '04-D8-00-77', 'tacleme', 'Tami', 'Clements', 'tamiclements@corecom.com'), +(69, 7, '99-82-48-DC', 'chmeado', 'Charlene', 'Meadows', 'charlenemeadows@corecom.com'), +(70, 7, '51-FC-6F-FB', 'loware', 'Lois', 'Ware', 'loisware@corecom.com'), +(71, 7, 'C5-20-CB-4B', 'mcwashi', 'Mcgee', 'Washington', 'mcgeewashington@corecom.com'), +(72, 7, 'BA-25-6F-EA', 'laoneil', 'Langley', 'Oneil', 'langleyoneil@corecom.com'), +(73, 7, 'D6-9E-A2-80', 'frfloyd', 'Frost', 'Floyd', 'frostfloyd@corecom.com'), +(74, 7, '26-C4-EB-5D', 'dipruit', 'Diaz', 'Pruitt', 'diazpruitt@corecom.com'), +(75, 7, '8A-BF-C9-3D', 'butucke', 'Bullock', 'Tucker', 'bullocktucker@corecom.com'), +(76, 7, '17-4B-80-EC', 'fohyde', 'Foster', 'Hyde', 'fosterhyde@corecom.com'), +(77, 7, 'C8-5B-C6-4A', 'halarse', 'Hahn', 'Larsen', 'hahnlarsen@corecom.com'), +(78, 7, 'BD-6F-75-F0', 'pahawki', 'Payne', 'Hawkins', 'paynehawkins@corecom.com'), +(79, 7, 'C4-DB-18-8B', 'lecantr', 'Leach', 'Cantrell', 'leachcantrell@corecom.com'), +(81, 7, '04-08-EB-92', 'mubrook', 'Munoz', 'Brooks', 'munozbrooks@corecom.com'), +(82, 7, 'EB-DB-FD-87', 'sofarle', 'Sofia', 'Farley', 'sofiafarley@corecom.com'), +(83, 7, '83-F4-17-0D', 'trwalls', 'Trina', 'Walls', 'trinawalls@corecom.com'), +(84, 7, 'E7-7D-E0-52', 'prgentr', 'Price', 'Gentry', 'pricegentry@corecom.com'), +(85, 7, '0F-6C-B6-F9', 'adwilli', 'Adriana', 'Williamson', 'adrianawilliamson@corecom.com'), +(86, 7, '2D-C2-9C-32', 'gaarmst', 'Garner', 'Armstrong', 'garnerarmstrong@corecom.com'), +(87, 7, '1C-5E-93-06', 'ratrevi', 'Rachael', 'Trevino', 'rachaeltrevino@corecom.com'), +(88, 7, '6F-49-74-A5', 'sagates', 'Samantha', 'Gates', 'samanthagates@corecom.com'), +(89, 7, '54-65-6C-9F', 'swbarry', 'Sweet', 'Barry', 'sweetbarry@corecom.com'), +(91, 7, 'F1-D0-5D-4E', 'rushann', 'blo', 'Shannon', 'russellshannon@corecom.com'), +(94, 7, '28-86-38-25', 'euantho', 'zlozlazli', 'Anthony', 'eugeniaanthony@corecom.com'), +(95, 7, 'C7-7C-E2-41', 'kirodri', 'bloblabli', 'Rodriguez', 'kingrodriguez@corecom.com'), +(96, 7, '6B-1B-5E-A7', 'momeyer', 'Montoya', 'Meyer', 'montoyameyer@corecom.com'), +(97, 7, '48-03-38-1F', 'lastron', 'Larsen', 'Strong', 'larsenstrong@corecom.com'), +(98, 7, 'E0-4B-04-F6', 'crklein', 'Craft', 'Klein', 'craftklein@corecom.com'), +(99, 7, '2F-7D-0A-51', 'decampo', 'Delgado', 'Campos', 'delgadocampos@corecom.com'), +(100, 7, '91-D4-7E-65', 'mclott', 'Mcmahon', 'Lott', 'mcmahonlott@corecom.com'), +(101, 7, '01-FB-DB-83', 'username', 'firstname', 'lastname', 'mail@mail.com'), +(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'), +(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'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_cluster` +-- + +CREATE TABLE `user_cluster` ( + `id_user_cluster` int(11) NOT NULL, + `id_warehouse` int(11) NOT NULL, + `name` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `user_cluster` +-- + +INSERT INTO `user_cluster` (`id_user_cluster`, `id_warehouse`, `name`) VALUES +(2, 7, 'conducteurs'), +(4, 7, 'maintenance'), +(5, 8, 'Conducteurs Lait'), +(6, 8, 'Maintenance'), +(7, 8, 'Conducteurs Surgelé'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_cluster_merge` +-- + +CREATE TABLE `user_cluster_merge` ( + `id_user_cluster_merge` int(11) NOT NULL, + `id_user_cluster` int(11) NOT NULL, + `id_user` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `user_cluster_merge` +-- + +INSERT INTO `user_cluster_merge` (`id_user_cluster_merge`, `id_user_cluster`, `id_user`) VALUES +(12, 2, 15), +(23, 4, 7), +(42, 2, 7), +(43, 2, 3), +(51, 4, 9), +(52, 4, 16), +(53, 4, 13), +(54, 2, 1), +(55, 4, 1), +(61, 7, 206), +(65, 7, 208), +(86, 6, 210), +(87, 5, 215); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `warehouse` +-- + +CREATE TABLE `warehouse` ( + `id_warehouse` int(11) NOT NULL, + `name` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL, + `theme` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'f44f06', + `password` varchar(128) COLLATE utf8_unicode_ci NOT NULL, + `token` varchar(128) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `warehouse` +-- + +INSERT INTO `warehouse` (`id_warehouse`, `name`, `theme`, `password`, `token`) VALUES +(7, 'stef-montauban', '3091DB', '53859350c1eb59e301d8fe747f4d1c96d3ec31d95cd1bc72c81d72800edbc6ab45da0d5b6208080fb2e519b1f9848ce0a1289775800912068f32e390f5e1bb6c', '2046c66738b4f1f1e6460537f11970ec5b2cfa65f295b2ca0d2036609dcd3f8ccb6ec271e15440933d3b24ae27eba71423a4545583ab6f3736a5d4f7c8f8c53e'), +(8, 'stef-toulouse', 'DB554E', '273bd225482d20c061620c80e3bb87528d9e178bd572acd47feb58eee7e8a3847cb308b287d9d94c7a292b33d4c766cdb7c95c2828f53b97bbc0f80fa44aeb83', '52131065a906de90e26da0732e58400edd6739cfa03fc658e7593abef4a4504e18e66e1a8fe9da374a8e8f753603463e4777789262b3ee945d4bf72dd8d6399c'); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `action` +-- +ALTER TABLE `action` + ADD PRIMARY KEY (`id_action`); + +-- +-- Indexes for table `action_merge` +-- +ALTER TABLE `action_merge` + ADD PRIMARY KEY (`id_action_merge`), + ADD KEY `id_action` (`id_action`), + ADD KEY `id_target` (`id_target`), + ADD KEY `id_source` (`id_source`); + +-- +-- Indexes for table `admin` +-- +ALTER TABLE `admin` + ADD PRIMARY KEY (`id_admin`), + ADD KEY `id_warehouse` (`id_warehouse`); + +-- +-- Indexes for table `chip` +-- +ALTER TABLE `chip` + ADD PRIMARY KEY (`id_chip`), + ADD KEY `id_module` (`id_module`); + +-- +-- Indexes for table `global_state` +-- +ALTER TABLE `global_state` + ADD PRIMARY KEY (`id_global_state`); + +-- +-- Indexes for table `history` +-- +ALTER TABLE `history` + ADD PRIMARY KEY (`id_history`), + ADD KEY `id_user` (`id_user`,`id_machine`,`id_action`), + ADD KEY `history_id_machine` (`id_machine`), + ADD KEY `history_id_action` (`id_action`); + +-- +-- Indexes for table `log` +-- +ALTER TABLE `log` + ADD PRIMARY KEY (`id_log`), + ADD KEY `id_machine` (`id_machine`), + ADD KEY `id_feature` (`id_feature`); + +-- +-- Indexes for table `machine` +-- +ALTER TABLE `machine` + ADD PRIMARY KEY (`id_machine`), + ADD UNIQUE KEY `token` (`token`), + ADD KEY `id_warehouse` (`id_warehouse`); + +-- +-- Indexes for table `machine_cluster` +-- +ALTER TABLE `machine_cluster` + ADD PRIMARY KEY (`id_machine_cluster`), + ADD KEY `id_warehouse` (`id_warehouse`); + +-- +-- Indexes for table `machine_cluster_merge` +-- +ALTER TABLE `machine_cluster_merge` + ADD PRIMARY KEY (`id_machine_cluster_merge`), + ADD KEY `id_machine_cluster` (`id_machine_cluster`), + ADD KEY `id_machine` (`id_machine`); + +-- +-- Indexes for table `module` +-- +ALTER TABLE `module` + ADD PRIMARY KEY (`id_module`); + +-- +-- Indexes for table `module_merge` +-- +ALTER TABLE `module_merge` + ADD KEY `id_module` (`id_module`), + ADD KEY `id_warehouse` (`id_warehouse`); + +-- +-- Indexes for table `pin_merge` +-- +ALTER TABLE `pin_merge` + ADD PRIMARY KEY (`id_pin_merge`), + ADD KEY `id_chip` (`id_chip`); + +-- +-- Indexes for table `state` +-- +ALTER TABLE `state` + ADD PRIMARY KEY (`id_state`), + ADD KEY `id_pin_merge` (`id_pin_merge`); + +-- +-- Indexes for table `user` +-- +ALTER TABLE `user` + ADD PRIMARY KEY (`id_user`), + ADD KEY `id_warehouse` (`id_warehouse`); + +-- +-- Indexes for table `user_cluster` +-- +ALTER TABLE `user_cluster` + ADD PRIMARY KEY (`id_user_cluster`), + ADD KEY `id_warehouse` (`id_warehouse`); + +-- +-- Indexes for table `user_cluster_merge` +-- +ALTER TABLE `user_cluster_merge` + ADD PRIMARY KEY (`id_user_cluster_merge`), + ADD KEY `id_user_cluster` (`id_user_cluster`), + ADD KEY `id_user` (`id_user`); + +-- +-- Indexes for table `warehouse` +-- +ALTER TABLE `warehouse` + ADD PRIMARY KEY (`id_warehouse`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `action` +-- +ALTER TABLE `action` + MODIFY `id_action` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; +-- +-- AUTO_INCREMENT for table `action_merge` +-- +ALTER TABLE `action_merge` + MODIFY `id_action_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39; +-- +-- AUTO_INCREMENT for table `admin` +-- +ALTER TABLE `admin` + MODIFY `id_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; +-- +-- AUTO_INCREMENT for table `chip` +-- +ALTER TABLE `chip` + MODIFY `id_chip` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; +-- +-- AUTO_INCREMENT for table `global_state` +-- +ALTER TABLE `global_state` + MODIFY `id_global_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; +-- +-- AUTO_INCREMENT for table `history` +-- +ALTER TABLE `history` + MODIFY `id_history` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=221; +-- +-- AUTO_INCREMENT for table `log` +-- +ALTER TABLE `log` + MODIFY `id_log` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `machine` +-- +ALTER TABLE `machine` + MODIFY `id_machine` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=130; +-- +-- AUTO_INCREMENT for table `machine_cluster` +-- +ALTER TABLE `machine_cluster` + MODIFY `id_machine_cluster` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; +-- +-- 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; +-- +-- AUTO_INCREMENT for table `module` +-- +ALTER TABLE `module` + MODIFY `id_module` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; +-- +-- AUTO_INCREMENT for table `pin_merge` +-- +ALTER TABLE `pin_merge` + MODIFY `id_pin_merge` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; +-- +-- AUTO_INCREMENT for table `state` +-- +ALTER TABLE `state` + MODIFY `id_state` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; +-- +-- AUTO_INCREMENT for table `user` +-- +ALTER TABLE `user` + MODIFY `id_user` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=216; +-- +-- AUTO_INCREMENT for table `user_cluster` +-- +ALTER TABLE `user_cluster` + MODIFY `id_user_cluster` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; +-- +-- 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; +-- +-- AUTO_INCREMENT for table `warehouse` +-- +ALTER TABLE `warehouse` + MODIFY `id_warehouse` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `action_merge` +-- +ALTER TABLE `action_merge` + ADD CONSTRAINT `action_merge_id_action` FOREIGN KEY (`id_action`) REFERENCES `action` (`id_action`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `action_merge_id_source` FOREIGN KEY (`id_source`) REFERENCES `user_cluster` (`id_user_cluster`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `action_merge_id_target` FOREIGN KEY (`id_target`) REFERENCES `machine_cluster` (`id_machine_cluster`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `admin` +-- +ALTER TABLE `admin` + ADD CONSTRAINT `admin_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`); + +-- +-- Constraints for table `chip` +-- +ALTER TABLE `chip` + ADD CONSTRAINT `chip_id_module` FOREIGN KEY (`id_module`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `history` +-- +ALTER TABLE `history` + ADD CONSTRAINT `history_id_action` FOREIGN KEY (`id_action`) REFERENCES `action` (`id_action`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `history_id_machine` FOREIGN KEY (`id_machine`) REFERENCES `machine` (`id_machine`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `history_id_user` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `log` +-- +ALTER TABLE `log` + ADD CONSTRAINT `log_id_feature` FOREIGN KEY (`id_feature`) REFERENCES `module` (`id_module`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `log_id_machine` FOREIGN KEY (`id_machine`) REFERENCES `machine` (`id_machine`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `machine` +-- +ALTER TABLE `machine` + ADD CONSTRAINT `machine_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`); + +-- +-- Constraints for table `machine_cluster` +-- +ALTER TABLE `machine_cluster` + ADD CONSTRAINT `machine_cluster_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- 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; + +-- +-- 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; + +-- +-- Constraints for table `pin_merge` +-- +ALTER TABLE `pin_merge` + ADD CONSTRAINT `pin_id_chip` FOREIGN KEY (`id_chip`) REFERENCES `chip` (`id_chip`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `state` +-- +ALTER TABLE `state` + ADD CONSTRAINT `state_id_pin_merge` FOREIGN KEY (`id_pin_merge`) REFERENCES `pin_merge` (`id_pin_merge`); + +-- +-- Constraints for table `user` +-- +ALTER TABLE `user` + ADD CONSTRAINT `user_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`); + +-- +-- Constraints for table `user_cluster` +-- +ALTER TABLE `user_cluster` + ADD CONSTRAINT `user_cluster_id_warehouse` FOREIGN KEY (`id_warehouse`) REFERENCES `warehouse` (`id_warehouse`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints for table `user_cluster_merge` +-- +ALTER TABLE `user_cluster_merge` + ADD CONSTRAINT `user_cluster_merge_id_user` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `user_cluster_merge_id_user_cluster` FOREIGN KEY (`id_user_cluster`) REFERENCES `user_cluster` (`id_user_cluster`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!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 */;