-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 29-04-2019 a las 16:05:32
-- Versión del servidor: 10.1.33-MariaDB
-- Versión de PHP: 7.2.10

START TRANSACTION;



--
-- Base de datos: `pepejeans`
--

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

--
-- Estructura de tabla para la tabla `answer`
--

CREATE TABLE `answer` (
  `id` int(11) NOT NULL,
  `question_id` int(11) DEFAULT NULL,
  `answer_text` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `answer_valid` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `answer` (`id`, `question_id`, `answer_text`, `answer_valid`) VALUES
(10, 4, 'a', 1),
(11, 4, 'b', 0),
(12, 4, 'c', 0),
(13, 5, 'a', 0),
(14, 5, 'b', 1),
(15, 5, 'c', 0),
(22, 8, 'e', 0),
(23, 8, 'd', 1),
(24, 8, 'h', 0),
(25, 9, 'sip', 1),
(26, 9, 'puede', 0),
(48, NULL, 'Sí', 1),
(49, NULL, 'No', NULL),
(50, NULL, 'Sí', 1),
(51, NULL, 'No', NULL);

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

--
-- Estructura de tabla para la tabla `attempt`
--

CREATE TABLE `attempt` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `attempt_number` int(11) NOT NULL,
  `total_score` int(11) DEFAULT NULL,
  `trinder_id` int(11) NOT NULL,
  `mechanic` enum('MEC1','MEC2','MEC3','MEC4') COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `attempt` (`id`, `user_id`, `attempt_number`, `total_score`, `trinder_id`, `mechanic`) VALUES
(1, 56, 1, 500, 1, 'MEC1'),
(2, 56, 2, 200, 1, 'MEC2'),
(3, 55, 1, 400, 1, 'MEC1'),
(4, 42, 1, 400, 1, 'MEC4');

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

--
-- Estructura de tabla para la tabla `badges`
--

CREATE TABLE `badges` (
  `id` int(11) NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image_size` int(11) NOT NULL,
  `updated_at` datetime NOT NULL,
  `level` int(11) NOT NULL,
  `badge_category_id` int(11) NOT NULL,
  `parameter` int(11) DEFAULT NULL,
  `reward` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `badges` (`id`, `description`, `image_name`, `image_size`, `updated_at`, `level`, `badge_category_id`, `parameter`, `reward`) VALUES
(1, '¡Has desbloqueado la primera sede Pepe Jeans!', 'b1.png', 0, '0000-00-00 00:00:00', 1, 2, 1, 50),
(2, '¡Has desbloqueado 2 sedes Pepe Jeans!', 'b2.png', 0, '0000-00-00 00:00:00', 2, 2, 2, 250),
(3, '¡Has desbloqueado las 4 sedes Pepe Jeans!', 'b3.png', 0, '0000-00-00 00:00:00', 3, 2, 4, 500),
(4, '¡Has entrado al juego por primera vez!', 'b4.png', 0, '0000-00-00 00:00:00', 1, 1, NULL, 50),
(5, '¡Has entrado al juego más de la mitad de los días!', 'b5.png', 0, '0000-00-00 00:00:00', 2, 1, NULL, 250),
(6, '¡Has entrado al juego todos los días!', 'b1.png', 0, '0000-00-00 00:00:00', 3, 1, NULL, 1000),
(7, '¡Has acertado una pregunta de cada departamento !', 'b2.png', 0, '0000-00-00 00:00:00', 1, 3, NULL, 50),
(8, '¡Has acertado la mitad de las preguntas!', 'b3.png', 0, '0000-00-00 00:00:00', 2, 3, NULL, 250),
(9, '¡Has acertado TODAS las preguntas!', 'b4.png', 0, '0000-00-00 00:00:00', 3, 3, NULL, 1000),
(10, '¡Te has enfrentado a tu primer dilema! ¡Y has sobrevivido!', 'b5.png', 0, '0000-00-00 00:00:00', 1, 4, NULL, 50),
(11, '¡Te has enfrentado a 2 dilemas y has sobrevivido!', 'b1.png', 0, '0000-00-00 00:00:00', 2, 4, NULL, 250),
(12, '¡Te has enfrentado a todos tus dilemas!', 'b2.png', 0, '0000-00-00 00:00:00', 3, 4, NULL, 500),
(13, '¡Has visto tu primer video pill!', 'b3.png', 0, '0000-00-00 00:00:00', 1, 5, NULL, 50),
(14, '¡Has visto la mitad de las video pills!', 'b4.png', 0, '0000-00-00 00:00:00', 2, 5, NULL, 250),
(15, '¡Has visto TODAS las video pills!', 'b5.png', 0, '0000-00-00 00:00:00', 3, 5, NULL, 1000),
(16, '¡Has donado 100 puntos!', 'b1.png', 0, '0000-00-00 00:00:00', 1, 6, NULL, 50),
(17, '¡Has donado 1000 puntos!', 'b2.png', 0, '0000-00-00 00:00:00', 2, 6, NULL, 250),
(18, '¡Has donado 2000 puntos!', 'b3.png', 0, '0000-00-00 00:00:00', 3, 6, NULL, 1000),
(19, '¡Has contestado 5 preguntas seguidas correctamente!', 'b4.png', 0, '0000-00-00 00:00:00', 1, 7, NULL, 50),
(20, '¡Has contestado 10 preguntas seguidas correctamente!', 'b5.png', 0, '0000-00-00 00:00:00', 2, 7, NULL, 250),
(21, '¡Has contestado 20 preguntas seguidas correctamente!', 'b1.png', 0, '0000-00-00 00:00:00', 3, 7, NULL, 500),
(22, '¡Has ganado todas las medallas de bronce!', 'b2.png', 0, '0000-00-00 00:00:00', 1, 8, NULL, 50),
(23, '¡Has ganado todas las medallas de plata!', 'b3.png', 0, '0000-00-00 00:00:00', 2, 8, NULL, 250),
(24, '¡Has ganado todas las medallas de oro!', 'b4.png', 0, '0000-00-00 00:00:00', 3, 8, NULL, 1000);

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

--
-- Estructura de tabla para la tabla `badge_category`
--

CREATE TABLE `badge_category` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `badge_category` (`id`, `name`, `image`, `updated_at`) VALUES
(1, 'Gamer', 'gamer.jpg', '0000-00-00 00:00:00'),
(2, 'Explorador', 'explorador.jpg', '0000-00-00 00:00:00'),
(3, 'Sabio', 'sabio.jpg', '0000-00-00 00:00:00'),
(4, 'Resolutivo', 'resolutivo.jpg', '0000-00-00 00:00:00'),
(5, 'Analista', 'analista.jpg', '0000-00-00 00:00:00'),
(6, 'Filántropo', 'filantropo.jpg', '0000-00-00 00:00:00'),
(7, 'Experimentado', 'experimentado.jpg', '0000-00-00 00:00:00'),
(8, 'Olímpico', 'olimpico.jpg\r\n', '0000-00-00 00:00:00');

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

--
-- Estructura de tabla para la tabla `badge_trivial_reference`
--

CREATE TABLE `badge_trivial_reference` (
  `id` int(11) NOT NULL,
  `badge_id` int(11) DEFAULT NULL,
  `trinder_id` int(11) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `category`
--

CREATE TABLE `category` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `trinder_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `category` (`id`, `name`, `image`, `updated_at`, `trinder_id`) VALUES
(1, 'Categoria1', 'default.png', '2019-04-10 11:33:27', 1),
(2, 'RRHH', 'default.png', '2019-04-17 12:50:36', 1);

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

--
-- Estructura de tabla para la tabla `clientes`
--

CREATE TABLE `clientes` (
  `id` int(11) NOT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `icon` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `clientes` (`id`, `name`, `icon`, `updated_at`) VALUES
(6, 'Cliente', 'default.png', '0000-00-00 00:00:00'),
(7, 'Cliente2', 'b1.png', '2018-11-08 15:44:16'),
(27, 'MQL', 'game_mql.png', '2018-10-17 14:52:43'),
(28, 'Cliente1', 'default.png', '0000-00-00 00:00:00'),
(29, 'TestingMQL', 'mql.png', '2019-02-04 10:13:56');

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

--
-- Estructura de tabla para la tabla `competition`
--

CREATE TABLE `competition` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `createdAt` datetime NOT NULL,
  `beginAt` datetime NOT NULL,
  `finalizeAt` datetime NOT NULL,
  `cliente_id` int(11) DEFAULT NULL,
  `created_by_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `competition` (`id`, `name`, `createdAt`, `beginAt`, `finalizeAt`, `cliente_id`, `created_by_id`) VALUES
(16, 'PepeJeans', '2019-04-05 14:19:21', '2019-05-06 00:00:00', '2019-05-10 00:00:00', 27, 43);

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

--
-- Estructura de tabla para la tabla `competition_users`
--

CREATE TABLE `competition_users` (
  `competition_id` int(11) NOT NULL,
  `users_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `competition_users` (`competition_id`, `users_id`) VALUES
(16, 55),
(16, 56);

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

--
-- Estructura de tabla para la tabla `document`
--

CREATE TABLE `document` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `type` enum('DOCUMENTO','URL') COLLATE utf8_unicode_ci DEFAULT NULL,
  `document` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `extension` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_at` datetime NOT NULL,
  `position` int(11) NOT NULL,
  `public` tinyint(1) NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `category_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `document` (`id`, `name`, `url`, `type`, `document`, `extension`, `updated_at`, `position`, `public`, `description`, `category_id`) VALUES
(1, 'Url de gooogle', 'https://www.google.es/?gws_rd=ssl', 'URL', NULL, NULL, '2019-04-08 15:30:06', 1, 1, 'Google', 1),
(3, 'W3Schools', 'https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_oninput', 'URL', NULL, NULL, '2019-04-08 15:47:55', 2, 1, 'W3Schools', 1),
(4, 'Miquel Produccion', 'https://trello.com/b/FfBH1lcq/miquel-produccion', 'URL', NULL, NULL, '2019-04-08 15:48:21', 3, 1, 'Trello', 1),
(5, 'Google 2 baby', 'https://www.google.es/?gws_rd=ssl', 'URL', NULL, NULL, '2019-04-09 11:14:05', 4, 1, 'Google 2', 1),
(6, 'Gmail', 'https://www.google.com/intl/es/gmail/about/#', 'URL', NULL, NULL, '2019-04-17 13:03:58', 1, 1, 'Gmail', 2);

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

--
-- Estructura de tabla para la tabla `migration_versions`
--

CREATE TABLE `migration_versions` (
  `version` varchar(14) COLLATE utf8mb4_unicode_ci NOT NULL,
  `executed_at` datetime NOT NULL COMMENT '(DC2Type:datetime_immutable)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `migration_versions` (`version`, `executed_at`) VALUES
('20190218125501', '2019-04-05 10:56:23');

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

--
-- Estructura de tabla para la tabla `mision`
--

CREATE TABLE `mision` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `mision` (`id`, `name`, `description`, `url`) VALUES
(1, 'Sevilla', 'Escanea el qr que te dará información sobre la sede de Sevilla', 'http://localhost/pepejeans/public/images/misions/Sevilla.txt'),
(2, 'Barcelona', 'Escanea el qr que te dará información sobre la sede de Barcelona', 'http://localhost/pepejeans/public/images/misions/Barcelona.txt'),
(3, 'Elche', 'Escanea el qr que te dará información sobre la sede de Elche', 'http://localhost/pepejeans/public/images/misions/Elche.txt'),
(4, 'Madrid', 'Escanea el qr que te dará información sobre la sede de Madrid', 'http://localhost/pepejeans/public/images/misions/Madrid.txt');

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

--
-- Estructura de tabla para la tabla `question`
--

CREATE TABLE `question` (
  `id` int(11) NOT NULL,
  `category_id` int(11) DEFAULT NULL,
  `statement` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `type` enum('TRIVIAL','TINDER') COLLATE utf8_unicode_ci DEFAULT NULL,
  `image` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `question` (`id`, `category_id`, `statement`, `type`, `image`, `updated_at`) VALUES
(4, 1, 'A', 'TRIVIAL', NULL, NULL),
(5, 1, 'b', 'TRIVIAL', NULL, NULL),
(8, 1, 'd', 'TRIVIAL', NULL, '2019-04-10 12:29:53'),
(9, 1, 'en1', 'TINDER', 'MultiAdd.csv', '2019-04-10 12:47:19');

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

--
-- Estructura de tabla para la tabla `tracking`
--

CREATE TABLE `tracking` (
  `id` int(11) NOT NULL,
  `attempt_id` int(11) DEFAULT NULL,
  `status` tinyint(1) NOT NULL,
  `time` int(11) NOT NULL,
  `question_id` int(11) DEFAULT NULL,
  `answer_id` int(11) DEFAULT NULL,
  `selfpoints` int(11) NOT NULL,
  `donatedpoints` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

INSERT INTO `tracking` (`id`, `attempt_id`, `status`, `time`, `question_id`, `answer_id`, `selfpoints`, `donatedpoints`) VALUES
(1, 1, 1, 10, 4, 10, 100, 20),
(2, 1, 1, 10, 5, 12, 200, 40),
(3, 2, 1, 10, 9, 26, 100, 20),
(4, 2, 1, 10, 8, 23, 100, 40),
(5, 3, 1, 4, 9, 23, 20, 200),
(6, 3, 1, 10, 5, 12, 40, 300),
(7, 4, 1, 2, 5, 11, 200, 500),
(8, 4, 1, 10, 5, 25, 10, 1200);

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

--
-- Estructura de tabla para la tabla `trinder`
--

CREATE TABLE `trinder` (
  `id` int(11) NOT NULL,
  `competition_id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `life` int(11) NOT NULL,
  `time` int(11) NOT NULL,
  `updated_at` datetime NOT NULL,
  `cooperative_score` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `trinder` (`id`, `competition_id`, `name`, `description`, `image`, `life`, `time`, `updated_at`, `cooperative_score`) VALUES
(1, 16, 'Game', 'Game de prueba para pepejeans', 'default.png', 3, 60, '2019-04-08 11:42:40', 5000);

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

--
-- Estructura de tabla para la tabla `users_document`
--

CREATE TABLE `users_document` (
  `users_id` int(11) NOT NULL,
  `document_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users_document` (`users_id`, `document_id`) VALUES
(55, 1),
(55, 4),
(56, 4);

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

--
-- Estructura de tabla para la tabla `users_mision_reference`
--

CREATE TABLE `users_mision_reference` (
  `id` int(11) NOT NULL,
  `users_id` int(11) NOT NULL,
  `mision_id` int(11) NOT NULL,
  `completed` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users_mision_reference` (`id`, `users_id`, `mision_id`, `completed`) VALUES
(1, 56, 1, 1),
(2, 56, 2, 1),
(3, 56, 3, 1),
(4, 56, 4, 1),
(5, 62, 1, 0),
(6, 62, 2, 0),
(7, 62, 3, 0),
(8, 62, 4, 0),
(9, 55, 1, 0),
(10, 55, 2, 0),
(11, 55, 3, 1),
(12, 55, 4, 1);

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

--
-- Estructura de tabla para la tabla `user_badge_reference`
--

CREATE TABLE `user_badge_reference` (
  `id` int(11) NOT NULL,
  `badge_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `isGained` tinyint(1) NOT NULL,
  `claimed` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `user_badge_reference` (`id`, `badge_id`, `user_id`, `isGained`, `claimed`) VALUES
(1, 2, 55, 1, 1),
(2, 1, 55, 1, 0),
(3, 3, 55, 0, 0),
(6, 4, 55, 0, 0),
(7, 5, 55, 0, 0),
(8, 6, 55, 0, 0),
(9, 7, 55, 0, 0),
(10, 8, 55, 0, 0),
(11, 9, 55, 0, 0),
(12, 10, 55, 0, 0),
(13, 11, 55, 0, 0),
(14, 12, 55, 0, 0),
(15, 13, 55, 0, 0),
(16, 14, 55, 0, 0),
(17, 15, 55, 0, 0),
(18, 16, 55, 0, 0),
(19, 17, 55, 0, 0),
(20, 18, 55, 0, 0),
(21, 19, 55, 0, 0),
(22, 20, 55, 0, 0),
(23, 21, 55, 0, 0),
(24, 22, 55, 0, 0),
(25, 23, 55, 0, 0),
(26, 24, 55, 0, 0),
(27, 1, 56, 1, 1),
(28, 2, 56, 1, 1),
(29, 3, 56, 1, 1),
(30, 4, 56, 0, 0),
(31, 5, 56, 0, 0),
(32, 6, 56, 0, 0),
(33, 7, 56, 0, 0),
(34, 8, 56, 0, 0),
(35, 9, 56, 0, 0),
(36, 10, 56, 0, 0),
(37, 11, 56, 0, 0),
(38, 12, 56, 0, 0),
(39, 13, 56, 0, 0),
(40, 14, 56, 0, 0),
(41, 15, 56, 0, 0),
(42, 16, 56, 0, 0),
(43, 17, 56, 0, 0),
(44, 18, 56, 0, 0),
(45, 19, 56, 0, 0),
(46, 20, 56, 0, 0),
(47, 21, 56, 0, 0),
(48, 22, 56, 0, 0),
(49, 23, 56, 0, 0),
(50, 24, 56, 0, 0);

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `answer`
--
ALTER TABLE `answer`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_DADD4A251E27F6BF` (`question_id`);

--
-- Indices de la tabla `attempt`
--
ALTER TABLE `attempt`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_18EC0266A76ED395` (`user_id`),
  ADD KEY `IDX_18EC02664CD1EBAB` (`trinder_id`);

--
-- Indices de la tabla `badges`
--
ALTER TABLE `badges`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_78F6539AFCBFAF35` (`badge_category_id`);

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

--
-- Indices de la tabla `badge_trivial_reference`
--
ALTER TABLE `badge_trivial_reference`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_4C5633A4F7A2C2FC` (`badge_id`),
  ADD KEY `IDX_4C5633A44CD1EBAB` (`trinder_id`);

--
-- Indices de la tabla `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_64C19C14CD1EBAB` (`trinder_id`);

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

--
-- Indices de la tabla `competition`
--
ALTER TABLE `competition`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_B50A2CB1DE734E51` (`cliente_id`),
  ADD KEY `IDX_B50A2CB1B03A8386` (`created_by_id`);

--
-- Indices de la tabla `competition_users`
--
ALTER TABLE `competition_users`
  ADD PRIMARY KEY (`competition_id`,`users_id`),
  ADD KEY `IDX_E734973F7B39D312` (`competition_id`),
  ADD KEY `IDX_E734973F67B3B43D` (`users_id`);

--
-- Indices de la tabla `document`
--
ALTER TABLE `document`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_D8698A7612469DE2` (`category_id`);

--
-- Indices de la tabla `migration_versions`
--
ALTER TABLE `migration_versions`
  ADD PRIMARY KEY (`version`);

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

--
-- Indices de la tabla `question`
--
ALTER TABLE `question`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_B6F7494E12469DE2` (`category_id`);

--
-- Indices de la tabla `tracking`
--
ALTER TABLE `tracking`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_A87C621CB191BE6B` (`attempt_id`),
  ADD KEY `IDX_A87C621C1E27F6BF` (`question_id`),
  ADD KEY `IDX_A87C621CAA334807` (`answer_id`);

--
-- Indices de la tabla `trinder`
--
ALTER TABLE `trinder`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_6525FE8E7B39D312` (`competition_id`);

--
-- Indices de la tabla `users_document`
--
ALTER TABLE `users_document`
  ADD PRIMARY KEY (`users_id`,`document_id`),
  ADD KEY `IDX_A328A1AC67B3B43D` (`users_id`),
  ADD KEY `IDX_A328A1ACC33F7837` (`document_id`);

--
-- Indices de la tabla `users_mision_reference`
--
ALTER TABLE `users_mision_reference`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_BF2451B567B3B43D` (`users_id`),
  ADD KEY `IDX_BF2451B52F612167` (`mision_id`);

--
-- Indices de la tabla `user_badge_reference`
--
ALTER TABLE `user_badge_reference`
  ADD PRIMARY KEY (`id`),
  ADD KEY `IDX_8DD37A08F7A2C2FC` (`badge_id`),
  ADD KEY `IDX_8DD37A08A76ED395` (`user_id`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `answer`
--
ALTER TABLE `answer`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;

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

--
-- AUTO_INCREMENT de la tabla `badges`
--
ALTER TABLE `badges`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT de la tabla `badge_category`
--
ALTER TABLE `badge_category`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT de la tabla `badge_trivial_reference`
--
ALTER TABLE `badge_trivial_reference`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT de la tabla `clientes`
--
ALTER TABLE `clientes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;

--
-- AUTO_INCREMENT de la tabla `competition`
--
ALTER TABLE `competition`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT de la tabla `document`
--
ALTER TABLE `document`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

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

--
-- AUTO_INCREMENT de la tabla `question`
--
ALTER TABLE `question`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT de la tabla `tracking`
--
ALTER TABLE `tracking`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT de la tabla `trinder`
--
ALTER TABLE `trinder`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT de la tabla `users_mision_reference`
--
ALTER TABLE `users_mision_reference`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT de la tabla `user_badge_reference`
--
ALTER TABLE `user_badge_reference`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `answer`
--
ALTER TABLE `answer`
  ADD CONSTRAINT `FK_DADD4A251E27F6BF` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `attempt`
--
ALTER TABLE `attempt`
  ADD CONSTRAINT `FK_18EC02664CD1EBAB` FOREIGN KEY (`trinder_id`) REFERENCES `trinder` (`id`),
  ADD CONSTRAINT `FK_18EC0266A76ED395` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `badges`
--
ALTER TABLE `badges`
  ADD CONSTRAINT `FK_78F6539AFCBFAF35` FOREIGN KEY (`badge_category_id`) REFERENCES `badge_category` (`id`);

--
-- Filtros para la tabla `badge_trivial_reference`
--
ALTER TABLE `badge_trivial_reference`
  ADD CONSTRAINT `FK_4C5633A44CD1EBAB` FOREIGN KEY (`trinder_id`) REFERENCES `trinder` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `FK_4C5633A4F7A2C2FC` FOREIGN KEY (`badge_id`) REFERENCES `badges` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `category`
--
ALTER TABLE `category`
  ADD CONSTRAINT `FK_64C19C14CD1EBAB` FOREIGN KEY (`trinder_id`) REFERENCES `trinder` (`id`);

--
-- Filtros para la tabla `competition`
--
ALTER TABLE `competition`
  ADD CONSTRAINT `FK_B50A2CB1B03A8386` FOREIGN KEY (`created_by_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `FK_B50A2CB1DE734E51` FOREIGN KEY (`cliente_id`) REFERENCES `clientes` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `competition_users`
--
ALTER TABLE `competition_users`
  ADD CONSTRAINT `FK_E734973F67B3B43D` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `FK_E734973F7B39D312` FOREIGN KEY (`competition_id`) REFERENCES `competition` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `document`
--
ALTER TABLE `document`
  ADD CONSTRAINT `FK_D8698A7612469DE2` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`);

--
-- Filtros para la tabla `question`
--
ALTER TABLE `question`
  ADD CONSTRAINT `FK_B6F7494E12469DE2` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `tracking`
--
ALTER TABLE `tracking`
  ADD CONSTRAINT `FK_A87C621C1E27F6BF` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `FK_A87C621CAA334807` FOREIGN KEY (`answer_id`) REFERENCES `answer` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `FK_A87C621CB191BE6B` FOREIGN KEY (`attempt_id`) REFERENCES `attempt` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `trinder`
--
ALTER TABLE `trinder`
  ADD CONSTRAINT `FK_6525FE8E7B39D312` FOREIGN KEY (`competition_id`) REFERENCES `competition` (`id`);

--
-- Filtros para la tabla `users_document`
--
ALTER TABLE `users_document`
  ADD CONSTRAINT `FK_A328A1AC67B3B43D` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `FK_A328A1ACC33F7837` FOREIGN KEY (`document_id`) REFERENCES `document` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `users_mision_reference`
--
ALTER TABLE `users_mision_reference`
  ADD CONSTRAINT `FK_BF2451B52F612167` FOREIGN KEY (`mision_id`) REFERENCES `mision` (`id`),
  ADD CONSTRAINT `FK_BF2451B567B3B43D` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`);

--
-- Filtros para la tabla `user_badge_reference`
--
ALTER TABLE `user_badge_reference`
  ADD CONSTRAINT `FK_8DD37A08A76ED395` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `FK_8DD37A08F7A2C2FC` FOREIGN KEY (`badge_id`) REFERENCES `badges` (`id`) ON DELETE CASCADE;
COMMIT;

