-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 12, 2026 at 06:42 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `schools`
--

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

--
-- Table structure for table `attendance`
--

CREATE TABLE `attendance` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `attendance_date` date NOT NULL,
  `status` enum('Present','Late With Excuse','Leave','Absent') NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `attendance`
--

INSERT INTO `attendance` (`id`, `school_id`, `class_id`, `student_id`, `attendance_date`, `status`, `created_at`, `updated_at`) VALUES
(7, 1, 2, 5, '2026-05-10', 'Leave', '2026-05-10 04:59:31', '2026-05-10 04:59:31');

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

--
-- Table structure for table `audit_logs`
--

CREATE TABLE `audit_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `school_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `module` varchar(100) NOT NULL,
  `action` varchar(50) NOT NULL,
  `record_id` bigint(20) UNSIGNED DEFAULT NULL,
  `message` text DEFAULT NULL,
  `old_data` longtext DEFAULT NULL,
  `new_data` longtext DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `audit_logs`
--

INSERT INTO `audit_logs` (`id`, `school_id`, `user_id`, `module`, `action`, `record_id`, `message`, `old_data`, `new_data`, `ip_address`, `user_agent`, `created_at`) VALUES
(46, 1, 2, 'Authentication', 'LOGOUT', 2, 'User logged out: admin (admin)', NULL, '{\"username\":\"admin\",\"name\":\"Hello Kids\",\"role\":\"admin\",\"logout_time\":\"2026-05-10 14:07:53\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 08:37:53'),
(47, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 14:07:57\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 08:37:57'),
(48, 1, 2, 'Authentication', 'LOGOUT', 2, 'User logged out: admin (admin)', NULL, '{\"username\":\"admin\",\"name\":\"Hello Kids\",\"role\":\"admin\",\"logout_time\":\"2026-05-10 14:14:40\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 08:44:40'),
(49, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 15:19:23\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 09:49:23'),
(50, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 16:07:27\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 10:37:27'),
(51, 1, 2, 'Authentication', 'LOGOUT', 2, 'User logged out: admin (admin)', NULL, '{\"username\":\"admin\",\"name\":\"Hello Kids\",\"role\":\"admin\",\"logout_time\":\"2026-05-10 22:36:16\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:06:16'),
(52, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 22:36:20\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:06:20'),
(53, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 22:44:47\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:14:47'),
(54, 1, 2, 'Authentication', 'LOGOUT', 2, 'User logged out: admin (admin)', NULL, '{\"username\":\"admin\",\"name\":\"Hello Kids\",\"role\":\"admin\",\"logout_time\":\"2026-05-10 22:57:37\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:27:37'),
(55, 1, 4, 'Authentication', 'LOGIN', 4, 'User logged in: teacher (teacher)', NULL, '{\"username\":\"teacher\",\"role\":\"teacher\",\"name\":\"Teacher\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 22:57:43\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:27:43'),
(56, 1, 4, 'Authentication', 'LOGOUT', 4, 'User logged out: teacher (teacher)', NULL, '{\"username\":\"teacher\",\"name\":\"Teacher\",\"role\":\"teacher\",\"logout_time\":\"2026-05-10 23:00:35\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:30:35'),
(57, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 23:00:38\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:30:38'),
(58, 1, 2, 'Authentication', 'LOGOUT', 2, 'User logged out: admin (admin)', NULL, '{\"username\":\"admin\",\"name\":\"Hello Kids\",\"role\":\"admin\",\"logout_time\":\"2026-05-10 23:02:46\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:32:46'),
(59, 1, 4, 'Authentication', 'LOGIN', 4, 'User logged in: teacher (teacher)', NULL, '{\"username\":\"teacher\",\"role\":\"teacher\",\"name\":\"Teacher\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 23:02:50\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:32:50'),
(60, 1, 4, 'Authentication', 'LOGOUT', 4, 'User logged out: teacher (teacher)', NULL, '{\"username\":\"teacher\",\"name\":\"Teacher\",\"role\":\"teacher\",\"logout_time\":\"2026-05-10 23:11:24\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"session_duration\":null}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:41:24'),
(61, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 23:11:28\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 17:41:28'),
(62, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-11 21:57:22\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 16:27:22'),
(63, 1, 2, 'Salary', 'DELETE', 5, 'Salary deleted for Teacher ID 4 (Receipt: SAL-1778518943)', '{\"id\":5,\"school_id\":1,\"teacher_id\":4,\"amount\":\"0.00\",\"payment_date\":\"2026-05-11\",\"month_year\":\"May-2026\",\"remarks\":\"\",\"receipt_no\":\"SAL-1778518943\",\"created_at\":\"2026-05-11 22:32:23\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:02:34'),
(64, 1, 2, 'Salary', 'DELETE', 4, 'Salary deleted for Teacher ID 4 (Receipt: SAL-1778518848)', '{\"id\":4,\"school_id\":1,\"teacher_id\":4,\"amount\":\"0.00\",\"payment_date\":\"2026-05-11\",\"month_year\":\"May-2026\",\"remarks\":\"\",\"receipt_no\":\"SAL-1778518848\",\"created_at\":\"2026-05-11 22:30:48\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:02:36'),
(65, 1, 2, 'Salary', 'DELETE', 3, 'Salary deleted for Teacher ID 4 (Receipt: SAL-20260510134326430)', '{\"id\":3,\"school_id\":1,\"teacher_id\":4,\"amount\":\"5000.00\",\"payment_date\":\"2026-05-10\",\"month_year\":\"April-2026\",\"remarks\":null,\"receipt_no\":\"SAL-20260510134326430\",\"created_at\":\"2026-05-10 13:43:26\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:02:38'),
(66, 1, 2, 'Teachers', 'UPDATE', 4, 'Teacher updated', '{\"name\":\"Teacher 2\",\"mobile_no\":\"\",\"qualification\":\"\",\"salary\":\"0.00\"}', '{\"name\":\"Teacher 2\",\"mobile_no\":\"\",\"qualification\":\"\",\"salary\":\"6000\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:04:10'),
(67, 1, 2, 'Salary', 'DELETE', 6, 'Salary deleted for Teacher ID 4 (Receipt: SAL-1778519024)', '{\"id\":6,\"school_id\":1,\"teacher_id\":4,\"amount\":\"0.00\",\"payment_date\":\"2026-05-11\",\"month_year\":\"April-2026\",\"remarks\":\"\",\"receipt_no\":\"SAL-1778519024\",\"created_at\":\"2026-05-11 22:33:44\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:04:17'),
(68, 1, 2, 'Teachers', 'DELETE', 4, 'Teacher deleted', '{\"name\":\"Teacher 2\",\"mobile_no\":\"\",\"qualification\":\"\",\"salary\":\"6000.00\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:04:35'),
(69, 1, 2, 'Teachers', 'CREATE', 5, 'New teacher added', NULL, '{\"name\":\"Teacher 1\",\"mobile_no\":\"\",\"qualification\":\"Bed\",\"salary\":\"\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:06:13'),
(70, 1, 2, 'Teachers', 'UPDATE', 5, 'Teacher updated', '{\"name\":\"Teacher 1\",\"mobile_no\":\"\",\"qualification\":\"Bed\",\"salary\":\"0.00\"}', '{\"name\":\"Teacher 1\",\"mobile_no\":\"\",\"qualification\":\"Bed\",\"salary\":\"9000\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-11 17:06:20'),
(71, 1, 2, 'Authentication', 'LOGIN', 2, 'User logged in: admin (admin)', NULL, '{\"username\":\"admin\",\"role\":\"admin\",\"name\":\"Hello Kids\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-12 08:06:46\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 02:36:46'),
(72, 1, 2, 'Salary', 'DELETE', 11, 'Salary deleted for Teacher ID 5 (Receipt: SAL-736628CF)', '{\"id\":11,\"school_id\":1,\"teacher_id\":5,\"amount\":\"8419.35\",\"payment_date\":\"2026-05-11\",\"month_year\":\"May-2026\",\"remarks\":\"\",\"receipt_no\":\"SAL-736628CF\",\"created_at\":\"2026-05-11 22:53:37\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 02:38:20'),
(73, 1, 2, 'Salary', 'DELETE', 12, 'Salary deleted for Teacher ID 5 (Receipt: SAL-15E08EC5)', '{\"id\":12,\"school_id\":1,\"teacher_id\":5,\"amount\":\"9000.00\",\"payment_date\":\"2026-05-12\",\"month_year\":\"April-2026\",\"remarks\":\"\",\"receipt_no\":\"SAL-15E08EC5\",\"created_at\":\"2026-05-12 08:12:05\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 02:56:27'),
(74, 1, 2, 'Salary', 'DELETE', 14, 'Salary deleted for Teacher ID 5 (Receipt: SAL-12D706A4)', '{\"id\":14,\"school_id\":1,\"teacher_id\":5,\"amount\":\"300.00\",\"payment_date\":\"2026-05-12\",\"month_year\":\"May-2026\",\"remarks\":\"\",\"receipt_no\":\"SAL-12D706A4\",\"created_at\":\"2026-05-12 08:29:09\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:15:59'),
(75, 1, 2, 'Salary', 'CREATE', 16, 'Salary paid to Teacher 1 for May-2026 (₹500)', NULL, '{\"teacher_id\":5,\"teacher_name\":\"Teacher 1\",\"amount\":500,\"payment_date\":\"2026-05-12\",\"month_year\":\"May-2026\",\"receipt_no\":\"SAL-20260512084611730\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:16:11'),
(76, 1, 2, 'Salary', 'DELETE', 16, 'Salary deleted for Teacher ID 5 (Receipt: SAL-20260512084611730)', '{\"id\":16,\"school_id\":1,\"teacher_id\":5,\"amount\":\"500.00\",\"payment_date\":\"2026-05-12\",\"month_year\":\"May-2026\",\"remarks\":null,\"receipt_no\":\"SAL-20260512084611730\",\"created_at\":\"2026-05-12 08:46:11\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:16:17'),
(77, 1, 2, 'Students', 'CREATE', 9, 'New student added', NULL, '{\"name\":\"dasdasd sada\",\"roll_no\":\"12\",\"class_id\":\"2\",\"section\":\"\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:23:02'),
(78, 1, 2, 'Students', 'CREATE', 10, 'New student added', NULL, '{\"name\":\"aaaa aaaaa\",\"roll_no\":\"10\",\"class_id\":\"2\",\"section\":\"\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:28:18');

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

--
-- Table structure for table `books`
--

CREATE TABLE `books` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `book_title` varchar(255) NOT NULL,
  `book_no` varchar(100) DEFAULT NULL,
  `isbn_no` varchar(100) DEFAULT NULL,
  `publish` varchar(255) DEFAULT NULL,
  `author` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `rack_no` varchar(50) DEFAULT NULL,
  `qty` int(11) DEFAULT 0,
  `perunitcost` decimal(10,2) DEFAULT 0.00,
  `postdate` date DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `books`
--

INSERT INTO `books` (`id`, `school_id`, `book_title`, `book_no`, `isbn_no`, `publish`, `author`, `subject`, `rack_no`, `qty`, `perunitcost`, `postdate`, `description`, `created_at`) VALUES
(1, 2, 'dsaa', 'dsada', 'dsaasd', 'dsad1', 'sa3d1a', '1dsa32d', '1ds32d1', 320, 0.00, '2026-01-31', 'sdasdasd12a', '2026-05-06 17:33:05'),
(3, 7, 'jflkdsj', 'jfflkjs`', 'jslkj`lfjlskfj`ljalskj`', 'jsdlksjf', 'ljsalkj', 'lkjdslkj', 'lklkjasl', 50, 500.00, '2026-05-08', 'asdjhad', '2026-05-08 07:41:02'),
(4, 1, 'sdjfsdlfj', 'jdfj', 'lkdj', 'jslkdj', 'lkjlkj', 'qlkslkdj', 'lkjslkjsaj', 50, 500.00, '2026-05-10', 'sd', '2026-05-10 05:05:57');

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

--
-- Table structure for table `book_issues`
--

CREATE TABLE `book_issues` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `book_id` int(11) NOT NULL,
  `member_id` int(11) NOT NULL,
  `issue_date` date NOT NULL,
  `due_date` date NOT NULL,
  `return_date` date DEFAULT NULL,
  `status` enum('Issued','Returned') DEFAULT 'Issued'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `book_issues`
--

INSERT INTO `book_issues` (`id`, `school_id`, `book_id`, `member_id`, `issue_date`, `due_date`, `return_date`, `status`) VALUES
(1, 2, 1, 2, '2026-05-06', '2026-05-12', '2026-05-06', 'Returned'),
(2, 1, 4, 3, '2026-05-10', '2026-05-10', '2026-05-10', 'Returned');

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

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

CREATE TABLE `classes` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `class_name` varchar(100) NOT NULL,
  `section` varchar(50) DEFAULT NULL,
  `house` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `classes` (`id`, `school_id`, `class_name`, `section`, `house`, `created_at`, `updated_at`) VALUES
(2, 1, 'LKG', 'A', NULL, '2026-05-05 18:04:21', '2026-05-05 18:04:21'),
(4, 2, '1st', 'A', NULL, '2026-05-05 18:06:43', '2026-05-05 18:06:43'),
(5, 2, '2nd', 'A', NULL, '2026-05-06 06:59:02', '2026-05-06 06:59:02'),
(6, 2, 'LKG', 'A', NULL, '2026-05-06 06:59:12', '2026-05-06 06:59:12'),
(7, 5, '9th', 'A', NULL, '2026-05-08 05:31:51', '2026-05-08 05:31:51'),
(8, 3, '10', 'A', NULL, '2026-05-08 05:32:11', '2026-05-08 05:32:11'),
(9, 7, '12th', NULL, NULL, '2026-05-08 07:38:01', '2026-05-08 07:38:01'),
(11, 1, 'UKG', 'A', NULL, '2026-05-08 07:42:57', '2026-05-08 07:42:57');

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

--
-- Table structure for table `class_fees`
--

CREATE TABLE `class_fees` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `total_fees` decimal(10,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `class_fees`
--

INSERT INTO `class_fees` (`id`, `school_id`, `class_id`, `total_fees`, `created_at`) VALUES
(2, 2, 4, 16000.00, '2026-05-06 08:08:38'),
(3, 2, 5, 18000.00, '2026-05-06 08:08:47'),
(4, 2, 6, 12000.00, '2026-05-06 08:08:52'),
(5, 1, 2, 5000.00, '2026-05-09 17:02:58');

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

--
-- Table structure for table `class_subject_teachers`
--

CREATE TABLE `class_subject_teachers` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `teacher_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `drivers`
--

CREATE TABLE `drivers` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `name` varchar(150) DEFAULT NULL,
  `license_no` varchar(50) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `drivers`
--

INSERT INTO `drivers` (`id`, `school_id`, `name`, `license_no`, `phone`, `status`) VALUES
(1, 2, 'Driver 1', 'Dl-12-ddas54', '9876543210', 'Active');

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

--
-- Table structure for table `exam_marks`
--

CREATE TABLE `exam_marks` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `exam_type_id` int(10) UNSIGNED NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `schedule_id` int(11) DEFAULT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `marks_obtained` decimal(5,2) DEFAULT NULL,
  `total_marks` decimal(5,2) DEFAULT NULL,
  `attendance_status` enum('Present','Absent') DEFAULT 'Present',
  `grade` varchar(5) DEFAULT '',
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_marks`
--

INSERT INTO `exam_marks` (`id`, `school_id`, `exam_type_id`, `class_id`, `schedule_id`, `student_id`, `subject_id`, `marks_obtained`, `total_marks`, `attendance_status`, `grade`, `remarks`, `created_at`, `updated_at`) VALUES
(1, 2, 2, 4, 1, 2, 3, 65.00, 80.00, 'Present', '', '', '2026-05-07 18:13:29', '2026-05-07 18:13:29'),
(2, 2, 2, 4, 2, 2, 2, 65.00, 80.00, 'Present', '', '', '2026-05-07 18:13:29', '2026-05-07 18:13:29'),
(3, 1, 4, 2, 3, 5, 6, 80.00, 100.00, 'Present', '', '', '2026-05-10 08:00:49', '2026-05-10 08:00:49');

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

--
-- Table structure for table `exam_results`
--

CREATE TABLE `exam_results` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `school_id` bigint(20) UNSIGNED NOT NULL,
  `exam_type_id` bigint(20) UNSIGNED NOT NULL,
  `class_id` bigint(20) UNSIGNED NOT NULL,
  `student_id` bigint(20) UNSIGNED NOT NULL,
  `session_year` varchar(20) NOT NULL,
  `total_subjects` int(11) NOT NULL DEFAULT 0,
  `total_marks` decimal(8,2) NOT NULL DEFAULT 0.00,
  `obtained_marks` decimal(8,2) NOT NULL DEFAULT 0.00,
  `percentage` decimal(6,2) NOT NULL DEFAULT 0.00,
  `overall_grade` varchar(20) DEFAULT NULL,
  `rank_position` int(11) DEFAULT NULL,
  `result_status` enum('Pass','Fail') DEFAULT 'Pass',
  `remarks` text DEFAULT NULL,
  `is_published` tinyint(1) NOT NULL DEFAULT 0,
  `generated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_results`
--

INSERT INTO `exam_results` (`id`, `school_id`, `exam_type_id`, `class_id`, `student_id`, `session_year`, `total_subjects`, `total_marks`, `obtained_marks`, `percentage`, `overall_grade`, `rank_position`, `result_status`, `remarks`, `is_published`, `generated_at`, `updated_at`) VALUES
(1, 2, 2, 4, 2, '2026-27', 2, 160.00, 130.00, 81.25, 'A', 1, 'Pass', NULL, 1, '2026-05-07 18:13:36', '2026-05-07 18:14:07'),
(2, 2, 3, 4, 2, '2026-27', 2, 100.00, 24.38, 24.38, 'F', 1, 'Pass', 'Final consolidated result generated', 0, '2026-05-08 04:17:52', '2026-05-08 04:17:52'),
(3, 1, 4, 2, 5, '2026-27', 1, 100.00, 80.00, 80.00, 'A', 1, 'Pass', NULL, 1, '2026-05-10 08:01:30', '2026-05-10 08:01:59');

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

--
-- Table structure for table `exam_result_details`
--

CREATE TABLE `exam_result_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `school_id` bigint(20) UNSIGNED NOT NULL,
  `result_id` bigint(20) UNSIGNED NOT NULL,
  `exam_type_id` bigint(20) UNSIGNED NOT NULL,
  `class_id` bigint(20) UNSIGNED NOT NULL,
  `student_id` bigint(20) UNSIGNED NOT NULL,
  `subject_id` bigint(20) UNSIGNED NOT NULL,
  `schedule_id` bigint(20) UNSIGNED DEFAULT NULL,
  `total_marks` decimal(5,2) NOT NULL DEFAULT 0.00,
  `obtained_marks` decimal(5,2) NOT NULL DEFAULT 0.00,
  `subject_grade` varchar(20) DEFAULT NULL,
  `attendance_status` enum('Present','Absent') DEFAULT 'Present',
  `result_status` enum('Pass','Fail') DEFAULT 'Pass',
  `remarks` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_result_details`
--

INSERT INTO `exam_result_details` (`id`, `school_id`, `result_id`, `exam_type_id`, `class_id`, `student_id`, `subject_id`, `schedule_id`, `total_marks`, `obtained_marks`, `subject_grade`, `attendance_status`, `result_status`, `remarks`, `created_at`, `updated_at`) VALUES
(1, 2, 1, 2, 4, 2, 3, 1, 80.00, 65.00, NULL, 'Present', 'Pass', NULL, '2026-05-07 18:13:36', '2026-05-07 18:13:36'),
(2, 2, 1, 2, 4, 2, 2, 2, 80.00, 65.00, NULL, 'Present', 'Pass', NULL, '2026-05-07 18:13:36', '2026-05-07 18:13:36'),
(3, 1, 3, 4, 2, 5, 6, 3, 100.00, 80.00, NULL, 'Present', 'Pass', NULL, '2026-05-10 08:01:30', '2026-05-10 08:01:30');

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

--
-- Table structure for table `exam_schedule`
--

CREATE TABLE `exam_schedule` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `exam_type_id` int(10) UNSIGNED NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `exam_date` date DEFAULT NULL,
  `max_marks` decimal(5,2) DEFAULT NULL,
  `no_exam` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `session_year` varchar(10) DEFAULT '2026-27'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_schedule`
--

INSERT INTO `exam_schedule` (`id`, `school_id`, `exam_type_id`, `class_id`, `subject_id`, `exam_date`, `max_marks`, `no_exam`, `created_at`, `session_year`) VALUES
(1, 2, 2, 4, 3, '2026-05-07', 80.00, 0, '2026-05-07 17:39:30', '2026-27'),
(2, 2, 2, 4, 2, '2026-05-08', 80.00, 0, '2026-05-07 17:39:30', '2026-27'),
(3, 1, 4, 2, 6, '2026-05-01', 100.00, 0, '2026-05-10 08:00:32', '2026-27');

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

--
-- Table structure for table `exam_types`
--

CREATE TABLE `exam_types` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `exam_name` varchar(100) NOT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_types`
--

INSERT INTO `exam_types` (`id`, `school_id`, `exam_name`, `status`, `created_at`, `updated_at`) VALUES
(1, 2, 'Unit Test', 'Active', '2026-05-07 17:26:53', '2026-05-07 17:26:53'),
(2, 2, 'Half Yearly', 'Active', '2026-05-07 17:26:59', '2026-05-07 17:27:07'),
(3, 2, 'Final Result', 'Active', '2026-05-08 04:17:52', '2026-05-08 04:17:52'),
(4, 1, 'Half Yearly', 'Active', '2026-05-10 07:35:37', '2026-05-10 07:35:37');

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `description` text DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_mode` varchar(50) DEFAULT NULL,
  `payment_date` date NOT NULL,
  `receipt_no` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `expenses`
--

INSERT INTO `expenses` (`id`, `school_id`, `category_id`, `description`, `amount`, `payment_mode`, `payment_date`, `receipt_no`, `created_at`) VALUES
(1, 2, 1, 'Bill', 1200.00, 'Cash', '2026-05-06', 'EXP-20260506224506518', '2026-05-06 17:15:06'),
(2, 2, 2, 'water bill', 600.00, 'Cash', '2026-05-06', 'EXP-20260506224543482', '2026-05-06 17:15:43'),
(4, 1, 7, 'Salary Paid to fsdf for April-2026', 5000.00, 'Bank Transfer', '2026-05-09', 'SAL-20260509141540548', '2026-05-09 08:45:40'),
(5, 1, 5, 'light bill', 500.00, 'Cash', '2026-05-10', 'EXP-20260510122040192', '2026-05-10 06:50:40'),
(6, 7, 8, 'Light', 500.00, 'Cash', '2026-05-10', 'EXP-20260510124518596', '2026-05-10 07:15:18');

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

--
-- Table structure for table `expense_categories`
--

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

--
-- Dumping data for table `expense_categories`
--

INSERT INTO `expense_categories` (`id`, `school_id`, `name`, `created_at`) VALUES
(1, 2, 'Electricity Bill', '2026-05-06 17:07:57'),
(2, 2, 'Water bill', '2026-05-06 17:15:30'),
(3, 2, 'Salary', '2026-05-06 17:20:33'),
(4, 1, 'bills', '2026-05-08 07:47:44'),
(5, 1, 'bill', '2026-05-08 07:48:59'),
(6, 1, 'electric', '2026-05-08 07:52:35'),
(7, 1, 'Salary', '2026-05-09 08:45:40'),
(8, 7, 'Bills', '2026-05-10 07:15:07');

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

--
-- Table structure for table `fee_payments`
--

CREATE TABLE `fee_payments` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `paid_amount` decimal(10,2) NOT NULL,
  `payment_date` date DEFAULT NULL,
  `receipt_no` varchar(20) DEFAULT NULL,
  `payment_mode` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fee_payments`
--

INSERT INTO `fee_payments` (`id`, `school_id`, `student_id`, `paid_amount`, `payment_date`, `receipt_no`, `payment_mode`, `created_at`) VALUES
(18, 1, 5, 500.00, '2026-05-09', 'REC-001', 'Cash', '2026-05-10 04:09:44'),
(19, 1, 5, 5500.00, '2026-05-10', 'REC-002', 'Cash', '2026-05-10 04:10:19'),
(23, 2, 2, 500.00, '2026-05-05', 'hel-0004', 'Cash', '2026-05-10 04:43:58'),
(24, 2, 2, 600.00, '2026-05-06', 'hel-0005', 'Cash', '2026-05-10 04:44:15'),
(25, 2, 2, 800.00, '2026-05-08', 'hel-0006', 'Cash', '2026-05-10 04:44:42');

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

--
-- Table structure for table `income`
--

CREATE TABLE `income` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_mode` varchar(50) DEFAULT NULL,
  `payment_date` date DEFAULT NULL,
  `receipt_no` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `income`
--

INSERT INTO `income` (`id`, `school_id`, `category_id`, `description`, `amount`, `payment_mode`, `payment_date`, `receipt_no`, `created_at`) VALUES
(3, 7, 3, 'Bhangar', 500.00, 'Cash', '2026-05-10', 'INC-1778397834', '2026-05-10 07:23:54'),
(4, 7, 4, 'Kids table', 2000.00, 'Cash', '2026-05-11', 'INC-1778397875', '2026-05-10 07:24:35'),
(5, 1, 2, 'paper scrap', 5100.00, 'Cash', '2026-05-10', 'INC-1778397909', '2026-05-10 07:25:09');

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

--
-- Table structure for table `income_categories`
--

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

--
-- Dumping data for table `income_categories`
--

INSERT INTO `income_categories` (`id`, `school_id`, `name`, `created_at`) VALUES
(1, 2, 'Bhangar', '2026-05-06 16:18:27'),
(2, 1, 'Bhangar', '2026-05-10 07:04:20'),
(3, 7, 'Bhangar', '2026-05-10 07:14:28'),
(4, 7, 'Science Fair', '2026-05-10 07:24:17');

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

--
-- Table structure for table `inventory_items`
--

CREATE TABLE `inventory_items` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `category` varchar(50) DEFAULT NULL,
  `unit` varchar(20) DEFAULT 'pcs',
  `min_stock_level` int(11) DEFAULT 2,
  `current_stock` int(11) DEFAULT 0,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `inventory_items`
--

INSERT INTO `inventory_items` (`id`, `school_id`, `name`, `category`, `unit`, `min_stock_level`, `current_stock`, `updated_at`) VALUES
(1, 2, 'Scissors', 'Stationary', 'pcs', 2, 4, '2026-05-06 17:25:32'),
(3, 1, 'lkfhdskjfh', 'hdskj', 'pcs', 2, 3, '2026-05-10 07:31:14');

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

--
-- Table structure for table `inventory_logs`
--

CREATE TABLE `inventory_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `item_id` int(10) UNSIGNED NOT NULL,
  `quantity` int(11) NOT NULL,
  `type` enum('IN','OUT') NOT NULL,
  `issued_to` varchar(150) DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `inventory_logs`
--

INSERT INTO `inventory_logs` (`id`, `school_id`, `item_id`, `quantity`, `type`, `issued_to`, `remarks`, `created_at`) VALUES
(1, 2, 1, 1, 'OUT', NULL, 'teacher 1', '2026-05-06 17:25:32'),
(2, 1, 3, 2, 'OUT', NULL, 'sjhdsa', '2026-05-10 07:31:14');

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

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `invoice_no` varchar(50) NOT NULL,
  `plan_name` varchar(100) NOT NULL,
  `amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `billing_cycle` enum('Monthly','Quarterly','Yearly') NOT NULL DEFAULT 'Yearly',
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `payment_status` enum('Pending','Paid','Cancelled') NOT NULL DEFAULT 'Pending',
  `payment_method` varchar(50) DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `invoices`
--

INSERT INTO `invoices` (`id`, `school_id`, `invoice_no`, `plan_name`, `amount`, `billing_cycle`, `start_date`, `end_date`, `payment_status`, `payment_method`, `remarks`, `created_at`, `updated_at`) VALUES
(2, 3, 'INV-334FE5F4', 'sdasd', 5000.00, 'Yearly', '2025-05-12', '2026-05-11', 'Paid', 'cash', '', '2026-05-12 03:42:49', '2026-05-12 03:42:49');

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

--
-- Table structure for table `library_members`
--

CREATE TABLE `library_members` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `user_type` enum('Student','Teacher') NOT NULL,
  `reference_id` int(11) NOT NULL,
  `library_card_no` varchar(50) DEFAULT NULL,
  `card_no` varchar(50) NOT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `library_members`
--

INSERT INTO `library_members` (`id`, `school_id`, `user_type`, `reference_id`, `library_card_no`, `card_no`, `status`) VALUES
(2, 2, 'Student', 2, NULL, '121', 'Active'),
(3, 1, 'Student', 7, NULL, 'asdad', 'Active');

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

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `message` text NOT NULL,
  `for_role` enum('all','student','teacher','parent','admin') DEFAULT 'all',
  `class_id` int(10) UNSIGNED DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `school_id`, `title`, `message`, `for_role`, `class_id`, `is_active`, `created_at`) VALUES
(3, 1, 'dasd', 'sadsada', 'all', NULL, 1, '2026-05-10 08:07:12');

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

--
-- Table structure for table `period_settings`
--

CREATE TABLE `period_settings` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `total_periods` int(11) NOT NULL DEFAULT 8,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `period_settings`
--

INSERT INTO `period_settings` (`id`, `school_id`, `total_periods`, `created_at`, `updated_at`) VALUES
(1, 2, 7, '2026-05-06 06:51:09', '2026-05-06 07:14:14');

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

--
-- Table structure for table `receipt_settings`
--

CREATE TABLE `receipt_settings` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `prefix` varchar(10) DEFAULT 'REC',
  `next_number` int(11) DEFAULT 1,
  `padding` int(11) DEFAULT 6,
  `school_name` varchar(100) DEFAULT 'Your School',
  `default_mode` varchar(20) DEFAULT 'Cash',
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `receipt_settings`
--

INSERT INTO `receipt_settings` (`id`, `school_id`, `prefix`, `next_number`, `padding`, `school_name`, `default_mode`, `updated_at`) VALUES
(1, 7, 'REC', 1, 3, 'priyanka', 'Cash', '2026-05-10 04:36:39'),
(2, 1, 'Hello', 1, 3, 'Hello Kids', 'Cash', '2026-05-10 04:38:21'),
(3, 2, 'hel', 7, 4, 'helloo kids', 'Cash', '2026-05-10 04:44:42');

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

--
-- Table structure for table `routes`
--

CREATE TABLE `routes` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `route_title` varchar(150) DEFAULT NULL,
  `fare` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `routes`
--

INSERT INTO `routes` (`id`, `school_id`, `route_title`, `fare`) VALUES
(1, 2, 'Indore', 1500.00);

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

--
-- Table structure for table `salary_payments`
--

CREATE TABLE `salary_payments` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `teacher_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_date` date NOT NULL,
  `month_year` varchar(20) NOT NULL,
  `remarks` text DEFAULT NULL,
  `receipt_no` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `salary_payments`
--

INSERT INTO `salary_payments` (`id`, `school_id`, `teacher_id`, `amount`, `payment_date`, `month_year`, `remarks`, `receipt_no`, `created_at`) VALUES
(13, 1, 5, 4600.00, '2026-05-12', 'April-2026', '', 'SAL-9581F152', '2026-05-12 02:58:38'),
(15, 1, 5, 4500.00, '2026-05-12', 'February-2026', '', 'SAL-B13E1A44', '2026-05-12 03:03:42'),
(17, 1, 5, 300.00, '2026-05-12', 'May-2026', '', 'SAL-9D59E27D', '2026-05-12 03:16:25');

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

--
-- Table structure for table `schools`
--

CREATE TABLE `schools` (
  `id` int(11) NOT NULL,
  `name` varchar(200) NOT NULL,
  `school_code` varchar(50) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `admin_name` varchar(100) DEFAULT NULL,
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `subscription_status` enum('Trial','Active','Expired') DEFAULT 'Trial',
  `subscription_start` date DEFAULT NULL,
  `subscription_end` date DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  `last_login_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `schools`
--

INSERT INTO `schools` (`id`, `name`, `school_code`, `address`, `phone`, `email`, `logo`, `admin_name`, `username`, `password`, `status`, `subscription_status`, `subscription_start`, `subscription_end`, `last_login`, `last_login_ip`, `created_at`) VALUES
(1, 'Hello Kids', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Trial', NULL, NULL, NULL, NULL, '2026-05-05 16:47:48'),
(2, 'helloo kids', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Trial', NULL, NULL, NULL, NULL, '2026-05-05 16:57:57'),
(3, 'Bella Kids', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Active', '2025-05-12', '2026-05-11', NULL, NULL, '2026-05-08 05:01:59'),
(4, 'chaalis chor', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Trial', NULL, NULL, NULL, NULL, '2026-05-08 05:19:24'),
(5, 'fools academy', NULL, NULL, '', '', NULL, NULL, NULL, NULL, 'active', 'Active', '2026-05-05', '2027-05-05', NULL, NULL, '2026-05-08 05:31:24'),
(6, 'tools school', NULL, NULL, '', '', NULL, NULL, NULL, NULL, 'inactive', 'Expired', '2026-04-08', '2027-05-07', NULL, NULL, '2026-05-08 06:55:36'),
(7, 'priyanka', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Active', '2026-05-08', '2027-05-08', NULL, NULL, '2026-05-08 07:08:37'),
(8, 'ravi', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Active', '2026-05-10', '2027-05-10', NULL, NULL, '2026-05-10 08:33:51'),
(9, 'ravi123', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Active', '2026-05-10', '2027-05-10', NULL, NULL, '2026-05-10 08:34:57'),
(10, 'qwerty', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Active', '2026-05-10', '2027-05-10', NULL, NULL, '2026-05-10 08:36:53'),
(11, 'asdfgh', NULL, NULL, '', '', NULL, NULL, NULL, NULL, 'inactive', 'Active', '2026-05-10', '2027-05-10', NULL, NULL, '2026-05-10 08:43:34'),
(12, 'plmkoij', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active', 'Active', '2026-05-10', '2027-05-10', NULL, NULL, '2026-05-10 10:15:36');

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

--
-- Table structure for table `school_settings`
--

CREATE TABLE `school_settings` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `school_name` varchar(255) NOT NULL,
  `school_address` text DEFAULT NULL,
  `school_phone` varchar(50) DEFAULT NULL,
  `school_email` varchar(100) DEFAULT NULL,
  `school_website` varchar(100) DEFAULT NULL,
  `school_reg_no` varchar(100) DEFAULT NULL,
  `dise_code` varchar(100) DEFAULT NULL,
  `current_session` varchar(50) DEFAULT NULL,
  `language` varchar(50) DEFAULT 'en',
  `currency` varchar(10) DEFAULT 'INR',
  `timezone` varchar(100) DEFAULT 'Asia/Kolkata',
  `date_format` varchar(30) DEFAULT 'd-m-Y',
  `result_pattern` varchar(50) DEFAULT NULL,
  `school_logo` varchar(255) DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `school_settings`
--

INSERT INTO `school_settings` (`id`, `school_id`, `school_name`, `school_address`, `school_phone`, `school_email`, `school_website`, `school_reg_no`, `dise_code`, `current_session`, `language`, `currency`, `timezone`, `date_format`, `result_pattern`, `school_logo`, `updated_at`) VALUES
(1, 2, 'Hello Kids School', 'Neemuch, Madhya Pradesh - 458441', '9876543210', 'info@hellokidsschool.com', 'www.hellokidsschool.com', 'CPS2026MP', '23345678901', '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', 'CBSE', '1778172531_1389.png', '2026-05-07 16:48:51'),
(2, 1, 'Hello Kids', 'Neemuch', '1234567890', 'Hello@admin.com', '', '12364', '134654', '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', '', '', '2026-05-10 08:17:20'),
(3, 4, 'chaalis chor', NULL, NULL, NULL, NULL, NULL, NULL, '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-08 05:19:24'),
(4, 5, 'fools academy', '', '', '', '', NULL, '', '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-08 05:38:13'),
(5, 6, 'tools school', '', '', '', '', NULL, '', '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-08 07:02:29'),
(6, 7, 'priyanka', NULL, NULL, NULL, NULL, NULL, NULL, '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-08 07:08:37'),
(7, 8, 'ravi', NULL, NULL, NULL, NULL, NULL, NULL, '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-10 08:33:57'),
(8, 9, 'ravi123', NULL, NULL, NULL, NULL, NULL, NULL, '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-10 08:34:57'),
(9, 10, 'qwerty', NULL, NULL, NULL, NULL, NULL, NULL, '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-10 08:36:53'),
(10, 11, 'asdfgh', '', '', '', '', NULL, '', '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-10 10:15:01'),
(11, 12, 'plmkoij', NULL, NULL, NULL, NULL, NULL, NULL, '2026-27', 'en', 'INR', 'Asia/Kolkata', 'd-m-Y', NULL, NULL, '2026-05-10 10:15:36');

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

--
-- Table structure for table `staff_attendance`
--

CREATE TABLE `staff_attendance` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `staff_id` int(11) NOT NULL,
  `attendance_date` date NOT NULL,
  `status` enum('Present','Absent','Leave','Half Day') NOT NULL DEFAULT 'Present',
  `remarks` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `staff_attendance`
--

INSERT INTO `staff_attendance` (`id`, `school_id`, `staff_id`, `attendance_date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES
(16, 1, 5, '2026-05-01', 'Present', '', '2026-05-12 02:39:21', '2026-05-12 02:39:21'),
(17, 1, 5, '2026-04-01', 'Present', '', '2026-05-12 02:39:38', '2026-05-12 02:39:38'),
(18, 1, 5, '2026-04-02', 'Present', '', '2026-05-12 02:39:52', '2026-05-12 02:39:52'),
(19, 1, 5, '2026-04-03', 'Present', '', '2026-05-12 02:39:59', '2026-05-12 02:39:59'),
(20, 1, 5, '2026-04-04', 'Present', '', '2026-05-12 02:40:07', '2026-05-12 02:40:07'),
(21, 1, 5, '2026-04-06', 'Present', '', '2026-05-12 02:40:13', '2026-05-12 02:40:13'),
(22, 1, 5, '2026-04-07', 'Present', '', '2026-05-12 02:40:19', '2026-05-12 02:40:19'),
(23, 1, 5, '2026-04-08', 'Present', '', '2026-05-12 02:40:24', '2026-05-12 02:40:24'),
(24, 1, 5, '2026-04-09', 'Present', '', '2026-05-12 02:40:31', '2026-05-12 02:40:31'),
(25, 1, 5, '2026-04-10', 'Present', '', '2026-05-12 02:40:37', '2026-05-12 02:40:37'),
(26, 1, 5, '2026-04-11', 'Present', '', '2026-05-12 02:40:45', '2026-05-12 02:40:45'),
(27, 1, 5, '2026-04-12', 'Present', '', '2026-05-12 02:40:56', '2026-05-12 02:40:56'),
(28, 1, 5, '2026-04-13', 'Present', '', '2026-05-12 02:41:03', '2026-05-12 02:41:03'),
(29, 1, 5, '2026-04-14', 'Present', '', '2026-05-12 02:41:09', '2026-05-12 02:41:09'),
(30, 1, 5, '2026-04-15', 'Present', '', '2026-05-12 02:41:13', '2026-05-12 02:41:13'),
(31, 1, 5, '2026-04-16', 'Present', '', '2026-05-12 02:41:31', '2026-05-12 02:41:31'),
(32, 1, 5, '2026-02-01', 'Present', '', '2026-05-12 03:02:32', '2026-05-12 03:02:32'),
(33, 1, 5, '2026-02-02', 'Present', '', '2026-05-12 03:02:37', '2026-05-12 03:02:37'),
(34, 1, 5, '2026-02-03', 'Present', '', '2026-05-12 03:02:40', '2026-05-12 03:02:40'),
(35, 1, 5, '2026-02-04', 'Present', '', '2026-05-12 03:02:45', '2026-05-12 03:02:45'),
(36, 1, 5, '2026-02-08', 'Present', '', '2026-05-12 03:02:49', '2026-05-12 03:02:49'),
(37, 1, 5, '2026-02-09', 'Present', '', '2026-05-12 03:02:53', '2026-05-12 03:02:53'),
(38, 1, 5, '2026-02-10', 'Present', '', '2026-05-12 03:02:57', '2026-05-12 03:02:57'),
(39, 1, 5, '2026-02-12', 'Present', '', '2026-05-12 03:03:01', '2026-05-12 03:03:01'),
(40, 1, 5, '2026-02-14', 'Present', '', '2026-05-12 03:03:16', '2026-05-12 03:03:16'),
(41, 1, 5, '2026-02-15', 'Present', '', '2026-05-12 03:03:20', '2026-05-12 03:03:20'),
(42, 1, 5, '2026-02-16', 'Present', '', '2026-05-12 03:03:23', '2026-05-12 03:03:23'),
(43, 1, 5, '2026-02-17', 'Present', '', '2026-05-12 03:03:28', '2026-05-12 03:03:28'),
(44, 1, 5, '2026-02-21', 'Present', '', '2026-05-12 03:03:31', '2026-05-12 03:03:31'),
(45, 1, 5, '2026-02-25', 'Present', '', '2026-05-12 03:03:35', '2026-05-12 03:03:35');

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

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

CREATE TABLE `students` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `roll_no` varchar(50) NOT NULL,
  `name` varchar(150) NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `section` varchar(20) DEFAULT NULL,
  `admission_date` date DEFAULT NULL,
  `father_name` varchar(150) DEFAULT NULL,
  `mother_name` varchar(150) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(150) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `dob` date DEFAULT NULL,
  `apaar_id` varchar(50) DEFAULT NULL,
  `pen_no` varchar(50) DEFAULT NULL,
  `admission_no` varchar(50) DEFAULT NULL,
  `enrollment_no` varchar(50) DEFAULT NULL,
  `first_name` varchar(100) DEFAULT NULL,
  `last_name` varchar(100) DEFAULT NULL,
  `gender` enum('Male','Female','Other') DEFAULT NULL,
  `blood_group` varchar(5) DEFAULT NULL,
  `prev_school_name` varchar(200) DEFAULT NULL,
  `prev_class_studied` varchar(50) DEFAULT NULL,
  `appeared_prev_exam` varchar(100) DEFAULT NULL,
  `prev_exam_result` varchar(50) DEFAULT NULL,
  `marks_percentage` decimal(5,2) DEFAULT NULL,
  `class_rank` varchar(20) DEFAULT NULL,
  `attendance_prev_year` varchar(20) DEFAULT NULL,
  `aadhaar_no` varchar(20) DEFAULT NULL,
  `name_as_per_aadhaar` varchar(150) DEFAULT NULL,
  `samagra_id` varchar(20) DEFAULT NULL,
  `family_sssmid` varchar(20) DEFAULT NULL,
  `category` varchar(20) DEFAULT NULL,
  `caste` varchar(50) DEFAULT NULL,
  `religion` varchar(50) DEFAULT NULL,
  `minority_group` varchar(50) DEFAULT NULL,
  `mother_tongue` varchar(50) DEFAULT NULL,
  `digital_caste_cert_no` varchar(50) DEFAULT NULL,
  `is_bpl` tinyint(1) DEFAULT 0,
  `is_rte` tinyint(1) DEFAULT 0,
  `is_ews` tinyint(1) DEFAULT 0,
  `ladli_laxmi_no` varchar(50) DEFAULT NULL,
  `annual_income` decimal(12,2) DEFAULT NULL,
  `bank_acc_no` varchar(30) DEFAULT NULL,
  `bank_name` varchar(100) DEFAULT NULL,
  `ifsc_code` varchar(20) DEFAULT NULL,
  `opening_balance` decimal(12,2) DEFAULT NULL,
  `father_phone` varchar(20) DEFAULT NULL,
  `father_occupation` varchar(100) DEFAULT NULL,
  `father_dob` date DEFAULT NULL,
  `mother_phone` varchar(20) DEFAULT NULL,
  `mother_occupation` varchar(100) DEFAULT NULL,
  `mother_dob` date DEFAULT NULL,
  `guardian_name` varchar(150) DEFAULT NULL,
  `guardian_relation` varchar(50) DEFAULT NULL,
  `guardian_phone` varchar(20) DEFAULT NULL,
  `guardian_occupation` varchar(100) DEFAULT NULL,
  `guardian_address` text DEFAULT NULL,
  `sibling_details` text DEFAULT NULL,
  `permanent_address` text DEFAULT NULL,
  `state` varchar(50) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `village` varchar(50) DEFAULT NULL,
  `pincode` varchar(10) DEFAULT NULL,
  `alt_mobile` varchar(20) DEFAULT NULL,
  `is_out_of_school` tinyint(1) DEFAULT 0,
  `mainstreamed_status` varchar(50) DEFAULT NULL,
  `transport_route` varchar(100) DEFAULT NULL,
  `transport_fees` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `students` (`id`, `school_id`, `roll_no`, `name`, `class_id`, `section`, `admission_date`, `father_name`, `mother_name`, `address`, `phone`, `email`, `photo`, `status`, `created_at`, `updated_at`, `dob`, `apaar_id`, `pen_no`, `admission_no`, `enrollment_no`, `first_name`, `last_name`, `gender`, `blood_group`, `prev_school_name`, `prev_class_studied`, `appeared_prev_exam`, `prev_exam_result`, `marks_percentage`, `class_rank`, `attendance_prev_year`, `aadhaar_no`, `name_as_per_aadhaar`, `samagra_id`, `family_sssmid`, `category`, `caste`, `religion`, `minority_group`, `mother_tongue`, `digital_caste_cert_no`, `is_bpl`, `is_rte`, `is_ews`, `ladli_laxmi_no`, `annual_income`, `bank_acc_no`, `bank_name`, `ifsc_code`, `opening_balance`, `father_phone`, `father_occupation`, `father_dob`, `mother_phone`, `mother_occupation`, `mother_dob`, `guardian_name`, `guardian_relation`, `guardian_phone`, `guardian_occupation`, `guardian_address`, `sibling_details`, `permanent_address`, `state`, `city`, `village`, `pincode`, `alt_mobile`, `is_out_of_school`, `mainstreamed_status`, `transport_route`, `transport_fees`) VALUES
(2, 2, '1', 'Student 1', 4, '', '2026-05-05', 'dasd', 's4as6d5', '654dsa65da65', NULL, NULL, '1778005523_8684.jpg', 'Active', '2026-05-05 18:25:23', '2026-05-05 18:25:23', '2026-05-05', '654ds654das65', '65d456sd65as4', NULL, NULL, 'Student', '1', 'Female', 'A+', 'dssad', 'sadas', 'dsadas', 'sadasdas', 999.99, 'dsa56d4a', 'dsa65d4a', '54654', '5d4sa65d4as65d4', '654dsa65d4as654', '65d4sa65d4654', 'OBC', '654dsa56d4', '65d4sa65d4', '65dsa65d4as65d4sa65d4as65d4sa65d4', 'd4sa6d5a4s', '4654s6d54a6', 0, 0, 0, NULL, 64654654.00, '4D54SA6A54D', '654D65SD4A65', 'D6AS65D4', NULL, '554', '454', NULL, '5465', '564dsa65d4', NULL, '654das65d4', '65das65d654', '54654', NULL, NULL, NULL, '56dsa65d6', '54ds65das65', '65d4s65d4a654', '65d4sa65d4', '654656', NULL, 0, 'No', '65D4AS65D4', 6546546.00),
(4, 7, '', 'dsas ', 9, '', '0000-00-00', '', '', '', NULL, NULL, '', 'Active', '2026-05-08 07:38:21', '2026-05-08 07:38:21', '0000-00-00', '', '', NULL, NULL, 'dsas', '', 'Male', '', '', '', '', '', 0.00, '', '', '', '', '', '', 'General', '', '', '', '', '', 0, 0, 0, NULL, 0.00, '', '', '', NULL, '', '', NULL, '', '', NULL, '', '', '', NULL, NULL, NULL, '', '', '', '', '', NULL, 0, 'No', '', 0.00),
(5, 1, '', 'sadasd ', 2, '', '0000-00-00', '', '', '', NULL, NULL, '', 'Active', '2026-05-08 07:58:01', '2026-05-08 07:58:01', '0000-00-00', '', '', NULL, NULL, 'sadasd', '', 'Male', '', '', '', '', '', 0.00, '', '', '', '', '', '', 'General', '', '', '', '', '', 0, 0, 0, NULL, 0.00, '', '', '', NULL, '', '', NULL, '', '', NULL, '', '', '', NULL, NULL, NULL, '', '', '', '', '', NULL, 0, 'No', '', 0.00),
(7, 1, '', 'ddasdas ', 11, '', '0000-00-00', '', '', '', NULL, NULL, '', 'Active', '2026-05-09 17:55:42', '2026-05-09 17:55:42', '0000-00-00', '', '', NULL, NULL, 'ddasdas', '', 'Male', '', '', '', '', '', 0.00, '', '', '', '', '', '', 'General', '', '', '', '', '', 0, 0, 0, NULL, 0.00, '', '', '', NULL, '', '', NULL, '', '', NULL, '', '', '', NULL, NULL, NULL, '', '', '', '', '', NULL, 0, 'No', '', 0.00),
(9, 1, '12', 'dasdasd sada', 2, '', '2026-05-12', '', '', '', NULL, NULL, '', 'Active', '2026-05-12 03:23:02', '2026-05-12 03:23:02', '2016-05-12', '', '', NULL, NULL, 'dasdasd', 'sada', 'Male', 'AB-', '', '', '', '', 0.00, '', '', '', '', '', '', 'General', '', '', '', '', '', 0, 0, 0, NULL, 0.00, '', '', '', NULL, '', '', NULL, '', '', NULL, '', '', '', NULL, NULL, NULL, '', '', '', '', '', NULL, 0, 'No', '', 0.00),
(10, 1, '10', 'aaaa aaaaa', 2, '', '2026-05-12', '', '', '', NULL, NULL, '', 'Active', '2026-05-12 03:28:18', '2026-05-12 03:28:18', '2018-05-12', '', '', NULL, NULL, 'aaaa', 'aaaaa', 'Male', 'A-', '', '', '', '', 0.00, '', '', '', '', '', '', 'General', '', '', '', '', '', 0, 0, 0, NULL, 0.00, '', '', '', NULL, '', '', NULL, '', '', NULL, '', '', '', NULL, NULL, NULL, '', '', '', '', '', NULL, 0, 'No', '', 0.00);

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

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

CREATE TABLE `subjects` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `subject_code` varchar(50) NOT NULL,
  `type` enum('Theory','Practical') DEFAULT 'Theory',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `subjects` (`id`, `school_id`, `name`, `subject_code`, `type`, `created_at`) VALUES
(2, 2, 'Hindi', 'Hin 01', 'Theory', '2026-05-06 06:26:40'),
(3, 2, 'English ', 'Eng02', 'Theory', '2026-05-07 17:35:45'),
(6, 1, 'Hindi', 'Hin01', 'Theory', '2026-05-10 07:50:21');

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

--
-- Table structure for table `super_admins`
--

CREATE TABLE `super_admins` (
  `id` int(10) UNSIGNED NOT NULL,
  `full_name` varchar(100) NOT NULL,
  `email` varchar(150) NOT NULL,
  `password` varchar(255) NOT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `profile_photo` varchar(255) DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  `last_login_ip` varchar(45) DEFAULT NULL,
  `failed_attempts` int(11) DEFAULT 0,
  `account_locked` tinyint(1) DEFAULT 0,
  `status` enum('Active','Inactive') DEFAULT 'Active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `super_admins`
--

INSERT INTO `super_admins` (`id`, `full_name`, `email`, `password`, `mobile`, `profile_photo`, `last_login`, `last_login_ip`, `failed_attempts`, `account_locked`, `status`, `created_at`, `updated_at`) VALUES
(1, 'Raavan', 'raavan@admin.com', '$2y$10$WagAGZC6j7uzV7.GDwmBrOLEs4HkOU0xrchpcWebZh0l4IX3p8/1q', NULL, NULL, '2026-05-12 09:01:02', '::1', 0, 0, 'Active', '2026-05-08 04:35:34', '2026-05-12 03:31:02'),
(2, 'ravi', 'ravi@admin.com', '$2y$10$slxu2Ocz1icauCgiv1dYzeRgdhFq7jxhVLqLURhLwRUAKmAyH.eP.', '', NULL, '2026-05-10 16:03:10', '::1', 0, 0, 'Active', '2026-05-10 10:21:33', '2026-05-10 10:33:10');

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

--
-- Table structure for table `super_admin_audit_logs`
--

CREATE TABLE `super_admin_audit_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `super_admin_id` int(10) UNSIGNED DEFAULT NULL,
  `super_admin_email` varchar(150) DEFAULT NULL,
  `super_admin_name` varchar(100) DEFAULT NULL,
  `module` varchar(100) NOT NULL,
  `action` varchar(50) NOT NULL,
  `record_id` int(10) UNSIGNED DEFAULT NULL,
  `message` text NOT NULL,
  `old_data` longtext DEFAULT NULL,
  `new_data` longtext DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `super_admin_audit_logs`
--

INSERT INTO `super_admin_audit_logs` (`id`, `super_admin_id`, `super_admin_email`, `super_admin_name`, `module`, `action`, `record_id`, `message`, `old_data`, `new_data`, `ip_address`, `user_agent`, `created_at`) VALUES
(9, 2, 'ravi@admin.com', 'ravi', 'Super Admin Authentication', 'LOGOUT', 2, 'Super Admin logged out: ravi', NULL, '{\"email\":\"ravi@admin.com\",\"admin_name\":\"ravi\",\"role\":\"Super Admin\",\"logout_time\":\"2026-05-10 16:03:01\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 10:33:01'),
(10, 2, 'ravi@admin.com', 'ravi', 'Super Admin Authentication', 'LOGIN', 2, 'Super Admin logged in: ravi', NULL, '{\"email\":\"ravi@admin.com\",\"admin_name\":\"ravi\",\"role\":\"Super Admin\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-10 16:03:10\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 10:33:10'),
(11, 2, 'ravi@admin.com', 'ravi', 'Super Admin Authentication', 'LOGOUT', 2, 'Super Admin logged out: ravi', NULL, '{\"email\":\"ravi@admin.com\",\"admin_name\":\"ravi\",\"role\":\"Super Admin\",\"logout_time\":\"2026-05-10 16:03:38\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-10 10:33:38'),
(12, 1, 'raavan@admin.com', 'Raavan', 'Super Admin Authentication', 'LOGIN', 1, 'Super Admin logged in: Raavan', NULL, '{\"email\":\"raavan@admin.com\",\"admin_name\":\"Raavan\",\"role\":\"Super Admin\",\"ip_address\":\"::1\",\"user_agent\":\"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/147.0.0.0 Safari\\/537.36\",\"login_time\":\"2026-05-12 09:01:02\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:31:02'),
(13, 1, 'raavan@admin.com', 'Raavan', 'Invoice Management', 'CREATE', 1, 'Invoice created: INV-D1236FA4', NULL, '{\"invoice_id\":\"1\",\"invoice_no\":\"INV-D1236FA4\",\"school_id\":3,\"plan_name\":\"sda\",\"amount\":5500,\"billing_cycle\":\"Yearly\",\"payment_status\":\"Paid\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:38:45'),
(14, 1, 'raavan@admin.com', 'Raavan', 'Invoice Management', 'UPDATE', 1, 'Invoice updated: INV-D1236FA4', '{\"id\":1,\"school_id\":3,\"invoice_no\":\"INV-D1236FA4\",\"plan_name\":\"sda\",\"amount\":\"5500.00\",\"billing_cycle\":\"Yearly\",\"start_date\":\"2026-05-12\",\"end_date\":\"2027-05-11\",\"payment_status\":\"Paid\",\"payment_method\":\"cash\",\"remarks\":\"\",\"created_at\":\"2026-05-12 09:08:45\",\"updated_at\":\"2026-05-12 09:08:45\"}', '{\"school_id\":3,\"plan_name\":\"sda\",\"amount\":5600,\"billing_cycle\":\"Yearly\",\"payment_status\":\"Paid\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:41:26'),
(15, 1, 'raavan@admin.com', 'Raavan', 'Invoice Management', 'DELETE', 1, 'Invoice deleted: INV-D1236FA4', '{\"id\":1,\"school_id\":3,\"invoice_no\":\"INV-D1236FA4\",\"plan_name\":\"sda\",\"amount\":\"5600.00\",\"billing_cycle\":\"Yearly\",\"start_date\":\"2026-05-12\",\"end_date\":\"2027-05-11\",\"payment_status\":\"Paid\",\"payment_method\":\"cash\",\"remarks\":\"\",\"created_at\":\"2026-05-12 09:08:45\",\"updated_at\":\"2026-05-12 09:11:26\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:42:17'),
(16, 1, 'raavan@admin.com', 'Raavan', 'Invoice Management', 'CREATE', 2, 'Invoice created: INV-334FE5F4', NULL, '{\"invoice_id\":\"2\",\"invoice_no\":\"INV-334FE5F4\",\"school_id\":3,\"plan_name\":\"sdasd\",\"amount\":5000,\"billing_cycle\":\"Yearly\",\"payment_status\":\"Paid\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36', '2026-05-12 03:42:49');

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

--
-- Table structure for table `tc_certificates`
--

CREATE TABLE `tc_certificates` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `student_id` int(10) UNSIGNED NOT NULL,
  `tc_no` varchar(20) DEFAULT NULL,
  `issue_date` date DEFAULT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `principal_name` varchar(100) DEFAULT 'Dr. Ravi Sharma',
  `school_name` varchar(200) DEFAULT 'XYZ Public School, Bhopal',
  `school_address` text DEFAULT 'Bhopal, MP - 462001',
  `status` enum('issued','cancelled') DEFAULT 'issued',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tc_certificates`
--

INSERT INTO `tc_certificates` (`id`, `school_id`, `student_id`, `tc_no`, `issue_date`, `reason`, `principal_name`, `school_name`, `school_address`, `status`, `created_at`) VALUES
(1, 2, 2, 'TC-2026/001', '2026-05-06', 'School Transfer', 'Dr. Ravi Sharma', 'XYZ Public School, Bhopal', 'Bhopal, MP - 462001', 'issued', '2026-05-06 18:02:13');

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

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

CREATE TABLE `teachers` (
  `id` int(10) UNSIGNED NOT NULL,
  `school_id` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `father_name` varchar(150) DEFAULT NULL,
  `mother_name` varchar(150) DEFAULT NULL,
  `qualification` varchar(150) DEFAULT NULL,
  `tenth_year` varchar(10) DEFAULT NULL,
  `tenth_percentage` varchar(10) DEFAULT NULL,
  `twelfth_year` varchar(10) DEFAULT NULL,
  `twelfth_percentage` varchar(10) DEFAULT NULL,
  `grad_year` varchar(10) DEFAULT NULL,
  `grad_percentage` varchar(10) DEFAULT NULL,
  `pg_year` varchar(10) DEFAULT NULL,
  `pg_percentage` varchar(10) DEFAULT NULL,
  `marital_status` enum('Single','Married') DEFAULT 'Single',
  `salary` decimal(10,2) DEFAULT 0.00,
  `mobile_no` varchar(20) DEFAULT NULL,
  `adhar_no` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `date_of_joining` date DEFAULT NULL,
  `date_of_leaving` date DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `resume` varchar(255) DEFAULT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `teachers` (`id`, `school_id`, `name`, `father_name`, `mother_name`, `qualification`, `tenth_year`, `tenth_percentage`, `twelfth_year`, `twelfth_percentage`, `grad_year`, `grad_percentage`, `pg_year`, `pg_percentage`, `marital_status`, `salary`, `mobile_no`, `adhar_no`, `address`, `date_of_birth`, `date_of_joining`, `date_of_leaving`, `photo`, `resume`, `status`, `created_at`, `updated_at`) VALUES
(5, 1, 'Teacher 1', 'Father Teacher', 'Mother Teacher', 'Bed', '2016', '85', '2018', '88', '2021', '75', '', '', 'Single', 9000.00, '', '', '', '2000-01-01', '2026-01-01', NULL, '', '', 'Active', '2026-05-11 17:06:13', '2026-05-11 17:06:20');

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

--
-- Table structure for table `timetable`
--

CREATE TABLE `timetable` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `class_id` int(10) UNSIGNED NOT NULL,
  `day_name` enum('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday') NOT NULL,
  `period_number` int(11) NOT NULL,
  `subject_id` int(10) UNSIGNED NOT NULL,
  `teacher_id` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `transport_allocation`
--

CREATE TABLE `transport_allocation` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `user_type` enum('Student','Staff') DEFAULT NULL,
  `reference_id` int(11) DEFAULT NULL,
  `route_id` int(11) DEFAULT NULL,
  `vehicle_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `school_id` int(11) DEFAULT NULL,
  `username` varchar(50) NOT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('super_admin','admin','teacher','accountant') DEFAULT 'admin',
  `phone` varchar(20) DEFAULT NULL,
  `profile_photo` varchar(255) DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `last_login` datetime DEFAULT NULL,
  `failed_attempts` int(11) DEFAULT 0,
  `account_locked` tinyint(1) DEFAULT 0,
  `last_login_ip` varchar(45) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `salary` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `school_id`, `username`, `name`, `email`, `password`, `role`, `phone`, `profile_photo`, `status`, `last_login`, `failed_attempts`, `account_locked`, `last_login_ip`, `created_at`, `updated_at`, `salary`) VALUES
(2, 1, 'admin', 'Hello Kids', NULL, '$2y$10$L5Z34kHe8W62PJOMFWBQ2uaw5gj7/6Xz3F9puSs.kDqQhPNgmn0kK', 'admin', NULL, NULL, 'active', '2026-05-12 08:06:46', 0, 0, '::1', '2026-05-05 16:47:48', '2026-05-12 02:36:46', 0.00),
(3, 2, 'admin2', 'Helllllo', NULL, '$2y$10$zjNx2yfM3FikH4fI2Bprt.1nPjYyyK1ymHaoOsYhOwc65LeMzefq.', 'admin', NULL, NULL, 'active', '2026-05-10 10:09:19', 0, 0, '::1', '2026-05-05 16:57:57', '2026-05-10 04:39:41', 0.00),
(4, 1, 'teacher', 'Teacher', NULL, '$2y$10$VJ2wLpQBGtBsN5yW81S9LuhgXcsfit1uKID7BGONqfqv29RpuW7Zm', 'teacher', NULL, NULL, 'active', '2026-05-10 23:02:50', 0, 0, '::1', '2026-05-08 04:59:50', '2026-05-10 17:32:50', 0.00),
(5, 3, 'bella', 'bella', NULL, '$2y$10$lhenljzvsdpuKNa6KiGGe.aL31FW7PWaLUE5EUlquNUnE1Iz9G6.K', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-08 05:01:59', '2026-05-08 05:01:59', 0.00),
(6, 4, 'chaalis', 'chaalischor', NULL, '$2y$10$JI2pioDSaCLQN8xsUpJ1gu56CGQp/BLy9eiyxuv9ApB4ILbJk2.6a', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-08 05:19:24', '2026-05-08 06:41:34', 0.00),
(7, 5, 'foolish', 'fools', NULL, '$2y$10$IdxW9GfZKPEX9xguyZkJh.MeMWtwW3FZSKPRIm0OF0RBDGSJW3Jqi', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-08 05:31:24', '2026-05-08 05:31:24', 0.00),
(8, 6, 'tools', 'tools', NULL, '$2y$10$om6.bKRy2aeh19FhPdq/fORrcRpfIAbxHKtqmvbjqTghDb8GPpPUy', 'admin', NULL, NULL, 'inactive', '2026-05-08 12:45:50', 0, 0, '::1', '2026-05-08 06:55:36', '2026-05-08 07:20:58', 0.00),
(9, 7, 'priyanka', 'priyanka', NULL, '$2y$10$H1hZV82laIIWtjLeJuLYPe.KKcJp0nEXhIPjY4yOnhcVNF6ZwWTf6', 'admin', NULL, NULL, 'active', '2026-05-10 12:44:20', 0, 0, '::1', '2026-05-08 07:08:37', '2026-05-10 07:14:20', 0.00),
(10, 7, 'admin', 'admin', NULL, '$2y$10$aKOcbAxv9xeDTKg2HdDsJOtJZeQlR6QX9dt/w6b6XZdvr1yH0zKY.', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-08 07:29:09', '2026-05-08 07:29:09', 0.00),
(11, 8, 'ravi', 'ravi', NULL, '$2y$10$csBoJImXwGhfblxqELzcw.cYYIlNPCceqMV0cIDsqcNSmsmVDH00m', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-10 08:33:58', '2026-05-10 08:33:58', 0.00),
(12, 9, 'ravi12', 'ravi23', NULL, '$2y$10$3c.5SqTO9TAyQ86h.BJoJOxvI80go.DOafcStYe4hw5u1BA9A4ffu', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-10 08:34:57', '2026-05-10 08:34:57', 0.00),
(13, 10, 'qwerty', 'qwerty', NULL, '$2y$10$96biSGgiMCliALh38nqTguc.uzIp1vvpBNYyAmvGwYTW/B/1WSfb.', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-10 08:36:54', '2026-05-10 08:36:54', 0.00),
(14, 11, 'asdfg', 'asdfg', NULL, '$2y$10$cp1qJhJNIqkX3lhC5iNzhuhyfAH.ufeecgYDFNBt0YMHYL5AAXNLm', 'admin', NULL, NULL, 'inactive', NULL, 0, 0, NULL, '2026-05-10 08:43:34', '2026-05-10 10:11:00', 0.00),
(15, 12, 'sdhkasj', 'sdkasjh', NULL, '$2y$10$Ht/KQaYOpabmLFSFP5puou4H5LJFHGjru.oGecU2RxsJRwhl4kJy.', 'admin', NULL, NULL, 'active', NULL, 0, 0, NULL, '2026-05-10 10:15:36', '2026-05-10 10:15:36', 0.00);

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

--
-- Table structure for table `vehicles`
--

CREATE TABLE `vehicles` (
  `id` int(11) NOT NULL,
  `school_id` int(11) NOT NULL,
  `vehicle_no` varchar(50) NOT NULL,
  `vehicle_model` varchar(100) DEFAULT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vehicles`
--

INSERT INTO `vehicles` (`id`, `school_id`, `vehicle_no`, `vehicle_model`, `status`) VALUES
(1, 2, 'MP09-dc-1234', 'Tata', 'Active');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `attendance`
--
ALTER TABLE `attendance`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_attendance` (`school_id`,`student_id`,`attendance_date`),
  ADD KEY `fk_attendance_school` (`school_id`),
  ADD KEY `fk_attendance_class` (`class_id`),
  ADD KEY `fk_attendance_student` (`student_id`),
  ADD KEY `idx_class_student_date` (`class_id`,`student_id`,`attendance_date`),
  ADD KEY `idx_attendance_lookup` (`class_id`,`student_id`,`attendance_date`);

--
-- Indexes for table `audit_logs`
--
ALTER TABLE `audit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_school_id` (`school_id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_module` (`module`),
  ADD KEY `idx_action` (`action`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `books`
--
ALTER TABLE `books`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_books_school` (`school_id`);

--
-- Indexes for table `book_issues`
--
ALTER TABLE `book_issues`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_bookissues_school` (`school_id`),
  ADD KEY `fk_bookissues_book` (`book_id`),
  ADD KEY `fk_bookissues_member` (`member_id`);

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

--
-- Indexes for table `class_fees`
--
ALTER TABLE `class_fees`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_class_fee` (`school_id`,`class_id`),
  ADD KEY `fk_classfees_school` (`school_id`),
  ADD KEY `fk_classfees_class` (`class_id`);

--
-- Indexes for table `class_subject_teachers`
--
ALTER TABLE `class_subject_teachers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_cst_school` (`school_id`),
  ADD KEY `class_id` (`class_id`),
  ADD KEY `subject_id` (`subject_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `drivers`
--
ALTER TABLE `drivers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_drivers_school` (`school_id`);

--
-- Indexes for table `exam_marks`
--
ALTER TABLE `exam_marks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_exam_mark` (`school_id`,`exam_type_id`,`class_id`,`student_id`,`subject_id`),
  ADD UNIQUE KEY `unique_student_subject` (`school_id`,`exam_type_id`,`class_id`,`student_id`,`subject_id`),
  ADD KEY `fk_exammarks_school` (`school_id`),
  ADD KEY `idx_schedule` (`schedule_id`),
  ADD KEY `idx_student` (`student_id`),
  ADD KEY `fk_exammarks_class` (`class_id`),
  ADD KEY `fk_exammarks_subject` (`subject_id`);

--
-- Indexes for table `exam_results`
--
ALTER TABLE `exam_results`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_student_result` (`school_id`,`exam_type_id`,`class_id`,`student_id`,`session_year`),
  ADD KEY `idx_school` (`school_id`),
  ADD KEY `idx_exam` (`exam_type_id`),
  ADD KEY `idx_class` (`class_id`),
  ADD KEY `idx_student` (`student_id`),
  ADD KEY `idx_session` (`session_year`),
  ADD KEY `idx_rank` (`rank_position`);

--
-- Indexes for table `exam_result_details`
--
ALTER TABLE `exam_result_details`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_subject_result` (`school_id`,`result_id`,`subject_id`),
  ADD KEY `idx_school` (`school_id`),
  ADD KEY `idx_result` (`result_id`),
  ADD KEY `idx_exam` (`exam_type_id`),
  ADD KEY `idx_class` (`class_id`),
  ADD KEY `idx_student` (`student_id`),
  ADD KEY `idx_subject` (`subject_id`);

--
-- Indexes for table `exam_schedule`
--
ALTER TABLE `exam_schedule`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_schedule` (`school_id`,`exam_type_id`,`class_id`,`subject_id`),
  ADD UNIQUE KEY `unique_exam_schedule` (`school_id`,`exam_type_id`,`class_id`,`subject_id`,`session_year`),
  ADD KEY `fk_examschedule_school` (`school_id`),
  ADD KEY `fk_examschedule_class` (`class_id`),
  ADD KEY `fk_examschedule_subject` (`subject_id`);

--
-- Indexes for table `exam_types`
--
ALTER TABLE `exam_types`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_examtypes_school` (`school_id`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_expenses_school` (`school_id`),
  ADD KEY `fk_expenses_category` (`category_id`);

--
-- Indexes for table `expense_categories`
--
ALTER TABLE `expense_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_expcat_school` (`school_id`);

--
-- Indexes for table `fee_payments`
--
ALTER TABLE `fee_payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_school_receipt` (`school_id`,`receipt_no`),
  ADD KEY `fk_feepay_school` (`school_id`),
  ADD KEY `idx_student` (`student_id`);

--
-- Indexes for table `income`
--
ALTER TABLE `income`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_income_school` (`school_id`),
  ADD KEY `fk_income_category` (`category_id`),
  ADD KEY `idx_payment_date` (`payment_date`);

--
-- Indexes for table `income_categories`
--
ALTER TABLE `income_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_inccat_school` (`school_id`);

--
-- Indexes for table `inventory_items`
--
ALTER TABLE `inventory_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_inventory_school` (`school_id`);

--
-- Indexes for table `inventory_logs`
--
ALTER TABLE `inventory_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_inventorylogs_school` (`school_id`),
  ADD KEY `item_id` (`item_id`);

--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `invoice_no` (`invoice_no`),
  ADD KEY `school_id` (`school_id`);

--
-- Indexes for table `library_members`
--
ALTER TABLE `library_members`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_school_card` (`school_id`,`card_no`),
  ADD UNIQUE KEY `unique_school_library_card` (`school_id`,`library_card_no`),
  ADD KEY `fk_library_school` (`school_id`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_class` (`class_id`),
  ADD KEY `idx_active` (`is_active`),
  ADD KEY `fk_notifications_school` (`school_id`);

--
-- Indexes for table `period_settings`
--
ALTER TABLE `period_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_school_period` (`school_id`),
  ADD KEY `fk_period_school` (`school_id`);

--
-- Indexes for table `receipt_settings`
--
ALTER TABLE `receipt_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_school` (`school_id`),
  ADD KEY `fk_receipt_school` (`school_id`);

--
-- Indexes for table `routes`
--
ALTER TABLE `routes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_routes_school` (`school_id`);

--
-- Indexes for table `salary_payments`
--
ALTER TABLE `salary_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_salary_school` (`school_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `schools`
--
ALTER TABLE `schools`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `school_code` (`school_code`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `school_settings`
--
ALTER TABLE `school_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_school_settings` (`school_id`),
  ADD KEY `fk_schoolsettings_school` (`school_id`);

--
-- Indexes for table `staff_attendance`
--
ALTER TABLE `staff_attendance`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_staff_attendance` (`school_id`,`staff_id`,`attendance_date`);

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_roll` (`school_id`,`class_id`,`roll_no`),
  ADD KEY `fk_students_class` (`class_id`),
  ADD KEY `fk_students_school` (`school_id`);

--
-- Indexes for table `subjects`
--
ALTER TABLE `subjects`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_subject_code` (`school_id`,`subject_code`),
  ADD KEY `fk_subjects_school` (`school_id`);

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

--
-- Indexes for table `super_admin_audit_logs`
--
ALTER TABLE `super_admin_audit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_super_admin_id` (`super_admin_id`),
  ADD KEY `idx_email` (`super_admin_email`),
  ADD KEY `idx_module` (`module`),
  ADD KEY `idx_action` (`action`),
  ADD KEY `idx_created_at` (`created_at`);

--
-- Indexes for table `tc_certificates`
--
ALTER TABLE `tc_certificates`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_tc_no_per_school` (`school_id`,`tc_no`),
  ADD KEY `fk_tc_school` (`school_id`),
  ADD KEY `idx_student` (`student_id`);

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

--
-- Indexes for table `timetable`
--
ALTER TABLE `timetable`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_timetable` (`school_id`,`class_id`,`day_name`,`period_number`),
  ADD KEY `fk_timetable_school` (`school_id`),
  ADD KEY `class_id` (`class_id`),
  ADD KEY `subject_id` (`subject_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `transport_allocation`
--
ALTER TABLE `transport_allocation`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_transport_school` (`school_id`),
  ADD KEY `fk_transport_route` (`route_id`),
  ADD KEY `fk_transport_vehicle` (`vehicle_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD UNIQUE KEY `unique_school_username` (`school_id`,`username`);

--
-- Indexes for table `vehicles`
--
ALTER TABLE `vehicles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_vehicles_school` (`school_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `attendance`
--
ALTER TABLE `attendance`
  ADD CONSTRAINT `fk_attendance_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_attendance_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_attendance_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `books`
--
ALTER TABLE `books`
  ADD CONSTRAINT `fk_books_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `book_issues`
--
ALTER TABLE `book_issues`
  ADD CONSTRAINT `fk_bookissues_book` FOREIGN KEY (`book_id`) REFERENCES `books` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_bookissues_member` FOREIGN KEY (`member_id`) REFERENCES `library_members` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_bookissues_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
  ADD CONSTRAINT `fk_classes_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `class_fees`
--
ALTER TABLE `class_fees`
  ADD CONSTRAINT `fk_classfees_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_classfees_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `class_subject_teachers`
--
ALTER TABLE `class_subject_teachers`
  ADD CONSTRAINT `fk_cst_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_cst_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_cst_subject` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_cst_teacher` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `drivers`
--
ALTER TABLE `drivers`
  ADD CONSTRAINT `fk_drivers_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `exam_marks`
--
ALTER TABLE `exam_marks`
  ADD CONSTRAINT `fk_exammarks_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_exammarks_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_exammarks_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_exammarks_subject` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `exam_schedule`
--
ALTER TABLE `exam_schedule`
  ADD CONSTRAINT `fk_examschedule_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_examschedule_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_examschedule_subject` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `exam_types`
--
ALTER TABLE `exam_types`
  ADD CONSTRAINT `fk_examtypes_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `fk_expenses_category` FOREIGN KEY (`category_id`) REFERENCES `expense_categories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_expenses_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `expense_categories`
--
ALTER TABLE `expense_categories`
  ADD CONSTRAINT `fk_expcat_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `fee_payments`
--
ALTER TABLE `fee_payments`
  ADD CONSTRAINT `fk_feepay_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_feepay_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `income`
--
ALTER TABLE `income`
  ADD CONSTRAINT `fk_income_category` FOREIGN KEY (`category_id`) REFERENCES `income_categories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_income_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `income_categories`
--
ALTER TABLE `income_categories`
  ADD CONSTRAINT `fk_inccat_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `inventory_items`
--
ALTER TABLE `inventory_items`
  ADD CONSTRAINT `fk_inventory_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `inventory_logs`
--
ALTER TABLE `inventory_logs`
  ADD CONSTRAINT `fk_inventorylogs_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `inventory_logs_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `inventory_items` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `library_members`
--
ALTER TABLE `library_members`
  ADD CONSTRAINT `fk_library_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `fk_notifications_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_notifications_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `period_settings`
--
ALTER TABLE `period_settings`
  ADD CONSTRAINT `fk_period_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `receipt_settings`
--
ALTER TABLE `receipt_settings`
  ADD CONSTRAINT `fk_receipt_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `routes`
--
ALTER TABLE `routes`
  ADD CONSTRAINT `fk_routes_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `salary_payments`
--
ALTER TABLE `salary_payments`
  ADD CONSTRAINT `fk_salary_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `salary_payments_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `school_settings`
--
ALTER TABLE `school_settings`
  ADD CONSTRAINT `fk_schoolsettings_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `students`
--
ALTER TABLE `students`
  ADD CONSTRAINT `fk_students_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_students_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `subjects`
--
ALTER TABLE `subjects`
  ADD CONSTRAINT `fk_subjects_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tc_certificates`
--
ALTER TABLE `tc_certificates`
  ADD CONSTRAINT `fk_tc_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_tc_student` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `teachers`
--
ALTER TABLE `teachers`
  ADD CONSTRAINT `fk_teachers_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `timetable`
--
ALTER TABLE `timetable`
  ADD CONSTRAINT `fk_timetable_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `timetable_ibfk_1` FOREIGN KEY (`class_id`) REFERENCES `classes` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `timetable_ibfk_2` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `timetable_ibfk_3` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `transport_allocation`
--
ALTER TABLE `transport_allocation`
  ADD CONSTRAINT `fk_transport_route` FOREIGN KEY (`route_id`) REFERENCES `routes` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `fk_transport_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_transport_vehicle` FOREIGN KEY (`vehicle_id`) REFERENCES `vehicles` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vehicles`
--
ALTER TABLE `vehicles`
  ADD CONSTRAINT `fk_vehicles_school` FOREIGN KEY (`school_id`) REFERENCES `schools` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
