-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 06-07-2025 a las 22:48:20
-- Versión del servidor: 10.4.32-MariaDB
-- Versión de PHP: 8.2.12

START TRANSACTION;



--
-- Base de datos: `agendacrm`
--

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

--
-- Estructura de tabla para la tabla `communes`
--

CREATE TABLE `communes` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `owner_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `communes` (`id`, `name`, `owner_id`, `created_at`) VALUES
(1, 'Arica', 1, '2025-06-25 00:28:36'),
(2, 'Camarones', 1, '2025-06-25 00:28:36'),
(3, 'Putre', 1, '2025-06-25 00:28:36'),
(4, 'General Lagos', 1, '2025-06-25 00:28:36'),
(5, 'Iquique', 1, '2025-06-25 00:28:36'),
(6, 'Alto Hospicio', 1, '2025-06-25 00:28:36'),
(7, 'Pozo Almonte', 1, '2025-06-25 00:28:36'),
(8, 'Camiña', 1, '2025-06-25 00:28:36'),
(9, 'Colchane', 1, '2025-06-25 00:28:36'),
(10, 'Huara', 1, '2025-06-25 00:28:36'),
(11, 'Pica', 1, '2025-06-25 00:28:36'),
(12, 'Antofagasta', 1, '2025-06-25 00:28:36'),
(13, 'Mejillones', 1, '2025-06-25 00:28:36'),
(14, 'Sierra Gorda', 1, '2025-06-25 00:28:36'),
(15, 'Taltal', 1, '2025-06-25 00:28:36'),
(16, 'Calama', 1, '2025-06-25 00:28:36'),
(17, 'Ollagüe', 1, '2025-06-25 00:28:36'),
(18, 'San Pedro de Atacama', 1, '2025-06-25 00:28:36'),
(19, 'Tocopilla', 1, '2025-06-25 00:28:36'),
(20, 'María Elena', 1, '2025-06-25 00:28:36'),
(21, 'Copiapó', 1, '2025-06-25 00:28:36'),
(22, 'Caldera', 1, '2025-06-25 00:28:36'),
(23, 'Tierra Amarilla', 1, '2025-06-25 00:28:36'),
(24, 'Chañaral', 1, '2025-06-25 00:28:36'),
(25, 'Diego de Almagro', 1, '2025-06-25 00:28:36'),
(26, 'Vallenar', 1, '2025-06-25 00:28:36'),
(27, 'Alto del Carmen', 1, '2025-06-25 00:28:36'),
(28, 'Freirina', 1, '2025-06-25 00:28:36'),
(29, 'Huasco', 1, '2025-06-25 00:28:36'),
(30, 'La Serena', 1, '2025-06-25 00:28:36'),
(31, 'Coquimbo', 1, '2025-06-25 00:28:36'),
(32, 'Andacollo', 1, '2025-06-25 00:28:36'),
(33, 'La Higuera', 1, '2025-06-25 00:28:36'),
(34, 'Paiguano', 1, '2025-06-25 00:28:36'),
(35, 'Vicuña', 1, '2025-06-25 00:28:36'),
(36, 'Illapel', 1, '2025-06-25 00:28:36'),
(37, 'Canela', 1, '2025-06-25 00:28:36'),
(38, 'Los Vilos', 1, '2025-06-25 00:28:36'),
(39, 'Salamanca', 1, '2025-06-25 00:28:36'),
(40, 'Ovalle', 1, '2025-06-25 00:28:36'),
(41, 'Combarbalá', 1, '2025-06-25 00:28:36'),
(42, 'Monte Patria', 1, '2025-06-25 00:28:36'),
(43, 'Punitaqui', 1, '2025-06-25 00:28:36'),
(44, 'Río Hurtado', 1, '2025-06-25 00:28:36'),
(45, 'Valparaíso', 1, '2025-06-25 00:28:36'),
(46, 'Casablanca', 1, '2025-06-25 00:28:36'),
(47, 'Concón', 1, '2025-06-25 00:28:36'),
(48, 'Juan Fernández', 1, '2025-06-25 00:28:36'),
(49, 'Puchuncaví', 1, '2025-06-25 00:28:36'),
(50, 'Quintero', 1, '2025-06-25 00:28:36'),
(51, 'Viña del Mar', 1, '2025-06-25 00:28:36'),
(52, 'Isla de Pascua', 1, '2025-06-25 00:28:36'),
(53, 'Los Andes', 1, '2025-06-25 00:28:36'),
(54, 'Calle Larga', 1, '2025-06-25 00:28:36'),
(55, 'Catemu', 1, '2025-06-25 00:28:36'),
(56, 'Llay-Llay', 1, '2025-06-25 00:28:36'),
(57, 'Panquehue', 1, '2025-06-25 00:28:36'),
(58, 'Putaendo', 1, '2025-06-25 00:28:36'),
(59, 'San Felipe', 1, '2025-06-25 00:28:36'),
(60, 'Santa María', 1, '2025-06-25 00:28:36'),
(61, 'Quillota', 1, '2025-06-25 00:28:36'),
(62, 'Calera', 1, '2025-06-25 00:28:36'),
(63, 'Hijuelas', 1, '2025-06-25 00:28:36'),
(64, 'La Cruz', 1, '2025-06-25 00:28:36'),
(65, 'Nogales', 1, '2025-06-25 00:28:36'),
(66, 'San Antonio', 1, '2025-06-25 00:28:36'),
(67, 'Algarrobo', 1, '2025-06-25 00:28:36'),
(68, 'Cartagena', 1, '2025-06-25 00:28:36'),
(69, 'El Quisco', 1, '2025-06-25 00:28:36'),
(70, 'El Tabo', 1, '2025-06-25 00:28:36'),
(71, 'Santo Domingo', 1, '2025-06-25 00:28:36'),
(72, 'San Felipe', 1, '2025-06-25 00:28:36'),
(73, 'Santa María', 1, '2025-06-25 00:28:36'),
(74, 'Limache', 1, '2025-06-25 00:28:36'),
(75, 'Olmué', 1, '2025-06-25 00:28:36'),
(76, 'Quilpué', 1, '2025-06-25 00:28:36'),
(77, 'Villa Alemana', 1, '2025-06-25 00:28:36'),
(78, 'Colina', 1, '2025-06-25 00:28:36'),
(79, 'Lampa', 1, '2025-06-25 00:28:36'),
(80, 'Tiltil', 1, '2025-06-25 00:28:36'),
(81, 'Pirque', 1, '2025-06-25 00:28:36'),
(82, 'Puente Alto', 1, '2025-06-25 00:28:36'),
(83, 'San José de Maipo', 1, '2025-06-25 00:28:36'),
(84, 'Buin', 1, '2025-06-25 00:28:36'),
(85, 'Calera de Tango', 1, '2025-06-25 00:28:36'),
(86, 'Paine', 1, '2025-06-25 00:28:36'),
(87, 'San Bernardo', 1, '2025-06-25 00:28:36'),
(88, 'Melipilla', 1, '2025-06-25 00:28:36'),
(89, 'Alhué', 1, '2025-06-25 00:28:36'),
(90, 'Curacaví', 1, '2025-06-25 00:28:36'),
(91, 'María Pinto', 1, '2025-06-25 00:28:36'),
(92, 'San Pedro', 1, '2025-06-25 00:28:36'),
(93, 'El Monte', 1, '2025-06-25 00:28:36'),
(94, 'Isla de Maipo', 1, '2025-06-25 00:28:36'),
(95, 'Padre Hurtado', 1, '2025-06-25 00:28:36'),
(96, 'Peñaflor', 1, '2025-06-25 00:28:36'),
(97, 'Talagante', 1, '2025-06-25 00:28:36'),
(98, 'Cerrillos', 1, '2025-06-25 00:28:36'),
(99, 'Cerro Navia', 1, '2025-06-25 00:28:36'),
(100, 'Conchalí', 1, '2025-06-25 00:28:36'),
(101, 'El Bosque', 1, '2025-06-25 00:28:36'),
(102, 'Estación Central', 1, '2025-06-25 00:28:36'),
(103, 'Huechuraba', 1, '2025-06-25 00:28:36'),
(104, 'Independencia', 1, '2025-06-25 00:28:36'),
(105, 'La Cisterna', 1, '2025-06-25 00:28:36'),
(106, 'La Florida', 1, '2025-06-25 00:28:36'),
(107, 'La Granja', 1, '2025-06-25 00:28:36'),
(108, 'La Pintana', 1, '2025-06-25 00:28:36'),
(109, 'La Reina', 1, '2025-06-25 00:28:36'),
(110, 'Las Condes', 1, '2025-06-25 00:28:36'),
(111, 'Lo Barnechea', 1, '2025-06-25 00:28:36'),
(112, 'Lo Espejo', 1, '2025-06-25 00:28:36'),
(113, 'Lo Prado', 1, '2025-06-25 00:28:36'),
(114, 'Macul', 1, '2025-06-25 00:28:36'),
(115, 'Maipú', 1, '2025-06-25 00:28:36'),
(116, 'Ñuñoa', 1, '2025-06-25 00:28:36'),
(117, 'Pedro Aguirre Cerda', 1, '2025-06-25 00:28:36'),
(118, 'Peñalolén', 1, '2025-06-25 00:28:36'),
(119, 'Providencia', 1, '2025-06-25 00:28:36'),
(120, 'Pudahuel', 1, '2025-06-25 00:28:36'),
(121, 'Quilicura', 1, '2025-06-25 00:28:36'),
(122, 'Quinta Normal', 1, '2025-06-25 00:28:36'),
(123, 'Recoleta', 1, '2025-06-25 00:28:36'),
(124, 'Renca', 1, '2025-06-25 00:28:36'),
(125, 'San Joaquín', 1, '2025-06-25 00:28:36'),
(126, 'San Miguel', 1, '2025-06-25 00:28:36'),
(127, 'San Ramón', 1, '2025-06-25 00:28:36'),
(128, 'Santiago', 1, '2025-06-25 00:28:36'),
(129, 'Vitacura', 1, '2025-06-25 00:28:36'),
(130, 'Rancagua', 1, '2025-06-25 00:28:36'),
(131, 'Codegua', 1, '2025-06-25 00:28:36'),
(132, 'Coinco', 1, '2025-06-25 00:28:36'),
(133, 'Coltauco', 1, '2025-06-25 00:28:36'),
(134, 'Doñihue', 1, '2025-06-25 00:28:36'),
(135, 'Graneros', 1, '2025-06-25 00:28:36'),
(136, 'Las Cabras', 1, '2025-06-25 00:28:36'),
(137, 'Machalí', 1, '2025-06-25 00:28:36'),
(138, 'Malloa', 1, '2025-06-25 00:28:36'),
(139, 'Mostazal', 1, '2025-06-25 00:28:36'),
(140, 'Olivar', 1, '2025-06-25 00:28:36'),
(141, 'Peumo', 1, '2025-06-25 00:28:36'),
(142, 'Pichidegua', 1, '2025-06-25 00:28:36'),
(143, 'Quinta de Tilcoco', 1, '2025-06-25 00:28:36'),
(144, 'Rengo', 1, '2025-06-25 00:28:36'),
(145, 'Requínoa', 1, '2025-06-25 00:28:36'),
(146, 'San Vicente de Tagua Tagua', 1, '2025-06-25 00:28:36'),
(147, 'Pichilemu', 1, '2025-06-25 00:28:36'),
(148, 'La Estrella', 1, '2025-06-25 00:28:36'),
(149, 'Litueche', 1, '2025-06-25 00:28:36'),
(150, 'Marchigüe', 1, '2025-06-25 00:28:36'),
(151, 'Navidad', 1, '2025-06-25 00:28:36'),
(152, 'Paredones', 1, '2025-06-25 00:28:36'),
(153, 'San Fernando', 1, '2025-06-25 00:28:36'),
(154, 'Chépica', 1, '2025-06-25 00:28:36'),
(155, 'Chimbarongo', 1, '2025-06-25 00:28:36'),
(156, 'Lolol', 1, '2025-06-25 00:28:36'),
(157, 'Nancagua', 1, '2025-06-25 00:28:36'),
(158, 'Palmilla', 1, '2025-06-25 00:28:36'),
(159, 'Peralillo', 1, '2025-06-25 00:28:36'),
(160, 'Placilla', 1, '2025-06-25 00:28:36'),
(161, 'Pumanque', 1, '2025-06-25 00:28:36'),
(162, 'Santa Cruz', 1, '2025-06-25 00:28:36'),
(163, 'Talca', 1, '2025-06-25 00:28:36'),
(164, 'Curepto', 1, '2025-06-25 00:28:36'),
(165, 'Constitución', 1, '2025-06-25 00:28:36'),
(166, 'Empedrado', 1, '2025-06-25 00:28:36'),
(167, 'Maule', 1, '2025-06-25 00:28:36'),
(168, 'Pelarco', 1, '2025-06-25 00:28:36'),
(169, 'Pencahue', 1, '2025-06-25 00:28:36'),
(170, 'Río Claro', 1, '2025-06-25 00:28:36'),
(171, 'San Clemente', 1, '2025-06-25 00:28:36'),
(172, 'San Rafael', 1, '2025-06-25 00:28:36'),
(173, 'Colbún', 1, '2025-06-25 00:28:36'),
(174, 'Linares', 1, '2025-06-25 00:28:36'),
(175, 'Longaví', 1, '2025-06-25 00:28:36'),
(176, 'Parral', 1, '2025-06-25 00:28:36'),
(177, 'Retiro', 1, '2025-06-25 00:28:36'),
(178, 'San Javier', 1, '2025-06-25 00:28:36'),
(179, 'Villa Alegre', 1, '2025-06-25 00:28:36'),
(180, 'Yerbas Buenas', 1, '2025-06-25 00:28:36'),
(181, 'Cauquenes', 1, '2025-06-25 00:28:36'),
(182, 'Chanco', 1, '2025-06-25 00:28:36'),
(183, 'Pelluhue', 1, '2025-06-25 00:28:36'),
(184, 'Curicó', 1, '2025-06-25 00:28:36'),
(185, 'Hualañé', 1, '2025-06-25 00:28:36'),
(186, 'Licantén', 1, '2025-06-25 00:28:36'),
(187, 'Molina', 1, '2025-06-25 00:28:36'),
(188, 'Romeral', 1, '2025-06-25 00:28:36'),
(189, 'Sagrada Familia', 1, '2025-06-25 00:28:36'),
(190, 'Teno', 1, '2025-06-25 00:28:36'),
(191, 'Vichuquén', 1, '2025-06-25 00:28:36'),
(192, 'Chillán', 1, '2025-06-25 00:28:36'),
(193, 'Bulnes', 1, '2025-06-25 00:28:36'),
(194, 'Cobquecura', 1, '2025-06-25 00:28:36'),
(195, 'Coelemu', 1, '2025-06-25 00:28:36'),
(196, 'Coihueco', 1, '2025-06-25 00:28:36'),
(197, 'Chillán Viejo', 1, '2025-06-25 00:28:36'),
(198, 'El Carmen', 1, '2025-06-25 00:28:36'),
(199, 'Ninhue', 1, '2025-06-25 00:28:36'),
(200, 'Ñiquén', 1, '2025-06-25 00:28:36'),
(201, 'Pemuco', 1, '2025-06-25 00:28:36'),
(202, 'Pinto', 1, '2025-06-25 00:28:36'),
(203, 'Portezuelo', 1, '2025-06-25 00:28:36'),
(204, 'Quillón', 1, '2025-06-25 00:28:36'),
(205, 'Quirihue', 1, '2025-06-25 00:28:36'),
(206, 'Ránquil', 1, '2025-06-25 00:28:36'),
(207, 'San Carlos', 1, '2025-06-25 00:28:36'),
(208, 'San Fabián', 1, '2025-06-25 00:28:36'),
(209, 'San Ignacio', 1, '2025-06-25 00:28:36'),
(210, 'San Nicolás', 1, '2025-06-25 00:28:36'),
(211, 'Treguaco', 1, '2025-06-25 00:28:36'),
(212, 'Yungay', 1, '2025-06-25 00:28:36'),
(213, 'Concepción', 1, '2025-06-25 00:28:36'),
(214, 'Coronel', 1, '2025-06-25 00:28:36'),
(215, 'Chiguayante', 1, '2025-06-25 00:28:36'),
(216, 'Florida', 1, '2025-06-25 00:28:36'),
(217, 'Hualqui', 1, '2025-06-25 00:28:36'),
(218, 'Lota', 1, '2025-06-25 00:28:36'),
(219, 'Penco', 1, '2025-06-25 00:28:36'),
(220, 'San Pedro de la Paz', 1, '2025-06-25 00:28:36'),
(221, 'Santa Juana', 1, '2025-06-25 00:28:36'),
(222, 'Talcahuano', 1, '2025-06-25 00:28:36'),
(223, 'Tomé', 1, '2025-06-25 00:28:36'),
(224, 'Hualpén', 1, '2025-06-25 00:28:36'),
(225, 'Lebu', 1, '2025-06-25 00:28:36'),
(226, 'Arauco', 1, '2025-06-25 00:28:36'),
(227, 'Cañete', 1, '2025-06-25 00:28:36'),
(228, 'Contulmo', 1, '2025-06-25 00:28:36'),
(229, 'Curanilahue', 1, '2025-06-25 00:28:36'),
(230, 'Los Álamos', 1, '2025-06-25 00:28:36'),
(231, 'Tirúa', 1, '2025-06-25 00:28:36'),
(232, 'Los Ángeles', 1, '2025-06-25 00:28:36'),
(233, 'Antuco', 1, '2025-06-25 00:28:36'),
(234, 'Cabrero', 1, '2025-06-25 00:28:36'),
(235, 'Laja', 1, '2025-06-25 00:28:36'),
(236, 'Mulchén', 1, '2025-06-25 00:28:36'),
(237, 'Nacimiento', 1, '2025-06-25 00:28:36'),
(238, 'Negrete', 1, '2025-06-25 00:28:36'),
(239, 'Quilaco', 1, '2025-06-25 00:28:36'),
(240, 'Quilleco', 1, '2025-06-25 00:28:36'),
(241, 'San Rosendo', 1, '2025-06-25 00:28:36'),
(242, 'Santa Bárbara', 1, '2025-06-25 00:28:36'),
(243, 'Tucapel', 1, '2025-06-25 00:28:36'),
(244, 'Yumbel', 1, '2025-06-25 00:28:36'),
(245, 'Alto Biobío', 1, '2025-06-25 00:28:36'),
(246, 'Temuco', 1, '2025-06-25 00:28:36'),
(247, 'Carahue', 1, '2025-06-25 00:28:36'),
(248, 'Cunco', 1, '2025-06-25 00:28:36'),
(249, 'Curarrehue', 1, '2025-06-25 00:28:36'),
(250, 'Freire', 1, '2025-06-25 00:28:36'),
(251, 'Galvarino', 1, '2025-06-25 00:28:36'),
(252, 'Gorbea', 1, '2025-06-25 00:28:36'),
(253, 'Lautaro', 1, '2025-06-25 00:28:36'),
(254, 'Loncoche', 1, '2025-06-25 00:28:36'),
(255, 'Melipeuco', 1, '2025-06-25 00:28:36'),
(256, 'Nueva Imperial', 1, '2025-06-25 00:28:36'),
(257, 'Padre Las Casas', 1, '2025-06-25 00:28:36'),
(258, 'Perquenco', 1, '2025-06-25 00:28:36'),
(259, 'Pitrufquén', 1, '2025-06-25 00:28:36'),
(260, 'Pucón', 1, '2025-06-25 00:28:36'),
(261, 'Saavedra', 1, '2025-06-25 00:28:36'),
(262, 'Teodoro Schmidt', 1, '2025-06-25 00:28:36'),
(263, 'Toltén', 1, '2025-06-25 00:28:36'),
(264, 'Vilcún', 1, '2025-06-25 00:28:36'),
(265, 'Villarrica', 1, '2025-06-25 00:28:36'),
(266, 'Cholchol', 1, '2025-06-25 00:28:36'),
(267, 'Angol', 1, '2025-06-25 00:28:36'),
(268, 'Collipulli', 1, '2025-06-25 00:28:36'),
(269, 'Curacautín', 1, '2025-06-25 00:28:36'),
(270, 'Ercilla', 1, '2025-06-25 00:28:36'),
(271, 'Lonquimay', 1, '2025-06-25 00:28:36'),
(272, 'Los Sauces', 1, '2025-06-25 00:28:36'),
(273, 'Lumaco', 1, '2025-06-25 00:28:36'),
(274, 'Purén', 1, '2025-06-25 00:28:36'),
(275, 'Renaico', 1, '2025-06-25 00:28:36'),
(276, 'Traiguén', 1, '2025-06-25 00:28:36'),
(277, 'Victoria', 1, '2025-06-25 00:28:36'),
(278, 'Valdivia', 1, '2025-06-25 00:28:36'),
(279, 'Corral', 1, '2025-06-25 00:28:36'),
(280, 'Lanco', 1, '2025-06-25 00:28:36'),
(281, 'Los Lagos', 1, '2025-06-25 00:28:36'),
(282, 'Máfil', 1, '2025-06-25 00:28:36'),
(283, 'Mariquina', 1, '2025-06-25 00:28:36'),
(284, 'Paillaco', 1, '2025-06-25 00:28:36'),
(285, 'Panguipulli', 1, '2025-06-25 00:28:36'),
(286, 'La Unión', 1, '2025-06-25 00:28:36'),
(287, 'Futrono', 1, '2025-06-25 00:28:36'),
(288, 'Lago Ranco', 1, '2025-06-25 00:28:36'),
(289, 'Río Bueno', 1, '2025-06-25 00:28:36'),
(290, 'Puerto Montt', 1, '2025-06-25 00:28:36'),
(291, 'Calbuco', 1, '2025-06-25 00:28:36'),
(292, 'Cochamó', 1, '2025-06-25 00:28:36'),
(293, 'Fresia', 1, '2025-06-25 00:28:36'),
(294, 'Frutillar', 1, '2025-06-25 00:28:36'),
(295, 'Los Muermos', 1, '2025-06-25 00:28:36'),
(296, 'Llanquihue', 1, '2025-06-25 00:28:36'),
(297, 'Maullín', 1, '2025-06-25 00:28:36'),
(298, 'Puerto Varas', 1, '2025-06-25 00:28:36'),
(299, 'Castro', 1, '2025-06-25 00:28:36'),
(300, 'Ancud', 1, '2025-06-25 00:28:36'),
(301, 'Chonchi', 1, '2025-06-25 00:28:36'),
(302, 'Curaco de Vélez', 1, '2025-06-25 00:28:36'),
(303, 'Dalcahue', 1, '2025-06-25 00:28:36'),
(304, 'Puqueldón', 1, '2025-06-25 00:28:36'),
(305, 'Queilén', 1, '2025-06-25 00:28:36'),
(306, 'Quellón', 1, '2025-06-25 00:28:36'),
(307, 'Quemchi', 1, '2025-06-25 00:28:36'),
(308, 'Quinchao', 1, '2025-06-25 00:28:36'),
(309, 'Osorno', 1, '2025-06-25 00:28:36'),
(310, 'Puerto Octay', 1, '2025-06-25 00:28:36'),
(311, 'Purranque', 1, '2025-06-25 00:28:36'),
(312, 'Puyehue', 1, '2025-06-25 00:28:36'),
(313, 'Río Negro', 1, '2025-06-25 00:28:36'),
(314, 'San Juan de la Costa', 1, '2025-06-25 00:28:36'),
(315, 'San Pablo', 1, '2025-06-25 00:28:36'),
(316, 'Chaitén', 1, '2025-06-25 00:28:36'),
(317, 'Futaleufú', 1, '2025-06-25 00:28:36'),
(318, 'Hualaihué', 1, '2025-06-25 00:28:36'),
(319, 'Palena', 1, '2025-06-25 00:28:36'),
(320, 'Coyhaique', 1, '2025-06-25 00:28:36'),
(321, 'Lago Verde', 1, '2025-06-25 00:28:36'),
(322, 'Aysén', 1, '2025-06-25 00:28:36'),
(323, 'Cisnes', 1, '2025-06-25 00:28:36'),
(324, 'Guaitecas', 1, '2025-06-25 00:28:36'),
(325, 'Cochrane', 1, '2025-06-25 00:28:36'),
(326, 'O’Higgins', 1, '2025-06-25 00:28:36'),
(327, 'Tortel', 1, '2025-06-25 00:28:36'),
(328, 'Chile Chico', 1, '2025-06-25 00:28:36'),
(329, 'Río Ibáñez', 1, '2025-06-25 00:28:36'),
(330, 'Punta Arenas', 1, '2025-06-25 00:28:36'),
(331, 'Laguna Blanca', 1, '2025-06-25 00:28:36'),
(332, 'Río Verde', 1, '2025-06-25 00:28:36'),
(333, 'San Gregorio', 1, '2025-06-25 00:28:36'),
(334, 'Cabo de Hornos', 1, '2025-06-25 00:28:36'),
(335, 'Antártica', 1, '2025-06-25 00:28:36'),
(336, 'Porvenir', 1, '2025-06-25 00:28:36'),
(337, 'Primavera', 1, '2025-06-25 00:28:36'),
(338, 'Timaukel', 1, '2025-06-25 00:28:36'),
(339, 'Natales', 1, '2025-06-25 00:28:36'),
(340, 'Torres del Paine', 1, '2025-06-25 00:28:36');

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

--
-- Estructura de tabla para la tabla `locals`
--

CREATE TABLE `locals` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `address` varchar(100) NOT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `commune_id` int(11) NOT NULL,
  `owner_id` int(11) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `locals` (`id`, `name`, `address`, `image_path`, `commune_id`, `owner_id`, `created_at`) VALUES
(1, 'Mash Sucursal Santiago', 'Santiago #123, Santiago Centro', NULL, 128, 1, '2025-06-28 18:05:02'),
(2, 'Mash Sucursal Huechuraba', 'Los Pinos #123, Huechuraba', NULL, 103, 1, '2025-06-28 18:05:02'),
(11, 'Mash Sucursal Puente Alto', 'las heras 1120', 'logo-B9RBsCz__1750989890.png', 82, 1, '2025-06-28 18:05:02');

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

--
-- Estructura de tabla para la tabla `professional_specialty`
--

CREATE TABLE `professional_specialty` (
  `professional_id` int(11) NOT NULL,
  `specialty_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estructura de tabla para la tabla `reservations`
--

CREATE TABLE `reservations` (
  `id` int(11) NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `duration` int(11) NOT NULL,
  `status_id` int(11) NOT NULL,
  `local_id` int(11) NOT NULL,
  `notes` varchar(100) NOT NULL,
  `assigned_to` int(11) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL,
  `owner_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `reservations` (`id`, `start_date`, `end_date`, `duration`, `status_id`, `local_id`, `notes`, `assigned_to`, `created_at`, `updated_at`, `owner_id`) VALUES
(1, '2025-06-26 18:00:00', '2025-06-26 18:15:00', 15, 1, 1, 'sin notas', 3, '2025-06-26 20:19:11', NULL, 1),
(2, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 38, 1, 1, 'commentario', 3, '2025-06-27 02:21:28', NULL, 1),
(3, '2025-06-27 08:00:00', '2025-06-27 09:00:00', 0, 1, 1, 'commentario', 3, '2025-06-27 02:24:15', NULL, 1),
(4, '2025-06-27 09:00:00', '2025-06-27 09:30:00', 30, 1, 1, 'commentario', 3, '2025-06-27 02:24:37', NULL, 1),
(5, '2025-06-27 09:30:00', '2025-06-27 10:00:00', 0, 1, 1, 'commentario', 3, '2025-06-27 02:26:52', NULL, 1),
(6, '2025-06-27 10:00:00', '2025-06-27 11:30:00', 30, 1, 1, 'commentario', 3, '2025-06-27 02:27:21', NULL, 1),
(7, '2025-06-27 11:30:00', '2025-06-27 12:00:00', 0, 1, 1, 'commentario', 3, '2025-06-27 02:27:53', NULL, 1),
(8, '2025-06-27 08:30:00', '2025-06-27 08:30:00', 30, 1, 1, 'commentario', 3, '2025-06-27 02:29:51', NULL, 1),
(9, '2025-06-27 10:30:00', '2025-06-27 10:30:00', 30, 1, 1, 'commentario', 3, '2025-06-27 02:30:28', NULL, 1),
(10, '2025-06-27 08:00:00', '2025-06-27 08:00:00', 0, 1, 1, 'commentario', 4, '2025-06-27 02:31:57', NULL, 1),
(11, '2025-06-27 09:00:00', '2025-06-27 09:00:00', 0, 1, 1, 'commentario', 4, '2025-06-27 02:32:21', NULL, 1),
(12, '2025-06-27 08:30:00', '2025-06-27 08:30:00', 30, 1, 1, 'commentario', 4, '2025-06-27 02:32:33', NULL, 1),
(13, '2025-06-27 10:30:00', '2025-06-27 11:30:00', 30, 1, 1, 'commentario', 4, '2025-06-27 02:42:43', NULL, 1),
(14, '2025-06-29 10:00:00', '2025-06-29 10:30:00', 30, 1, 1, 'nuevo cliente', 3, '2025-06-28 18:31:07', NULL, 1),
(15, '2025-07-06 08:30:00', '2025-07-06 08:30:00', 30, 1, 1, '', 4, '2025-07-05 18:21:29', NULL, 1);

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

--
-- Estructura de tabla para la tabla `reservation_states`
--

CREATE TABLE `reservation_states` (
  `id` int(11) NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `reservation_states` (`id`, `name`, `description`) VALUES
(1, 'Creado', 'Reserva creada'),
(2, 'Confirmada Sin Pagar', ''),
(3, 'Confirmada Pagada', '');

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

--
-- Estructura de tabla para la tabla `roles`
--

CREATE TABLE `roles` (
  `id` int(11) NOT NULL,
  `name` varchar(10) NOT NULL,
  `description` varchar(10) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `owner_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Estructura de tabla para la tabla `services`
--

CREATE TABLE `services` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(255) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `duration` int(11) NOT NULL,
  `local_id` int(11) NOT NULL,
  `specialty_id` int(11) NOT NULL,
  `owner_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `services` (`id`, `name`, `description`, `price`, `duration`, `local_id`, `specialty_id`, `owner_id`, `created_at`, `updated_at`) VALUES
(2, 'Corte clásico o moderno', 'Puedes elegir entre un corte de cabello clásico o moderno, con tijeras, navajas o maquina. Este Servicio incluye lavado de cabello y aplicación de productos de alta calidad.', 5000.00, 60, 1, 1, 1, '2025-07-04 19:52:22', '2025-07-04 19:52:22'),
(3, 'Perfilado de barba', 'Ritual de barba con tijera y navaja. Aplicación de toalla caliente más aceite preshave, gel de afeitado y bálsamo postshave. Limpieza facial con gel.', 18990.00, 30, 1, 1, 1, '2025-07-04 20:34:55', '2025-07-04 20:34:55'),
(9, 'Perfilado de barba PREMIUM', 'Ritual de barba con toalla caliente, aceite preshave, gel de afeitado y postshave balm. Masaje cráneo facial, limpieza/tratamiento antiedad y mascara.', 28990.00, 120, 1, 1, 1, '2025-07-04 20:45:33', '2025-07-04 20:45:33'),
(12, 'Manos permanentes', 'Servicio de manos permanentes.', 10000.00, 30, 1, 1, 1, '2025-07-05 02:15:45', '2025-07-05 02:15:45');

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

--
-- Estructura de tabla para la tabla `specialties`
--

CREATE TABLE `specialties` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) NOT NULL,
  `local_id` int(11) NOT NULL,
  `owner_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `specialties` (`id`, `name`, `description`, `local_id`, `owner_id`, `created_at`) VALUES
(1, 'General', 'de todo...', 1, 1, '2025-07-06 05:32:51'),
(2, 'Cortes de pelo', '', 1, 1, '2025-07-06 15:39:24');

--
-- Índices para tablas volcadas
--

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

--
-- Indices de la tabla `locals`
--
ALTER TABLE `locals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_id` (`owner_id`),
  ADD KEY `commune_id` (`commune_id`);

--
-- Indices de la tabla `professional_specialty`
--
ALTER TABLE `professional_specialty`
  ADD KEY `professional_id` (`professional_id`),
  ADD KEY `specialty_id` (`specialty_id`);

--
-- Indices de la tabla `reservations`
--
ALTER TABLE `reservations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `local_id` (`local_id`),
  ADD KEY `status_id` (`status_id`);

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

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

--
-- Indices de la tabla `services`
--
ALTER TABLE `services`
  ADD PRIMARY KEY (`id`),
  ADD KEY `local_id` (`local_id`),
  ADD KEY `owner_id` (`owner_id`),
  ADD KEY `specialty_id` (`specialty_id`);

--
-- Indices de la tabla `specialties`
--
ALTER TABLE `specialties`
  ADD PRIMARY KEY (`id`),
  ADD KEY `local_id` (`local_id`),
  ADD KEY `owner_id` (`owner_id`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

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

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

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

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

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

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

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

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `locals`
--
ALTER TABLE `locals`
  ADD CONSTRAINT `locals_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `locals_ibfk_2` FOREIGN KEY (`commune_id`) REFERENCES `communes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Filtros para la tabla `professional_specialty`
--
ALTER TABLE `professional_specialty`
  ADD CONSTRAINT `professional_specialty_ibfk_1` FOREIGN KEY (`professional_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `professional_specialty_ibfk_2` FOREIGN KEY (`specialty_id`) REFERENCES `specialties` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Filtros para la tabla `reservations`
--
ALTER TABLE `reservations`
  ADD CONSTRAINT `reservations_ibfk_1` FOREIGN KEY (`local_id`) REFERENCES `locals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `reservations_ibfk_2` FOREIGN KEY (`status_id`) REFERENCES `reservation_states` (`id`);

--
-- Filtros para la tabla `services`
--
ALTER TABLE `services`
  ADD CONSTRAINT `services_ibfk_1` FOREIGN KEY (`local_id`) REFERENCES `locals` (`id`),
  ADD CONSTRAINT `services_ibfk_2` FOREIGN KEY (`specialty_id`) REFERENCES `specialties` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `services_ibfk_3` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Filtros para la tabla `specialties`
--
ALTER TABLE `specialties`
  ADD CONSTRAINT `specialties_ibfk_1` FOREIGN KEY (`local_id`) REFERENCES `locals` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `specialties_ibfk_2` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

