-- https://www.phpmyadmin.net/
--
-- Tempo de geração: 10-Maio-2026 às 17:30
-- Versão do servidor: 11.4.10-MariaDB
-- versão do PHP: 8.4.20

START TRANSACTION;



--
-- Base de dados: `educagest_painel`
--

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

--
-- Estrutura da tabela `academic_classes`
--

CREATE TABLE `academic_classes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `course_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `shift` enum('morning','afternoon','night','integral') NOT NULL DEFAULT 'morning',
  `max_students` int(11) NOT NULL DEFAULT 30,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `status` enum('open','full','in_progress','finished','cancelled') NOT NULL DEFAULT 'open',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `academic_classes`
--

INSERT INTO `academic_classes` (`id`, `tenant_id`, `course_id`, `name`, `shift`, `max_students`, `start_date`, `end_date`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 1, 'Matematica', 'morning', 20, '2026-05-01', '2026-05-08', 'open', '2026-04-12 02:39:48', '2026-04-12 02:39:48', NULL),
(2, 1, 1, 'Matematica', 'afternoon', 20, '2026-05-01', '2026-05-08', 'open', '2026-04-12 02:40:41', '2026-04-12 02:40:41', NULL);

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

--
-- Estrutura da tabela `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `action` varchar(50) NOT NULL,
  `model_type` varchar(255) DEFAULT NULL,
  `model_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `old_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`old_values`)),
  `new_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`new_values`)),
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `activity_logs`
--

INSERT INTO `activity_logs` (`id`, `tenant_id`, `user_id`, `action`, `model_type`, `model_id`, `description`, `old_values`, `new_values`, `ip_address`, `user_agent`, `created_at`, `updated_at`) VALUES
(1, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\Tenant', 1, 'Tenant criado(a)', NULL, '{\"slug\":\"demo\",\"name\":\"Escola Demo\",\"document\":\"12345678000190\",\"email\":\"demo@educagest.com\",\"phone\":\"11999999999\",\"status\":\"active\",\"plan\":\"premium\",\"settings\":{\"timezone\":\"America\\/Sao_Paulo\",\"locale\":\"pt_BR\",\"currency\":\"BRL\"},\"updated_at\":\"2026-04-11T08:53:00.000000Z\",\"created_at\":\"2026-04-11T08:53:00.000000Z\",\"id\":1}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(2, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\User', 1, 'User criado(a)', NULL, '{\"email\":\"admin@educagest.com\",\"name\":\"Super Administrador\",\"role_id\":1,\"is_super_admin\":true,\"status\":\"active\",\"email_verified_at\":\"2026-04-11T08:53:00.000000Z\",\"updated_at\":\"2026-04-11T08:53:00.000000Z\",\"created_at\":\"2026-04-11T08:53:00.000000Z\",\"id\":1}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(3, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\User', 2, 'User criado(a)', NULL, '{\"email\":\"escola@educagest.com\",\"name\":\"Admin Escola Demo\",\"tenant_id\":1,\"role_id\":2,\"status\":\"active\",\"email_verified_at\":\"2026-04-11T08:53:01.000000Z\",\"updated_at\":\"2026-04-11T08:53:01.000000Z\",\"created_at\":\"2026-04-11T08:53:01.000000Z\",\"id\":2}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:53:01', '2026-04-11 11:53:01'),
(4, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\User', 3, 'User criado(a)', NULL, '{\"email\":\"professor@educagest.com\",\"name\":\"Professor Demo\",\"tenant_id\":1,\"role_id\":4,\"status\":\"active\",\"email_verified_at\":\"2026-04-11T08:53:01.000000Z\",\"updated_at\":\"2026-04-11T08:53:01.000000Z\",\"created_at\":\"2026-04-11T08:53:01.000000Z\",\"id\":3}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:53:01', '2026-04-11 11:53:01'),
(5, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\User', 4, 'User criado(a)', NULL, '{\"email\":\"marcelobradrj@gmail.com\",\"name\":\"Marcelo Brad\",\"role_id\":1,\"is_super_admin\":true,\"status\":\"active\",\"updated_at\":\"2026-04-11T08:53:01.000000Z\",\"created_at\":\"2026-04-11T08:53:01.000000Z\",\"id\":4}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:53:01', '2026-04-11 11:53:01'),
(6, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":null,\"last_login_ip\":null,\"updated_at\":\"2026-04-11T08:53:01.000000Z\"}', '{\"last_login_at\":\"2026-04-11 08:58:01\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-11 08:58:01\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:58:01', '2026-04-11 11:58:01'),
(7, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 11:58:01', '2026-04-11 11:58:01'),
(8, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\Tenant', 2, 'Tenant criado(a)', NULL, '{\"name\":\"Tenant\",\"slug\":\"teste\",\"status\":\"active\",\"trial_ends_at\":\"2026-04-25T00:00:00.000000Z\",\"plan\":\"trial\",\"settings\":{\"onboarding_completed\":false},\"updated_at\":\"2026-04-11T09:10:48.000000Z\",\"created_at\":\"2026-04-11T09:10:48.000000Z\",\"id\":2}', '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 12:10:48', '2026-04-11 12:10:48'),
(9, NULL, NULL, 'created', 'App\\Modules\\Core\\Models\\User', 5, 'User criado(a)', NULL, '{\"tenant_id\":2,\"role_id\":null,\"name\":\"Monique\",\"email\":\"site.kdkhost@gmail.com\",\"status\":\"active\",\"updated_at\":\"2026-04-11T09:10:48.000000Z\",\"created_at\":\"2026-04-11T09:10:48.000000Z\",\"id\":5}', '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 12:10:48', '2026-04-11 12:10:48'),
(10, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T08:58:01.000000Z\",\"updated_at\":\"2026-04-11T08:58:01.000000Z\"}', '{\"last_login_at\":\"2026-04-11 14:04:25\",\"updated_at\":\"2026-04-11 14:04:25\"}', '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 17:04:25', '2026-04-11 17:04:25'),
(11, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 17:04:25', '2026-04-11 17:04:25'),
(12, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T14:04:25.000000Z\",\"updated_at\":\"2026-04-11T14:04:25.000000Z\"}', '{\"last_login_at\":\"2026-04-11 14:45:54\",\"updated_at\":\"2026-04-11 14:45:54\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 17:45:54', '2026-04-11 17:45:54'),
(13, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 17:45:54', '2026-04-11 17:45:54'),
(14, NULL, 4, 'logout', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou logout', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 19:32:29', '2026-04-11 19:32:29'),
(15, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":null,\"last_login_ip\":null,\"updated_at\":\"2026-04-11T08:53:01.000000Z\"}', '{\"last_login_at\":\"2026-04-11 16:32:44\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-11 16:32:44\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 19:32:44', '2026-04-11 19:32:44'),
(16, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 19:32:44', '2026-04-11 19:32:44'),
(17, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T16:32:44.000000Z\",\"updated_at\":\"2026-04-11T16:32:44.000000Z\"}', '{\"last_login_at\":\"2026-04-11 17:29:54\",\"updated_at\":\"2026-04-11 17:29:54\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 20:29:54', '2026-04-11 20:29:54'),
(18, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 20:29:54', '2026-04-11 20:29:54'),
(19, 1, 2, 'updated', 'App\\Modules\\Core\\Models\\Tenant', 1, 'Tenant atualizado(a)', '{\"payment_config\":null,\"whatsapp_config\":null,\"updated_at\":\"2026-04-11T08:53:00.000000Z\"}', '{\"payment_config\":\"{\\\"gateway\\\":null,\\\"mercado_pago_token\\\":null,\\\"paghiper_token\\\":null}\",\"whatsapp_config\":\"{\\\"base_url\\\":null,\\\"api_key\\\":null,\\\"instance\\\":null}\",\"updated_at\":\"2026-04-11 17:39:03\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 20:39:03', '2026-04-11 20:39:03'),
(20, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T17:29:54.000000Z\",\"updated_at\":\"2026-04-11T17:29:54.000000Z\"}', '{\"last_login_at\":\"2026-04-11 18:36:12\",\"updated_at\":\"2026-04-11 18:36:12\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:36:12', '2026-04-11 21:36:12'),
(21, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:36:12', '2026-04-11 21:36:12'),
(22, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T14:45:54.000000Z\",\"updated_at\":\"2026-04-11T14:45:54.000000Z\"}', '{\"last_login_at\":\"2026-04-11 18:47:39\",\"updated_at\":\"2026-04-11 18:47:39\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:47:39', '2026-04-11 21:47:39'),
(23, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:47:39', '2026-04-11 21:47:39'),
(24, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T18:36:12.000000Z\",\"updated_at\":\"2026-04-11T18:36:12.000000Z\"}', '{\"last_login_at\":\"2026-04-11 18:48:59\",\"updated_at\":\"2026-04-11 18:48:59\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:48:59', '2026-04-11 21:48:59'),
(25, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:48:59', '2026-04-11 21:48:59'),
(26, 1, 2, 'logout', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou logout', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:57:15', '2026-04-11 21:57:15'),
(27, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T18:47:39.000000Z\",\"updated_at\":\"2026-04-11T18:47:39.000000Z\"}', '{\"last_login_at\":\"2026-04-11 18:57:31\",\"updated_at\":\"2026-04-11 18:57:31\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:57:31', '2026-04-11 21:57:31'),
(28, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-11 21:57:31', '2026-04-11 21:57:31'),
(29, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T18:57:31.000000Z\",\"updated_at\":\"2026-04-11T18:57:31.000000Z\"}', '{\"last_login_at\":\"2026-04-11 20:35:37\",\"updated_at\":\"2026-04-11 20:35:37\"}', '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 23:35:37', '2026-04-11 23:35:37'),
(30, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 23:35:37', '2026-04-11 23:35:37'),
(31, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 5, 'User atualizado(a)', '{\"role_id\":null,\"document\":null,\"whatsapp\":null,\"address\":null,\"updated_at\":\"2026-04-11T09:10:48.000000Z\"}', '{\"role_id\":\"3\",\"document\":\"05525927730\",\"whatsapp\":\"21989588235\",\"address\":\"{\\\"cep\\\":\\\"22710-310\\\",\\\"street\\\":\\\"Rua Carlos Palut\\\",\\\"number\\\":\\\"359\\\",\\\"neighborhood\\\":\\\"Taquara\\\",\\\"city\\\":\\\"Rio de Janeiro\\\",\\\"state\\\":\\\"RJ\\\"}\",\"updated_at\":\"2026-04-11 20:38:40\"}', '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 23:38:40', '2026-04-11 23:38:40'),
(32, NULL, 4, 'logout', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou logout', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36', '2026-04-11 23:39:40', '2026-04-11 23:39:40'),
(33, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T18:48:59.000000Z\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-11T18:48:59.000000Z\"}', '{\"last_login_at\":\"2026-04-11 23:29:01\",\"last_login_ip\":\"189.40.65.52\",\"updated_at\":\"2026-04-11 23:29:01\"}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:29:01', '2026-04-12 02:29:01'),
(34, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:29:01', '2026-04-12 02:29:01'),
(35, 1, 2, 'updated', 'App\\Modules\\Core\\Models\\Tenant', 1, 'Tenant atualizado(a)', '{\"logo\":null,\"updated_at\":\"2026-04-11T17:39:03.000000Z\"}', '{\"logo\":\"logos\\/EqG9NwD5Iw6JFGhaxQKaoOgS6MCy1wO5r7UTRJTF.png\",\"updated_at\":\"2026-04-11 23:35:48\"}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:35:48', '2026-04-12 02:35:48'),
(36, 1, 2, 'updated', 'App\\Modules\\Core\\Models\\Tenant', 1, 'Tenant atualizado(a)', '{\"logo\":\"logos\\/EqG9NwD5Iw6JFGhaxQKaoOgS6MCy1wO5r7UTRJTF.png\",\"updated_at\":\"2026-04-11T23:35:48.000000Z\"}', '{\"logo\":\"logos\\/hY4gCsgH4yjDxYlWhXaKCt47BztUQCJb2LI48K5E.png\",\"updated_at\":\"2026-04-11 23:36:05\"}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:36:06', '2026-04-12 02:36:06'),
(37, 1, 2, 'created', 'App\\Modules\\Academic\\Models\\Course', 1, 'Course criado(a)', NULL, '{\"name\":\"Ensino Medio\",\"type\":\"regular\",\"description\":null,\"status\":\"active\",\"tenant_id\":1,\"slug\":\"ensino-medio\",\"updated_at\":\"2026-04-11T23:37:50.000000Z\",\"created_at\":\"2026-04-11T23:37:50.000000Z\",\"id\":1}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:37:50', '2026-04-12 02:37:50'),
(38, 1, 2, 'created', 'App\\Modules\\Academic\\Models\\Course', 2, 'Course criado(a)', NULL, '{\"name\":\"Ensino Fundamental\",\"type\":\"regular\",\"description\":null,\"status\":\"active\",\"tenant_id\":1,\"slug\":\"ensino-fundamental\",\"updated_at\":\"2026-04-11T23:38:05.000000Z\",\"created_at\":\"2026-04-11T23:38:05.000000Z\",\"id\":2}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:38:05', '2026-04-12 02:38:05'),
(39, 1, 2, 'created', 'App\\Modules\\Academic\\Models\\AcademicClass', 1, 'AcademicClass criado(a)', NULL, '{\"course_id\":\"1\",\"name\":\"Matematica\",\"shift\":\"morning\",\"max_students\":\"20\",\"start_date\":\"2026-05-01T00:00:00.000000Z\",\"end_date\":\"2026-05-08T00:00:00.000000Z\",\"status\":\"open\",\"tenant_id\":1,\"updated_at\":\"2026-04-11T23:39:48.000000Z\",\"created_at\":\"2026-04-11T23:39:48.000000Z\",\"id\":1}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:39:48', '2026-04-12 02:39:48'),
(40, 1, 2, 'created', 'App\\Modules\\Academic\\Models\\AcademicClass', 2, 'AcademicClass criado(a)', NULL, '{\"course_id\":\"1\",\"name\":\"Matematica\",\"shift\":\"afternoon\",\"max_students\":\"20\",\"start_date\":\"2026-05-01T00:00:00.000000Z\",\"end_date\":\"2026-05-08T00:00:00.000000Z\",\"status\":\"open\",\"tenant_id\":1,\"updated_at\":\"2026-04-11T23:40:41.000000Z\",\"created_at\":\"2026-04-11T23:40:41.000000Z\",\"id\":2}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:40:41', '2026-04-12 02:40:41'),
(41, 1, 2, 'logout', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou logout', NULL, NULL, '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:50:04', '2026-04-12 02:50:04'),
(42, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T20:35:37.000000Z\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-11T20:35:37.000000Z\"}', '{\"last_login_at\":\"2026-04-11 23:50:14\",\"last_login_ip\":\"189.40.65.52\",\"updated_at\":\"2026-04-11 23:50:14\"}', '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:50:14', '2026-04-12 02:50:14'),
(43, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:50:14', '2026-04-12 02:50:14'),
(44, NULL, 4, 'deleted', 'App\\Modules\\Core\\Models\\User', 5, 'User removido(a)', '{\"id\":5,\"tenant_id\":2,\"role_id\":3,\"name\":\"Monique\",\"email\":\"site.kdkhost@gmail.com\",\"document\":\"05525927730\",\"phone\":null,\"whatsapp\":\"21989588235\",\"avatar\":null,\"birth_date\":null,\"gender\":null,\"address\":{\"cep\":\"22710-310\",\"street\":\"Rua Carlos Palut\",\"number\":\"359\",\"neighborhood\":\"Taquara\",\"city\":\"Rio de Janeiro\",\"state\":\"RJ\"},\"preferences\":null,\"status\":\"active\",\"last_login_at\":null,\"last_login_ip\":null,\"is_super_admin\":false,\"email_verified_at\":null,\"created_at\":\"2026-04-11T09:10:48.000000Z\",\"updated_at\":\"2026-04-11T23:51:28.000000Z\",\"deleted_at\":\"2026-04-11T23:51:28.000000Z\",\"role\":{\"id\":3,\"name\":\"Diretoria\",\"slug\":\"director\",\"description\":\"Membro da diretoria\",\"is_system\":true,\"level\":2,\"created_at\":\"2026-04-11T08:53:00.000000Z\",\"updated_at\":\"2026-04-11T08:53:00.000000Z\"}}', NULL, '189.40.65.52', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-04-12 02:51:28', '2026-04-12 02:51:28'),
(45, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T23:50:14.000000Z\",\"last_login_ip\":\"189.40.65.52\",\"updated_at\":\"2026-04-11T23:50:14.000000Z\"}', '{\"last_login_at\":\"2026-04-12 17:42:38\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-12 17:42:38\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-12 20:42:38', '2026-04-12 20:42:38'),
(46, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-12 20:42:38', '2026-04-12 20:42:38'),
(47, NULL, 4, 'updated', 'App\\Modules\\Core\\Models\\User', 4, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-12T17:42:38.000000Z\",\"updated_at\":\"2026-04-12T17:42:38.000000Z\"}', '{\"last_login_at\":\"2026-04-13 03:05:50\",\"updated_at\":\"2026-04-13 03:05:50\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-13 06:05:50', '2026-04-13 06:05:50'),
(48, NULL, 4, 'login', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-13 06:05:50', '2026-04-13 06:05:50'),
(49, NULL, 4, 'logout', 'App\\Modules\\Core\\Models\\User', 4, 'Usuário realizou logout', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-13 06:14:55', '2026-04-13 06:14:55'),
(50, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-11T23:29:01.000000Z\",\"last_login_ip\":\"189.40.65.52\",\"updated_at\":\"2026-04-11T23:29:01.000000Z\"}', '{\"last_login_at\":\"2026-04-13 03:15:05\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-13 03:15:05\"}', '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-13 06:15:05', '2026-04-13 06:15:05'),
(51, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '177.192.4.34', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36', '2026-04-13 06:15:05', '2026-04-13 06:15:05'),
(52, NULL, 2, 'updated', 'App\\Modules\\Core\\Models\\User', 2, 'User atualizado(a)', '{\"last_login_at\":\"2026-04-13T03:15:05.000000Z\",\"last_login_ip\":\"177.192.4.34\",\"updated_at\":\"2026-04-13T03:15:05.000000Z\"}', '{\"last_login_at\":\"2026-04-13 03:15:22\",\"last_login_ip\":\"179.158.141.13\",\"updated_at\":\"2026-04-13 03:15:22\"}', '179.158.141.13', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36', '2026-04-13 06:15:22', '2026-04-13 06:15:22'),
(53, NULL, 2, 'login', 'App\\Modules\\Core\\Models\\User', 2, 'Usuário realizou login', NULL, NULL, '179.158.141.13', 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Mobile Safari/537.36', '2026-04-13 06:15:22', '2026-04-13 06:15:22');

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

--
-- Estrutura da tabela `attendance`
--

CREATE TABLE `attendance` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `class_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `is_present` tinyint(1) NOT NULL DEFAULT 1,
  `justification` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `class_subject_teacher`
--

CREATE TABLE `class_subject_teacher` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `academic_class_id` bigint(20) UNSIGNED NOT NULL,
  `subject_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `assigned_at` date DEFAULT NULL,
  `is_lead` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `courses`
--

CREATE TABLE `courses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `type` enum('regular','dynamic','technical','workshop') NOT NULL DEFAULT 'regular',
  `status` enum('active','inactive','archived') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `courses`
--

INSERT INTO `courses` (`id`, `tenant_id`, `name`, `slug`, `description`, `type`, `status`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 1, 'Ensino Medio', 'ensino-medio', NULL, 'regular', 'active', '2026-04-12 02:37:50', '2026-04-12 02:37:50', NULL),
(2, 1, 'Ensino Fundamental', 'ensino-fundamental', NULL, 'regular', 'active', '2026-04-12 02:38:05', '2026-04-12 02:38:05', NULL);

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

--
-- Estrutura da tabela `course_subject`
--

CREATE TABLE `course_subject` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `course_id` bigint(20) UNSIGNED NOT NULL,
  `subject_id` bigint(20) UNSIGNED NOT NULL,
  `order` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `enrollments`
--

CREATE TABLE `enrollments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `class_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('active','suspended','cancelled','completed') NOT NULL DEFAULT 'active',
  `enrolled_at` date DEFAULT NULL,
  `fee_amount` decimal(12,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `financial_bills`
--

CREATE TABLE `financial_bills` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `description` varchar(255) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `amount_paid` decimal(12,2) NOT NULL DEFAULT 0.00,
  `due_date` date NOT NULL,
  `paid_at` date DEFAULT NULL,
  `status` enum('pending','paid','partially_paid','cancelled','overdue') NOT NULL DEFAULT 'pending',
  `type` varchar(255) NOT NULL DEFAULT 'monthly_fee',
  `gateway_id` varchar(255) DEFAULT NULL,
  `payment_url` varchar(255) DEFAULT NULL,
  `pix_code` text DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `financial_payments`
--

CREATE TABLE `financial_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `bill_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `gateway` varchar(255) NOT NULL DEFAULT 'manual',
  `transaction_id` varchar(255) DEFAULT NULL,
  `method` enum('pix','boleto','credit_card','cash') NOT NULL DEFAULT 'cash',
  `payment_date` date NOT NULL,
  `raw_response` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`raw_response`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `grades`
--

CREATE TABLE `grades` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `enrollment_id` bigint(20) UNSIGNED NOT NULL,
  `subject_id` bigint(20) UNSIGNED NOT NULL,
  `score` decimal(5,2) DEFAULT NULL,
  `period` varchar(255) NOT NULL,
  `type` enum('exam','work','participation','final') NOT NULL DEFAULT 'exam',
  `teacher_comments` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `migrations`
--

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

--
-- Extraindo dados da tabela `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2026_04_11_000001_create_tenants_table', 1),
(5, '2026_04_11_000002_create_roles_permissions_tables', 1),
(6, '2026_04_11_000003_add_educagest_fields_to_users_table', 1),
(7, '2026_04_11_000004_create_tenant_settings_and_activity_logs_tables', 1),
(8, '2026_04_11_000005_create_academic_tables', 1),
(9, '2026_04_11_000006_create_financial_tables', 1),
(10, '2026_04_11_000007_create_diary_tables', 1),
(11, '2026_04_11_000008_create_pedagogical_reports_table', 1),
(12, '2026_04_11_042511_create_saas_billing_tables', 1),
(13, '2026_04_11_043233_expand_saas_billing_and_cname', 1),
(14, '2026_04_11_044936_link_guardians_to_students_and_notifications', 1),
(15, '2026_04_11_050736_create_class_subject_teacher_table', 1),
(16, '2026_04_11_051853_add_pwa_fields_to_tenants_table', 1),
(17, '2026_04_11_052613_add_experience_fields_to_tenants_table', 1),
(18, '2026_04_11_054001_add_communication_fields_to_tenants_table', 1);

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

--
-- Estrutura da tabela `notifications`
--

CREATE TABLE `notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `type` varchar(255) NOT NULL DEFAULT 'info',
  `link` varchar(255) DEFAULT NULL,
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `pedagogical_reports`
--

CREATE TABLE `pedagogical_reports` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `enrollment_id` bigint(20) UNSIGNED NOT NULL,
  `teacher_id` bigint(20) UNSIGNED NOT NULL,
  `report_date` date NOT NULL,
  `content` text NOT NULL,
  `evolution_level` int(11) NOT NULL DEFAULT 3,
  `focus_area` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `module` varchar(50) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `slug`, `module`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Ver Dashboard', 'dashboard.view', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(2, 'Ver Usuários', 'users.view', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(3, 'Criar Usuários', 'users.create', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(4, 'Editar Usuários', 'users.edit', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(5, 'Excluir Usuários', 'users.delete', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(6, 'Ver Configurações', 'settings.view', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(7, 'Editar Configurações', 'settings.edit', 'core', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(8, 'Ver Cursos', 'courses.view', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(9, 'Criar Cursos', 'courses.create', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(10, 'Editar Cursos', 'courses.edit', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(11, 'Excluir Cursos', 'courses.delete', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(12, 'Ver Turmas', 'classes.view', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(13, 'Criar Turmas', 'classes.create', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(14, 'Editar Turmas', 'classes.edit', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(15, 'Excluir Turmas', 'classes.delete', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(16, 'Ver Matrículas', 'enrollments.view', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(17, 'Criar Matrículas', 'enrollments.create', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(18, 'Editar Matrículas', 'enrollments.edit', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(19, 'Excluir Matrículas', 'enrollments.delete', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(20, 'Ver Alunos', 'students.view', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(21, 'Criar Alunos', 'students.create', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(22, 'Editar Alunos', 'students.edit', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(23, 'Excluir Alunos', 'students.delete', 'academic', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(24, 'Ver Financeiro', 'financial.view', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(25, 'Criar Cobranças', 'financial.create', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(26, 'Editar Cobranças', 'financial.edit', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(27, 'Excluir Cobranças', 'financial.delete', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(28, 'Ver Relatórios', 'reports.view', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(29, 'Processar Pagamentos', 'payments.process', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(30, 'Estornar Pagamentos', 'payments.refund', 'financial', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(31, 'Enviar Emails', 'emails.send', 'communication', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(32, 'Enviar WhatsApp', 'whatsapp.send', 'communication', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(33, 'Gerenciar Templates', 'templates.manage', 'communication', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(34, 'Ver Logs de Envio', 'logs.view', 'communication', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(35, 'Ver Documentos', 'documents.view', 'documents', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(36, 'Upload Documentos', 'documents.upload', 'documents', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(37, 'Excluir Documentos', 'documents.delete', 'documents', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(38, 'Ver Atendimento Domiciliar', 'homeservice.view', 'homeservice', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(39, 'Registrar Check-in', 'homeservice.checkin', 'homeservice', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(40, 'Gerenciar Visitas', 'homeservice.manage', 'homeservice', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(41, 'Ver Agendador', 'scheduler.view', 'scheduler', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(42, 'Gerenciar Tarefas', 'scheduler.manage', 'scheduler', NULL, '2026-04-11 11:53:00', '2026-04-11 11:53:00');

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

--
-- Estrutura da tabela `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `slug` varchar(50) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `is_system` tinyint(1) NOT NULL DEFAULT 0,
  `level` int(11) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `roles`
--

INSERT INTO `roles` (`id`, `name`, `slug`, `description`, `is_system`, `level`, `created_at`, `updated_at`) VALUES
(1, 'SuperAdmin', 'super_admin', 'Administrador geral do sistema', 1, 0, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(2, 'Escola/Empresa', 'school', 'Administrador da escola ou empresa', 1, 1, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(3, 'Diretoria', 'director', 'Membro da diretoria', 1, 2, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(4, 'Professor', 'teacher', 'Professor ou instrutor', 1, 3, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(5, 'Contador', 'accountant', 'Contador ou financeiro', 1, 3, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(6, 'Aluno', 'student', 'Aluno ou estudante', 1, 4, '2026-04-11 11:53:00', '2026-04-11 11:53:00'),
(7, 'Responsável', 'guardian', 'Responsável pelo aluno', 1, 4, '2026-04-11 11:53:00', '2026-04-11 11:53:00');

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

--
-- Estrutura da tabela `role_permission`
--

CREATE TABLE `role_permission` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `permission_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `role_permission`
--

INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(1, 2),
(2, 2),
(3, 2),
(1, 3),
(2, 3),
(3, 3),
(1, 4),
(2, 4),
(3, 4),
(1, 5),
(2, 5),
(1, 6),
(2, 6),
(3, 6),
(1, 7),
(2, 7),
(1, 8),
(2, 8),
(3, 8),
(4, 8),
(1, 9),
(2, 9),
(3, 9),
(1, 10),
(2, 10),
(3, 10),
(1, 11),
(2, 11),
(3, 11),
(1, 12),
(2, 12),
(3, 12),
(4, 12),
(1, 13),
(2, 13),
(3, 13),
(1, 14),
(2, 14),
(3, 14),
(1, 15),
(2, 15),
(3, 15),
(1, 16),
(2, 16),
(3, 16),
(4, 16),
(1, 17),
(2, 17),
(3, 17),
(1, 18),
(2, 18),
(3, 18),
(1, 19),
(2, 19),
(3, 19),
(1, 20),
(2, 20),
(3, 20),
(4, 20),
(1, 21),
(2, 21),
(3, 21),
(1, 22),
(2, 22),
(3, 22),
(1, 23),
(2, 23),
(3, 23),
(1, 24),
(2, 24),
(3, 24),
(5, 24),
(7, 24),
(1, 25),
(2, 25),
(3, 25),
(5, 25),
(1, 26),
(2, 26),
(3, 26),
(5, 26),
(1, 27),
(2, 27),
(3, 27),
(1, 28),
(2, 28),
(3, 28),
(5, 28),
(1, 29),
(2, 29),
(3, 29),
(5, 29),
(1, 30),
(2, 30),
(3, 30),
(1, 31),
(2, 31),
(1, 32),
(2, 32),
(1, 33),
(2, 33),
(1, 34),
(2, 34),
(1, 35),
(2, 35),
(3, 35),
(4, 35),
(6, 35),
(7, 35),
(1, 36),
(2, 36),
(3, 36),
(4, 36),
(1, 37),
(2, 37),
(3, 37),
(1, 38),
(2, 38),
(3, 38),
(4, 38),
(1, 39),
(2, 39),
(3, 39),
(4, 39),
(1, 40),
(2, 40),
(3, 40),
(1, 41),
(1, 42);

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

--
-- Estrutura da tabela `saas_billing_tables`
--

CREATE TABLE `saas_billing_tables` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `saas_plans`
--

CREATE TABLE `saas_plans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `price_monthly` decimal(10,2) NOT NULL,
  `price_quarterly` decimal(10,2) NOT NULL,
  `price_semiannual` decimal(10,2) NOT NULL,
  `price_annual` decimal(10,2) NOT NULL,
  `has_whatsapp` tinyint(1) NOT NULL DEFAULT 0,
  `features` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`features`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `saas_plans`
--

INSERT INTO `saas_plans` (`id`, `name`, `price_monthly`, `price_quarterly`, `price_semiannual`, `price_annual`, `has_whatsapp`, `features`, `created_at`, `updated_at`) VALUES
(1, 'Básico', 100.00, 280.00, 550.00, 1000.00, 0, '[\"Ex: At\\u00e9 500 Alunos Ativos\",\"Ex: Gest\\u00e3o Financeira Embutida\"]', '2026-04-13 06:08:00', '2026-04-13 06:08:00'),
(2, 'Plus', 180.00, 540.00, 1000.00, 1600.00, 0, '[\"Ex: At\\u00e9 800 Alunos Ativos\",\"Ex: Gest\\u00e3o Financeira Embutida\"]', '2026-04-13 06:10:53', '2026-04-13 06:10:53'),
(3, 'Master', 250.00, 730.00, 1300.00, 2500.00, 1, '[\"Ex: At\\u00e9 500 Alunos Ativos\",\"Ex: Gest\\u00e3o Financeira Embutida\",\"Suporte via WhatsApp\"]', '2026-04-13 06:12:29', '2026-04-13 06:12:29');

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

--
-- Estrutura da tabela `saas_subscriptions`
--

CREATE TABLE `saas_subscriptions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `saas_plan_id` bigint(20) UNSIGNED NOT NULL,
  `modality` enum('monthly','quarterly','semiannual','annual') NOT NULL DEFAULT 'monthly',
  `starts_at` date NOT NULL,
  `expires_at` date NOT NULL,
  `status` enum('active','past_due','canceled') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `saas_whatsapp_slots`
--

CREATE TABLE `saas_whatsapp_slots` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `instance_id` varchar(255) NOT NULL,
  `display_name` varchar(255) DEFAULT NULL,
  `is_main` tinyint(1) NOT NULL DEFAULT 0,
  `status` enum('active','inactive','connecting') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `student_profiles`
--

CREATE TABLE `student_profiles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `guardian_user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `birth_date` date DEFAULT NULL,
  `has_neurodivergence` tinyint(1) NOT NULL DEFAULT 0,
  `neurodivergence_type` varchar(255) DEFAULT NULL,
  `neurodivergence_notes` text DEFAULT NULL,
  `requires_special_support` tinyint(1) NOT NULL DEFAULT 0,
  `pedagogical_observations` text DEFAULT NULL,
  `health_observations` text DEFAULT NULL,
  `medications` text DEFAULT NULL,
  `guardian_name` varchar(255) DEFAULT NULL,
  `guardian_document` varchar(255) DEFAULT NULL,
  `guardian_phone` varchar(255) DEFAULT NULL,
  `blood_type` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `subjects`
--

CREATE TABLE `subjects` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tenant_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Estrutura da tabela `tenants`
--

CREATE TABLE `tenants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `custom_domain` varchar(255) DEFAULT NULL,
  `document` varchar(18) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `whatsapp` varchar(20) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `favicon` varchar(255) DEFAULT NULL,
  `theme` varchar(20) NOT NULL DEFAULT 'light',
  `primary_color` varchar(7) NOT NULL DEFAULT '#6366f1',
  `secondary_color` varchar(7) NOT NULL DEFAULT '#8b5cf6',
  `pwa_icon_192` varchar(255) DEFAULT NULL,
  `pwa_icon_512` varchar(255) DEFAULT NULL,
  `pwa_short_name` varchar(255) DEFAULT NULL,
  `pwa_enabled` tinyint(1) NOT NULL DEFAULT 1,
  `preloader_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`preloader_config`)),
  `maintenance_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`maintenance_config`)),
  `mail_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mail_config`)),
  `communication_settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`communication_settings`)),
  `communication_templates` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`communication_templates`)),
  `custom_error_layout` varchar(255) NOT NULL DEFAULT 'default',
  `address` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`address`)),
  `settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`settings`)),
  `payment_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`payment_config`)),
  `email_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`email_config`)),
  `whatsapp_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`whatsapp_config`)),
  `notification_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`notification_config`)),
  `seo_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`seo_config`)),
  `pwa_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`pwa_config`)),
  `status` enum('active','inactive','suspended','trial') NOT NULL DEFAULT 'active',
  `academic_period_type` varchar(255) NOT NULL DEFAULT 'bimestral',
  `notification_settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`notification_settings`)),
  `trial_ends_at` date DEFAULT NULL,
  `plan` varchar(50) NOT NULL DEFAULT 'basic',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Extraindo dados da tabela `tenants`
--

INSERT INTO `tenants` (`id`, `name`, `slug`, `custom_domain`, `document`, `email`, `phone`, `whatsapp`, `logo`, `favicon`, `theme`, `primary_color`, `secondary_color`, `pwa_icon_192`, `pwa_icon_512`, `pwa_short_name`, `pwa_enabled`, `preloader_config`, `maintenance_config`, `mail_config`, `communication_settings`, `communication_templates`, `custom_error_layout`, `address`, `settings`, `payment_config`, `email_config`, `whatsapp_config`, `notification_config`, `seo_config`, `pwa_config`, `status`, `academic_period_type`, `notification_settings`, `trial_ends_at`, `plan`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Escola Demo', 'demo', NULL, '12345678000190', 'demo@educagest.com', '11999999999', NULL, 'logos/hY4gCsgH4yjDxYlWhXaKCt47BztUQCJb2LI48K5E.png', NULL, 'light', '#6366f1', '#8b5cf6', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'default', NULL, '{\"timezone\":\"America\\/Sao_Paulo\",\"locale\":\"pt_BR\",\"currency\":\"BRL\"}', '{\"gateway\":null,\"mercado_pago_token\":null,\"paghiper_token\":null}', NULL, '{\"base_url\":null,\"api_key\":null,\"instance\":null}', NULL, NULL, NULL, 'active', 'bimestral', NULL, NULL, 'premium', '2026-04-11 11:53:00', '2026-04-12 02:36:05', NULL);

--
-- Índices para tabelas despejadas
--

--
-- Índices para tabela `academic_classes`
--
ALTER TABLE `academic_classes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `academic_classes_tenant_id_foreign` (`tenant_id`),
  ADD KEY `academic_classes_course_id_foreign` (`course_id`);

--
-- Índices para tabela `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `activity_logs_user_id_foreign` (`user_id`),
  ADD KEY `activity_logs_tenant_id_created_at_index` (`tenant_id`,`created_at`),
  ADD KEY `activity_logs_model_type_model_id_index` (`model_type`,`model_id`),
  ADD KEY `activity_logs_action_index` (`action`);

--
-- Índices para tabela `attendance`
--
ALTER TABLE `attendance`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `attendance_unique_entry` (`class_id`,`user_id`,`date`),
  ADD KEY `attendance_tenant_id_foreign` (`tenant_id`),
  ADD KEY `attendance_user_id_foreign` (`user_id`);

--
-- Índices para tabela `class_subject_teacher`
--
ALTER TABLE `class_subject_teacher`
  ADD PRIMARY KEY (`id`),
  ADD KEY `class_subject_teacher_academic_class_id_foreign` (`academic_class_id`),
  ADD KEY `class_subject_teacher_subject_id_foreign` (`subject_id`),
  ADD KEY `class_subject_teacher_user_id_foreign` (`user_id`),
  ADD KEY `class_subject_teacher_tenant_id_academic_class_id_index` (`tenant_id`,`academic_class_id`),
  ADD KEY `class_subject_teacher_tenant_id_user_id_index` (`tenant_id`,`user_id`);

--
-- Índices para tabela `courses`
--
ALTER TABLE `courses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `courses_tenant_id_foreign` (`tenant_id`);

--
-- Índices para tabela `course_subject`
--
ALTER TABLE `course_subject`
  ADD PRIMARY KEY (`id`),
  ADD KEY `course_subject_course_id_foreign` (`course_id`),
  ADD KEY `course_subject_subject_id_foreign` (`subject_id`);

--
-- Índices para tabela `enrollments`
--
ALTER TABLE `enrollments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `enrollments_tenant_id_foreign` (`tenant_id`),
  ADD KEY `enrollments_user_id_foreign` (`user_id`),
  ADD KEY `enrollments_class_id_foreign` (`class_id`);

--
-- Índices para tabela `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Índices para tabela `financial_bills`
--
ALTER TABLE `financial_bills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `financial_bills_tenant_id_foreign` (`tenant_id`),
  ADD KEY `financial_bills_user_id_foreign` (`user_id`);

--
-- Índices para tabela `financial_payments`
--
ALTER TABLE `financial_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `financial_payments_tenant_id_foreign` (`tenant_id`),
  ADD KEY `financial_payments_bill_id_foreign` (`bill_id`);

--
-- Índices para tabela `grades`
--
ALTER TABLE `grades`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grades_tenant_id_foreign` (`tenant_id`),
  ADD KEY `grades_enrollment_id_foreign` (`enrollment_id`),
  ADD KEY `grades_subject_id_foreign` (`subject_id`);

--
-- Índices para tabela `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Índices para tabela `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Índices para tabela `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Índices para tabela `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_tenant_id_foreign` (`tenant_id`),
  ADD KEY `notifications_user_id_foreign` (`user_id`);

--
-- Índices para tabela `pedagogical_reports`
--
ALTER TABLE `pedagogical_reports`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pedagogical_reports_tenant_id_foreign` (`tenant_id`),
  ADD KEY `pedagogical_reports_enrollment_id_foreign` (`enrollment_id`),
  ADD KEY `pedagogical_reports_teacher_id_foreign` (`teacher_id`);

--
-- Índices para tabela `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_slug_unique` (`slug`),
  ADD KEY `permissions_slug_index` (`slug`),
  ADD KEY `permissions_module_index` (`module`);

--
-- Índices para tabela `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_slug_unique` (`slug`),
  ADD KEY `roles_slug_index` (`slug`);

--
-- Índices para tabela `role_permission`
--
ALTER TABLE `role_permission`
  ADD PRIMARY KEY (`role_id`,`permission_id`),
  ADD KEY `role_permission_permission_id_foreign` (`permission_id`);

--
-- Índices para tabela `saas_billing_tables`
--
ALTER TABLE `saas_billing_tables`
  ADD PRIMARY KEY (`id`);

--
-- Índices para tabela `saas_plans`
--
ALTER TABLE `saas_plans`
  ADD PRIMARY KEY (`id`);

--
-- Índices para tabela `saas_subscriptions`
--
ALTER TABLE `saas_subscriptions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `saas_subscriptions_tenant_id_foreign` (`tenant_id`),
  ADD KEY `saas_subscriptions_saas_plan_id_foreign` (`saas_plan_id`);

--
-- Índices para tabela `saas_whatsapp_slots`
--
ALTER TABLE `saas_whatsapp_slots`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `saas_whatsapp_slots_instance_id_unique` (`instance_id`),
  ADD KEY `saas_whatsapp_slots_tenant_id_foreign` (`tenant_id`);

--
-- Índices para tabela `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Índices para tabela `student_profiles`
--
ALTER TABLE `student_profiles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_profiles_user_id_foreign` (`user_id`),
  ADD KEY `student_profiles_guardian_user_id_foreign` (`guardian_user_id`);

--
-- Índices para tabela `subjects`
--
ALTER TABLE `subjects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subjects_tenant_id_foreign` (`tenant_id`);

--
-- Índices para tabela `tenants`
--
ALTER TABLE `tenants`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `tenants_slug_unique` (`slug`),
  ADD UNIQUE KEY `tenants_custom_domain_unique` (`custom_domain`),
  ADD KEY `tenants_slug_index` (`slug`),
  ADD KEY `tenants_status_index` (`status`);

--
-- AUTO_INCREMENT de tabelas despejadas
--

--
-- AUTO_INCREMENT de tabela `academic_classes`
--
ALTER TABLE `academic_classes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de tabela `activity_logs`
--
ALTER TABLE `activity_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=54;

--
-- AUTO_INCREMENT de tabela `attendance`
--
ALTER TABLE `attendance`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `class_subject_teacher`
--
ALTER TABLE `class_subject_teacher`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `courses`
--
ALTER TABLE `courses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de tabela `course_subject`
--
ALTER TABLE `course_subject`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `enrollments`
--
ALTER TABLE `enrollments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `financial_bills`
--
ALTER TABLE `financial_bills`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `financial_payments`
--
ALTER TABLE `financial_payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `grades`
--
ALTER TABLE `grades`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT de tabela `notifications`
--
ALTER TABLE `notifications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `pedagogical_reports`
--
ALTER TABLE `pedagogical_reports`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=43;

--
-- AUTO_INCREMENT de tabela `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT de tabela `saas_billing_tables`
--
ALTER TABLE `saas_billing_tables`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `saas_plans`
--
ALTER TABLE `saas_plans`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT de tabela `saas_subscriptions`
--
ALTER TABLE `saas_subscriptions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `saas_whatsapp_slots`
--
ALTER TABLE `saas_whatsapp_slots`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `student_profiles`
--
ALTER TABLE `student_profiles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `subjects`
--
ALTER TABLE `subjects`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tenants`
--
ALTER TABLE `tenants`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Restrições para despejos de tabelas
--

--
-- Limitadores para a tabela `academic_classes`
--
ALTER TABLE `academic_classes`
  ADD CONSTRAINT `academic_classes_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `academic_classes_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD CONSTRAINT `activity_logs_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `activity_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Limitadores para a tabela `attendance`
--
ALTER TABLE `attendance`
  ADD CONSTRAINT `attendance_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `academic_classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `attendance_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `attendance_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `class_subject_teacher`
--
ALTER TABLE `class_subject_teacher`
  ADD CONSTRAINT `class_subject_teacher_academic_class_id_foreign` FOREIGN KEY (`academic_class_id`) REFERENCES `academic_classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `class_subject_teacher_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `class_subject_teacher_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `class_subject_teacher_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `courses`
--
ALTER TABLE `courses`
  ADD CONSTRAINT `courses_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `course_subject`
--
ALTER TABLE `course_subject`
  ADD CONSTRAINT `course_subject_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `course_subject_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `enrollments`
--
ALTER TABLE `enrollments`
  ADD CONSTRAINT `enrollments_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `academic_classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `enrollments_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `enrollments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `financial_bills`
--
ALTER TABLE `financial_bills`
  ADD CONSTRAINT `financial_bills_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `financial_bills_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `financial_payments`
--
ALTER TABLE `financial_payments`
  ADD CONSTRAINT `financial_payments_bill_id_foreign` FOREIGN KEY (`bill_id`) REFERENCES `financial_bills` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `financial_payments_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `grades`
--
ALTER TABLE `grades`
  ADD CONSTRAINT `grades_enrollment_id_foreign` FOREIGN KEY (`enrollment_id`) REFERENCES `enrollments` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `grades_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `grades_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `pedagogical_reports`
--
ALTER TABLE `pedagogical_reports`
  ADD CONSTRAINT `pedagogical_reports_enrollment_id_foreign` FOREIGN KEY (`enrollment_id`) REFERENCES `enrollments` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `pedagogical_reports_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `pedagogical_reports_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `role_permission`
--
ALTER TABLE `role_permission`
  ADD CONSTRAINT `role_permission_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_permission_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `saas_subscriptions`
--
ALTER TABLE `saas_subscriptions`
  ADD CONSTRAINT `saas_subscriptions_saas_plan_id_foreign` FOREIGN KEY (`saas_plan_id`) REFERENCES `saas_plans` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `saas_subscriptions_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `saas_whatsapp_slots`
--
ALTER TABLE `saas_whatsapp_slots`
  ADD CONSTRAINT `saas_whatsapp_slots_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `student_profiles`
--
ALTER TABLE `student_profiles`
  ADD CONSTRAINT `student_profiles_guardian_user_id_foreign` FOREIGN KEY (`guardian_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `student_profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Limitadores para a tabela `subjects`
--
ALTER TABLE `subjects`
  ADD CONSTRAINT `subjects_tenant_id_foreign` FOREIGN KEY (`tenant_id`) REFERENCES `tenants` (`id`) ON DELETE CASCADE;
COMMIT;

