-- phpMyAdmin SQL Dump
-- version 5.2.2
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 02-03-2026 a las 11:26:33
-- Versión del servidor: 10.11.16-MariaDB
-- Versión de PHP: 8.4.17

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
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 */;

--
-- Base de datos: `tufichaje_dev_fichapp`
--

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

--
-- Estructura de tabla para la tabla `aprobaciones_modificaciones_registros`
--

CREATE TABLE `aprobaciones_modificaciones_registros` (
  `id` int(11) NOT NULL,
  `id_registro` int(11) NOT NULL,
  `h1_original` time DEFAULT NULL,
  `h1_modificada` time DEFAULT NULL,
  `h2_original` time DEFAULT NULL,
  `h2_modificada` time DEFAULT NULL,
  `h3_original` time DEFAULT NULL,
  `h3_modificada` time DEFAULT NULL,
  `h4_original` time DEFAULT NULL,
  `h4_modificada` time DEFAULT NULL,
  `h5_original` time DEFAULT NULL,
  `h5_modificada` time DEFAULT NULL,
  `h6_original` time DEFAULT NULL,
  `h6_modificada` time DEFAULT NULL,
  `h7_original` time DEFAULT NULL,
  `h7_modificada` time DEFAULT NULL,
  `h8_original` time DEFAULT NULL,
  `h8_modificada` time DEFAULT NULL,
  `h9_original` time DEFAULT NULL,
  `h9_modificada` time DEFAULT NULL,
  `h10_original` time DEFAULT NULL,
  `h10_modificada` time DEFAULT NULL,
  `id_empleado` int(11) NOT NULL,
  `tipo` varchar(12) NOT NULL DEFAULT 'modificar',
  `id_motivo` int(11) NOT NULL DEFAULT 1,
  `fecha` datetime NOT NULL DEFAULT current_timestamp(),
  `estado` varchar(12) NOT NULL DEFAULT 'pendiente'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `bajas_empleado`
--

CREATE TABLE `bajas_empleado` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `fecha` date NOT NULL,
  `fecha_incorporacion` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `configuraciones`
--

CREATE TABLE `configuraciones` (
  `id` int(11) NOT NULL,
  `meta` varchar(180) NOT NULL,
  `valor` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `configuraciones` (`id`, `meta`, `valor`) VALUES
(1, 'mostrar_dias_vacios_exportar', '1'),
(2, 'comprobar_incidencias', '0'),
(3, 'notas', '0'),
(4, 'mostrar_empleados_eliminados', '1'),
(5, 'mostrar_ult_registro_fichador', '0'),
(6, 'digitos_pin', '2'),
(7, 'contrato_completo_horas', '40'),
(8, 'recaptcha_fichar', '0'),
(9, 'minutos_tolerancia_fichaje', '15'),
(10, 'minimo_minutos_acumulables', '15'),
(11, 'restar_bolsa_horas', '1'),
(12, 'fichador_masivo', '0'),
(13, 'pantalla_bienvenida', '1'),
(14, 'fichador_tema', 'light'),
(15, 'iniciar_sesion_tema', 'light'),
(16, 'autofichar', '0'),
(17, 'fichador_titulo', '1'),
(18, 'permitir_fichador_cambiar_tema', '1'),
(19, 'sonidos_fichador', '1'),
(20, 'pdf_tamaño_logo', '100'),
(21, 'pdf_margen_superior', '1'),
(22, 'pdf_margen_izquierdo', '2'),
(23, 'mostrar_apellidos_tabla', '0'),
(24, 'mostrar_apellidos_fichador', '0'),
(26, 'mostrar_horas_excedidas', '1'),
(27, 'mostrar_horas_excedidas_exportar', '1'),
(28, 'fichador_tamaño_logo', ''),
(29, 'fichador_logo_ext', ''),
(30, 'ver_vacaciones_otros', '1'),
(33, 'minutos_sin_conversion', '0');

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

--
-- Estructura de tabla para la tabla `configuraciones_usuarios`
--

CREATE TABLE `configuraciones_usuarios` (
  `id` int(11) NOT NULL,
  `id_usuario` int(11) NOT NULL,
  `meta` varchar(180) NOT NULL,
  `valor` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `configuraciones_usuarios` (`id`, `id_usuario`, `meta`, `valor`) VALUES
(1, 1, 'modo_claro_oscuro', 'light'),
(2, 2, 'modo_claro_oscuro', 'light'),
(3, 1, 'menu_estado', '0'),
(4, 1, 'reducir_efectos_movimiento', '0'),
(5, 1, 'formato_fecha_tabla', '0');

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

--
-- Estructura de tabla para la tabla `copia_cierre_mes`
--

CREATE TABLE `copia_cierre_mes` (
  `id` int(11) NOT NULL,
  `id_cierre` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `horas_acu` decimal(10,6) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `dias_inhabiles`
--

CREATE TABLE `dias_inhabiles` (
  `id` int(11) NOT NULL,
  `id_grupo` int(11) DEFAULT NULL,
  `id_motivo` int(11) DEFAULT NULL,
  `id_empleado` int(11) DEFAULT NULL,
  `fecha_entrada` date NOT NULL,
  `fecha_termina` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `documentos`
--

CREATE TABLE `documentos` (
  `id` int(11) NOT NULL,
  `id_usuario_subido` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `alias` varchar(200) DEFAULT NULL,
  `archivo` text NOT NULL,
  `nomina` tinyint(1) NOT NULL DEFAULT 0,
  `fecha` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `empleados`
--

CREATE TABLE `empleados` (
  `id` int(4) NOT NULL,
  `nombre` varchar(40) NOT NULL,
  `apellidos` varchar(180) DEFAULT NULL,
  `telefono` varchar(12) DEFAULT NULL,
  `email` varchar(200) DEFAULT NULL,
  `tipo_contrato` varchar(12) DEFAULT 'completo',
  `contrato_horas` tinyint(4) DEFAULT 40,
  `fecha_alta` date DEFAULT NULL,
  `id_grupo` int(11) NOT NULL DEFAULT 1,
  `sin_horario_asignado` tinyint(1) NOT NULL DEFAULT 0,
  `horario_nocturno` tinyint(1) NOT NULL DEFAULT 0,
  `horas_acu` decimal(10,6) DEFAULT NULL,
  `pin` int(11) NOT NULL,
  `subcontratado` tinyint(1) DEFAULT 0,
  `observaciones` text DEFAULT NULL,
  `lunh1` time DEFAULT NULL,
  `lunh2` time DEFAULT NULL,
  `lunh3` time DEFAULT NULL,
  `lunh4` time DEFAULT NULL,
  `lunh5` time DEFAULT NULL,
  `lunh6` time DEFAULT NULL,
  `marh1` time DEFAULT NULL,
  `marh2` time DEFAULT NULL,
  `marh3` time DEFAULT NULL,
  `marh4` time DEFAULT NULL,
  `marh5` time DEFAULT NULL,
  `marh6` time DEFAULT NULL,
  `mieh1` time DEFAULT NULL,
  `mieh2` time DEFAULT NULL,
  `mieh3` time DEFAULT NULL,
  `mieh4` time DEFAULT NULL,
  `mieh5` time DEFAULT NULL,
  `mieh6` time DEFAULT NULL,
  `jueh1` time DEFAULT NULL,
  `jueh2` time DEFAULT NULL,
  `jueh3` time DEFAULT NULL,
  `jueh4` time DEFAULT NULL,
  `jueh5` time DEFAULT NULL,
  `jueh6` time DEFAULT NULL,
  `vieh1` time DEFAULT NULL,
  `vieh2` time DEFAULT NULL,
  `vieh3` time DEFAULT NULL,
  `vieh4` time DEFAULT NULL,
  `vieh5` time DEFAULT NULL,
  `vieh6` time DEFAULT NULL,
  `sabh1` time DEFAULT NULL,
  `sabh2` time DEFAULT NULL,
  `sabh3` time DEFAULT NULL,
  `sabh4` time DEFAULT NULL,
  `sabh5` time DEFAULT NULL,
  `sabh6` time DEFAULT NULL,
  `domh1` time DEFAULT NULL,
  `domh2` time DEFAULT NULL,
  `domh3` time DEFAULT NULL,
  `domh4` time DEFAULT NULL,
  `domh5` time DEFAULT NULL,
  `domh6` time DEFAULT NULL,
  `lunh7` time DEFAULT NULL,
  `lunh8` time DEFAULT NULL,
  `lunh9` time DEFAULT NULL,
  `lunh10` time DEFAULT NULL,
  `marh7` time DEFAULT NULL,
  `marh8` time DEFAULT NULL,
  `marh9` time DEFAULT NULL,
  `marh10` time DEFAULT NULL,
  `mieh7` time DEFAULT NULL,
  `mieh8` time DEFAULT NULL,
  `mieh9` time DEFAULT NULL,
  `mieh10` time DEFAULT NULL,
  `jueh7` time DEFAULT NULL,
  `jueh8` time DEFAULT NULL,
  `jueh9` time DEFAULT NULL,
  `jueh10` time DEFAULT NULL,
  `vieh7` time DEFAULT NULL,
  `vieh8` time DEFAULT NULL,
  `vieh9` time DEFAULT NULL,
  `vieh10` time DEFAULT NULL,
  `sabh7` time DEFAULT NULL,
  `sabh8` time DEFAULT NULL,
  `sabh9` time DEFAULT NULL,
  `sabh10` time DEFAULT NULL,
  `domh7` time DEFAULT NULL,
  `domh8` time DEFAULT NULL,
  `domh9` time DEFAULT NULL,
  `domh10` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `empleados_eliminados`
--

CREATE TABLE `empleados_eliminados` (
  `id_empleado` int(11) NOT NULL,
  `nombre` varchar(120) NOT NULL,
  `fecha` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `filtro_busqueda`
--

CREATE TABLE `filtro_busqueda` (
  `id` int(11) NOT NULL,
  `id_usuario` int(11) NOT NULL,
  `nombre` varchar(120) DEFAULT NULL,
  `fecha_inicio` date NOT NULL,
  `fecha_fin` date NOT NULL,
  `id_motivo` int(11) DEFAULT NULL,
  `fecha` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `grupos`
--

CREATE TABLE `grupos` (
  `id` int(11) NOT NULL,
  `nombre` varchar(45) NOT NULL,
  `tipo_grupo` tinyint(1) NOT NULL DEFAULT 0,
  `tipo_flexible` int(11) NOT NULL DEFAULT 0,
  `horas` text DEFAULT NULL,
  `dias_trabaja_semana` tinyint(4) DEFAULT NULL,
  `lunes` tinyint(1) DEFAULT 0,
  `martes` tinyint(1) DEFAULT 0,
  `miercoles` tinyint(1) DEFAULT 0,
  `jueves` tinyint(1) DEFAULT 0,
  `viernes` tinyint(1) DEFAULT 0,
  `sabado` tinyint(1) DEFAULT 0,
  `domingo` tinyint(1) DEFAULT 0,
  `lunh` varchar(5) DEFAULT NULL,
  `marh` varchar(5) DEFAULT NULL,
  `mieh` varchar(5) DEFAULT NULL,
  `jueh` varchar(5) DEFAULT NULL,
  `vieh` varchar(5) DEFAULT NULL,
  `sabh` varchar(5) DEFAULT NULL,
  `domh` varchar(5) DEFAULT NULL,
  `lunh1` time DEFAULT NULL,
  `lunh2` time DEFAULT NULL,
  `lunh3` time DEFAULT NULL,
  `lunh4` time DEFAULT NULL,
  `lunh5` time DEFAULT NULL,
  `lunh6` time DEFAULT NULL,
  `marh1` time DEFAULT NULL,
  `marh2` time DEFAULT NULL,
  `marh3` time DEFAULT NULL,
  `marh4` time DEFAULT NULL,
  `marh5` time DEFAULT NULL,
  `marh6` time DEFAULT NULL,
  `mieh1` time DEFAULT NULL,
  `mieh2` time DEFAULT NULL,
  `mieh3` time DEFAULT NULL,
  `mieh4` time DEFAULT NULL,
  `mieh5` time DEFAULT NULL,
  `mieh6` time DEFAULT NULL,
  `jueh1` time DEFAULT NULL,
  `jueh2` time DEFAULT NULL,
  `jueh3` time DEFAULT NULL,
  `jueh4` time DEFAULT NULL,
  `jueh5` time DEFAULT NULL,
  `jueh6` time DEFAULT NULL,
  `vieh1` time DEFAULT NULL,
  `vieh2` time DEFAULT NULL,
  `vieh3` time DEFAULT NULL,
  `vieh4` time DEFAULT NULL,
  `vieh5` time DEFAULT NULL,
  `vieh6` time DEFAULT NULL,
  `sabh1` time DEFAULT NULL,
  `sabh2` time DEFAULT NULL,
  `sabh3` time DEFAULT NULL,
  `sabh4` time DEFAULT NULL,
  `sabh5` time DEFAULT NULL,
  `sabh6` time DEFAULT NULL,
  `domh1` time DEFAULT NULL,
  `domh2` time DEFAULT NULL,
  `domh3` time DEFAULT NULL,
  `domh4` time DEFAULT NULL,
  `domh5` time DEFAULT NULL,
  `domh6` time DEFAULT NULL,
  `cambiar_horas` tinyint(1) NOT NULL DEFAULT 0,
  `lunh7` time DEFAULT NULL,
  `lunh8` time DEFAULT NULL,
  `lunh9` time DEFAULT NULL,
  `lunh10` time DEFAULT NULL,
  `marh7` time DEFAULT NULL,
  `marh8` time DEFAULT NULL,
  `marh9` time DEFAULT NULL,
  `marh10` time DEFAULT NULL,
  `mieh7` time DEFAULT NULL,
  `mieh8` time DEFAULT NULL,
  `mieh9` time DEFAULT NULL,
  `mieh10` time DEFAULT NULL,
  `jueh7` time DEFAULT NULL,
  `jueh8` time DEFAULT NULL,
  `jueh9` time DEFAULT NULL,
  `jueh10` time DEFAULT NULL,
  `vieh7` time DEFAULT NULL,
  `vieh8` time DEFAULT NULL,
  `vieh9` time DEFAULT NULL,
  `vieh10` time DEFAULT NULL,
  `sabh7` time DEFAULT NULL,
  `sabh8` time DEFAULT NULL,
  `sabh9` time DEFAULT NULL,
  `sabh10` time DEFAULT NULL,
  `domh7` time DEFAULT NULL,
  `domh8` time DEFAULT NULL,
  `domh9` time DEFAULT NULL,
  `domh10` time DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `grupos` (`id`, `nombre`, `tipo_grupo`, `tipo_flexible`, `horas`, `dias_trabaja_semana`, `lunes`, `martes`, `miercoles`, `jueves`, `viernes`, `sabado`, `domingo`, `lunh`, `marh`, `mieh`, `jueh`, `vieh`, `sabh`, `domh`, `lunh1`, `lunh2`, `lunh3`, `lunh4`, `lunh5`, `lunh6`, `marh1`, `marh2`, `marh3`, `marh4`, `marh5`, `marh6`, `mieh1`, `mieh2`, `mieh3`, `mieh4`, `mieh5`, `mieh6`, `jueh1`, `jueh2`, `jueh3`, `jueh4`, `jueh5`, `jueh6`, `vieh1`, `vieh2`, `vieh3`, `vieh4`, `vieh5`, `vieh6`, `sabh1`, `sabh2`, `sabh3`, `sabh4`, `sabh5`, `sabh6`, `domh1`, `domh2`, `domh3`, `domh4`, `domh5`, `domh6`, `cambiar_horas`, `lunh7`, `lunh8`, `lunh9`, `lunh10`, `marh7`, `marh8`, `marh9`, `marh10`, `mieh7`, `mieh8`, `mieh9`, `mieh10`, `jueh7`, `jueh8`, `jueh9`, `jueh10`, `vieh7`, `vieh8`, `vieh9`, `vieh10`, `sabh7`, `sabh8`, `sabh9`, `sabh10`, `domh7`, `domh8`, `domh9`, `domh10`) VALUES
(1, 'Por defecto', 0, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

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

--
-- Estructura de tabla para la tabla `historial_horarios`
--

CREATE TABLE `historial_horarios` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `fecha_inicio` date NOT NULL,
  `fecha_fin` date DEFAULT NULL,
  `lunh1` time NOT NULL,
  `lunh2` time DEFAULT NULL,
  `lunh3` time DEFAULT NULL,
  `lunh4` time DEFAULT NULL,
  `lunh5` time DEFAULT NULL,
  `lunh6` time NOT NULL,
  `marh1` time DEFAULT NULL,
  `marh2` time DEFAULT NULL,
  `marh3` time DEFAULT NULL,
  `marh4` time DEFAULT NULL,
  `marh5` time DEFAULT NULL,
  `marh6` time DEFAULT NULL,
  `mieh1` time DEFAULT NULL,
  `mieh2` time DEFAULT NULL,
  `mieh3` time DEFAULT NULL,
  `mieh4` time DEFAULT NULL,
  `mieh5` time DEFAULT NULL,
  `mieh6` time DEFAULT NULL,
  `jueh1` time DEFAULT NULL,
  `jueh2` time DEFAULT NULL,
  `jueh3` time DEFAULT NULL,
  `jueh4` time DEFAULT NULL,
  `jueh5` time DEFAULT NULL,
  `jueh6` time DEFAULT NULL,
  `vieh1` time DEFAULT NULL,
  `vieh2` time DEFAULT NULL,
  `vieh3` time DEFAULT NULL,
  `vieh4` time DEFAULT NULL,
  `vieh5` time DEFAULT NULL,
  `vieh6` time DEFAULT NULL,
  `sabh1` time DEFAULT NULL,
  `sabh2` time DEFAULT NULL,
  `sabh3` time DEFAULT NULL,
  `sabh4` time DEFAULT NULL,
  `sabh5` time DEFAULT NULL,
  `sabh6` time DEFAULT NULL,
  `domh1` time DEFAULT NULL,
  `domh2` time DEFAULT NULL,
  `domh3` time DEFAULT NULL,
  `domh4` time DEFAULT NULL,
  `domh5` time DEFAULT NULL,
  `domh6` time DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `historial_horas_acumuladas`
--

CREATE TABLE `historial_horas_acumuladas` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `fecha_inicio` date NOT NULL,
  `fecha_fin` date NOT NULL,
  `horas_disponibles` decimal(10,6) DEFAULT NULL,
  `horas_pagadas` decimal(10,6) DEFAULT NULL,
  `horas_acumuladas` decimal(10,6) DEFAULT NULL,
  `nota` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `historial_horas_acumuladas_cron`
--

CREATE TABLE `historial_horas_acumuladas_cron` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `horas_ant` decimal(10,6) DEFAULT NULL,
  `horas` decimal(10,6) DEFAULT NULL,
  `fecha` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Estructura de tabla para la tabla `incidencias`
--

CREATE TABLE `incidencias` (
  `id` bigint(20) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `nombre_empleado` varchar(120) NOT NULL,
  `id_registro` int(11) NOT NULL,
  `rh1` time NOT NULL,
  `rh2` time DEFAULT NULL,
  `rh3` time DEFAULT NULL,
  `rh4` time DEFAULT NULL,
  `rh5` time DEFAULT NULL,
  `rh6` time DEFAULT NULL,
  `fecha` date NOT NULL,
  `diferencia_horas` int(11) DEFAULT NULL,
  `id_motivo` int(11) DEFAULT NULL,
  `estado` tinyint(4) NOT NULL,
  `descripcion` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `logs`
--

CREATE TABLE `logs` (
  `id` bigint(20) NOT NULL,
  `fecha` datetime NOT NULL DEFAULT current_timestamp(),
  `tipo` varchar(120) NOT NULL,
  `titulo` varchar(200) NOT NULL,
  `archivo` varchar(200) NOT NULL,
  `descripcion` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `meses_cerrados`
--

CREATE TABLE `meses_cerrados` (
  `id` int(11) NOT NULL,
  `fecha_inicio` date NOT NULL DEFAULT current_timestamp(),
  `fecha_fin` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `motivos`
--

CREATE TABLE `motivos` (
  `id` int(11) NOT NULL,
  `nombre` varchar(120) NOT NULL,
  `resolucion` int(11) NOT NULL,
  `modificar_horario` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `motivos` (`id`, `nombre`, `resolucion`, `modificar_horario`) VALUES
(1, 'CORREGIDO', 0, 0),
(2, 'LLEGA TARDE', -1, 0),
(3, 'VACACIONES', 0, 0),
(4, 'FESTIVO', 0, 0),
(7, 'MÉDICO', 0, 0),
(8, 'PERMISO', 0, 1);

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

--
-- Estructura de tabla para la tabla `registros`
--

CREATE TABLE `registros` (
  `id` int(11) NOT NULL,
  `nombre` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `hora1` time NOT NULL,
  `hora2` time DEFAULT NULL,
  `hora3` time DEFAULT NULL,
  `hora4` time DEFAULT NULL,
  `hora5` time DEFAULT NULL,
  `hora6` time DEFAULT NULL,
  `hora7` time DEFAULT NULL,
  `hora8` time DEFAULT NULL,
  `hora9` time DEFAULT NULL,
  `hora10` time DEFAULT NULL,
  `fecha` date DEFAULT NULL,
  `nota` text CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh1` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh1` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh2` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh2` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh3` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh3` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh4` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh4` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh5` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh5` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh6` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh6` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `activo` tinyint(1) NOT NULL DEFAULT 1
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `registros_inspector`
--

CREATE TABLE `registros_inspector` (
  `id` int(11) NOT NULL,
  `nombre` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `hora1` time NOT NULL,
  `hora2` time DEFAULT NULL,
  `hora3` time DEFAULT NULL,
  `hora4` time DEFAULT NULL,
  `hora5` time DEFAULT NULL,
  `hora6` time DEFAULT NULL,
  `hora7` time DEFAULT NULL,
  `hora8` time DEFAULT NULL,
  `hora9` time DEFAULT NULL,
  `hora10` time DEFAULT NULL,
  `fecha` date DEFAULT NULL,
  `mensaje` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh1` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh1` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh2` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh2` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh3` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh3` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh4` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh4` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh5` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh5` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `latitudh6` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `longitudh6` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_spanish2_ci DEFAULT NULL,
  `activo` tinyint(1) NOT NULL DEFAULT 1,
  `bloqueado` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estructura de tabla para la tabla `solicitudes_notas`
--

CREATE TABLE `solicitudes_notas` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `id_registro` int(11) NOT NULL,
  `nota` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `fecha` date NOT NULL,
  `estado` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

--
-- Estructura de tabla para la tabla `solicitudes_vacaciones`
--

CREATE TABLE `solicitudes_vacaciones` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL,
  `fecha_inicio` date NOT NULL,
  `fecha_fin` date NOT NULL,
  `motivo` text DEFAULT NULL,
  `estado` tinyint(4) DEFAULT 1 COMMENT '0=Rechazada, 1=Pendiente, 2=Aprobada',
  `fecha_solicitud` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estructura de tabla para la tabla `usuarios`
--

CREATE TABLE `usuarios` (
  `id` int(11) NOT NULL,
  `id_empleado` int(11) NOT NULL DEFAULT 0,
  `usuario` varchar(80) NOT NULL,
  `contra` varchar(80) NOT NULL,
  `tipo` varchar(18) NOT NULL DEFAULT 'empleado'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `usuarios` (`id`, `id_empleado`, `usuario`, `contra`, `tipo`) VALUES
(1, 0, 'dev', 'fe01ce2a7fbac8fafaed7c982a04e229', 'admin'),
(2, 0, 'dev1', 'fe01ce2a7fbac8fafaed7c982a04e229', 'inspector');

--
-- Índices para tablas volcadas
--

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

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

--
-- Indices de la tabla `configuraciones`
--
ALTER TABLE `configuraciones`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `meta` (`meta`);

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

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

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

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

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

--
-- Indices de la tabla `empleados_eliminados`
--
ALTER TABLE `empleados_eliminados`
  ADD PRIMARY KEY (`id_empleado`);

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `usuarios` (`usuario`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT de la tabla `incidencias`
--
ALTER TABLE `incidencias`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `logs`
--
ALTER TABLE `logs`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

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

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

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

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

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

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

--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE `usuarios`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!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 */;
