-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 24, 2016 at 06:35 PM
-- Server version: 5.7.12-0ubuntu1.1
-- PHP Version: 7.0.4-7ubuntu2.1

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: `stefproject`
--

-- --------------------------------------------------------

--
-- 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,
  `action` varchar(20) COLLATE utf8_unicode_ci NOT NULL
) 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', 'X1X'),
(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
(1, 1, 2, 1),
(4, 1, 2, 5),
(6, 1, 2, 2),
(7, 1, 2, 3);

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
  `id_admin` int(11) NOT NULL,
  `id_warehouse` int(11) NOT NULL,
  `username` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `mail` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `password` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `token` varchar(64) 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', '963bbded00d37fb3ab2863093a5a76033d9cce6557c833af65e541c8abb96c6a', '65c8c2e3d59f258f1b81fec65d8e7d19f557d2a6eb5ab83848c2cd89d08ba84c'),
(2, 8, 'alexandre.marques', 'admin2mail@gmail.com', '963bbded00d37fb3ab2863093a5a76033d9cce6557c833af65e541c8abb96c6a', '65c8c2e3d59f258f1b81fec65d8e7d19f557d2a6eb5ab83848c2cd89d08ba84f');

-- --------------------------------------------------------

--
-- 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,
  `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
(1, 20160721, 1, 5, 1),
(2, 2016079, 1, 5, 2),
(3, 20160725, 1, 6, 5),
(8, 20160749, 7, 8, 2),
(9, 20160749, 8, 8, 2),
(10, 20160749, 8, 9, 2),
(11, 20160749, 8, 10, 2);

-- --------------------------------------------------------

--
-- Table structure for table `machine`
--

CREATE TABLE `machine` (
  `id_machine` int(11) NOT NULL,
  `id_warehouse` int(11) NOT NULL,
  `name` varchar(30) NOT NULL,
  `token` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `machine`
--

INSERT INTO `machine` (`id_machine`, `id_warehouse`, `name`, `token`) VALUES
(5, 7, 'HKSWO', 'b4d98765257085fbf670f5bc2051d614b74c46cc3bc7d82254527f04676060a3'),
(6, 7, 'ASIFK', 'a0c5074a566fdea09699eeddbe9bf7abe2c4c20cfaaf5c804450a98c5baa6c2a'),
(7, 7, 'CCKED', '4ad84c1316ea4e468593ce463128e22de253edb8636716ffc56c30568abf7f85'),
(8, 7, 'KDVSJ', '8a0c38ea61bfc52f64b76e3435e44c9265a058fb122f7ad6a6148d56366ea92d'),
(9, 7, 'VCEWY', '5617b97c0cb13da11c88517c13fdeb9320595456ffba46d06792e2ddcd608f73'),
(10, 7, 'UKWVN', 'a25a4c5fcf09cec6d57cd1b4b3606fd137cbf502bc21dfaa84e34a0124766a1e'),
(11, 7, 'FFJDJ', '432a14853f6cb254828cef3dafa2698b43d4adebe71bd20af5eccc14fa9f1b96'),
(12, 7, 'NHCWO', 'ebda82bba05de9bf7bfd8b28c8bfc37c0613b6dde9b520c3b203c89ebbc9510c'),
(13, 7, 'IBRFK', '15589a0db29ce6bcc79033c34bce79807ee1e6e09d33d7a68516766f137e8287'),
(14, 7, 'FGLXK', 'b984d53fc57f3f4421e40b0843596d91d0c1495ecfb6971037cf328bb265ba8a'),
(15, 7, 'BUZRV', 'e3506725d92913d4ebf27ca7dd94e169f127620e106d8c807c831a6129a7161a'),
(16, 7, 'WKNTM', 'fd17d195ba3dc750b1f7ff1d6d8436a8d596927d0a4e8472f5cb8fd719c5f3ba'),
(17, 7, 'SPQOQ', '0d5d3e77cbfbe84a781644c2dcd11fd1d2be0f7e714bf6cc9b438cdd0b94e59f'),
(18, 7, 'SSRWE', '6ef4fd3bf0faf1d0d7b4e5098fd030124462ea9b2c4ab5df747f77edad9c627f'),
(19, 7, 'TIBAH', '61b66c8b6a094f6ab1048c7c7875391a707156fb364933ab7037548c578febed'),
(20, 7, 'EKOFT', 'a429abbb7cad9c018f3e9dfe117cfb6e7234f7a114fe01ce5c721349c9100206'),
(21, 7, 'GJTJW', 'f23bc3d2fa84fbd8c242dad16c7da3789acf2a39273315f977d67529e74589b5'),
(22, 7, 'XIPNP', '19961d49dfcdaf12f21c3ebe9cfeb2fc4eb271506c4c8a74ceb86244ab7cf408'),
(23, 7, 'FDFXQ', 'c30780d4dfc1c7f6ff13643b4ab2ee7f627ce6b17ffea9603a77c063cb810f91'),
(24, 7, 'HSCUZ', '7ff3d951b505db3191f5378fb44bcbdc9dca85eae08da318b104383b13e60c62'),
(25, 7, 'BYKBF', '82484ba0b110d43dc9be707cb4fe32ca44a689455a182933d116add9e7b75764'),
(26, 7, 'GNOKK', '057a38294c9f4bf06b5c7f5fd1152b1ba17fb3c742dfe96f17311b801a817ad8'),
(27, 7, 'WLSUB', '5c916e172a2a1f705a16263e12b45013c78ce200c13de57739f0427971aab1f0'),
(28, 7, 'DMTTJ', '8ea3e26a208dc8398d3583adff5e1028a8bf54f9988567e06ec8ec849a884e9e'),
(29, 7, 'OCFWD', '1e03b1c91df17b15fc06d14b0c0470b2d92c9a08714ae879d176b685d18699e9'),
(32, 7, 'OULIX', '97fbf7090fad2bd900d597129e276eeb658bc309d94c03ab70e8b59a4ff62f5b'),
(33, 7, 'XCDYM', '8dcec2b55e2dbf8d44d7fd012e6c3a602d4618ae9f3558a6e3ef193940e2ccdf'),
(34, 7, 'LREGF', 'b30e2862a0a4e8058a602271a8e9e02ca81b344db55351f430c95bfbf289d372'),
(35, 7, 'DDLSP', '1896e6d21974a50c6915331be5b80c6ee0c3ddaf87b37fcce445077d47f73189'),
(36, 7, 'DTGHG', '855833a4f4d67cce130d3599caf61ea25fae668292656d9bd60dbcb501fdd9ef'),
(37, 7, 'BZWUE', '8bdc09434eb2be80911e5b5b436a6cdfe2d6c86dd2cdec3514e83d6f9c8cf5a7'),
(38, 7, 'LGDDS', 'a9ccdb71a78b4829b37e9b4c62f5706dfbac452fcc04163c31e5147ec5bbc833'),
(39, 7, 'ERXMY', '729beb8c9b588f92a97875037228ebd73a8dd22ce34920500f7793dbece6349b'),
(40, 7, 'VJGER', '5a4860c7597c43006d7493f220b3947f0b4a5840e0577718d4b320e88f5f89c0'),
(41, 7, 'LOXIE', '933d2dc041ac654d3c397aecd2eb55035fedfed67dad13ad40f49b244a5a1481'),
(42, 7, 'IHARA', '0c60f2e4c5b81609edbca8a79792595f43ab7c40d12fc9f81df0fb78b1a4744a'),
(43, 7, 'ZIQJQ', '8f374e108c45091aea35e0d4c74b7f2eb9697ade150593e66cb0361eed12d511'),
(44, 7, 'ZKUEW', 'cc45a1444e2a9fe42ce392050423cf2a7d82649ca99c72f3bd1107b9bd0ea657'),
(45, 7, 'BLDTO', '1c6e765a71503171c5ca60e5b557def304c601a537c6d11dd14398f6b19a9108'),
(46, 7, 'OZRQF', 'b90f84bc2bd318e8596ac824e12886a31ae777166b1ab44c7c2e66aeec548906'),
(47, 7, 'NWPBM', 'fd5b958ffc6a45f87ce06fdca087904d776252f03f25d284240d148446f58f11'),
(48, 7, 'OZDYC', 'bacfbf8119a8fa393c4fc038c7e5ff26aa29ceabd2a4b69cdbc823274674b11a'),
(49, 7, 'ETUZU', 'a298994fbf596e8c31bc6554f98bce963cf7df4ad75beecc42a341b914bcadab'),
(50, 7, 'CNQAB', 'ce216623099573f2de1048263f855e097a7fdbc715b5eca66ee01df592675d8a'),
(51, 7, 'OPIIW', '5833f8bd0146fa77afc8db5c0afae1c8fa14aa3c778ee487665380dbd064fc34'),
(53, 7, 'NMHYG', '3f42a35f55a6fbe59efe4b5d50234ded26ce6a6bb56b43292f1303ae28f5a403'),
(54, 7, 'ASKZD', '6838763e798c247b95efe4ca5e919eb095cc25654adb7e8ba93e4ba5087f8653'),
(55, 7, 'QMIJT', '5ee3e8beac1be4fa6afd60927dce814109a53185c57d5db356faedf89445e079'),
(56, 7, 'BBDZL', '8cc6b777e06d7b63f690ddb85c75600ca8e6defb7918800a09e9bfb28c261967'),
(57, 7, 'WKKYH', '669bf7ff1371d4999a426dd9d0e50a7148e22802456a710236c85dec5149086f'),
(58, 7, 'AFHJH', '229cab3a6ce9e0f451031cae1b96e95abb96da5f37016398a19df68b7ba1ac7f'),
(59, 7, 'CASXB', 'bed34b57fd452b7be6e4c0339949185023868025658534f7a614ce74a04547b5'),
(60, 7, 'LOXOZ', '26402659d53dd4656cde56026397c57d2046a928cd732c9647dc2f1322c721e3'),
(61, 7, 'ZTUNO', '420b4e5684138fd75173a9b4eabf097355a98bd343a54ac7430d88069505cea0'),
(62, 7, 'QGQNK', '6c10170d46ceb5aabfdbb8827a50816a3e10709e28c3b559f7fcfc74746635bb'),
(63, 7, 'SVIBS', '08b37cf1831d8f485c9956bd869cf7e5933378a04082090449821dafa21e0d73'),
(64, 7, 'RSVXL', '84eda88c1073ba85e043ab84a488651983fdead00f2e028ac822a1289304794d'),
(65, 7, 'EMESC', '3e1a9132319d0e9bcba98c3fef70eb002dfae1cda7ee4dcfdbe8fb331d8789a5'),
(66, 7, 'BBXON', '5597a04e965436d3bfa82a98429c08ce589a7737a55ad7f03cff5f75a8d9e592'),
(67, 7, 'NGLBK', 'e67031f5e890c03587261b27cf36b16f0f77fdc9f5b176f464cd9dbf72635b0d'),
(68, 7, 'MZHBC', '40dad1354fec6ad6845648ad4b509f596380fdbe95d72f49214ad4ff8a9fe7ed'),
(69, 7, 'OYEPB', '1992615a129ae81e55f8a6344e3d412d319f90e15537e8fbdbf4d9f49f32f041'),
(70, 7, 'RQFNK', 'a6c0168ef35869b18fd16e87220b79ce20e55f02738b0f3578752a344075c6be'),
(71, 7, 'MRUUS', '8a982f6776569ac16d27f1f6378f2bbee04268e6b62bc2b6d9c9ff1a9bc812d0'),
(72, 7, 'DJDVW', '4448ba4887beb9f880e858b812cb5cd9eecab4a1200ae95bee5b7f164d692235'),
(73, 7, 'SOJEJ', '6d88d67101e79c477f7ecc135eeba10125c8d5df6d4f26479f9da4504f88734a'),
(74, 7, 'YYSRC', '6fe67b9fbc3cb6a07a1f03b4ec1a59f06161d80a74b65b631279ad567c09d049'),
(75, 7, 'AJNMI', '97168f5566a1ff4deb1a9d1ac9a716667c7263c24b7396f3bf6d2efac715cc94'),
(76, 7, 'IVUSU', '24a6be400fb83f2e7bc7a0ff85f7c46da92e865cf4d07aea57f08c07b9bad6f0'),
(77, 7, 'VYPUB', 'f3df506f315afe55e23801ac10f09b265a1f16f25691f3c02b29df73bb1125e0'),
(78, 7, 'SJYUN', 'e587b7ba01cd028e22da6216eab12f1efd4742ed59b9d826018b7a307554d5cb'),
(79, 7, 'QRGTG', 'fcc626bf62245896c11bdec21ef0eca4c41b16ab031cb4b524679cef5de0afad'),
(80, 7, 'LXIFX', 'cd02c8d73eb1d480660ce0788c8d2fdf16c4871f4fe6f96da6496fcd0afe49b2'),
(81, 7, 'YXWTP', '99317d134fb5d7e7b08a990e03b618f1bacd4555f3df182554e2804e1fa9e342'),
(82, 7, 'SMEFT', '5383409fc2af704de10ada3476ac241b2f38c9d9ae29992a6fdde672b5bf7aa4'),
(83, 7, 'HUTUW', '057f8c6aa146e59e55054e9dc64d8a1c8e88740b12dfaced971954fe8ffb257a'),
(84, 7, 'DYCLY', '431c1f6e6cb3782d4befef80f2211822838e1e1bc3af7630cadf99a2b9ffe831'),
(85, 7, 'VBJWP', '6ec5e08c7041ff5ebcf5d954362bc26d70a3c9f35d040702e8d24baa353280a3'),
(86, 7, 'CZRPO', '4be28fbcc8341ce980fd7368e146ecb802b5b7cdcaacc181594f3130ba086342'),
(87, 7, 'JCNSP', '71bd9280397f4892f0ffd3323dead4212cfe77bceeaf9aab5dbcd18b2556d77a'),
(88, 7, 'EOKCA', '4441b025276f5abd0ca286079ee390451aa1cf1154abc6f539453de133961277'),
(89, 7, 'PZEAK', 'd63bd4317b3c7f1b0d760196523d3b4a1da643253e4afc9403e1417a04508136'),
(90, 7, 'ERIMX', '568f171451d75f3fcdcb1592deebd94f15f775ce0f73fedf7f0a93cddd40b8e7'),
(91, 7, 'NGVPC', 'efa33fff2175e3218261a168b055696d684ca286f8e714315403a3327eae8ade'),
(92, 7, 'MVONW', '15959b37cc1fc8e7a09c5b41fefbbe982bf43e7ec1c91fa9d4c25d5513087cc0'),
(93, 7, 'ZUHOD', 'caef75217a3dc8dcac3701dede3bcb91b6c955076d51300e86ebcf6573e3f639'),
(94, 7, 'YIATG', 'ed8881fcfbb6232a040d3726c7617c12d4a06bcc40bfa551b37cd6dbaf44f1e9'),
(95, 7, 'WFQGC', 'b5ed9282b5f6b0850b06a8225656a845f4d3e67efaeb6b24b3217c2703f15e98'),
(96, 7, 'NKZQL', '9f24a90c879534a77cab60f2e06ff34cb71f26494eb87a18f8b52c538b77b349'),
(97, 7, 'EMIWA', '0b070a27c9d3acd35de1054bc0cde8087491a154e8de78fe1ac8b907fe702925'),
(98, 7, 'WOYWY', 'd053eff105dc18ae3a7102cc7780a4e5c2da525eeb5d2c518e707bd3a8dc9322'),
(99, 7, 'ZBLQG', '08d5c78d8265d4a50af9077d04cef7003d0305127dcebe6296f38b6e1ac28a1d'),
(100, 7, 'STQYS', '0e46017afa2de78b817a151e41a37d3e5352a1616d0fc13c40ed3ac12580baa1'),
(101, 7, 'a', '5786289d418301e2584541b8fa484d4ec0f04dfabd36f6d15ab174b9c53811f8'),
(102, 7, 'machine1', '831e9024227e651fb4c17a9cfd050a9c68075bbb475ce2f731707d8371c8ab61'),
(103, 7, 'machine2', '5ab4012b23ddb474973eefa85afd21d03e5d4e07a8287c991e56fe013f36eace'),
(104, 7, 'machine3', '77d23601952121f65a1546eec81b08e81382deb5d015abb9e055d091899836ba'),
(105, 7, 'machine4', 'd65aa0434e18f41b4467ae2fc0a671e207753a238bb21ca922bfb8d9a87158c6'),
(106, 7, 'machine5', '1b615c263a166e6aea509260993f88da7e7575432e1cabc2007ce495b1e578ed'),
(107, 7, 'machine6', 'bfb1715589556a5e81dd0863bb3c5c0424149d8d0cae88cbf201ec7a52f3223f'),
(108, 7, 'machine7', '92db4c0c92acba35372a7b0741cd48565c57c7a8c0a2c07a39c75e329ba3a4a4'),
(109, 7, 'machine8', '82adcb46952b4308ed6c4c81972e4d46f3bc81e37fcdce49c89e8b9eccc77d03'),
(110, 7, 'machine9', '9070391dc61984bf52cf7c944d58e53cfa715d34fa30ca508df220e01db32302'),
(111, 7, 'machine10', 'c1c47684322f0c448ad8509f3e7a60b9bb20cd12adcf4abe0147d6f6ce777271'),
(112, 7, 'machine11', '0d8ecbf9a0b82a441d4afeab98579d23b44beaffe109d4bc081dc70cd86a4957'),
(113, 7, 'machine12', '47ca3abe1c46a43a4bf572ba08bc0f4322ac4dbc9017676ceaf578250fb05248'),
(114, 7, 'b', '123c966969541eb1aebc3183a28573caf7fc8f69eb8147273392f69ccd29ff2d'),
(115, 7, 'sd', '5b8f03b003ff40649949af3940ecd4e2aef82169f6bc3ae382be49a0b2141670'),
(116, 7, 'machine13', '7da985aaaca93d277baf0ddfb89274cda6785be46cec5f8c42772f08d876c964'),
(118, 7, 'macTest2', '07892380f3b3e490b1642d13619da69958acd14261f8906ba3e7be6129b2c096'),
(121, 7, 'dsad', 'e307030e0531069beffc6d4721eeabd395381e2c7193b6c3b45e373702f3df88');

-- --------------------------------------------------------

--
-- 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) COLLATE utf8_unicode_ci 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, 'mac_1');

-- --------------------------------------------------------

--
-- 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
(13, 1, 10),
(20, 1, 5),
(21, 1, 6),
(22, 1, 7),
(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),
(33, 1, 26),
(34, 1, 28);

-- --------------------------------------------------------

--
-- 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, 1, 'SERIAL'),
(2, 1, 2, 'SERIAL'),
(3, 1, 3, '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', 255),
(6, 3, 'G', 0),
(7, 1, 'B', 0),
(8, 2, 'B', 0),
(9, 3, 'B', 255),
(10, 1, 'R', 255),
(11, 2, 'R', 0),
(12, 3, 'R', 0),
(13, 4, '0', 0),
(14, 4, '1', 255),
(15, 5, '0', 0),
(16, 5, '1', 255);

-- --------------------------------------------------------

--
-- 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) NOT NULL,
  `firstname` varchar(30) NOT NULL,
  `lastname` varchar(30) 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'),
(10, 7, '12-34-56-67', '12', '12', '12', '12@ds.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');

-- --------------------------------------------------------

--
-- 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) COLLATE utf8_unicode_ci 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, 'DoNotRemove'),
(4, 7, 'userClus1');

-- --------------------------------------------------------

--
-- 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
(11, 2, 10),
(12, 2, 15),
(23, 4, 7),
(42, 2, 7),
(43, 2, 3),
(51, 4, 9),
(52, 4, 16),
(53, 4, 13),
(54, 2, 1);

-- --------------------------------------------------------

--
-- Table structure for table `warehouse`
--

CREATE TABLE `warehouse` (
  `id_warehouse` int(11) NOT NULL,
  `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `theme` varchar(6) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'f44f06',
  `password` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `token` varchar(64) 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', '00B0EB', '963bbded00d37fb3ab2863093a5a76033d9cce6557c833af65e541c8abb96c6a', '643405e1004845c2291c244faab192e3ad493b9dec147c8030475794b0f2fa23'),
(8, 'stef-toulouse', 'B356C8', '963bbded00d37fb3ab2863093a5a76033d9cce6557c833af65e541c8abb96c6a', '643405e1004845c2291c244faab192e3ad493b9dec147c803047f794b0f2fa23');

--
-- 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 `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 UNIQUE KEY `username` (`username`),
  ADD UNIQUE KEY `code` (`code`),
  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=10;
--
-- 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=12;
--
-- AUTO_INCREMENT for table `machine`
--
ALTER TABLE `machine`
  MODIFY `id_machine` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=122;
--
-- AUTO_INCREMENT for table `machine_cluster`
--
ALTER TABLE `machine_cluster`
  MODIFY `id_machine_cluster` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- 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=35;
--
-- 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=206;
--
-- AUTO_INCREMENT for table `user_cluster`
--
ALTER TABLE `user_cluster`
  MODIFY `id_user_cluster` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- 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=55;
--
-- 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 `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 */;
