-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 18-05-2021 a las 14:49:19
-- Versión del servidor: 10.4.14-MariaDB
-- Versión de PHP: 7.2.34

START TRANSACTION;



--
-- Base de datos: `authwe`
--

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

--
-- Estructura de tabla para la tabla `app`
--

CREATE TABLE `app` (
  `idApp` int(11) NOT NULL,
  `sName` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `app`
--

INSERT INTO `app` (`idApp`, `sName`) VALUES
(2, 'Check'),
(4, 'Entry'),
(3, 'Health'),
(1, 'Plan');

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

--
-- Estructura de tabla para la tabla `device`
--

CREATE TABLE `device` (
  `idDevice` int(11) NOT NULL,
  `idUser` int(11) NOT NULL,
  `sImei` varchar(255) DEFAULT NULL,
  `sDeviceId` varchar(255) DEFAULT NULL,
  `sBrand` varchar(45) DEFAULT NULL,
  `sModel` varchar(45) DEFAULT NULL,
  `sOsVersion` varchar(45) DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `device`
--

INSERT INTO `device` (`idDevice`, `idUser`, `sImei`, `sDeviceId`, `sBrand`, `sModel`, `sOsVersion`, `updated_at`, `created_at`) VALUES
(115, 300, NULL, 'cacf27d859ea72c3', 'samsung', 'SM-A510M', '24', '2020-04-22 17:48:54', '2020-04-22 17:48:54'),
(120, 249, '111222333', 'asad4r43ff4', 'asamsungsd', 'S-SFSFS', '28', '2020-04-23 14:53:51', '2020-04-23 14:53:51'),
(150, 296, '357458090164053', '52f0624af2762a9b', 'samsung', 'SM-G570M', '26', '2020-06-03 14:24:26', '2020-06-03 14:24:26'),
(156, 324, 'b7456e7815f5bf04', 'b7456e7815f5bf04', 'samsung', 'SM-A705MN', '29', '2020-06-10 17:45:51', '2020-06-10 17:45:51'),
(162, 326, '353108087560516', 'ead4e0cba996aa9b', 'samsung', 'SM-G532M', '23', '2020-07-21 14:01:48', '2020-07-21 14:01:48'),
(208, 128, '353108080587045', '97adc2f87cf98762', 'samsung', 'SM-G532M', '23', '2020-08-07 12:31:06', '2020-08-07 12:31:06'),
(218, 327, 'bd3f809f67bafe63', 'bd3f809f67bafe63', 'samsung', 'SM-J600G', '29', '2020-08-17 23:28:54', '2020-08-17 23:28:54'),
(223, 329, '352940097534292', 'e321dac7eaa53722', 'samsung', 'SM-G532M', '23', '2020-08-18 17:01:40', '2020-08-18 17:01:40'),
(235, 331, '352822102684843', '37806d44ccd864b7', 'samsung', 'SM-J415G', '28', '2020-08-24 12:27:37', '2020-08-24 12:27:37'),
(240, 316, '359830062710600', '9f213ba9acd8f7a5', 'samsung', 'SM-A300M', '21', '2020-09-01 19:28:52', '2020-09-01 19:28:52'),
(244, 258, '356193101033648', 'd6eaaf76c64d45cb', 'samsung', 'SM-J260M', '27', '2020-09-29 12:31:33', '2020-09-29 12:31:33'),
(245, 338, '359592078712232', 'cc06fb057e7daebc', 'samsung', 'SM-J710MN', '24', '2020-09-30 16:46:05', '2020-09-30 16:46:05'),
(253, 339, '354651082587686', '66671f8b6d1dfd21', 'lge', 'LG-X240', '23', '2020-10-13 19:37:53', '2020-10-13 19:37:53'),
(266, 344, '355526092098065', '96258a67ea63de64', 'motorola', 'moto g(6) plus', '28', '2020-11-10 19:16:51', '2020-11-10 19:16:51'),
(267, 345, NULL, '5fb4964042f2b6f4', 'motorola', 'moto g(8) plus', '29', '2020-12-08 02:42:13', '2020-12-08 02:42:13'),
(268, 346, '354651083292401', '7076a06a7dd55cc0', 'lge', 'LG-X240', '23', '2020-12-10 14:08:53', '2020-12-10 14:08:53'),
(269, 347, '8197530ab6c5330a', '8197530ab6c5330a', 'Redmi', 'Redmi Note 9 Pro', '29', '2020-12-10 21:59:22', '2020-12-10 21:59:22'),
(271, 303, '1bfaf774c35660f1', '1bfaf774c35660f1', 'samsung', 'SM-A505G', '29', '2020-12-29 12:21:22', '2020-12-29 12:21:22'),
(272, 328, '354621086662231', 'c44b81310f23910f', 'samsung', 'SM-G570M', '26', '2021-01-04 23:14:46', '2021-01-04 23:14:46'),
(273, 354, '9c3d024520d5afbf', '9c3d024520d5afbf', 'samsung', 'SM-A105M', '29', '2021-01-13 23:11:03', '2021-01-13 23:11:03'),
(274, 355, NULL, '85668f9a17087acb', 'TCL', '5101A', '28', '2021-01-14 18:47:13', '2021-01-14 18:47:13'),
(275, 356, NULL, '7db6cae75261f9e4', 'samsung', 'SM-T825', '26', '2021-01-26 02:59:33', '2021-01-26 02:59:33'),
(276, 357, '357713083297249', '0ac9bd65545ef7e5', 'samsung', 'SM-G610M', '27', '2021-01-26 23:59:29', '2021-01-26 23:59:29'),
(277, 352, '359567081231610', 'dc125bcd2ff728ec', 'motorola', 'Moto G (5S) Plus', '27', '2021-01-31 22:36:46', '2021-01-31 22:36:46');

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

--
-- Estructura de tabla para la tabla `domain`
--

CREATE TABLE `domain` (
  `idDomain` int(11) NOT NULL,
  `sDescription` varchar(100) NOT NULL,
  `idTeam` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `domain`
--

INSERT INTO `domain` (`idDomain`, `sDescription`, `idTeam`) VALUES
(1, 'ciar.com.ar', 1),
(2, 'alitaware.com', 1);

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

--
-- Estructura de tabla para la tabla `isclient`
--

CREATE TABLE `isclient` (
  `idTeam` int(11) NOT NULL,
  `idTeamClient` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `isclient`
--

INSERT INTO `isclient` (`idTeam`, `idTeamClient`) VALUES
(1, 6),
(1, 42),
(1, 55),
(1, 56),
(1, 58),
(6, 20),
(6, 23),
(23, 1),
(23, 20),
(23, 23);

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

--
-- Estructura de tabla para la tabla `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Volcado de datos para la tabla `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2019_09_26_124138_create_users_table', 1);

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

--
-- Estructura de tabla para la tabla `person`
--

CREATE TABLE `person` (
  `idPerson` int(11) NOT NULL,
  `dBirthdate` date DEFAULT NULL,
  `sDni` int(11) DEFAULT NULL,
  `sAddress` varchar(100) DEFAULT NULL,
  `nMaritialStatus` enum('Soltero','Casado','Divorciado','Viudo') DEFAULT NULL,
  `sUrlPhoto` varchar(1000) DEFAULT NULL,
  `nGender` enum('Femenino','Masculino','ND') DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Estructura de tabla para la tabla `role`
--

CREATE TABLE `role` (
  `idRole` int(11) NOT NULL,
  `sDescription` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `role`
--

INSERT INTO `role` (`idRole`, `sDescription`) VALUES
(1, 'Admin'),
(2, 'Editor'),
(3, 'Viewer');

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

--
-- Estructura de tabla para la tabla `team`
--

CREATE TABLE `team` (
  `idTeam` int(11) NOT NULL,
  `sName` varchar(45) NOT NULL,
  `bActive` tinyint(4) DEFAULT 1,
  `sLogo` varchar(150) NOT NULL DEFAULT 'logo.png'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `team`
--

INSERT INTO `team` (`idTeam`, `sName`, `bActive`, `sLogo`) VALUES
(1, 'TeamUNO', 1, ''),
(2, 'DOS', 0, '1783686_14653.png'),
(6, 'Ciar', 0, ''),
(11, 'TeamTest2', 0, ''),
(16, 'Oldelval', 1, 'logo.png'),
(20, 'Camuzzi', 1, ''),
(23, 'Vientos', 1, ''),
(42, 'Cliente', 1, 'We - Propuestas-014167.jpg'),
(44, 'Microsoft', 0, 'logo.png'),
(45, 'Google', 1, 'logo.png'),
(47, 'test auth', 0, '1783686_14075.png'),
(55, 'Test', 1, '1783686_12694.png'),
(56, 'IBM', 1, 'nginx8087.png'),
(58, 'Apache', 1, 'apache5012.png'),
(59, 'Prueba', 1, 'logo.png'),
(62, 'AWS', 1, '1AWS.png');

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

--
-- Estructura de tabla para la tabla `teamconfiguration`
--

CREATE TABLE `teamconfiguration` (
  `idTeamConfiguration` int(11) NOT NULL,
  `idTeam` int(11) NOT NULL,
  `bValidaAlarma` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Corresponde a entry',
  `bValidaZona` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Corresponde a entry',
  `bValidaSalida` tinyint(4) NOT NULL COMMENT 'Corresponde a entry',
  `sHoraEntrada` time NOT NULL DEFAULT '00:00:00' COMMENT 'Corresponde a entry',
  `sHoraSalida` time NOT NULL DEFAULT '00:00:00' COMMENT 'Corresponde a entry',
  `nIntervalo` int(10) NOT NULL DEFAULT 0 COMMENT 'Corresponde a entry'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `teamconfiguration`
--

INSERT INTO `teamconfiguration` (`idTeamConfiguration`, `idTeam`, `bValidaAlarma`, `bValidaZona`, `bValidaSalida`, `sHoraEntrada`, `sHoraSalida`, `nIntervalo`) VALUES
(1, 11, 1, 0, 0, '00:00:00', '00:00:00', 0),
(3, 20, 1, 0, 0, '00:00:00', '00:00:00', 0),
(6, 1, 1, 1, 0, '08:00:00', '20:00:00', 1),
(7, 6, 1, 1, 0, '08:00:00', '20:00:00', 2);

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

--
-- Estructura de tabla para la tabla `teamlimiteusuarios`
--

CREATE TABLE `teamlimiteusuarios` (
  `idTeamLimiteUsuarios` int(11) NOT NULL,
  `idTeam` int(11) NOT NULL,
  `nLimite` int(11) NOT NULL,
  `dFecha` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `teamlimiteusuarios`
--

INSERT INTO `teamlimiteusuarios` (`idTeamLimiteUsuarios`, `idTeam`, `nLimite`, `dFecha`) VALUES
(1, 20, 50, '2020-05-08'),
(2, 20, 15, '2020-05-08'),
(3, 20, 50, '2020-05-08');

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

--
-- Estructura de tabla para la tabla `userteam`
--

CREATE TABLE `userteam` (
  `idUserTeam` int(11) NOT NULL,
  `idUser` int(11) NOT NULL,
  `idTeam` int(11) NOT NULL,
  `sJob` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `userteam`
--

INSERT INTO `userteam` (`idUserTeam`, `idUser`, `idTeam`, `sJob`) VALUES
(1, 1, 1, NULL),
(2, 2, 1, NULL),
(7, 1, 6, NULL),
(9, 2, 2, NULL),
(15, 7, 1, NULL),
(16, 10, 1, NULL),
(18, 58, 2, NULL),
(19, 10, 2, NULL),
(20, 7, 2, NULL),
(21, 61, 6, NULL),
(22, 10, 6, NULL),
(24, 64, 2, NULL),
(25, 64, 6, NULL),
(35, 10, 23, NULL),
(37, 101, 1, NULL),
(38, 101, 2, NULL),
(39, 96, 6, NULL),
(41, 96, 1, NULL),
(42, 128, 20, NULL),
(43, 130, 6, NULL),
(44, 131, 6, NULL),
(45, 131, 1, NULL),
(48, 154, 1, NULL),
(50, 156, 1, NULL),
(86, 223, 1, NULL),
(88, 228, 1, NULL),
(90, 232, 1, NULL),
(91, 223, 6, NULL),
(92, 223, 6, NULL),
(93, 233, 1, NULL),
(95, 166, 1, NULL),
(96, 236, 44, NULL),
(97, 237, 44, NULL),
(98, 238, 1, NULL),
(99, 239, 1, NULL),
(101, 245, 44, NULL),
(103, 156, 2, NULL),
(104, 156, 6, NULL),
(105, 238, 6, NULL),
(106, 249, 20, NULL),
(107, 7, 20, NULL),
(108, 9, 11, NULL),
(111, 251, 47, NULL),
(112, 1, 20, NULL),
(113, 258, 20, NULL),
(114, 280, 20, NULL),
(115, 287, 20, NULL),
(116, 289, 20, NULL),
(117, 292, 20, NULL),
(118, 294, 20, NULL),
(119, 296, 20, NULL),
(121, 299, 20, NULL),
(122, 300, 20, NULL),
(123, 301, 20, NULL),
(125, 303, 20, NULL),
(127, 306, 16, NULL),
(129, 307, 16, NULL),
(131, 308, 20, NULL),
(134, 315, 20, NULL),
(135, 316, 20, NULL),
(136, 317, 16, NULL),
(137, 318, 20, NULL),
(138, 319, 20, NULL),
(139, 320, 20, NULL),
(140, 321, 20, NULL),
(141, 322, 16, NULL),
(142, 323, 16, NULL),
(143, 324, 20, NULL),
(144, 326, 20, NULL),
(146, 328, 20, NULL),
(147, 327, 20, NULL),
(148, 329, 20, NULL),
(149, 330, 20, NULL),
(150, 331, 20, NULL),
(151, 332, 20, NULL),
(152, 333, 20, NULL),
(153, 334, 20, NULL),
(154, 335, 20, NULL),
(155, 336, 20, NULL),
(156, 337, 20, NULL),
(157, 338, 20, NULL),
(158, 339, 20, NULL),
(159, 340, 20, NULL),
(160, 341, 20, NULL),
(161, 342, 20, NULL),
(162, 343, 20, NULL),
(163, 344, 20, NULL),
(164, 345, 20, NULL),
(165, 346, 20, NULL),
(166, 347, 20, NULL),
(167, 348, 20, NULL),
(169, 350, 20, NULL),
(170, 351, 20, NULL),
(171, 352, 20, NULL),
(172, 353, 20, NULL),
(173, 354, 20, NULL),
(174, 355, 20, NULL),
(175, 356, 20, NULL),
(176, 357, 20, NULL),
(177, 358, 20, NULL);

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

--
-- Estructura de tabla para la tabla `userteamapprole`
--

CREATE TABLE `userteamapprole` (
  `idUserTeamAppRole` int(11) NOT NULL,
  `idUserTeam` int(11) NOT NULL,
  `idApp` int(11) NOT NULL,
  `idRole` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Volcado de datos para la tabla `userteamapprole`
--

INSERT INTO `userteamapprole` (`idUserTeamAppRole`, `idUserTeam`, `idApp`, `idRole`) VALUES
(1, 1, 1, 1),
(2, 2, 1, 1),
(7, 7, 1, 2),
(13, 1, 1, 2),
(16, 16, 2, 3),
(19, 16, 1, 2),
(20, 18, 2, 3),
(22, 20, 2, 2),
(23, 16, 3, 1),
(24, 22, 4, 2),
(27, 19, 2, 2),
(28, 16, 4, 1),
(29, 35, 2, 1),
(32, 37, 4, 1),
(33, 22, 2, 1),
(34, 42, 1, 1),
(35, 48, 3, 3),
(37, 50, 3, 1),
(39, 86, 4, 3),
(41, 88, 4, 3),
(42, 90, 4, 3),
(43, 91, 4, 2),
(44, 93, 4, 2),
(46, 95, 3, 2),
(47, 96, 4, 2),
(48, 97, 4, 1),
(49, 98, 4, 3),
(50, 99, 4, 2),
(53, 103, 3, 2),
(54, 104, 3, 3),
(55, 103, 2, 1),
(56, 104, 2, 2),
(57, 50, 4, 1),
(58, 95, 4, 2),
(59, 95, 2, 2),
(60, 48, 2, 3),
(61, 48, 4, 3),
(62, 106, 1, 1),
(64, 113, 1, 2),
(65, 115, 1, 1),
(66, 116, 1, 2),
(67, 117, 1, 2),
(68, 118, 1, 2),
(69, 119, 1, 2),
(71, 121, 1, 2),
(72, 122, 1, 1),
(73, 123, 1, 2),
(76, 95, 1, 1),
(78, 125, 1, 2),
(80, 127, 1, 1),
(81, 129, 1, 2),
(82, 131, 1, 3),
(84, 134, 1, 1),
(85, 135, 1, 1),
(86, 136, 1, 2),
(87, 137, 1, 1),
(88, 138, 1, 1),
(89, 139, 1, 1),
(90, 140, 1, 3),
(91, 141, 1, 3),
(92, 142, 1, 3),
(93, 143, 1, 2),
(94, 144, 1, 2),
(96, 146, 1, 2),
(97, 147, 1, 2),
(98, 148, 1, 2),
(99, 149, 1, 1),
(100, 150, 1, 2),
(101, 151, 1, 3),
(102, 152, 1, 3),
(103, 153, 1, 3),
(104, 154, 1, 3),
(105, 155, 1, 3),
(106, 156, 1, 2),
(107, 157, 1, 2),
(108, 158, 1, 2),
(109, 159, 1, 3),
(110, 160, 1, 2),
(111, 161, 1, 3),
(112, 162, 1, 3),
(113, 163, 1, 2),
(114, 164, 1, 2),
(115, 165, 1, 2),
(116, 166, 1, 2),
(117, 167, 1, 3),
(119, 169, 1, 2),
(120, 170, 1, 3),
(121, 171, 1, 2),
(122, 172, 1, 2),
(123, 173, 1, 2),
(124, 174, 1, 2),
(125, 175, 1, 2),
(126, 176, 1, 2),
(127, 177, 1, 3);

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

--
-- Estructura Stand-in para la vista `viewuserapproleteam`
-- (Véase abajo para la vista actual)
--
CREATE TABLE `viewuserapproleteam` (
`idUser` int(11)
,`sUsername` varchar(255)
,`sFirstname` varchar(255)
,`sLastname` varchar(255)
,`sEmail` varchar(255)
,`teamName` varchar(45)
,`teamId` int(11)
,`appName` varchar(45)
,`appId` int(11)
,`roleName` varchar(45)
,`roleId` int(11)
);

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

--
-- Estructura para la vista `viewuserapproleteam`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`admin`@`%` SQL SECURITY DEFINER VIEW `viewuserapproleteam`  AS SELECT `user`.`idUser` AS `idUser`, `user`.`sUsername` AS `sUsername`, `user`.`sFirstname` AS `sFirstname`, `user`.`sLastname` AS `sLastname`, `user`.`sEmail` AS `sEmail`, `team`.`sName` AS `teamName`, `team`.`idTeam` AS `teamId`, `app`.`sName` AS `appName`, `app`.`idApp` AS `appId`, `role`.`sDescription` AS `roleName`, `role`.`idRole` AS `roleId` FROM (((((`user` join `userteam` on(`userteam`.`idUser` = `user`.`idUser`)) join `team` on(`team`.`idTeam` = `userteam`.`idTeam`)) join `userteamapprole` on(`userteamapprole`.`idUserTeam` = `userteam`.`idUserTeam`)) join `app` on(`userteamapprole`.`idApp` = `app`.`idApp`)) join `role` on(`userteamapprole`.`idRole` = `role`.`idRole`)) WHERE `team`.`bActive` = 1 ORDER BY `user`.`idUser` ASC, `team`.`idTeam` ASC, `app`.`idApp` ASC ;

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `app`
--
ALTER TABLE `app`
  ADD PRIMARY KEY (`idApp`),
  ADD UNIQUE KEY `idApp_UNIQUE` (`idApp`),
  ADD UNIQUE KEY `sName_UNIQUE` (`sName`);

--
-- Indices de la tabla `device`
--
ALTER TABLE `device`
  ADD PRIMARY KEY (`idDevice`),
  ADD UNIQUE KEY `idUser_UNIQUE` (`idUser`),
  ADD UNIQUE KEY `sDeviceId_UNIQUE` (`sDeviceId`),
  ADD KEY `idUser_idx` (`idUser`);

--
-- Indices de la tabla `domain`
--
ALTER TABLE `domain`
  ADD PRIMARY KEY (`idDomain`),
  ADD KEY `fk_team_idx` (`idTeam`);

--
-- Indices de la tabla `isclient`
--
ALTER TABLE `isclient`
  ADD PRIMARY KEY (`idTeam`,`idTeamClient`),
  ADD UNIQUE KEY `teams_unique` (`idTeam`,`idTeamClient`),
  ADD KEY `idTeam_idx` (`idTeam`),
  ADD KEY `idTeamClient_idx` (`idTeamClient`);

--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `person`
--
ALTER TABLE `person`
  ADD PRIMARY KEY (`idPerson`),
  ADD UNIQUE KEY `idPerson_UNIQUE` (`idPerson`);

--
-- Indices de la tabla `role`
--
ALTER TABLE `role`
  ADD PRIMARY KEY (`idRole`),
  ADD UNIQUE KEY `idRole_UNIQUE` (`idRole`);

--
-- Indices de la tabla `team`
--
ALTER TABLE `team`
  ADD PRIMARY KEY (`idTeam`),
  ADD UNIQUE KEY `idTeam_UNIQUE` (`idTeam`),
  ADD UNIQUE KEY `sName_UNIQUE` (`sName`);

--
-- Indices de la tabla `teamconfiguration`
--
ALTER TABLE `teamconfiguration`
  ADD PRIMARY KEY (`idTeamConfiguration`),
  ADD UNIQUE KEY `idTeam_UNIQUE` (`idTeam`),
  ADD KEY `fk_team_config_idx` (`idTeam`);

--
-- Indices de la tabla `teamlimiteusuarios`
--
ALTER TABLE `teamlimiteusuarios`
  ADD PRIMARY KEY (`idTeamLimiteUsuarios`),
  ADD UNIQUE KEY `idTeamLimiteUsuarios_UNIQUE` (`idTeamLimiteUsuarios`),
  ADD KEY `idTeam_FK2_idx` (`idTeam`);

--
-- Indices de la tabla `userteam`
--
ALTER TABLE `userteam`
  ADD PRIMARY KEY (`idUserTeam`),
  ADD UNIQUE KEY `idUserTeam_UNIQUE` (`idUserTeam`),
  ADD KEY `user_idx` (`idUser`),
  ADD KEY `team_idx` (`idTeam`);

--
-- Indices de la tabla `userteamapprole`
--
ALTER TABLE `userteamapprole`
  ADD PRIMARY KEY (`idUserTeamAppRole`),
  ADD UNIQUE KEY `idUserTeamAppRole_UNIQUE` (`idUserTeamAppRole`),
  ADD KEY `userTeamUTAP_idx` (`idUserTeam`),
  ADD KEY `appUTAP_idx` (`idApp`),
  ADD KEY `roleUTAP_idx` (`idRole`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `app`
--
ALTER TABLE `app`
  MODIFY `idApp` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT de la tabla `device`
--
ALTER TABLE `device`
  MODIFY `idDevice` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=278;

--
-- AUTO_INCREMENT de la tabla `domain`
--
ALTER TABLE `domain`
  MODIFY `idDomain` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `role`
--
ALTER TABLE `role`
  MODIFY `idRole` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT de la tabla `team`
--
ALTER TABLE `team`
  MODIFY `idTeam` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=63;

--
-- AUTO_INCREMENT de la tabla `teamconfiguration`
--
ALTER TABLE `teamconfiguration`
  MODIFY `idTeamConfiguration` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT de la tabla `teamlimiteusuarios`
--
ALTER TABLE `teamlimiteusuarios`
  MODIFY `idTeamLimiteUsuarios` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT de la tabla `userteam`
--
ALTER TABLE `userteam`
  MODIFY `idUserTeam` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=178;

--
-- AUTO_INCREMENT de la tabla `userteamapprole`
--
ALTER TABLE `userteamapprole`
  MODIFY `idUserTeamAppRole` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=128;

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `device`
--
ALTER TABLE `device`
  ADD CONSTRAINT `idUser_fk` FOREIGN KEY (`idUser`) REFERENCES `user` (`idUser`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Filtros para la tabla `domain`
--
ALTER TABLE `domain`
  ADD CONSTRAINT `fk_team` FOREIGN KEY (`idTeam`) REFERENCES `team` (`idTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Filtros para la tabla `isclient`
--
ALTER TABLE `isclient`
  ADD CONSTRAINT `idTeamClient_fk` FOREIGN KEY (`idTeamClient`) REFERENCES `team` (`idTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `idTeam_fk` FOREIGN KEY (`idTeam`) REFERENCES `team` (`idTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Filtros para la tabla `teamconfiguration`
--
ALTER TABLE `teamconfiguration`
  ADD CONSTRAINT `fk_team_config` FOREIGN KEY (`idTeam`) REFERENCES `team` (`idTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Filtros para la tabla `teamlimiteusuarios`
--
ALTER TABLE `teamlimiteusuarios`
  ADD CONSTRAINT `idTeam_FK2` FOREIGN KEY (`idTeam`) REFERENCES `team` (`idTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Filtros para la tabla `userteam`
--
ALTER TABLE `userteam`
  ADD CONSTRAINT `teamUT` FOREIGN KEY (`idTeam`) REFERENCES `team` (`idTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `userUT` FOREIGN KEY (`idUser`) REFERENCES `user` (`idUser`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Filtros para la tabla `userteamapprole`
--
ALTER TABLE `userteamapprole`
  ADD CONSTRAINT `appUTAP` FOREIGN KEY (`idApp`) REFERENCES `app` (`idApp`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `roleUTAP` FOREIGN KEY (`idRole`) REFERENCES `role` (`idRole`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `userTeamUTAP` FOREIGN KEY (`idUserTeam`) REFERENCES `userteam` (`idUserTeam`) ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;

