-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `school_db`
--

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

--
-- Table structure for table `academic_years`
--

CREATE TABLE `academic_years` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `academic_years`
--

INSERT INTO `academic_years` (`id`, `name`, `start_date`, `end_date`, `created_at`, `updated_at`, `deleted_at`) VALUES
(11, '2025-2026', '0025-09-01', '2026-07-24', '2026-02-08 19:47:21', '2026-02-08 19:47:21', NULL),
(16, '2026-2027', '2026-09-10', '2027-07-14', '2026-03-14 13:25:02', '2026-03-14 13:25:02', NULL),
(18, '2027-2028', '2027-09-08', '2028-07-20', '2026-04-04 13:14:12', '2026-04-04 13:14:12', NULL);

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

--
-- Table structure for table `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` int(9) UNSIGNED NOT NULL,
  `user_id` int(9) UNSIGNED DEFAULT NULL,
  `role` varchar(50) DEFAULT NULL,
  `action` varchar(255) NOT NULL,
  `ip_address` varchar(50) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `assessment_components`
--

CREATE TABLE `assessment_components` (
  `id` int(10) UNSIGNED NOT NULL,
  `assessment_section_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `max_mark` float NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `assessment_modules`
--

CREATE TABLE `assessment_modules` (
  `id` int(10) UNSIGNED NOT NULL,
  `department_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `assessment_sections`
--

CREATE TABLE `assessment_sections` (
  `id` int(10) UNSIGNED NOT NULL,
  `assessment_module_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `percentage` float DEFAULT NULL,
  `use_percentage` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `attendance_records`
--

CREATE TABLE `attendance_records` (
  `id` int(9) UNSIGNED NOT NULL,
  `academic_year_id` int(9) UNSIGNED NOT NULL,
  `term_id` int(9) UNSIGNED NOT NULL,
  `class_id` int(9) UNSIGNED NOT NULL,
  `house_id` int(9) UNSIGNED DEFAULT NULL,
  `student_id` int(9) UNSIGNED NOT NULL,
  `attendance_date` date NOT NULL,
  `status` enum('Present','Absent','Late','Excused') NOT NULL DEFAULT 'Present',
  `remarks` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `classes`
--

CREATE TABLE `classes` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `department_id` int(10) UNSIGNED NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `classes`
--

INSERT INTO `classes` (`id`, `name`, `department_id`, `description`, `created_at`, `updated_at`) VALUES
(22, 'Creche A', 11, '', '2026-02-08 20:11:37', '2026-03-14 15:00:45'),
(23, 'Nursery 1', 11, '', '2026-02-08 20:12:02', '2026-02-08 20:14:40'),
(24, 'Nursery 2', 11, '', '2026-02-08 20:12:20', '2026-02-08 20:15:02'),
(25, 'KG 1', 11, '', '2026-02-08 20:12:44', '2026-02-08 20:17:39'),
(26, 'KG 2', 11, '', '2026-02-08 20:13:41', '2026-02-08 20:18:02'),
(27, 'Basic 1', 12, '', '2026-02-08 20:16:20', '2026-02-08 20:18:21'),
(28, 'Basic 2', 12, NULL, '2026-02-08 20:18:38', '2026-02-08 20:18:38'),
(29, 'Basic 3', 12, NULL, '2026-02-08 20:18:58', '2026-02-08 20:18:58'),
(30, 'Basic 4', 12, NULL, '2026-02-08 20:19:23', '2026-02-08 20:19:23'),
(31, 'Basic 5', 12, NULL, '2026-02-08 20:20:17', '2026-02-08 20:20:17'),
(32, 'Basic 6', 12, NULL, '2026-02-08 20:20:38', '2026-02-08 20:20:38'),
(33, 'JHS 1A', 13, NULL, '2026-02-08 20:21:14', '2026-02-08 20:21:14'),
(34, 'JHS 1B', 13, NULL, '2026-02-08 20:21:31', '2026-02-08 20:21:31'),
(35, 'JHS 2A', 13, NULL, '2026-02-08 20:21:47', '2026-02-08 20:21:47'),
(36, 'JHS 2B', 13, NULL, '2026-02-08 20:22:11', '2026-02-08 20:22:11'),
(37, 'JHS 3', 13, NULL, '2026-02-08 20:22:38', '2026-02-08 20:22:38'),
(38, 'SCI 1', 14, NULL, '2026-02-08 20:23:11', '2026-02-08 20:23:11'),
(39, 'G/A 1A', 15, NULL, '2026-02-08 20:23:30', '2026-02-08 20:23:30');

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

--
-- Table structure for table `class_subjects`
--

CREATE TABLE `class_subjects` (
  `id` int(10) UNSIGNED NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `comments`
--

CREATE TABLE `comments` (
  `id` int(9) UNSIGNED NOT NULL,
  `enrollment_id` int(10) UNSIGNED NOT NULL,
  `academic_year_id` int(9) UNSIGNED NOT NULL,
  `term_id` int(9) UNSIGNED NOT NULL,
  `class_id` int(9) UNSIGNED NOT NULL,
  `student_id` int(9) UNSIGNED NOT NULL,
  `comment` text DEFAULT NULL,
  `attendance` int(10) UNSIGNED DEFAULT NULL,
  `promoted_to_class_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `comments`
--

INSERT INTO `comments` (`id`, `enrollment_id`, `academic_year_id`, `term_id`, `class_id`, `student_id`, `comment`, `attendance`, `promoted_to_class_id`, `created_at`, `updated_at`) VALUES
(1, 0, 1, 1, 12, 37, 'very hard working student. C & R Good', 51, 9, '2025-08-17 20:21:47', '2025-08-18 01:09:13'),
(2, 0, 1, 1, 12, 41, 'she needs to take her studies seriously. Very respectful and Obedient', 43, 10, '2025-08-17 20:21:47', '2025-08-18 01:09:13'),
(3, 0, 1, 1, 12, 40, 'Very Good. Keep it up. ', 16, 0, '2025-08-17 20:21:47', '2025-08-18 01:09:13'),
(4, 0, 1, 1, 10, 43, 'goody', 61, 0, '2025-08-17 21:42:38', '2025-08-18 03:37:24'),
(5, 0, 1, 1, 10, 38, 'fgd', 55, 0, '2025-08-17 21:42:38', '2025-08-18 03:37:24'),
(6, 0, 1, 1, 10, 39, 'fdg', 56, 0, '2025-08-17 21:42:38', '2025-08-18 03:37:24'),
(7, 0, 1, 1, 10, 42, 'dfg', 6, 0, '2025-08-17 21:42:38', '2025-08-18 03:37:24'),
(8, 0, 1, 1, 12, 154, 'good', 57, 13, '2025-08-24 21:32:00', '2025-08-24 21:32:00'),
(9, 0, 1, 1, 12, 155, 'fair', 61, 13, '2025-08-24 21:32:00', '2025-08-24 21:32:00'),
(10, 0, 1, 2, 12, 154, 'fine', 44, 0, '2025-08-24 21:32:54', '2025-08-24 21:32:54'),
(11, 0, 1, 2, 12, 155, 'not fine', 49, 13, '2025-08-24 21:32:54', '2025-08-24 21:32:54'),
(12, 0, 1, 4, 12, 154, '', 0, 0, '2025-08-24 21:34:26', '2025-08-24 21:34:26'),
(13, 0, 1, 4, 12, 155, '', 0, 0, '2025-08-24 21:34:26', '2025-08-24 21:34:26'),
(14, 0, 1, 1, 12, 1, 'fine', 53, 0, '2025-08-25 05:39:38', '2025-08-29 08:51:38'),
(15, 0, 1, 1, 12, 2, 'good', 60, 0, '2025-08-25 05:39:38', '2025-08-26 22:14:11'),
(16, 0, 1, 1, 12, 3, 'v. good', 55, 0, '2025-08-29 08:51:38', '2025-08-29 08:51:38'),
(17, 0, 1, 2, 10, 2, 'hhh', 45, 0, '2025-08-29 09:07:41', '2025-08-29 09:07:41'),
(18, 0, 1, 2, 10, 4, 'jjjjjj', 55, 0, '2025-08-29 09:07:41', '2025-08-29 09:07:41'),
(19, 0, 4, 2, 15, 5, 'more room for improvement', 50, 14, '2026-02-06 21:28:17', '2026-02-06 21:28:17'),
(20, 0, 4, 2, 15, 6, 'has improved', 53, 0, '2026-02-06 21:28:17', '2026-02-06 21:28:17'),
(21, 0, 8, 2, 15, 5, 'good work', 8, 0, '2026-02-06 22:11:11', '2026-02-06 22:11:11'),
(22, 0, 8, 2, 15, 6, 'improving', 0, 0, '2026-02-06 22:11:11', '2026-02-06 22:11:11'),
(23, 0, 8, 5, 15, 5, 'no fine', 7, 0, '2026-02-06 22:23:54', '2026-02-06 22:23:54'),
(24, 0, 8, 5, 15, 6, 'fine', 8, 0, '2026-02-06 22:23:54', '2026-02-06 22:23:54'),
(25, 0, 11, 9, 27, 9, 'Good Job!', 60, 0, '2026-02-08 23:15:47', '2026-03-23 19:55:15'),
(26, 0, 11, 9, 27, 10, 'Keep Improving', 61, 0, '2026-02-08 23:15:47', '2026-03-23 19:55:15'),
(27, 0, 11, 9, 38, 19, 'WELL DONE', 60, 0, '2026-03-14 08:47:22', '2026-03-14 08:47:22'),
(28, 0, 11, 9, 38, 18, 'GREAT', 59, 0, '2026-03-14 08:47:22', '2026-03-14 08:47:22'),
(29, 0, 11, 9, 27, 16, 'advancing', 52, 0, '2026-03-15 12:53:14', '2026-03-23 19:55:15'),
(30, 0, 11, 9, 27, 20, 'fine', 54, 0, '2026-03-23 19:55:15', '2026-03-23 19:55:15'),
(31, 7, 11, 10, 28, 25, 'good', 49, 0, '2026-03-27 18:49:13', '2026-03-27 18:49:40'),
(32, 9, 11, 10, 28, 27, 'fine', 50, 0, '2026-03-27 18:49:13', '2026-03-27 18:49:40'),
(33, 10, 11, 10, 28, 28, 'nice', 40, 0, '2026-03-27 18:49:13', '2026-03-27 18:49:40'),
(34, 12, 11, 9, 29, 30, 'c', 11, 0, '2026-03-28 14:22:07', '2026-03-28 14:22:07'),
(35, 13, 11, 9, 29, 31, 'd', 12, 0, '2026-03-28 14:22:07', '2026-03-28 14:22:07'),
(36, 14, 11, 9, 29, 32, 'e', 13, 0, '2026-03-28 14:22:07', '2026-03-28 14:22:07'),
(37, 35, 11, 9, 27, 33, 'More room for improvement More room for improvement More room for improvement More room for improvement', 49, 0, '2026-03-29 10:51:11', '2026-04-07 20:59:59'),
(38, 36, 11, 9, 27, 34, 'Could do better than this', 56, 0, '2026-03-29 10:51:11', '2026-04-07 20:59:59'),
(39, 37, 11, 9, 27, 35, 'Improving', 59, 0, '2026-03-29 10:51:11', '2026-04-07 20:59:59'),
(40, 38, 16, 9, 28, 33, 'eeey', 32, 0, '2026-03-29 13:26:39', '2026-03-29 13:27:00'),
(41, 39, 16, 9, 28, 34, 'bbb', 44, 0, '2026-03-29 13:26:39', '2026-03-29 13:27:00'),
(42, 40, 16, 9, 28, 35, 'ddd', 55, 0, '2026-03-29 13:26:39', '2026-03-29 13:27:00'),
(43, 41, 16, 9, 27, 35, 'Well conducted, keep up!', 49, 0, '2026-04-03 06:09:26', '2026-04-03 06:15:40');

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

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(11, 'Pre School', '', '2026-02-08 20:08:47', '2026-02-08 20:08:47'),
(12, 'Primary School', '', '2026-02-08 20:09:07', '2026-02-08 20:09:07'),
(13, 'Junior High School', '', '2026-02-08 20:09:22', '2026-02-08 20:09:22'),
(14, 'Science Department', '', '2026-02-08 20:09:35', '2026-02-08 20:09:35'),
(15, 'General Arts Department', '', '2026-02-08 20:09:51', '2026-02-08 20:09:51'),
(16, 'Home Economics Department', '', '2026-02-08 20:10:04', '2026-02-08 20:10:04');

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

--
-- Table structure for table `discount_approvals`
--

CREATE TABLE `discount_approvals` (
  `id` int(10) UNSIGNED NOT NULL,
  `fee_entry_id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `original_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_percentage` decimal(5,2) DEFAULT NULL,
  `reason` text NOT NULL,
  `requested_by` int(11) DEFAULT NULL,
  `approved_by` int(11) DEFAULT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `remarks` text DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `enrollments`
--

CREATE TABLE `enrollments` (
  `id` int(11) NOT NULL,
  `student_id` int(11) UNSIGNED NOT NULL,
  `academic_year_id` int(11) DEFAULT NULL,
  `term_id` int(11) DEFAULT NULL,
  `department_id` int(9) UNSIGNED DEFAULT NULL,
  `class_id` int(9) UNSIGNED DEFAULT NULL,
  `roll_number` varchar(50) DEFAULT NULL,
  `enrollment_date` date DEFAULT NULL,
  `status` enum('active','promoted','graduated','transferred','dropped') DEFAULT 'active',
  `is_current` tinyint(1) DEFAULT 0,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `enrollments`
--

INSERT INTO `enrollments` (`id`, `student_id`, `academic_year_id`, `term_id`, `department_id`, `class_id`, `roll_number`, `enrollment_date`, `status`, `is_current`, `created_at`, `updated_at`) VALUES
(29, 30, 16, 9, 12, 30, '002', '2026-03-29', 'active', 0, '2026-03-29 10:28:27', '2026-03-29 10:28:27'),
(30, 30, 16, 9, 12, 30, '003', '2026-03-29', 'active', 1, '2026-03-29 10:28:27', '2026-03-29 10:28:27'),
(31, 31, 16, 9, 12, 30, '004', '2026-03-29', 'active', 0, '2026-03-29 10:28:27', '2026-03-29 10:28:27'),
(32, 31, 16, 9, 12, 30, '005', '2026-03-29', 'active', 1, '2026-03-29 10:28:27', '2026-03-29 10:28:27'),
(33, 32, 16, 9, 12, 30, '006', '2026-03-29', 'active', 0, '2026-03-29 10:28:27', '2026-03-29 10:28:27'),
(34, 32, 16, 9, 12, 30, '007', '2026-03-29', 'active', 1, '2026-03-29 10:28:27', '2026-03-29 10:28:27'),
(35, 33, 11, 9, 12, 27, '001', '2026-03-29', 'promoted', 0, '2026-03-29 10:44:39', '2026-04-04 13:16:24'),
(36, 34, 11, 9, 12, 27, '002', '2026-03-29', 'promoted', 0, '2026-03-29 10:45:13', '2026-04-04 13:16:24'),
(37, 35, 11, 9, 12, 27, '003', '2026-03-29', 'promoted', 0, '2026-03-29 10:46:58', '2026-04-04 13:16:24'),
(38, 33, 16, 9, 12, 28, '001', '2026-03-29', 'active', 1, '2026-03-29 11:08:49', '2026-04-05 08:38:15'),
(39, 34, 16, 9, 12, 28, '002', '2026-03-29', 'active', 1, '2026-03-29 11:08:49', '2026-04-05 08:39:05'),
(40, 35, 16, 9, 12, 28, '003', '2026-03-29', 'active', 1, '2026-03-29 11:08:49', '2026-04-05 08:39:13'),
(41, 35, 16, 9, 12, 27, '001', '2026-04-02', 'promoted', 0, '2026-04-02 21:51:04', '2026-04-05 08:44:34'),
(45, 33, 16, 0, 12, 30, '007', '2026-04-03', 'active', 0, '2026-04-03 22:03:42', '2026-04-03 22:03:42'),
(46, 34, 16, 0, 12, 30, '008', '2026-04-03', 'active', 0, '2026-04-03 22:03:42', '2026-04-03 22:03:42'),
(47, 35, 16, 0, 12, 30, '009', '2026-04-03', 'active', 0, '2026-04-03 22:03:42', '2026-04-03 22:03:42'),
(48, 33, 16, 0, 12, 32, '001', '2026-04-04', 'active', 0, '2026-04-04 13:09:51', '2026-04-04 13:09:51'),
(49, 34, 16, 0, 12, 32, '002', '2026-04-04', 'active', 0, '2026-04-04 13:09:51', '2026-04-04 13:09:51'),
(50, 35, 16, 0, 12, 32, '003', '2026-04-04', 'active', 0, '2026-04-04 13:09:51', '2026-04-04 13:09:51'),
(51, 33, 16, 10, 12, 33, '001', '2026-04-04', 'active', 1, '2026-04-04 13:16:24', '2026-04-04 13:16:24'),
(52, 34, 16, 10, 12, 33, '002', '2026-04-04', 'active', 1, '2026-04-04 13:16:24', '2026-04-04 13:16:24'),
(53, 35, 16, 10, 12, 33, '003', '2026-04-04', 'active', 1, '2026-04-04 13:16:24', '2026-04-04 13:16:24'),
(54, 36, 16, 9, 11, 22, '001', '2026-04-04', 'promoted', 0, '2026-04-04 15:49:33', '2026-04-04 16:32:40'),
(55, 36, 16, 9, 11, 23, '001', '2026-04-04', 'active', 1, '2026-04-04 16:32:40', '2026-04-04 16:32:40'),
(59, 35, 16, 9, 12, 31, '001', '2026-04-05', 'active', 1, '2026-04-05 08:44:34', '2026-04-05 08:44:34');

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

--
-- Table structure for table `fee_bands`
--

CREATE TABLE `fee_bands` (
  `id` int(9) UNSIGNED NOT NULL,
  `fee_system_id` int(9) UNSIGNED NOT NULL,
  `bill_item` varchar(255) NOT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fee_bands`
--

INSERT INTO `fee_bands` (`id`, `fee_system_id`, `bill_item`, `amount`, `created_at`, `updated_at`) VALUES
(104, 11, 'Portfolio For All Class Works For The Term', 12000.00, '2026-03-10 19:39:41', '2026-03-10 19:39:41'),
(105, 11, 'Project Work', 200.00, '2026-03-10 19:39:41', '2026-03-10 19:39:41'),
(137, 10, 'Mock Fee', 300.00, '2026-03-20 09:24:09', '2026-03-20 09:24:09'),
(152, 8, 'Clinic Levy', 30.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(153, 8, 'Extra Class Fee', 70.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(154, 8, 'Feeding Fee', 300.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(155, 8, 'ICT dues', 45.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(156, 8, 'Library Fee', 15.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(157, 8, 'Maintenance', 15.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(158, 8, 'P.T.A Dues', 60.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(159, 8, 'Printing Fee', 25.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(160, 8, 'Tuition Fee', 70.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(161, 8, 'User Bus Fee', 300.00, '2026-03-20 09:30:38', '2026-03-20 09:30:38'),
(166, 12, 'Library', 31.00, '2026-03-20 09:33:49', '2026-03-20 09:33:49'),
(167, 12, 'Maintainance', 600.00, '2026-03-20 09:33:49', '2026-03-20 09:33:49'),
(168, 15, 'class fee', 304.00, '2026-03-20 09:34:41', '2026-03-20 09:34:41'),
(169, 15, 'Clinic Levy', 450.00, '2026-03-20 09:34:41', '2026-03-20 09:34:41'),
(170, 9, 'Extra classess', 90.00, '2026-03-20 09:56:13', '2026-03-20 09:56:13'),
(171, 9, 'Library', 15.00, '2026-03-20 09:56:13', '2026-03-20 09:56:13'),
(172, 9, 'Mock Fee', 150.00, '2026-03-20 09:56:13', '2026-03-20 09:56:13'),
(173, 9, 'Tuition', 300.00, '2026-03-20 09:56:13', '2026-03-20 09:56:13'),
(174, 16, 'Tuition Fee', 80.00, '2026-03-28 14:28:32', '2026-03-28 14:28:32');

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

--
-- Table structure for table `fee_entries`
--

CREATE TABLE `fee_entries` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `enrollment_id` int(10) UNSIGNED DEFAULT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `academic_year_id` int(10) UNSIGNED NOT NULL,
  `fee_system_id` int(9) UNSIGNED DEFAULT NULL,
  `term_id` int(10) UNSIGNED NOT NULL,
  `bill_item` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `amount_due` decimal(10,2) NOT NULL DEFAULT 0.00,
  `arrears` decimal(10,2) NOT NULL DEFAULT 0.00,
  `arrears_type` enum('bf','manual','new') DEFAULT 'new' COMMENT 'bf: brought forward, manual: manually entered, new: no previous term',
  `total_payable` decimal(10,2) NOT NULL DEFAULT 0.00,
  `balance` decimal(10,2) DEFAULT 0.00,
  `status` enum('unpaid','paid','partial') NOT NULL DEFAULT 'unpaid',
  `payment_status` enum('unpaid','partial','paid','overpaid') DEFAULT 'unpaid',
  `payment_date` date DEFAULT NULL,
  `last_payment_date` datetime DEFAULT NULL,
  `reference_number` varchar(100) DEFAULT NULL,
  `payment_deadline` date DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `updated_by` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fee_entries`
--

INSERT INTO `fee_entries` (`id`, `student_id`, `enrollment_id`, `class_id`, `academic_year_id`, `fee_system_id`, `term_id`, `bill_item`, `amount`, `discount`, `amount_due`, `arrears`, `arrears_type`, `total_payable`, `balance`, `status`, `payment_status`, `payment_date`, `last_payment_date`, `reference_number`, `payment_deadline`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES
(577, 33, 35, 27, 11, 8, 9, NULL, 930.00, 100.00, 830.00, 0.00, 'manual', 830.00, 0.00, 'unpaid', 'unpaid', '2026-03-29', NULL, NULL, NULL, NULL, NULL, '2026-03-29 10:59:16', '2026-03-29 13:21:13'),
(578, 34, 36, 27, 11, 8, 9, NULL, 930.00, 0.00, 930.00, 16.00, 'manual', 946.00, 0.00, 'unpaid', 'paid', '2026-03-29', NULL, NULL, NULL, NULL, NULL, '2026-03-29 10:59:16', '2026-03-29 13:21:13'),
(579, 35, 37, 27, 11, 8, 9, NULL, 930.00, 0.00, 930.00, 30.00, 'manual', 960.00, 0.00, 'unpaid', 'paid', '2026-03-29', NULL, NULL, NULL, NULL, NULL, '2026-03-29 10:59:16', '2026-03-29 13:21:13'),
(580, 33, 38, 28, 16, 15, 9, NULL, 754.00, 0.00, 754.00, 830.00, 'bf', 1584.00, 0.00, 'unpaid', 'unpaid', '2026-03-29', NULL, NULL, NULL, NULL, NULL, '2026-03-29 11:17:31', '2026-04-03 08:36:36'),
(581, 34, 39, 28, 16, 15, 9, NULL, 754.00, 0.00, 754.00, 1.00, 'bf', 755.00, 0.00, 'paid', 'paid', '2026-03-29', NULL, NULL, NULL, NULL, NULL, '2026-03-29 11:17:31', '2026-04-03 17:43:23'),
(582, 35, 40, 28, 16, 15, 9, NULL, 754.00, 0.00, 754.00, -50.00, 'bf', 704.00, 0.00, 'unpaid', 'unpaid', '2026-03-29', NULL, NULL, NULL, NULL, NULL, '2026-03-29 11:17:31', '2026-04-03 08:36:36'),
(583, 35, 41, 27, 16, 15, 9, NULL, 754.00, 0.00, 754.00, -50.00, 'bf', 704.00, 0.00, 'paid', 'paid', '2026-04-03', NULL, NULL, NULL, NULL, NULL, '2026-04-03 08:02:55', '2026-04-03 16:58:21');

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

--
-- Table structure for table `fee_systems`
--

CREATE TABLE `fee_systems` (
  `id` int(9) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `department_id` int(9) UNSIGNED DEFAULT NULL,
  `academic_year_id` int(10) UNSIGNED DEFAULT NULL,
  `term_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fee_systems`
--

INSERT INTO `fee_systems` (`id`, `name`, `description`, `department_id`, `academic_year_id`, `term_id`, `created_at`, `updated_at`) VALUES
(8, 'Primary 2025-2026 FT', '', 12, 11, 9, '2026-02-09 13:00:48', '2026-03-20 09:30:38'),
(9, 'Primary 2025-2026 ST', '', 12, 11, 10, '2026-02-09 13:02:27', '2026-03-20 09:56:13'),
(10, 'Billing C', '', 13, 16, 10, '2026-03-10 19:14:49', '2026-03-20 09:24:09'),
(11, 'Billing D', '', 13, 11, 10, '2026-03-10 19:26:03', '2026-03-10 19:39:41'),
(12, 'Primary 2025-2026 TT', '', 12, 11, 11, '2026-03-10 22:24:28', '2026-03-20 09:33:49'),
(15, 'Primary 2026-2027 FT', '', 12, 16, 9, '2026-03-14 13:33:37', '2026-03-20 09:34:41'),
(16, 'dfsfs', '', 13, 11, 9, '2026-03-28 14:28:32', '2026-03-28 14:28:32');

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

--
-- Table structure for table `grading_bands`
--

CREATE TABLE `grading_bands` (
  `id` int(9) UNSIGNED NOT NULL,
  `grading_system_id` int(9) UNSIGNED NOT NULL,
  `score_from` decimal(5,2) NOT NULL,
  `score_to` decimal(5,2) NOT NULL,
  `grade` varchar(5) NOT NULL,
  `remark` varchar(100) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `grading_bands`
--

INSERT INTO `grading_bands` (`id`, `grading_system_id`, `score_from`, `score_to`, `grade`, `remark`, `created_at`, `updated_at`) VALUES
(173, 12, 90.00, 100.00, '1', 'Highest', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(174, 12, 80.00, 89.00, '2', 'Higher', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(175, 12, 70.00, 79.00, '3', 'High', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(176, 12, 60.00, 69.00, '4', 'High Average', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(177, 12, 50.00, 59.00, '5', 'Average', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(178, 12, 45.00, 49.00, '6', 'Low Average', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(179, 12, 40.00, 44.00, '7', 'Low', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(180, 12, 35.00, 39.00, '8', 'Lower', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(181, 12, 0.00, 34.00, '9', 'Lowest', '2026-03-14 10:02:25', '2026-03-14 10:02:25'),
(242, 20, 10.00, 50.00, 'a', 'hh', '2026-03-28 14:21:17', '2026-03-28 14:21:17'),
(261, 10, 80.00, 100.00, '1', 'GreeGold Bravo Working', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(262, 10, 70.00, 80.00, '2', 'Goody Jobs', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(263, 10, 60.00, 70.00, '3', 'Good', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(264, 10, 50.00, 60.00, '4', 'Credit', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(265, 10, 40.00, 50.00, '5', 'Pass', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(266, 10, 30.00, 40.00, '6', 'Fail', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(267, 10, 20.00, 30.00, '7', 'xee', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(268, 10, 10.00, 20.00, '8', 'yee', '2026-04-07 20:32:42', '2026-04-07 20:32:42'),
(269, 10, 0.00, 10.00, '9', 'zee', '2026-04-07 20:32:42', '2026-04-07 20:32:42');

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

--
-- Table structure for table `grading_systems`
--

CREATE TABLE `grading_systems` (
  `id` int(9) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `department_id` int(9) UNSIGNED DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `grading_systems`
--

INSERT INTO `grading_systems` (`id`, `name`, `description`, `department_id`, `created_at`, `updated_at`) VALUES
(10, 'Primary', '', 12, '2026-02-08 22:44:31', '2026-04-07 20:32:42'),
(12, 'Junior High', '', 13, '2026-02-08 22:55:02', '2026-03-14 10:02:25'),
(20, 'rqwrqwr', '', 14, '2026-03-28 14:21:17', '2026-03-28 14:21:17');

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

--
-- Table structure for table `houses`
--

CREATE TABLE `houses` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `houses`
--

INSERT INTO `houses` (`id`, `name`, `description`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Yellow', '', '2025-07-03 12:14:47', '2025-08-31 11:59:45', '2025-08-31 11:59:45'),
(2, 'Red', '', '2025-07-03 12:23:27', '2026-02-07 21:22:40', '2026-02-07 21:22:40'),
(3, 'Blue', '', '2025-07-03 12:23:42', '2026-02-07 21:22:45', '2026-02-07 21:22:45'),
(4, 'Green', '', '2025-07-03 12:23:54', '2026-02-07 21:22:51', '2026-02-07 21:22:51'),
(5, 'pink', '', '2025-07-03 12:24:05', '2025-07-03 12:24:24', '2025-07-03 12:24:24'),
(6, 'House 1', '', '2026-02-08 20:25:34', '2026-03-14 10:28:50', '2026-03-14 10:28:50'),
(7, 'House 1', 'Golden Boys and Girls', '2026-02-08 20:25:46', '2026-03-14 15:04:41', NULL),
(8, 'House 2', '', '2026-02-08 20:25:58', '2026-03-14 14:19:22', NULL),
(9, 'House 4', '', '2026-02-08 20:26:08', '2026-03-14 10:27:33', '2026-03-14 10:27:33'),
(10, 'House 3', '', '2026-03-14 14:18:35', '2026-03-14 14:19:35', NULL),
(11, 'House 4', '', '2026-03-14 14:18:53', '2026-03-14 14:20:18', NULL),
(12, 'class 1Bvv', '', '2026-03-14 14:48:51', '2026-03-14 14:48:58', '2026-03-14 14:48:58');

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

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `version` varchar(255) NOT NULL,
  `class` varchar(255) NOT NULL,
  `group` varchar(255) NOT NULL,
  `namespace` varchar(255) NOT NULL,
  `time` int(11) NOT NULL,
  `batch` int(11) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `version`, `class`, `group`, `namespace`, `time`, `batch`) VALUES
(1, '2025-06-27-110000', 'App\\Database\\Migrations\\CreateRolesTable', 'default', 'App', 1751053594, 1),
(2, '2025-06-27-110010', 'App\\Database\\Migrations\\CreateUsersTable', 'default', 'App', 1751053594, 1),
(3, '2025-06-27-110020', 'App\\Database\\Migrations\\CreateAcademicYearsTable', 'default', 'App', 1751053594, 1),
(4, '2025-06-27-110030', 'App\\Database\\Migrations\\CreateTermsTable', 'default', 'App', 1751053594, 1),
(5, '2025-06-27-110040', 'App\\Database\\Migrations\\CreateDepartmentsTable', 'default', 'App', 1751053594, 1),
(6, '2025-06-27-110050', 'App\\Database\\Migrations\\CreateClassesTable', 'default', 'App', 1751053594, 1),
(7, '2025-06-27-110060', 'App\\Database\\Migrations\\CreateHousesTable', 'default', 'App', 1751053594, 1),
(8, '2025-06-27-110070', 'App\\Database\\Migrations\\CreateSubjectsTable', 'default', 'App', 1751053594, 1),
(9, '2025-06-27-110080', 'App\\Database\\Migrations\\CreateTeachersTable', 'default', 'App', 1751053594, 1),
(10, '2025-06-27-110090', 'App\\Database\\Migrations\\CreateParentsTable', 'default', 'App', 1751053595, 1),
(11, '2025-06-27-110100', 'App\\Database\\Migrations\\CreateStudentsTable', 'default', 'App', 1751053595, 1),
(12, '2025-06-27-110105', 'App\\Database\\Migrations\\CreateStudentParentsTable', 'default', 'App', 1751053595, 1),
(13, '2025-06-27-110110', 'App\\Database\\Migrations\\CreateEnrollmentsTable', 'default', 'App', 1751053595, 1),
(14, '2025-06-27-110120', 'App\\Database\\Migrations\\CreateClassSubjectsTable', 'default', 'App', 1751053595, 1),
(15, '2025-06-27-110130', 'App\\Database\\Migrations\\CreateTeacherAssignmentsTable', 'default', 'App', 1751053595, 1),
(16, '2025-06-27-110140', 'App\\Database\\Migrations\\CreateGradingSystemsTable', 'default', 'App', 1751053595, 1),
(17, '2025-06-27-110150', 'App\\Database\\Migrations\\CreateGradingBandsTable', 'default', 'App', 1751053595, 1),
(18, '2025-06-27-110160', 'App\\Database\\Migrations\\CreateScoreConversionsTable', 'default', 'App', 1751053595, 1),
(19, '2025-06-27-110170', 'App\\Database\\Migrations\\CreateFeesCategoriesTable', 'default', 'App', 1751053595, 1),
(20, '2025-06-27-110180', 'App\\Database\\Migrations\\CreateFeesStructuresTable', 'default', 'App', 1751053595, 1),
(21, '2025-06-27-110190', 'App\\Database\\Migrations\\CreateFeePaymentsTable', 'default', 'App', 1751053595, 1),
(22, '2025-06-27-110200', 'App\\Database\\Migrations\\CreateAttendanceRecordsTable', 'default', 'App', 1751116390, 2),
(23, '2025-06-27-110210', 'App\\Database\\Migrations\\CreateResultsTable', 'default', 'App', 1751116390, 2),
(24, '2025-06-27-110220', 'App\\Database\\Migrations\\CreateResultCommentsTable', 'default', 'App', 1751116390, 2),
(25, '2025-06-27-110230', 'App\\Database\\Migrations\\CreateSettingsTable', 'default', 'App', 1751116390, 2),
(26, '2025-06-27-110240', 'App\\Database\\Migrations\\CreateActivityLogsTable', 'default', 'App', 1751116390, 2),
(27, '2025-06-28-132243', 'App\\Database\\Migrations\\CreatePromotionRecordsTable', 'default', 'App', 1751117146, 3),
(28, '2025-06-28-132436', 'App\\Database\\Migrations\\CreateTimetablesTable', 'default', 'App', 1751117146, 3),
(29, '2025-06-28-161914', 'App\\Database\\Migrations\\CreateUserRolesTable', 'default', 'App', 1751127616, 4),
(30, '2025-06-28-110000', 'App\\Database\\Migrations\\CreateRolesTable', 'default', 'App', 1751131723, 5),
(31, '2025-06-28-110010', 'App\\Database\\Migrations\\CreateUsersTable', 'default', 'App', 1751131723, 5),
(32, '2025-06-28-110015', 'App\\Database\\Migrations\\CreateUserRolesTable', 'default', 'App', 1751131723, 5),
(33, '2025-06-29-110000', 'App\\Database\\Migrations\\CreateRolesTable', 'default', 'App', 1751199231, 6),
(34, '2025-06-29-110010', 'App\\Database\\Migrations\\CreateUsersTable', 'default', 'App', 1751199231, 6),
(35, '2025-06-29-110015', 'App\\Database\\Migrations\\CreateUserRolesTable', 'default', 'App', 1751199231, 6),
(36, '2025-07-04-215007', 'App\\Database\\Migrations\\AlterTeachersTable', 'default', 'App', 1751666035, 7),
(37, '2025-07-05-100838', 'App\\Database\\Migrations\\CreateTeacherAssignmentClassSubject', 'default', 'App', 1751710271, 8),
(38, '2025-07-05-115753', 'App\\Database\\Migrations\\RemoveClassAndSubjectFromTeacherAssignments', 'default', 'App', 1751716791, 9),
(39, '2025-07-06-125106', 'App\\Database\\Migrations\\AddStatusToEnrollments', 'default', 'App', 1752773040, 10),
(40, '2025-07-17-134153', 'App\\Database\\Migrations\\CreateAssessmentModules', 'default', 'App', 1752773471, 11),
(41, '2025-07-17-100000', 'App\\Database\\Migrations\\CreateAssessmentModules', 'default', 'App', 1752776053, 12),
(42, '2025-07-17-100100', 'App\\Database\\Migrations\\CreateAssessmentSections', 'default', 'App', 1752776053, 12),
(43, '2025-07-17-100200', 'App\\Database\\Migrations\\CreateAssessmentComponents', 'default', 'App', 1752776053, 12),
(44, '2025-07-20-112031', 'App\\Database\\Migrations\\CreateExamSchedulesTable', 'default', 'App', 1753010576, 13),
(45, '2025-07-22-110010', 'App\\Database\\Migrations\\CreateResultsTable', 'default', 'App', 1753197229, 14),
(46, '2025-07-22-152020', 'App\\Database\\Migrations\\CreateResultsTable', 'default', 'App', 1753197711, 15),
(47, '2025-07-22-162020', 'App\\Database\\Migrations\\CreateResultsTable', 'default', 'App', 1753222281, 16),
(48, '2026-02-11-180906', 'App\\Database\\Migrations\\AddFeeManagementColumns', 'default', 'App', 1770833431, 17);

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

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `fee_entry_id` int(10) UNSIGNED NOT NULL,
  `amount_paid` decimal(10,2) NOT NULL DEFAULT 0.00,
  `payment_date` datetime NOT NULL,
  `payment_method` varchar(50) NOT NULL DEFAULT 'cash',
  `reference` varchar(100) NOT NULL,
  `paystack_reference` varchar(100) DEFAULT NULL,
  `transaction_id` varchar(100) DEFAULT NULL,
  `status` enum('pending','success','failed','refunded') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `recorded_by` int(11) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` (`id`, `student_id`, `fee_entry_id`, `amount_paid`, `payment_date`, `payment_method`, `reference`, `paystack_reference`, `transaction_id`, `status`, `notes`, `recorded_by`, `created_at`, `updated_at`) VALUES
(137, 35, 579, 1000.00, '2026-03-29 11:05:09', 'mobile_money', 'RCT-20260329-7654F39A', NULL, NULL, 'success', 'Full payment', 36, '2026-03-29 11:05:09', '2026-03-29 11:05:09'),
(138, 34, 578, 945.00, '2026-03-29 11:05:52', 'bank_transfer', 'RCT-20260329-7902BD18', NULL, NULL, 'success', 'Full payment', 36, '2026-03-29 11:05:52', '2026-03-29 11:05:52'),
(139, 35, 579, 10.00, '2026-03-29 12:57:30', 'bank_transfer', 'RCT-20260329-1BAEDC5D', NULL, NULL, 'success', 'P.T.A Dues', 36, '2026-03-29 12:57:30', '2026-03-29 12:57:30'),
(140, 35, 583, 704.00, '2026-04-03 16:58:21', 'mobile_money', 'RCT-20260403-1ADE379A', NULL, NULL, 'success', 'Being partment for excussion', 36, '2026-04-03 16:58:21', '2026-04-03 16:58:21'),
(141, 34, 581, 755.00, '2026-04-03 17:43:23', 'mobile_money', 'RCT-20260403-C3B942C0', NULL, NULL, 'success', 'Full payment', 36, '2026-04-03 17:43:23', '2026-04-03 17:43:23');

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

--
-- Table structure for table `payment_reminders`
--

CREATE TABLE `payment_reminders` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `fee_entry_id` int(10) UNSIGNED NOT NULL,
  `reminder_type` enum('email','sms') NOT NULL DEFAULT 'sms',
  `scheduled_date` date NOT NULL,
  `sent_date` date DEFAULT NULL,
  `status` enum('pending','sent','failed') NOT NULL DEFAULT 'pending',
  `message` text DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `promotion_records`
--

CREATE TABLE `promotion_records` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `from_enrollment_id` int(10) UNSIGNED DEFAULT NULL,
  `to_enrollment_id` int(10) UNSIGNED DEFAULT NULL,
  `new_student_id` int(10) UNSIGNED DEFAULT NULL,
  `from_class_id` int(10) UNSIGNED NOT NULL,
  `from_academic_year_id` int(10) UNSIGNED DEFAULT NULL,
  `from_term_id` int(10) UNSIGNED DEFAULT NULL,
  `to_class_id` int(10) UNSIGNED NOT NULL,
  `to_academic_year_id` int(10) UNSIGNED DEFAULT NULL,
  `to_term_id` int(10) UNSIGNED DEFAULT NULL,
  `promotion_date` date NOT NULL,
  `promoted_by` int(10) UNSIGNED DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `is_current` tinyint(1) DEFAULT 0,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `promotion_records`
--

INSERT INTO `promotion_records` (`id`, `student_id`, `from_enrollment_id`, `to_enrollment_id`, `new_student_id`, `from_class_id`, `from_academic_year_id`, `from_term_id`, `to_class_id`, `to_academic_year_id`, `to_term_id`, `promotion_date`, `promoted_by`, `remarks`, `is_current`, `created_at`, `updated_at`, `deleted_at`) VALUES
(49, 33, 35, 38, NULL, 27, 11, 9, 28, 16, 9, '2026-03-29', 36, '', 0, '2026-03-29 11:08:49', '2026-04-03 21:54:12', NULL),
(50, 34, 36, 39, NULL, 27, 11, 9, 28, 16, 9, '2026-03-29', 36, '', 0, '2026-03-29 11:08:49', '2026-04-03 21:54:12', NULL),
(51, 35, 37, 40, NULL, 27, 11, 9, 28, 16, 9, '2026-03-29', 36, '', 0, '2026-03-29 11:08:49', '2026-04-03 21:54:12', NULL),
(55, 33, 38, 45, NULL, 28, 16, 0, 30, 16, 0, '2026-04-03', 36, '', 0, '2026-04-03 22:03:42', '2026-04-04 13:09:51', NULL),
(56, 34, 39, 46, NULL, 28, 16, 0, 30, 16, 0, '2026-04-03', 36, '', 0, '2026-04-03 22:03:42', '2026-04-04 13:09:51', NULL),
(57, 35, 40, 47, NULL, 28, 16, 0, 30, 16, 0, '2026-04-03', 36, '', 0, '2026-04-03 22:03:42', '2026-04-04 13:09:51', NULL),
(58, 33, 35, 48, NULL, 27, 11, 0, 32, 16, 0, '2026-04-04', 36, '', 0, '2026-04-04 13:09:51', '2026-04-04 13:16:24', NULL),
(59, 34, 36, 49, NULL, 27, 11, 0, 32, 16, 0, '2026-04-04', 36, '', 0, '2026-04-04 13:09:51', '2026-04-04 13:16:24', NULL),
(60, 35, 37, 50, NULL, 27, 11, 0, 32, 16, 0, '2026-04-04', 36, '', 0, '2026-04-04 13:09:51', '2026-04-04 13:16:24', NULL),
(61, 33, 35, 51, NULL, 27, 11, 9, 33, 16, 10, '2026-04-04', 36, '', 0, '2026-04-04 13:16:24', '2026-04-05 08:35:32', NULL),
(62, 34, 36, 52, NULL, 27, 11, 9, 33, 16, 10, '2026-04-04', 36, '', 0, '2026-04-04 13:16:24', '2026-04-05 08:35:32', NULL),
(63, 35, 37, 53, NULL, 27, 11, 9, 33, 16, 10, '2026-04-04', 36, '', 0, '2026-04-04 13:16:24', '2026-04-05 08:35:32', NULL),
(67, 35, 41, 59, NULL, 27, 16, 9, 31, 16, 9, '2026-04-05', 36, '', 1, '2026-04-05 08:44:34', '2026-04-05 08:44:34', NULL);

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

--
-- Table structure for table `results`
--

CREATE TABLE `results` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `enrollment_id` int(10) UNSIGNED DEFAULT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `academic_year_id` int(10) UNSIGNED NOT NULL,
  `term_id` int(10) UNSIGNED NOT NULL,
  `class_score` decimal(4,1) DEFAULT NULL,
  `exam_score` decimal(4,1) DEFAULT NULL,
  `converted_class_score` decimal(4,1) DEFAULT NULL,
  `converted_exam_score` decimal(4,1) DEFAULT NULL,
  `total_score` decimal(4,1) DEFAULT NULL,
  `grade` varchar(10) DEFAULT NULL,
  `remark` varchar(255) DEFAULT NULL,
  `position` int(11) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `results`
--

INSERT INTO `results` (`id`, `student_id`, `enrollment_id`, `class_id`, `subject_id`, `academic_year_id`, `term_id`, `class_score`, `exam_score`, `converted_class_score`, `converted_exam_score`, `total_score`, `grade`, `remark`, `position`, `created_at`, `updated_at`) VALUES
(36, 33, NULL, 28, 31, 16, 9, 99.0, 0.0, 29.7, 0.0, 29.7, 'F', 'Fail', 2, '2026-03-29 11:14:36', '2026-03-29 11:14:55'),
(37, 34, NULL, 28, 31, 16, 9, 100.0, 0.0, 30.0, 0.0, 30.0, 'F', 'Fail', 1, '2026-03-29 11:14:36', '2026-03-29 11:14:55'),
(38, 35, NULL, 28, 31, 16, 9, 90.0, 0.0, 27.0, 0.0, 27.0, 'F', 'Fail', 3, '2026-03-29 11:14:36', '2026-03-29 11:14:55'),
(39, 33, NULL, 27, 32, 11, 9, 90.0, 0.0, 23.4, 0.0, 23.4, '7', 'xee', 2, '2026-03-29 12:33:57', '2026-04-08 18:33:10'),
(40, 34, NULL, 27, 32, 11, 9, 70.0, 0.0, 18.2, 0.0, 18.2, '8', 'yee', 3, '2026-03-29 12:33:57', '2026-04-08 18:33:10'),
(41, 35, NULL, 27, 32, 11, 9, 99.0, 0.0, 25.7, 0.0, 25.7, '7', 'xee', 1, '2026-03-29 12:33:57', '2026-04-08 18:33:10'),
(42, 33, NULL, 28, 32, 16, 9, 80.0, 0.0, 24.0, 0.0, 24.0, 'F', 'Fail', 2, '2026-03-29 13:25:17', '2026-03-29 13:25:48'),
(43, 34, NULL, 28, 32, 16, 9, 60.0, 0.0, 18.0, 0.0, 18.0, 'F', 'Fail', 3, '2026-03-29 13:25:17', '2026-03-29 13:25:48'),
(44, 35, NULL, 28, 32, 16, 9, 100.0, 0.0, 30.0, 0.0, 30.0, 'F', 'Fail', 1, '2026-03-29 13:25:17', '2026-03-29 13:25:48'),
(45, 33, NULL, 27, 33, 11, 9, 100.0, 0.0, 26.0, 0.0, 26.0, '7', 'xee', 1, '2026-04-02 19:38:24', '2026-04-08 18:35:03'),
(46, 34, NULL, 27, 33, 11, 9, 89.0, 0.0, 23.1, 0.0, 23.1, '7', 'xee', 3, '2026-04-02 19:38:24', '2026-04-08 18:35:03'),
(47, 35, NULL, 27, 33, 11, 9, 100.0, 0.0, 26.0, 0.0, 26.0, '7', 'xee', 1, '2026-04-02 19:38:24', '2026-04-08 18:35:03'),
(54, 33, NULL, 28, 34, 16, 9, 99.9, 88.6, 26.0, 65.6, 91.6, 'A', 'GreeGold Bravo Working', 1, '2026-04-02 21:49:01', '2026-04-02 21:49:01'),
(55, 34, NULL, 28, 34, 16, 9, 90.0, 90.0, 23.4, 66.6, 90.0, 'A', 'GreeGold Bravo Working', 2, '2026-04-02 21:49:01', '2026-04-02 21:49:01'),
(56, 35, NULL, 28, 34, 16, 9, 0.0, 0.0, 0.0, 0.0, 0.0, 'F', 'Fail', 3, '2026-04-02 21:49:01', '2026-04-02 21:49:01'),
(57, 35, NULL, 27, 32, 16, 9, 100.0, 79.9, 26.0, 59.1, 85.1, 'A', 'GreeGold Bravo Working', 1, '2026-04-03 05:44:40', '2026-04-03 05:45:14'),
(58, 35, NULL, 27, 34, 16, 9, 80.0, 70.0, 20.8, 51.8, 72.6, 'B', 'Goody Jobs', 1, '2026-04-03 05:55:51', '2026-04-03 06:05:54'),
(59, 35, NULL, 27, 33, 16, 9, 75.0, 90.0, 19.5, 66.6, 86.1, 'A', 'GreeGold Bravo Working', 1, '2026-04-03 06:07:49', '2026-04-03 06:07:49'),
(60, 33, NULL, 27, 34, 11, 9, 2.0, 80.0, 0.5, 59.2, 59.7, '4', 'Credit', 3, NULL, '2026-04-08 18:45:20'),
(61, 34, NULL, 27, 34, 11, 9, 90.0, 100.0, 23.4, 74.0, 97.4, '1', 'GreeGold Bravo Working', 1, NULL, '2026-04-08 18:45:20'),
(62, 35, NULL, 27, 34, 11, 9, 100.0, 50.0, 26.0, 37.0, 63.0, '3', 'Good', 2, NULL, '2026-04-08 18:45:20'),
(87, 33, NULL, 27, 31, 11, 9, 10.0, 0.0, 2.6, 0.0, 2.6, '9', 'zee', 3, NULL, '2026-04-07 20:33:06'),
(88, 34, NULL, 27, 31, 11, 9, 100.0, 0.0, 26.0, 0.0, 26.0, '7', 'xee', 2, NULL, '2026-04-07 20:33:06'),
(89, 35, NULL, 27, 31, 11, 9, 100.0, 100.0, 26.0, 74.0, 100.0, '1', 'GreeGold Bravo Working', 1, NULL, '2026-04-07 20:33:06');

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'admin', NULL, NULL),
(2, 'teacher', NULL, NULL),
(3, 'student', NULL, NULL),
(4, 'parent', NULL, NULL),
(5, 'accountant', NULL, NULL);

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

--
-- Table structure for table `score_conversions`
--

CREATE TABLE `score_conversions` (
  `id` int(9) UNSIGNED NOT NULL,
  `department_id` int(9) UNSIGNED DEFAULT NULL,
  `class_score` decimal(4,1) DEFAULT NULL,
  `exam_score` decimal(4,1) DEFAULT NULL,
  `description` varchar(150) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `score_conversions`
--

INSERT INTO `score_conversions` (`id`, `department_id`, `class_score`, `exam_score`, `description`, `created_at`, `updated_at`) VALUES
(19, 12, 26.0, 74.0, NULL, '2026-02-08 22:56:38', '2026-04-02 18:51:09'),
(20, 13, 50.0, 50.0, NULL, '2026-02-08 22:57:06', '2026-03-14 10:20:38'),
(21, 14, 20.0, 80.0, NULL, '2026-03-14 09:29:14', '2026-03-14 09:32:33'),
(22, 15, 45.0, 55.0, NULL, '2026-03-28 14:29:25', '2026-03-28 14:29:25');

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

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` int(9) UNSIGNED NOT NULL,
  `school_name` varchar(255) DEFAULT NULL,
  `school_email` varchar(100) DEFAULT NULL,
  `school_phone` varchar(50) DEFAULT NULL,
  `school_address` varchar(255) DEFAULT NULL,
  `motto` varchar(255) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `signature_principal` varchar(255) DEFAULT NULL,
  `signature_accountant` varchar(255) DEFAULT NULL,
  `current_academic_year_id` int(9) UNSIGNED DEFAULT NULL,
  `current_term_id` int(9) UNSIGNED DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` (`id`, `school_name`, `school_email`, `school_phone`, `school_address`, `motto`, `logo`, `signature_principal`, `signature_accountant`, `current_academic_year_id`, `current_term_id`, `created_at`, `updated_at`) VALUES
(1, 'Dynamic Proswoan Academy', 'proswoanacademy@gmail.com', '(+233) 0592409087', 'Post Office Box 56, La-Accra, Opposite Ariel View Hotel De Mark', 'Excellence is Our Hall Mark', '1774416910_51583fdafcc00fa796ce.png', NULL, NULL, 11, 9, NULL, NULL),
(7, 'Great Proswoan International Academy. (The Pride of Volta)', 'proswoanacademy@gmail.com', '(+233) 0592409087', 'Post Office Box 56, La-Accra, Opposite Ariel View Hotel De Mark', 'Excellence is Our Hall Mark Everyday', '1774021162_393763db16a8a0f8a090.jpg', '1773514754_3a8cce622c269517ded9.jpg', '1773514754_662824b13a8fc9ae22f4.jpg', 11, 9, NULL, NULL);

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

--
-- Table structure for table `sms_logs`
--

CREATE TABLE `sms_logs` (
  `id` int(11) NOT NULL,
  `batch_id` varchar(50) DEFAULT NULL,
  `recipient` varchar(20) NOT NULL,
  `recipient_name` varchar(255) DEFAULT NULL,
  `recipient_type` varchar(50) DEFAULT NULL,
  `message` text NOT NULL,
  `type` varchar(50) DEFAULT 'general',
  `status` enum('PENDING','QUEUED','SUBMITTED','DELIVERED','NOT_DELIVERED','REJECTED','PROHIBITED','EXPIRED','FAILED') DEFAULT 'PENDING',
  `status_message` varchar(255) DEFAULT NULL,
  `reference` varchar(100) DEFAULT NULL,
  `api_response` text DEFAULT NULL,
  `sent_by` int(11) DEFAULT NULL,
  `sent_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sms_logs`
--

INSERT INTO `sms_logs` (`id`, `batch_id`, `recipient`, `recipient_name`, `recipient_type`, `message`, `type`, `status`, `status_message`, `reference`, `api_response`, `sent_by`, `sent_at`, `created_at`, `updated_at`) VALUES
(1, 'PARENT_CREDS_1774418255_0592409087', '233592409087', 'WOANGBA PROS', 'parent', 'Dynamic Proswoan Academy Parent Portal Login\n\nHello WOANGBA PROS,\n\nYour login credentials:\nUsername: 0592409087\nPassword: XJx7bkh2\n\nLogin at: http://localhost:8080/student/login\n\nPlease change your password after first login.\nDynamic Proswoan Academy', 'credentials', 'SUBMITTED', 'SMS submitted', 'PARENT_CREDS_1774418255', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233592409087\",\"reference\":\"PARENT_CREDS_1774418252\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"01c3b123-0570-4182-8031-7a74b95b5021\",\"recipient\":\"233592409087\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":3462},\"message\":\"SMS sent successfully\"}}', 36, '2026-03-25 05:57:35', '2026-03-25 05:57:35', '2026-03-25 05:57:35'),
(2, 'PAYMENT_RCT-20260328-4DA396B3', '233592409087', 'gdgdg gdfgdfg fdgdfguu', 'parent', '🏫 Dynamic Proswoan Academy\n✅ PAYMENT RECEIPT\nStudent: gdgdg gdfgdfg fdgdfguu\nAmount: GH¢ 200.00\nPaid As: Payment for Bus -User Fee\nMethod: Mobile Money\nReceipt: RCT-20260328-4DA396B3\nDate: 28/03/2026 03:33 PM\nBalance: GH¢ 1,030.00 - Thank you!', 'payment', 'SUBMITTED', 'SMS submitted', NULL, '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233592409087\",\"reference\":\"PAYMENT_RCT-20260328-4DA396B3\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"ca30b678-1a96-4858-926d-0237a704495d\",\"recipient\":\"233592409087\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2994},\"message\":\"SMS sent successfully\"}}', 36, '2026-03-28 15:33:53', '2026-03-28 15:33:53', '2026-03-28 15:33:53'),
(3, 'PAYMENT_RCT-20260329-7654F39A', '233592409087', 'GANYO KWAME ', 'parent', '🏫 Dynamic Proswoan Academy\n✅ PAYMENT RECEIPT\nStudent: GANYO KWAME \nAmount: GH¢ 1,000.00\nPaid As: Full payment\nMethod: Mobile Money\nReceipt: RCT-20260329-7654F39A\nDate: 29/03/2026 11:05 AM\nOverpaid: GH¢ 40.00 - Thank you!', 'payment', 'SUBMITTED', 'SMS submitted', NULL, '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233592409087\",\"reference\":\"PAYMENT_RCT-20260329-7654F39A\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"63720d9c-c8cb-4ad2-9e6f-b4233990d923\",\"recipient\":\"233592409087\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2990},\"message\":\"SMS sent successfully\"}}', 36, '2026-03-29 11:05:23', '2026-03-29 11:05:23', '2026-03-29 11:05:23'),
(4, 'PAYMENT_RCT-20260329-1BAEDC5D', '233592409087', 'GANYO KWAME ', 'parent', '🏫 Dynamic Proswoan Academy\n✅ PAYMENT RECEIPT\nStudent: GANYO KWAME \nAmount: GH¢ 10.00\nPaid As: P.T.A Dues\nMethod: Bank Transfer\nReceipt: RCT-20260329-1BAEDC5D\nDate: 29/03/2026 12:57 PM\nOverpaid: GH¢ 50.00 - Thank you!', 'payment', 'SUBMITTED', 'SMS submitted', NULL, '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233592409087\",\"reference\":\"PAYMENT_RCT-20260329-1BAEDC5D\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"b158bf60-0e12-4d07-9228-41e80dfd5bb0\",\"recipient\":\"233592409087\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2986},\"message\":\"SMS sent successfully\"}}', 36, '2026-03-29 12:57:33', '2026-03-29 12:57:33', '2026-03-29 12:57:33'),
(5, 'PAYMENT_RCT-20260403-1ADE379A', '233592409087', 'GANYO KWAME ', 'parent', '🏫 Dynamic Proswoan Academy\n✅ PAYMENT RECEIPT\nStudent: GANYO KWAME \nAmount: GH¢ 704.00\nPaid As: Being partment for excussion\nMethod: Mobile Money\nReceipt: RCT-20260403-1ADE379A\nDate: 03/04/2026 04:58 PM\nFully paid. Thank you!', 'payment', 'SUBMITTED', 'SMS submitted', NULL, '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233592409087\",\"reference\":\"PAYMENT_RCT-20260403-1ADE379A\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"d53b4b77-d360-4f94-82b9-32b120ad8e9f\",\"recipient\":\"233592409087\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2982},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-03 16:58:28', '2026-04-03 16:58:28', '2026-04-03 16:58:28'),
(6, 'BATCH_1775381422_69d22baeecf80', '77777', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 77777', 'BATCH_1775381422_69d22baeecf80_77777', NULL, 36, '2026-04-05 09:30:22', '2026-04-05 09:30:22', '2026-04-05 09:30:22'),
(7, 'BATCH_1775381422_69d22baeecf80', '55', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 55', 'BATCH_1775381422_69d22baeecf80_55', NULL, 36, '2026-04-05 09:30:23', '2026-04-05 09:30:23', '2026-04-05 09:30:23'),
(8, 'BATCH_1775381422_69d22baeecf80', '0249755593', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0249755593', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249755593\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249755593\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"3fb4cffe-3fdf-4ebd-b2da-c00e60a9a2d1\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2978},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:30', '2026-04-05 09:30:30', '2026-04-05 09:30:30'),
(9, 'BATCH_1775381422_69d22baeecf80', '0249755593', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0249755593', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249755593\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249755593\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"20e6d51c-13f6-4c36-8cc7-2f3c682a52b1\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2977},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:32', '2026-04-05 09:30:32', '2026-04-05 09:30:32'),
(10, 'BATCH_1775381422_69d22baeecf80', '0249111111', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0249111111', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249111111\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249111111\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"c607e823-bfb0-420b-81f3-8bbb9f26bbe5\",\"recipient\":\"233249111111\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2976},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:34', '2026-04-05 09:30:34', '2026-04-05 09:30:34'),
(11, 'BATCH_1775381422_69d22baeecf80', '0249999999', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0249999999', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249999999\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249999999\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"aa6eebb7-c817-49ff-9c4d-878f46cb2c77\",\"recipient\":\"233249999999\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2975},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:37', '2026-04-05 09:30:37', '2026-04-05 09:30:37'),
(12, 'BATCH_1775381422_69d22baeecf80', '055', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 055', 'BATCH_1775381422_69d22baeecf80_055', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249999999\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249999999\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"aa6eebb7-c817-49ff-9c4d-878f46cb2c77\",\"recipient\":\"233249999999\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2975},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:37', '2026-04-05 09:30:37', '2026-04-05 09:30:37'),
(13, 'BATCH_1775381422_69d22baeecf80', '0555555555', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0555555555', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233555555555\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0555555555\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"37dd643e-dd23-400f-8309-95693cabe2f1\",\"recipient\":\"233555555555\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2974},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:39', '2026-04-05 09:30:39', '2026-04-05 09:30:39'),
(14, 'BATCH_1775381422_69d22baeecf80', '0200000000', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0200000000', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233200000000\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0200000000\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"662eed02-cd08-47dc-aefb-e23c64e8d2cb\",\"recipient\":\"233200000000\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2973},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:46', '2026-04-05 09:30:46', '2026-04-05 09:30:46'),
(15, 'BATCH_1775381422_69d22baeecf80', '049755593', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 049755593', 'BATCH_1775381422_69d22baeecf80_049755593', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233200000000\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0200000000\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"662eed02-cd08-47dc-aefb-e23c64e8d2cb\",\"recipient\":\"233200000000\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2973},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:46', '2026-04-05 09:30:46', '2026-04-05 09:30:46'),
(16, 'BATCH_1775381422_69d22baeecf80', '0249710433', ' ', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0249710433', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:49', '2026-04-05 09:30:49', '2026-04-05 09:30:49'),
(17, 'BATCH_1775381422_69d22baeecf80', '0300', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 0300', 'BATCH_1775381422_69d22baeecf80_0300', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:49', '2026-04-05 09:30:49', '2026-04-05 09:30:49'),
(18, 'BATCH_1775381422_69d22baeecf80', '02497555934', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 02497555934', 'BATCH_1775381422_69d22baeecf80_02497555934', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:50', '2026-04-05 09:30:50', '2026-04-05 09:30:50'),
(19, 'BATCH_1775381422_69d22baeecf80', '9999', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 9999', 'BATCH_1775381422_69d22baeecf80_9999', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:50', '2026-04-05 09:30:50', '2026-04-05 09:30:50'),
(20, 'BATCH_1775381422_69d22baeecf80', '76', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 76', 'BATCH_1775381422_69d22baeecf80_76', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:51', '2026-04-05 09:30:51', '2026-04-05 09:30:51'),
(21, 'BATCH_1775381422_69d22baeecf80', '9654', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 9654', 'BATCH_1775381422_69d22baeecf80_9654', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:51', '2026-04-05 09:30:51', '2026-04-05 09:30:51'),
(22, 'BATCH_1775381422_69d22baeecf80', '5453', ' ', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 5453', 'BATCH_1775381422_69d22baeecf80_5453', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:52', '2026-04-05 09:30:52', '2026-04-05 09:30:52'),
(23, 'BATCH_1775381422_69d22baeecf80', '888', '777 877', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 888', 'BATCH_1775381422_69d22baeecf80_888', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:52', '2026-04-05 09:30:52', '2026-04-05 09:30:52'),
(24, 'BATCH_1775381422_69d22baeecf80', '8080', 'GFHF 4HH', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 8080', 'BATCH_1775381422_69d22baeecf80_8080', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710433\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710433\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"2c915abb-7827-4164-ae67-97113803b5e8\",\"recipient\":\"233249710433\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2972},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:53', '2026-04-05 09:30:53', '2026-04-05 09:30:53'),
(25, 'BATCH_1775381422_69d22baeecf80', '0249710432', 'Mercy Mad. Dogbey', 'all_parents', 'hi there! bIG', 'general', 'SUBMITTED', 'SMS submitted', 'BATCH_1775381422_69d22baeecf80_0249710432', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710432\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710432\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"c5c15ac1-b493-4d1b-9f3d-4abdf482adfc\",\"recipient\":\"233249710432\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2971},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:30:59', '2026-04-05 09:30:59', '2026-04-05 09:30:59'),
(26, 'BATCH_1775381422_69d22baeecf80', '111111111', 'pot2 pot', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 111111111', 'BATCH_1775381422_69d22baeecf80_111111111', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710432\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710432\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"c5c15ac1-b493-4d1b-9f3d-4abdf482adfc\",\"recipient\":\"233249710432\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2971},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:31:00', '2026-04-05 09:31:00', '2026-04-05 09:31:00'),
(27, 'BATCH_1775381422_69d22baeecf80', '555', 'rtgt fff', 'all_parents', 'hi there! bIG', 'general', '', 'Invalid phone number format: 555', 'BATCH_1775381422_69d22baeecf80_555', '{\"success\":true,\"status\":\"SUBMITTED\",\"status_message\":\"SMS submitted\",\"recipient\":\"233249710432\",\"reference\":\"BATCH_1775381422_69d22baeecf80_0249710432\",\"data\":{\"success\":true,\"data\":{\"data\":[{\"id\":\"c5c15ac1-b493-4d1b-9f3d-4abdf482adfc\",\"recipient\":\"233249710432\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":2971},\"message\":\"SMS sent successfully\"}}', 36, '2026-04-05 09:31:00', '2026-04-05 09:31:00', '2026-04-05 09:31:00');

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

--
-- Table structure for table `sms_logs_old`
--

CREATE TABLE `sms_logs_old` (
  `id` int(11) NOT NULL,
  `recipient` text DEFAULT NULL,
  `message` text DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `recipient_type` varchar(50) DEFAULT NULL,
  `recipient_count` int(11) DEFAULT 0,
  `recipients_list` longtext DEFAULT NULL,
  `success_count` int(11) DEFAULT 0,
  `failed_count` int(11) DEFAULT 0,
  `failed_numbers` longtext DEFAULT NULL,
  `reference` varchar(100) DEFAULT NULL,
  `status` enum('pending','sent','failed') DEFAULT 'pending',
  `response` text DEFAULT NULL,
  `sent_by` int(11) DEFAULT NULL,
  `sent_at` datetime DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sms_logs_old`
--

INSERT INTO `sms_logs_old` (`id`, `recipient`, `message`, `type`, `recipient_type`, `recipient_count`, `recipients_list`, `success_count`, `failed_count`, `failed_numbers`, `reference`, `status`, `response`, `sent_by`, `sent_at`, `created_at`, `updated_at`) VALUES
(1, '0249710432, 0249755593', 'Checking bulk sms', 'multiple', 'multiple', 2, NULL, 0, 0, NULL, 'SMS_1772834861', 'failed', '{\"success\":false,\"message\":\"Unknown error\",\"response\":{\"data\":[{\"id\":\"57d679e4-1182-4025-9c28-cdaa07165149\",\"recipient\":\"233249710432\"},{\"id\":\"5835d520-82dd-460f-8b6c-04707c78e10b\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1275}}', 34, '2026-03-06 22:07:41', '2026-03-06 22:07:41', '2026-03-06 22:07:41'),
(2, '0249710432, 0249755593', 'Checking bulk sms', 'multiple', 'multiple', 2, NULL, 0, 0, NULL, 'SMS_1772834861', 'failed', '{\"success\":false,\"message\":\"Unknown error\",\"response\":{\"data\":[{\"id\":\"57d679e4-1182-4025-9c28-cdaa07165149\",\"recipient\":\"233249710432\"},{\"id\":\"5835d520-82dd-460f-8b6c-04707c78e10b\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1275}}', 34, '2026-03-06 22:07:41', '2026-03-06 22:07:41', '2026-03-06 22:07:41'),
(3, '0249710432, 0249755593', 'Hi testin sms', 'class_parents', 'class_parents', 2, NULL, 0, 0, NULL, 'SMS_1772835256', 'sent', '{\"success\":true,\"data\":{\"data\":[{\"id\":\"0924b342-15e3-4401-8c37-f75deaf8974e\",\"recipient\":\"233249710432\"},{\"id\":\"22b0c6a9-17d0-425f-8617-168b095373f0\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1273},\"message\":\"SMS sent successfully\",\"valid_count\":2,\"invalid_count\":0,\"invalid\":[]}', 34, '2026-03-06 22:14:16', '2026-03-06 22:14:16', '2026-03-06 22:14:16'),
(4, '0249710432, 0249755593', 'Hi testin sms', 'class_parents', 'class_parents', 2, NULL, 0, 0, NULL, 'SMS_1772835256', 'sent', '{\"success\":true,\"data\":{\"data\":[{\"id\":\"0924b342-15e3-4401-8c37-f75deaf8974e\",\"recipient\":\"233249710432\"},{\"id\":\"22b0c6a9-17d0-425f-8617-168b095373f0\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1273},\"message\":\"SMS sent successfully\",\"valid_count\":2,\"invalid_count\":0,\"invalid\":[]}', 34, '2026-03-06 22:14:16', '2026-03-06 22:14:16', '2026-03-06 22:14:16'),
(5, '0249710432, 8080, 888, 555, 77777...', 'new testing', 'all_parents', 'all_parents', 21, NULL, 0, 0, NULL, 'SMS_1772835640', 'sent', '{\"success\":true,\"data\":{\"message\":\"Some SMS were not delivered because there are invalid phone numbers!\",\"data\":[{\"id\":\"2d5ce8d6-c0da-417c-bcd9-83699dc90dd6\",\"recipient\":\"233249710432\"},{\"id\":\"b173059b-6140-45bf-a8ce-f94c9b3c9c12\",\"recipient\":\"233249755593\"},{\"id\":\"01ac2718-2999-4b28-89bd-4ec9c1b76d8e\",\"recipient\":\"233249111111\"},{\"id\":\"d104fa9d-58b2-4726-9787-6f84c48ce606\",\"recipient\":\"233249999999\"},{\"id\":\"31c62d2d-380e-4c30-916d-c8f1366c44d5\",\"recipient\":\"233555555555\"},{\"id\":\"b18b158f-84f5-4cff-b013-8c1e048459a0\",\"recipient\":\"233200000000\"},{\"id\":\"d1f3aa36-2592-4cba-953f-707bb43eab11\",\"recipient\":\"233249710433\"},{\"invalid numbers\":[\"233049755593\",\"233111111111\"]}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1271},\"message\":\"SMS sent successfully\",\"valid_count\":9,\"invalid_count\":12,\"invalid\":[\"8080\",\"888\",\"555\",\"77777\",\"55\",\"055\",\"0300\",\"02497555934\",\"9999\",\"76\",\"9654\",\"5453\"]}', 34, '2026-03-06 22:20:40', '2026-03-06 22:20:40', '2026-03-06 22:20:40'),
(6, '0249710432, 8080, 888, 555, 77777...', 'new testing', 'all_parents', 'all_parents', 21, NULL, 0, 0, NULL, 'SMS_1772835640', 'sent', '{\"success\":true,\"data\":{\"message\":\"Some SMS were not delivered because there are invalid phone numbers!\",\"data\":[{\"id\":\"2d5ce8d6-c0da-417c-bcd9-83699dc90dd6\",\"recipient\":\"233249710432\"},{\"id\":\"b173059b-6140-45bf-a8ce-f94c9b3c9c12\",\"recipient\":\"233249755593\"},{\"id\":\"01ac2718-2999-4b28-89bd-4ec9c1b76d8e\",\"recipient\":\"233249111111\"},{\"id\":\"d104fa9d-58b2-4726-9787-6f84c48ce606\",\"recipient\":\"233249999999\"},{\"id\":\"31c62d2d-380e-4c30-916d-c8f1366c44d5\",\"recipient\":\"233555555555\"},{\"id\":\"b18b158f-84f5-4cff-b013-8c1e048459a0\",\"recipient\":\"233200000000\"},{\"id\":\"d1f3aa36-2592-4cba-953f-707bb43eab11\",\"recipient\":\"233249710433\"},{\"invalid numbers\":[\"233049755593\",\"233111111111\"]}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1271},\"message\":\"SMS sent successfully\",\"valid_count\":9,\"invalid_count\":12,\"invalid\":[\"8080\",\"888\",\"555\",\"77777\",\"55\",\"055\",\"0300\",\"02497555934\",\"9999\",\"76\",\"9654\",\"5453\"]}', 34, '2026-03-06 22:20:40', '2026-03-06 22:20:40', '2026-03-06 22:20:40'),
(7, '0249710432, 0249755593', 'hello, test 2', 'class_parents', 'class_parents', 2, NULL, 0, 0, NULL, 'SMS_1772841360', 'sent', '{\"success\":true,\"message\":\"Bulk SMS processed\",\"success_count\":2,\"fail_count\":0,\"valid_count\":2,\"invalid_count\":0,\"invalid\":[],\"results\":[{\"success\":true,\"data\":{\"data\":[{\"id\":\"88d9a1ce-b841-49b7-9edd-09037e45e0cf\",\"recipient\":\"233249710432\"},{\"id\":\"f729b158-f652-4812-a649-56ebb7b6f796\",\"recipient\":\"233249755593\"}],\"status\":\"success\",\"main_balance\":0.2,\"sms_balance\":1255},\"message\":\"SMS sent successfully\"}]}', 34, '2026-03-06 23:56:00', '2026-03-06 23:56:00', '2026-03-06 23:56:00');

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

--
-- Table structure for table `students`
--

CREATE TABLE `students` (
  `id` int(9) UNSIGNED NOT NULL,
  `surname` varchar(100) NOT NULL,
  `first_name` varchar(100) NOT NULL,
  `other_names` varchar(100) DEFAULT NULL,
  `gender` enum('Male','Female') NOT NULL,
  `date_of_birth` date DEFAULT NULL,
  `nationality` varchar(100) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `academic_year_id` int(11) DEFAULT NULL,
  `previous_academic_year_id` int(11) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `term_id` int(11) DEFAULT NULL,
  `department_id` int(9) UNSIGNED DEFAULT NULL,
  `class_id` int(9) UNSIGNED DEFAULT NULL,
  `previous_class_id` int(11) DEFAULT NULL,
  `house_id` int(9) UNSIGNED DEFAULT NULL,
  `admission_number` varchar(50) NOT NULL,
  `admission_date` date DEFAULT NULL,
  `religion` varchar(50) DEFAULT NULL,
  `previous_school` varchar(150) DEFAULT NULL,
  `disability` varchar(150) DEFAULT NULL,
  `parent_relationship` varchar(20) DEFAULT NULL,
  `parent_phone` varchar(20) DEFAULT NULL,
  `parent_email` varchar(100) DEFAULT NULL,
  `parent_full_name` varchar(255) DEFAULT NULL,
  `parent_address` varchar(255) DEFAULT NULL,
  `parent_occupation` varchar(100) DEFAULT NULL,
  `parent_photo` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `students`
--

INSERT INTO `students` (`id`, `surname`, `first_name`, `other_names`, `gender`, `date_of_birth`, `nationality`, `photo`, `academic_year_id`, `previous_academic_year_id`, `is_active`, `term_id`, `department_id`, `class_id`, `previous_class_id`, `house_id`, `admission_number`, `admission_date`, `religion`, `previous_school`, `disability`, `parent_relationship`, `parent_phone`, `parent_email`, `parent_full_name`, `parent_address`, `parent_occupation`, `parent_photo`, `created_at`, `updated_at`, `deleted_at`) VALUES
(33, 'MAWULI', 'SAM', 'KOFI', 'Male', NULL, '', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'ADM-0001', '2026-03-29', '', '', '', '', '', '', '', '', '', NULL, NULL, NULL, NULL),
(34, 'AGBENYUI', 'DORIS', 'ABENA', 'Female', NULL, '', NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'ADM-0002', '2026-03-29', '', '', '', '', '', '', '', '', '', NULL, NULL, NULL, NULL),
(35, 'GANYO', 'KWAME', '', 'Male', '2020-01-07', 'GHANAIAN', '69c90362195de.jpg', NULL, NULL, 1, NULL, NULL, NULL, NULL, 10, 'ADM-0003', '2026-03-10', 'CHRISTIAN', 'TEMA BASIC SCHOOL', 'NONE', 'Father', '0592409087', 'proscetech@gmail.com', 'MR.  GANYO MIKEY', 'VX-8945-2394', 'PHARMARCIST', NULL, NULL, NULL, NULL),
(36, 'TANU', 'SENA', 'MATHEW', 'Male', '2022-07-19', 'GHANAIAN', '69d1330dd6030.jpg', NULL, NULL, 1, NULL, NULL, NULL, NULL, 11, 'ADM-0004', '2026-04-04', 'CRT', 'TAMALE R.C BASIC SCHOOL', 'NONE', 'Guardian', '0249755593', 'proscetech@gmail.com', 'MASTER TANU YAW', 'VX-8945-2394', 'PHARMARCIST', NULL, NULL, NULL, NULL);

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

--
-- Table structure for table `student_fee_options`
--

CREATE TABLE `student_fee_options` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `fees_category_id` int(10) UNSIGNED NOT NULL,
  `academic_year_id` int(10) UNSIGNED NOT NULL,
  `term_id` int(10) UNSIGNED NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `assigned_by` int(10) UNSIGNED DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `student_login_history`
--

CREATE TABLE `student_login_history` (
  `id` int(9) UNSIGNED NOT NULL,
  `student_user_id` int(9) UNSIGNED NOT NULL,
  `login_time` datetime DEFAULT current_timestamp(),
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `status` enum('success','failed') DEFAULT 'success'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_login_history`
--

INSERT INTO `student_login_history` (`id`, `student_user_id`, `login_time`, `ip_address`, `user_agent`, `status`) VALUES
(1, 42, '2026-03-24 12:03:14', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(2, 42, '2026-03-24 12:04:16', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(3, 42, '2026-03-24 12:04:45', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(4, 42, '2026-03-24 12:12:35', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(5, 42, '2026-03-24 12:20:52', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(6, 9, '2026-03-24 12:59:22', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(7, 42, '2026-03-24 13:00:35', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(8, 9, '2026-03-24 13:03:50', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(9, 42, '2026-03-24 13:04:25', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(10, 42, '2026-03-24 13:12:55', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(11, 42, '2026-03-24 13:13:25', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(12, 45, '2026-03-24 23:07:47', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 'success'),
(13, 48, '2026-03-28 14:17:49', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success'),
(14, 48, '2026-03-28 15:32:57', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success'),
(15, 49, '2026-03-29 14:00:46', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success'),
(16, 49, '2026-04-01 16:37:42', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success'),
(17, 49, '2026-04-03 19:18:10', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success'),
(18, 49, '2026-04-03 20:32:46', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success'),
(19, 49, '2026-04-08 19:40:16', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:149.0) Gecko/20100101 Firefox/149.0', 'success');

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

--
-- Table structure for table `student_notifications`
--

CREATE TABLE `student_notifications` (
  `id` int(9) UNSIGNED NOT NULL,
  `student_id` int(9) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `type` enum('payment','result','bill','receipt','general') DEFAULT 'general',
  `recipient_type` enum('single','class','department','school') DEFAULT 'single',
  `recipient_id` int(9) UNSIGNED DEFAULT NULL,
  `sent_by` int(9) UNSIGNED DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_notifications`
--

INSERT INTO `student_notifications` (`id`, `student_id`, `title`, `message`, `type`, `recipient_type`, `recipient_id`, `sent_by`, `is_read`, `created_at`) VALUES
(1, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-04 14:38:45'),
(2, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-04 19:10:08'),
(3, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-04 19:51:11'),
(4, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-04 21:32:12'),
(5, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-05 19:29:34'),
(6, 10, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-05 20:43:24'),
(7, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-05 21:48:29'),
(8, 10, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-05 22:08:15'),
(9, 9, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-06 19:20:37'),
(10, 9, 'Meeting', 'There will be a PTA meeting on the 10th of March, 2026. Thank You.', 'general', 'single', NULL, NULL, 1, '2026-03-06 20:45:25'),
(11, 10, 'Meeting', 'There will be a PTA meeting on the 10th of March, 2026. Thank You.', 'general', 'single', NULL, NULL, 1, '2026-03-06 20:45:25'),
(12, 9, 'hi there', 'test 1', 'general', 'single', NULL, NULL, 1, '2026-03-06 21:04:12'),
(13, 10, 'hi there', 'test 1', 'general', 'single', NULL, NULL, 1, '2026-03-06 21:04:12'),
(14, 9, 'reponing', 'We resume tomorrow', 'general', 'single', NULL, NULL, 0, '2026-03-06 23:42:46'),
(15, 10, 'reponing', 'We resume tomorrow', 'general', 'single', NULL, NULL, 1, '2026-03-06 23:42:46'),
(16, 16, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-07 20:26:22'),
(17, 16, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 0, '2026-03-11 22:56:09'),
(18, 16, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 0, '2026-03-12 07:21:26'),
(19, 16, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 0, '2026-03-12 21:26:13'),
(20, 16, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 0, '2026-03-13 13:25:33'),
(21, 10, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-19 23:30:22'),
(22, 10, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-20 10:25:22'),
(23, 10, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-20 10:48:00'),
(24, 10, 'Welcome', 'Welcome to the student portal. You can now view your fees, bills, and results.', 'general', 'single', NULL, NULL, 1, '2026-03-20 16:54:12'),
(25, 9, 'pay reminder', 'pay your dues', 'payment', 'single', NULL, NULL, 0, '2026-03-22 13:06:41');

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

--
-- Table structure for table `student_parents`
--

CREATE TABLE `student_parents` (
  `id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `parent_id` int(10) UNSIGNED NOT NULL,
  `relationship` enum('Father','Mother','Guardian') NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `subjects`
--

CREATE TABLE `subjects` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `code` varchar(20) DEFAULT NULL,
  `department_id` int(10) UNSIGNED NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `subjects`
--

INSERT INTO `subjects` (`id`, `name`, `code`, `department_id`, `created_at`, `updated_at`) VALUES
(28, 'matb', '79', 5, '2025-08-31 12:05:52', '2025-08-31 12:05:52'),
(29, 'Numeracy Skills', 'Num-001', 11, '2026-02-08 20:29:05', '2026-03-14 15:12:28'),
(30, 'Literacy', 'Lit-001', 11, '2026-02-08 20:29:29', '2026-02-08 20:33:14'),
(31, 'English Language', 'Eng-001', 12, '2026-02-08 20:30:08', '2026-02-08 20:30:50'),
(32, 'Mathematics', 'Mat-001', 12, '2026-02-08 20:30:33', '2026-02-08 20:30:33'),
(33, 'Science', 'Sci-001', 12, '2026-02-08 20:31:53', '2026-02-08 20:32:34'),
(34, 'Creative Art & Design', 'Crt-001', 12, '2026-02-08 20:33:54', '2026-02-08 20:33:54'),
(35, 'English Language', 'Eng-002', 13, '2026-02-08 20:34:19', '2026-02-08 20:34:19'),
(36, 'Mathematics', 'Mat-002', 13, '2026-02-08 20:34:37', '2026-02-08 20:34:37'),
(37, 'Chemistry', 'chem002', 14, '2026-03-14 07:15:26', '2026-03-14 07:15:26');

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

--
-- Table structure for table `teachers`
--

CREATE TABLE `teachers` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `gender` enum('Male','Female') DEFAULT NULL,
  `qualification` varchar(100) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `teachers`
--

INSERT INTO `teachers` (`id`, `user_id`, `phone`, `address`, `gender`, `qualification`, `photo`, `created_at`, `updated_at`) VALUES
(10, 3, '0249710432', 'Box 63, Tema', 'Male', 'Degree', '1753341507_92ea9f7b4b4ab1cdd376.jpg', '2025-07-24 07:18:27', '2025-07-24 07:18:27'),
(15, 22, '0249710432', 'BOX 44, ACCRA', 'Male', 'TEACHING', '1770584174_7e83d6384be740e9e04f.jpg', '2026-02-08 20:55:50', '2026-02-08 20:56:14'),
(16, 23, '049755593', 'BOX 32', 'Female', 'DEGREE', '1770584239_0921e7bad00463784bf2.jpg', '2026-02-08 20:57:19', '2026-02-08 20:57:19'),
(17, 27, '0249710432', 'BOX 43-TEMA', 'Male', 'DEGREE', '1770739889_78a25ebe1933c6b8c2d2.jpg', '2026-02-10 16:11:29', '2026-02-10 16:11:29'),
(18, 28, '0249755593', 'BOX 56 ACCRA', 'Female', 'DIPLOMA', '1773527100_2ded61aa6ee54f47c28a.jpg', '2026-02-10 16:12:31', '2026-03-14 22:25:00'),
(19, 45, '0249755593', 'b0x 7', 'Male', 'DIPLOMA', '1774381595_ff67619734e0124ac41b.jpg', '2026-03-24 17:20:59', '2026-03-24 19:46:35');

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

--
-- Table structure for table `teacher_assignments`
--

CREATE TABLE `teacher_assignments` (
  `id` int(9) UNSIGNED NOT NULL,
  `teacher_id` int(9) UNSIGNED NOT NULL,
  `academic_year_id` int(9) UNSIGNED NOT NULL,
  `term_id` int(9) UNSIGNED NOT NULL,
  `department_id` int(9) UNSIGNED NOT NULL,
  `assigned_date` date DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `teacher_assignments`
--

INSERT INTO `teacher_assignments` (`id`, `teacher_id`, `academic_year_id`, `term_id`, `department_id`, `assigned_date`, `created_at`, `updated_at`) VALUES
(29, 10, 4, 2, 5, '2025-11-13', NULL, NULL),
(30, 15, 11, 9, 12, '2026-02-08', NULL, NULL),
(31, 16, 11, 9, 13, '2026-02-07', NULL, NULL),
(32, 17, 11, 9, 12, '2026-01-26', NULL, NULL),
(33, 17, 11, 9, 13, '2026-01-26', NULL, NULL),
(35, 18, 11, 9, 12, '2026-01-26', NULL, NULL),
(36, 19, 11, 9, 12, '2026-03-27', NULL, NULL);

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

--
-- Table structure for table `teacher_assignment_class_subject`
--

CREATE TABLE `teacher_assignment_class_subject` (
  `id` int(10) UNSIGNED NOT NULL,
  `teacher_assignment_id` int(10) UNSIGNED NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `teacher_assignment_class_subject`
--

INSERT INTO `teacher_assignment_class_subject` (`id`, `teacher_assignment_id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES
(196, 29, 11, 28, NULL, NULL),
(197, 29, 14, 28, NULL, NULL),
(198, 30, 27, 31, NULL, NULL),
(199, 30, 27, 32, NULL, NULL),
(200, 30, 27, 33, NULL, NULL),
(201, 30, 27, 34, NULL, NULL),
(208, 31, 33, 36, NULL, NULL),
(209, 31, 34, 36, NULL, NULL),
(210, 31, 35, 36, NULL, NULL),
(211, 31, 36, 36, NULL, NULL),
(212, 31, 37, 36, NULL, NULL),
(213, 32, 27, 31, NULL, NULL),
(214, 32, 27, 32, NULL, NULL),
(215, 32, 27, 33, NULL, NULL),
(216, 32, 27, 34, NULL, NULL),
(217, 33, 35, 35, NULL, NULL),
(218, 33, 35, 36, NULL, NULL),
(227, 35, 27, 31, NULL, NULL),
(228, 35, 27, 32, NULL, NULL),
(229, 35, 27, 35, NULL, NULL),
(230, 35, 27, 37, NULL, NULL),
(231, 35, 37, 31, NULL, NULL),
(232, 35, 37, 32, NULL, NULL),
(233, 35, 37, 35, NULL, NULL),
(234, 35, 37, 37, NULL, NULL),
(235, 35, 38, 31, NULL, NULL),
(236, 35, 38, 32, NULL, NULL),
(237, 35, 38, 35, NULL, NULL),
(238, 35, 38, 37, NULL, NULL),
(239, 36, 28, 32, NULL, NULL);

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

--
-- Table structure for table `terms`
--

CREATE TABLE `terms` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `number_of_days_open` int(10) UNSIGNED DEFAULT NULL,
  `next_term_begins` date DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `terms`
--

INSERT INTO `terms` (`id`, `name`, `start_date`, `end_date`, `number_of_days_open`, `next_term_begins`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'First Term', '2025-07-23', '2025-08-10', 62, '2025-09-02', '2025-07-01 15:31:16', '2025-08-31 12:14:32', '2025-08-31 12:14:32'),
(2, 'Second Term', '2026-01-01', '2026-06-25', 56, '2026-07-14', '2025-07-01 15:32:26', '2026-02-07 20:53:56', '2026-02-07 20:53:56'),
(4, 'Third Term', '2025-04-15', '2025-08-30', 0, '0000-00-00', '2025-08-24 21:29:02', '2026-02-07 20:54:08', '2026-02-07 20:54:08'),
(5, 'First Term', '2025-08-20', '2025-08-14', 79, '0000-00-00', '2025-08-31 12:55:07', '2026-02-07 20:54:19', '2026-02-07 20:54:19'),
(6, 'nh', '2025-09-03', '2025-08-29', 564, '2025-08-21', '2025-08-31 14:07:58', '2026-02-07 20:54:01', '2026-02-07 20:54:01'),
(8, 'Fourth Term', '2025-01-10', '2025-07-30', 71, '2025-09-20', '2025-08-31 14:43:47', '2026-02-07 20:54:14', '2026-02-07 20:54:14'),
(9, 'First Term', '2025-10-01', '2025-12-22', 62, '2026-02-09', '2026-02-08 19:58:19', '2026-04-03 08:18:13', NULL),
(10, 'Second Term', '2026-04-08', '2026-04-11', 59, '2026-05-10', '2026-02-08 20:00:20', '2026-03-14 06:30:29', NULL),
(11, 'Third Term', '2026-06-08', '2026-07-24', 55, '2027-01-10', '2026-02-08 20:01:47', '2026-02-08 20:01:47', NULL);

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

--
-- Table structure for table `timetables`
--

CREATE TABLE `timetables` (
  `id` int(10) UNSIGNED NOT NULL,
  `academic_year_id` int(10) UNSIGNED NOT NULL,
  `term_id` int(10) UNSIGNED DEFAULT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `house_id` int(10) UNSIGNED DEFAULT NULL,
  `day_of_week` varchar(20) NOT NULL,
  `period_number` int(2) NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `teacher_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `user_roles`
--

CREATE TABLE `user_roles` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `role_id` int(10) UNSIGNED NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_roles`
--

INSERT INTO `user_roles` (`id`, `user_id`, `role_id`, `created_at`, `updated_at`) VALUES
(11, 3, 1, '2025-06-29 13:40:25', '2025-06-29 18:10:46'),
(13, 5, 1, NULL, NULL),
(15, 7, 2, NULL, NULL),
(16, 8, 2, NULL, NULL),
(17, 13, 1, NULL, NULL),
(18, 14, 4, NULL, NULL),
(19, 15, 4, NULL, NULL),
(20, 16, 2, NULL, NULL),
(21, 17, 2, NULL, NULL),
(22, 18, 2, NULL, NULL),
(23, 19, 3, NULL, NULL),
(24, 20, 2, NULL, NULL),
(25, 21, 5, NULL, NULL),
(26, 22, 2, NULL, NULL),
(27, 23, 2, NULL, NULL),
(28, 24, 1, NULL, NULL),
(29, 25, 2, NULL, NULL),
(30, 26, 1, NULL, NULL),
(31, 27, 2, NULL, NULL),
(32, 28, 2, NULL, NULL),
(33, 29, 2, NULL, NULL),
(34, 30, 2, NULL, NULL),
(35, 31, 2, NULL, NULL),
(36, 32, 5, NULL, NULL),
(37, 33, 5, NULL, NULL),
(38, 34, 1, NULL, NULL),
(39, 35, 5, NULL, NULL),
(40, 36, 1, NULL, NULL),
(41, 37, 1, NULL, NULL),
(42, 38, 4, NULL, NULL),
(43, 39, 3, NULL, NULL),
(44, 40, 4, NULL, NULL),
(45, 41, 1, NULL, NULL),
(46, 42, 1, NULL, NULL),
(47, 43, 1, NULL, NULL),
(48, 44, 1, NULL, NULL),
(49, 45, 2, NULL, NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `academic_years`
--
ALTER TABLE `academic_years`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `activity_logs_user_id_foreign` (`user_id`);

--
-- Indexes for table `assessment_components`
--
ALTER TABLE `assessment_components`
  ADD PRIMARY KEY (`id`),
  ADD KEY `assessment_components_assessment_section_id_foreign` (`assessment_section_id`);

--
-- Indexes for table `assessment_modules`
--
ALTER TABLE `assessment_modules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `assessment_modules_department_id_foreign` (`department_id`);

--
-- Indexes for table `assessment_sections`
--
ALTER TABLE `assessment_sections`
  ADD PRIMARY KEY (`id`),
  ADD KEY `assessment_sections_assessment_module_id_foreign` (`assessment_module_id`);

--
-- Indexes for table `attendance_records`
--
ALTER TABLE `attendance_records`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `student_id_attendance_date` (`student_id`,`attendance_date`),
  ADD KEY `attendance_records_academic_year_id_foreign` (`academic_year_id`),
  ADD KEY `attendance_records_term_id_foreign` (`term_id`),
  ADD KEY `attendance_records_class_id_foreign` (`class_id`),
  ADD KEY `attendance_records_house_id_foreign` (`house_id`);

--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `classes_department_id_foreign` (`department_id`);

--
-- Indexes for table `class_subjects`
--
ALTER TABLE `class_subjects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `class_subjects_class_id_foreign` (`class_id`),
  ADD KEY `class_subjects_subject_id_foreign` (`subject_id`);

--
-- Indexes for table `comments`
--
ALTER TABLE `comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `academic_year_id` (`academic_year_id`),
  ADD KEY `term_id` (`term_id`),
  ADD KEY `class_id` (`class_id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `promoted_to_class_id` (`promoted_to_class_id`),
  ADD KEY `enrollment_id` (`enrollment_id`);

--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `discount_approvals`
--
ALTER TABLE `discount_approvals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_fee_entry_id` (`fee_entry_id`),
  ADD KEY `idx_student_id` (`student_id`),
  ADD KEY `idx_status` (`status`);

--
-- Indexes for table `enrollments`
--
ALTER TABLE `enrollments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `academic_year_id` (`academic_year_id`),
  ADD KEY `term_id` (`term_id`),
  ADD KEY `department_id` (`department_id`),
  ADD KEY `class_id` (`class_id`);

--
-- Indexes for table `fee_bands`
--
ALTER TABLE `fee_bands`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fee_system_id` (`fee_system_id`);

--
-- Indexes for table `fee_entries`
--
ALTER TABLE `fee_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_student_id` (`student_id`),
  ADD KEY `idx_class_id` (`class_id`),
  ADD KEY `idx_academic_year_id` (`academic_year_id`),
  ADD KEY `idx_term_id` (`term_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_fee_entries_fee_system` (`fee_system_id`),
  ADD KEY `enrollment_id` (`enrollment_id`);

--
-- Indexes for table `fee_systems`
--
ALTER TABLE `fee_systems`
  ADD PRIMARY KEY (`id`),
  ADD KEY `department_id` (`department_id`),
  ADD KEY `idx_fee_systems_academic_year` (`academic_year_id`),
  ADD KEY `idx_fee_systems_term` (`term_id`);

--
-- Indexes for table `grading_bands`
--
ALTER TABLE `grading_bands`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grading_bands_grading_system_id_foreign` (`grading_system_id`);

--
-- Indexes for table `grading_systems`
--
ALTER TABLE `grading_systems`
  ADD PRIMARY KEY (`id`),
  ADD KEY `grading_systems_department_id_foreign` (`department_id`);

--
-- Indexes for table `houses`
--
ALTER TABLE `houses`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_reference` (`reference`),
  ADD KEY `idx_student_id` (`student_id`),
  ADD KEY `idx_fee_entry_id` (`fee_entry_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_payment_date` (`payment_date`);

--
-- Indexes for table `payment_reminders`
--
ALTER TABLE `payment_reminders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_student_id` (`student_id`),
  ADD KEY `idx_fee_entry_id` (`fee_entry_id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_scheduled_date` (`scheduled_date`);

--
-- Indexes for table `promotion_records`
--
ALTER TABLE `promotion_records`
  ADD PRIMARY KEY (`id`),
  ADD KEY `promotion_records_student_id_foreign` (`student_id`),
  ADD KEY `promotion_records_from_class_id_foreign` (`from_class_id`),
  ADD KEY `promotion_records_to_class_id_foreign` (`to_class_id`),
  ADD KEY `promotion_records_promoted_by_foreign` (`promoted_by`),
  ADD KEY `idx_is_current` (`is_current`),
  ADD KEY `idx_student_current` (`student_id`,`is_current`),
  ADD KEY `from_enrollment_id` (`from_enrollment_id`),
  ADD KEY `to_enrollment_id` (`to_enrollment_id`),
  ADD KEY `from_academic_year_id` (`from_academic_year_id`),
  ADD KEY `to_academic_year_id` (`to_academic_year_id`);

--
-- Indexes for table `results`
--
ALTER TABLE `results`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `idx_unique_result` (`student_id`,`class_id`,`subject_id`,`academic_year_id`,`term_id`),
  ADD KEY `idx_results_composite` (`academic_year_id`,`term_id`,`class_id`,`subject_id`),
  ADD KEY `idx_student_id` (`student_id`),
  ADD KEY `idx_class_id` (`class_id`),
  ADD KEY `idx_subject_id` (`subject_id`),
  ADD KEY `idx_academic_year_id` (`academic_year_id`),
  ADD KEY `idx_term_id` (`term_id`),
  ADD KEY `idx_position_calc` (`class_id`,`subject_id`,`term_id`,`academic_year_id`,`total_score`),
  ADD KEY `enrollment_id` (`enrollment_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `score_conversions`
--
ALTER TABLE `score_conversions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `department_id_class_score_exam_score` (`department_id`,`class_score`,`exam_score`);

--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`id`),
  ADD KEY `settings_current_academic_year_id_foreign` (`current_academic_year_id`),
  ADD KEY `settings_current_term_id_foreign` (`current_term_id`);

--
-- Indexes for table `sms_logs`
--
ALTER TABLE `sms_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_batch_id` (`batch_id`),
  ADD KEY `idx_recipient` (`recipient`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_sent_at` (`sent_at`);

--
-- Indexes for table `sms_logs_old`
--
ALTER TABLE `sms_logs_old`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_status` (`status`),
  ADD KEY `idx_recipient_type` (`recipient_type`);

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `admission_number` (`admission_number`),
  ADD KEY `students_academic_year_id_foreign` (`academic_year_id`),
  ADD KEY `students_term_id_foreign` (`term_id`),
  ADD KEY `students_department_id_foreign` (`department_id`),
  ADD KEY `students_class_id_foreign` (`class_id`),
  ADD KEY `students_house_id_foreign` (`house_id`);

--
-- Indexes for table `student_fee_options`
--
ALTER TABLE `student_fee_options`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_student_fee_option` (`student_id`,`fees_category_id`,`academic_year_id`,`term_id`,`class_id`),
  ADD KEY `fk_sfo_cat` (`fees_category_id`),
  ADD KEY `fk_sfo_ay` (`academic_year_id`),
  ADD KEY `fk_sfo_term` (`term_id`),
  ADD KEY `fk_sfo_class` (`class_id`),
  ADD KEY `fk_sfo_user` (`assigned_by`);

--
-- Indexes for table `student_login_history`
--
ALTER TABLE `student_login_history`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_user_id` (`student_user_id`);

--
-- Indexes for table `student_notifications`
--
ALTER TABLE `student_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `idx_recipient` (`recipient_type`,`recipient_id`);

--
-- Indexes for table `student_parents`
--
ALTER TABLE `student_parents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_parents_student_id_foreign` (`student_id`),
  ADD KEY `student_parents_parent_id_foreign` (`parent_id`);

--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `subjects_department_id_foreign` (`department_id`);

--
-- Indexes for table `teachers`
--
ALTER TABLE `teachers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `teachers_user_id_foreign` (`user_id`);

--
-- Indexes for table `teacher_assignments`
--
ALTER TABLE `teacher_assignments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `teacher_assignments_teacher_id_foreign` (`teacher_id`),
  ADD KEY `teacher_assignments_academic_year_id_foreign` (`academic_year_id`),
  ADD KEY `teacher_assignments_term_id_foreign` (`term_id`),
  ADD KEY `teacher_assignments_department_id_foreign` (`department_id`);

--
-- Indexes for table `teacher_assignment_class_subject`
--
ALTER TABLE `teacher_assignment_class_subject`
  ADD PRIMARY KEY (`id`),
  ADD KEY `teacher_assignment_class_subject_teacher_assignment_id_foreign` (`teacher_assignment_id`),
  ADD KEY `teacher_assignment_class_subject_class_id_foreign` (`class_id`),
  ADD KEY `teacher_assignment_class_subject_subject_id_foreign` (`subject_id`);

--
-- Indexes for table `terms`
--
ALTER TABLE `terms`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `timetables`
--
ALTER TABLE `timetables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `timetables_academic_year_id_foreign` (`academic_year_id`),
  ADD KEY `timetables_term_id_foreign` (`term_id`),
  ADD KEY `timetables_class_id_foreign` (`class_id`),
  ADD KEY `timetables_house_id_foreign` (`house_id`),
  ADD KEY `timetables_subject_id_foreign` (`subject_id`),
  ADD KEY `timetables_teacher_id_foreign` (`teacher_id`);

--
-- Indexes for table `user_roles`
--
ALTER TABLE `user_roles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_roles_user_id_foreign` (`user_id`),
  ADD KEY `user_roles_role_id_foreign` (`role_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `academic_years`
--
ALTER TABLE `academic_years`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `activity_logs`
--
ALTER TABLE `activity_logs`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `assessment_components`
--
ALTER TABLE `assessment_components`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `assessment_modules`
--
ALTER TABLE `assessment_modules`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `assessment_sections`
--
ALTER TABLE `assessment_sections`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `attendance_records`
--
ALTER TABLE `attendance_records`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `classes`
--
ALTER TABLE `classes`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;

--
-- AUTO_INCREMENT for table `class_subjects`
--
ALTER TABLE `class_subjects`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `comments`
--
ALTER TABLE `comments`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;

--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT for table `discount_approvals`
--
ALTER TABLE `discount_approvals`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `enrollments`
--
ALTER TABLE `enrollments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;

--
-- AUTO_INCREMENT for table `fee_bands`
--
ALTER TABLE `fee_bands`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=175;

--
-- AUTO_INCREMENT for table `fee_entries`
--
ALTER TABLE `fee_entries`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=584;

--
-- AUTO_INCREMENT for table `fee_systems`
--
ALTER TABLE `fee_systems`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `grading_bands`
--
ALTER TABLE `grading_bands`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=270;

--
-- AUTO_INCREMENT for table `grading_systems`
--
ALTER TABLE `grading_systems`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `houses`
--
ALTER TABLE `houses`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=49;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=142;

--
-- AUTO_INCREMENT for table `payment_reminders`
--
ALTER TABLE `payment_reminders`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `promotion_records`
--
ALTER TABLE `promotion_records`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68;

--
-- AUTO_INCREMENT for table `results`
--
ALTER TABLE `results`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=90;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `score_conversions`
--
ALTER TABLE `score_conversions`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `settings`
--
ALTER TABLE `settings`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `sms_logs`
--
ALTER TABLE `sms_logs`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

--
-- AUTO_INCREMENT for table `sms_logs_old`
--
ALTER TABLE `sms_logs_old`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;

--
-- AUTO_INCREMENT for table `student_fee_options`
--
ALTER TABLE `student_fee_options`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `student_login_history`
--
ALTER TABLE `student_login_history`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT for table `student_notifications`
--
ALTER TABLE `student_notifications`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26;

--
-- AUTO_INCREMENT for table `student_parents`
--
ALTER TABLE `student_parents`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=55;

--
-- AUTO_INCREMENT for table `subjects`
--
ALTER TABLE `subjects`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39;

--
-- AUTO_INCREMENT for table `teachers`
--
ALTER TABLE `teachers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=20;

--
-- AUTO_INCREMENT for table `teacher_assignments`
--
ALTER TABLE `teacher_assignments`
  MODIFY `id` int(9) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;

--
-- AUTO_INCREMENT for table `teacher_assignment_class_subject`
--
ALTER TABLE `teacher_assignment_class_subject`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=240;

--
-- AUTO_INCREMENT for table `terms`
--
ALTER TABLE `terms`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `timetables`
--
ALTER TABLE `timetables`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_roles`
--
ALTER TABLE `user_roles`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=50;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD CONSTRAINT `activity_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE SET NULL;

--
-- Constraints for table `assessment_components`
--
ALTER TABLE `assessment_components`
  ADD CONSTRAINT `assessment_components_assessment_section_id_foreign` FOREIGN KEY (`assessment_section_id`) REFERENCES `assessment_sections` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `assessment_modules`
--
ALTER TABLE `assessment_modules`
  ADD CONSTRAINT `assessment_modules_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `assessment_sections`
--
ALTER TABLE `assessment_sections`
  ADD CONSTRAINT `assessment_sections_assessment_module_id_foreign` FOREIGN KEY (`assessment_module_id`) REFERENCES `assessment_modules` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `attendance_records`
--
ALTER TABLE `attendance_records`
  ADD CONSTRAINT `attendance_records_academic_year_id_foreign` FOREIGN KEY (`academic_year_id`) REFERENCES `academic_years` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `attendance_records_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `attendance_records_house_id_foreign` FOREIGN KEY (`house_id`) REFERENCES `houses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `attendance_records_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `attendance_records_term_id_foreign` FOREIGN KEY (`term_id`) REFERENCES `terms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
  ADD CONSTRAINT `classes_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `class_subjects`
--
ALTER TABLE `class_subjects`
  ADD CONSTRAINT `class_subjects_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `class_subjects_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `fee_bands`
--
ALTER TABLE `fee_bands`
  ADD CONSTRAINT `fee_bands_ibfk_1` FOREIGN KEY (`fee_system_id`) REFERENCES `fee_systems` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `fee_entries`
--
ALTER TABLE `fee_entries`
  ADD CONSTRAINT `fk_fee_entries_academic_years` FOREIGN KEY (`academic_year_id`) REFERENCES `academic_years` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_fee_entries_classes` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_fee_entries_fee_system` FOREIGN KEY (`fee_system_id`) REFERENCES `fee_systems` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_fee_entries_students` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_fee_entries_terms` FOREIGN KEY (`term_id`) REFERENCES `terms` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `fee_systems`
--
ALTER TABLE `fee_systems`
  ADD CONSTRAINT `fk_fee_systems_academic_year` FOREIGN KEY (`academic_year_id`) REFERENCES `academic_years` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_fee_systems_term` FOREIGN KEY (`term_id`) REFERENCES `terms` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `grading_bands`
--
ALTER TABLE `grading_bands`
  ADD CONSTRAINT `grading_bands_grading_system_id_foreign` FOREIGN KEY (`grading_system_id`) REFERENCES `grading_systems` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `grading_systems`
--
ALTER TABLE `grading_systems`
  ADD CONSTRAINT `grading_systems_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE ON UPDATE SET NULL;

--
-- Constraints for table `promotion_records`
--
ALTER TABLE `promotion_records`
  ADD CONSTRAINT `promotion_records_from_class_id_foreign` FOREIGN KEY (`from_class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `promotion_records_promoted_by_foreign` FOREIGN KEY (`promoted_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE SET NULL,
  ADD CONSTRAINT `promotion_records_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `promotion_records_to_class_id_foreign` FOREIGN KEY (`to_class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `results`
--
ALTER TABLE `results`
  ADD CONSTRAINT `fk_results_academic_year` FOREIGN KEY (`academic_year_id`) REFERENCES `academic_years` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_results_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_results_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_results_subject` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_results_term` FOREIGN KEY (`term_id`) REFERENCES `terms` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `score_conversions`
--
ALTER TABLE `score_conversions`
  ADD CONSTRAINT `score_conversions_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE CASCADE ON UPDATE SET NULL;

--
-- Constraints for table `settings`
--
ALTER TABLE `settings`
  ADD CONSTRAINT `settings_current_academic_year_id_foreign` FOREIGN KEY (`current_academic_year_id`) REFERENCES `academic_years` (`id`) ON DELETE CASCADE ON UPDATE SET NULL,
  ADD CONSTRAINT `settings_current_term_id_foreign` FOREIGN KEY (`current_term_id`) REFERENCES `terms` (`id`) ON DELETE CASCADE ON UPDATE SET NULL;

--
-- Constraints for table `students`
--
ALTER TABLE `students`
  ADD CONSTRAINT `fk_students_class_id` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_students_department_id` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `students_house_id_foreign` FOREIGN KEY (`house_id`) REFERENCES `houses` (`id`) ON DELETE CASCADE ON UPDATE SET NULL;

--
-- Constraints for table `student_parents`
--
ALTER TABLE `student_parents`
  ADD CONSTRAINT `student_parents_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `parents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `student_parents_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

