-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 26, 2025 at 11:09 AM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.0.28

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: `school_management`
--

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

--
-- Table structure for table `academic_history`
--

CREATE TABLE `academic_history` (
  `history_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `subject` varchar(100) DEFAULT NULL,
  `grade` varchar(2) DEFAULT NULL,
  `term` varchar(10) DEFAULT NULL,
  `year` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `academic_history`
--

INSERT INTO `academic_history` (`history_id`, `student_id`, `subject`, `grade`, `term`, `year`) VALUES
(9, 5, 'Mathematics', 'A', 'Fall', 2023),
(10, 5, 'Science', 'B', 'Fall', 2023),
(11, 5, 'English', 'A', 'Fall', 2023),
(12, 5, 'History', 'B', 'Fall', 2023),
(13, 5, 'Mathematics', 'A', 'Spring', 2023),
(14, 5, 'Science', 'A', 'Spring', 2023),
(15, 5, 'English', 'B', 'Spring', 2023),
(16, 5, 'History', 'A', 'Spring', 2023),
(18, 5, 'Maths', 'A1', '3rd', 2024),
(19, 13, 'Mathematics', 'A1', '3rd', 2024),
(20, 17, 'Maths', '80', '1st Term', 2024),
(21, 17, 'English', '60', '1st Term', 2024);

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

--
-- Table structure for table `assets`
--

CREATE TABLE `assets` (
  `asset_id` int(11) NOT NULL,
  `description` varchar(255) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `assets`
--

INSERT INTO `assets` (`asset_id`, `description`, `amount`, `date`) VALUES
(1, 'Chairs and Table', 8000.00, '2024-07-13');

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

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

CREATE TABLE `attendance` (
  `attendance_id` int(11) NOT NULL,
  `teacher_id` int(11) NOT NULL,
  `attendance_date` date NOT NULL,
  `status` enum('Present','Absent','Leave') NOT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `attendance` (`attendance_id`, `teacher_id`, `attendance_date`, `status`, `notes`) VALUES
(1, 1, '2024-07-12', 'Present', 'Present and came early'),
(3, 1, '2024-09-11', 'Absent', ''),
(4, 6, '2025-09-20', 'Present', 'early');

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

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

CREATE TABLE `classes` (
  `class_id` int(11) NOT NULL,
  `class_name` varchar(50) NOT NULL,
  `teacher_id` int(11) DEFAULT NULL,
  `section` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `classes` (`class_id`, `class_name`, `teacher_id`, `section`) VALUES
(1, 'Basic 7', 1, 'Secondary'),
(2, 'Basic 8', 6, 'Secondary'),
(3, 'Basic 9', 3, 'Secondary'),
(4, 'SSS 1', 4, 'Secondary'),
(5, 'SSS 2', 2, 'Secondary');

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

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

CREATE TABLE `enrollments` (
  `enrollment_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `subject_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `enrollments` (`enrollment_id`, `student_id`, `subject_id`) VALUES
(1, 5, 1),
(2, 5, 3);

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

--
-- Table structure for table `equity`
--

CREATE TABLE `equity` (
  `equity_id` int(11) NOT NULL,
  `description` varchar(255) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `equity`
--

INSERT INTO `equity` (`equity_id`, `description`, `amount`, `date`) VALUES
(1, 'uniform', 6000.00, '2024-07-13');

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

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

CREATE TABLE `expenses` (
  `expense_id` int(11) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `term` varchar(50) DEFAULT NULL,
  `session` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `expenses` (`expense_id`, `description`, `amount`, `date`, `term`, `session`) VALUES
(1, 'furniture', 1500.00, '2024-07-13', '1st ', '2024-2025'),
(2, 'petrol', 5000.00, '2024-09-11', '1st ', '2024-2025');

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

--
-- Table structure for table `fees`
--

CREATE TABLE `fees` (
  `fee_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `due_date` date DEFAULT NULL,
  `status` enum('paid','pending') DEFAULT 'pending'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `financial_transactions`
--

CREATE TABLE `financial_transactions` (
  `transaction_id` int(11) NOT NULL,
  `type` enum('income','expenditure') NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `description` text DEFAULT NULL,
  `date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `forums`
--

CREATE TABLE `forums` (
  `forum_id` int(11) NOT NULL,
  `forum_name` varchar(100) NOT NULL,
  `is_private` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `forum_posts`
--

CREATE TABLE `forum_posts` (
  `post_id` int(11) NOT NULL,
  `forum_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `post_text` text DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `groups`
--

CREATE TABLE `groups` (
  `group_id` int(11) NOT NULL,
  `group_name` varchar(100) NOT NULL,
  `is_private` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `group_members`
--

CREATE TABLE `group_members` (
  `group_member_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `join_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `group_members`
--

INSERT INTO `group_members` (`group_member_id`, `group_id`, `student_id`, `join_date`) VALUES
(1, 9, 13, '2024-07-31 22:46:11'),
(2, 3, 9, '2024-08-01 10:15:31'),
(3, 10, 13, '2024-08-05 00:01:35');

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

--
-- Table structure for table `group_messages`
--

CREATE TABLE `group_messages` (
  `message_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `sender_id` int(11) NOT NULL,
  `message` text NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `group_messages`
--

INSERT INTO `group_messages` (`message_id`, `group_id`, `sender_id`, `message`, `timestamp`) VALUES
(1, 2, 15, 'hello my fellow people in this group', '2024-07-22 03:39:36'),
(2, 2, 9, 'HI', '2024-07-22 03:41:56'),
(5, 2, 15, 'hello my fellow people in this group', '2024-07-22 03:45:30'),
(7, 2, 9, 'hello', '2024-07-22 04:28:40'),
(8, 3, 9, 'invalid id', '2024-07-22 08:17:53'),
(9, 3, 13, 'hello', '2024-07-22 08:18:05'),
(10, 3, 18, 'My name is Itolowa', '2024-07-22 08:18:08'),
(11, 3, 13, 'hello', '2024-07-22 08:19:57'),
(12, 3, 13, 'hello', '2024-07-22 08:20:15'),
(13, 3, 13, 'hello', '2024-07-22 08:22:36'),
(14, 3, 9, 'invalid id', '2024-07-22 08:22:42'),
(15, 3, 18, 'My name is Itolowa', '2024-07-22 08:22:42'),
(16, 3, 13, 'hello', '2024-07-22 08:23:18'),
(17, 3, 18, 'My name is Itolowa', '2024-07-22 08:23:24');

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

--
-- Table structure for table `group_notifications`
--

CREATE TABLE `group_notifications` (
  `notification_id` int(11) NOT NULL,
  `group_id` int(11) DEFAULT NULL,
  `student_id` int(11) DEFAULT NULL,
  `message` varchar(255) DEFAULT NULL,
  `is_read` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `group_notifications`
--

INSERT INTO `group_notifications` (`notification_id`, `group_id`, `student_id`, `message`, `is_read`, `created_at`) VALUES
(2, 6, 13, 'New join request from student ID 9', 0, '2024-08-01 09:31:55'),
(3, 6, 13, 'New join request from student ID ', 1, '2024-08-01 09:39:45'),
(4, 6, 13, 'New join request from student Salawu Malik', 1, '2024-08-01 09:46:41');

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

--
-- Table structure for table `group_posts`
--

CREATE TABLE `group_posts` (
  `post_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `post_content` text NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
  `post_sender` varchar(255) DEFAULT NULL,
  `group_image` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `group_posts`
--

INSERT INTO `group_posts` (`post_id`, `group_id`, `student_id`, `post_content`, `timestamp`, `post_sender`, `group_image`) VALUES
(4, 10, 13, 'Good Morning all', '2024-08-05 02:36:18', NULL, NULL),
(5, 9, 13, 'Anonymous: ', '2024-08-05 02:37:05', NULL, NULL),
(6, 9, 13, 'Anonymous: Hello', '2024-08-05 02:37:36', NULL, NULL),
(8, 10, 13, 'hello', '2024-08-05 02:47:25', NULL, NULL),
(10, 9, NULL, 'Anonymous: What is your opinion on our coach style today', '2024-08-05 02:54:43', NULL, NULL),
(11, 10, NULL, 'hi', '2024-08-05 02:59:14', 'Anonymous Sender', NULL),
(12, 10, NULL, 'how are you?', '2024-08-05 03:00:09', '13', NULL),
(13, 10, 13, 'What\'s up with you', '2024-08-05 04:16:21', '13', NULL),
(14, 10, 13, 'add me up to whatsapp group', '2024-08-05 04:17:10', 'Anonymous Sender', NULL),
(15, 10, 13, 'send me your whatsapp number', '2024-08-05 04:25:49', '13', ''),
(16, 10, 13, 'good', '2024-08-05 04:42:43', '13', ''),
(17, 10, 13, 'give it to me', '2024-08-05 04:56:32', 'Anonymous Sender', ''),
(18, 9, 13, 'poor', '2024-08-05 05:03:12', 'Anonymous Sender', ''),
(19, 10, 13, 'what', '2024-08-05 05:04:41', 'Anonymous Sender', ''),
(20, 10, 13, 'you', '2024-08-05 05:11:26', 'Anonymous Sender', ''),
(21, 10, 13, 'g', '2024-08-05 05:12:29', 'Anonymous Sender', ''),
(22, 10, 13, 'perfect', '2024-08-05 05:19:59', '13', '');

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

--
-- Table structure for table `homework`
--

CREATE TABLE `homework` (
  `homework_id` int(11) NOT NULL,
  `subject_id` int(11) DEFAULT NULL,
  `teacher_id` int(11) DEFAULT NULL,
  `class_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `homework`
--

INSERT INTO `homework` (`homework_id`, `subject_id`, `teacher_id`, `class_id`, `title`, `description`, `due_date`, `created_at`) VALUES
(1, 3, 1, 1, 'Week 1 Assignment', 'what is Noun', '2024-07-15', '2024-07-14 09:01:03'),
(2, 2, 2, 3, 'Week 2 Assignment', 'what is science', '2024-07-21', '2024-07-19 01:29:31'),
(3, 7, 2, 2, 'week 2', 'what is land?', '2024-07-22', '2024-07-19 01:49:19'),
(4, 5, 4, 4, 'Week 1 homework', 'what is geography', '2024-07-23', '2024-07-19 03:10:20'),
(5, NULL, 4, 4, 'Week 4 Homework', 'What is map?', '2024-07-23', '2024-07-20 21:15:20');

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

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

CREATE TABLE `income` (
  `income_id` int(11) NOT NULL,
  `source` varchar(255) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `term` varchar(50) DEFAULT NULL,
  `session` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `income` (`income_id`, `source`, `amount`, `date`, `term`, `session`) VALUES
(1, 'tuition ', 8000.00, '2024-07-10', '2nd', '2024-2025'),
(2, 'tuition ', 5000.00, '2024-07-13', '1st ', '2024-2025'),
(3, 'tuition ', 12000.00, '2024-07-13', '1st ', '2023-2024');

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

--
-- Table structure for table `join_requests`
--

CREATE TABLE `join_requests` (
  `request_id` int(11) NOT NULL,
  `group_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `status` enum('Pending','Approved','Denied') DEFAULT 'Pending',
  `request_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `join_requests`
--

INSERT INTO `join_requests` (`request_id`, `group_id`, `student_id`, `status`, `request_date`) VALUES
(1, 10, 13, 'Approved', '2024-07-31 22:53:25'),
(2, 3, 9, 'Approved', '2024-08-01 09:22:11'),
(4, 6, 9, 'Pending', '2024-08-01 09:39:45'),
(5, 6, 9, 'Pending', '2024-08-01 09:43:23'),
(6, 6, 9, 'Pending', '2024-08-01 09:44:09'),
(7, 6, 9, 'Pending', '2024-08-01 09:46:17'),
(8, 6, 9, 'Pending', '2024-08-01 09:46:41');

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

--
-- Table structure for table `liabilities`
--

CREATE TABLE `liabilities` (
  `liability_id` int(11) NOT NULL,
  `description` varchar(255) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `liabilities`
--

INSERT INTO `liabilities` (`liability_id`, `description`, `amount`, `date`) VALUES
(1, 'petrol', 2000.00, '2024-07-13');

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

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `message_id` int(11) NOT NULL,
  `sender_id` int(11) NOT NULL,
  `receiver_id` int(11) DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `message_text` text DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `message_replies`
--

CREATE TABLE `message_replies` (
  `reply_id` int(11) NOT NULL,
  `message_id` int(11) NOT NULL,
  `sender_id` int(11) NOT NULL,
  `reply` text NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `message_replies`
--

INSERT INTO `message_replies` (`reply_id`, `message_id`, `sender_id`, `reply`, `timestamp`) VALUES
(1, 7, 9, 'great', '2024-07-22 05:18:48'),
(2, 7, 9, 'ok', '2024-07-22 05:18:58'),
(3, 7, 15, 'how was your night', '2024-07-22 05:19:04'),
(4, 7, 9, 'ok', '2024-07-22 05:48:00'),
(5, 7, 15, 'how was your night', '2024-07-22 05:48:20'),
(6, 7, 15, 'great', '2024-07-22 05:48:31'),
(7, 7, 9, 'ok', '2024-07-22 05:48:37'),
(8, 5, 9, 'are u on your way to school?', '2024-07-22 05:49:18'),
(9, 7, 15, 'great', '2024-07-22 05:49:29'),
(10, 5, 9, 'are u on your way to school?', '2024-07-22 05:59:01'),
(11, 5, 9, 'yes', '2024-07-22 05:59:20'),
(12, 7, 15, 'great', '2024-07-22 05:59:26'),
(13, 10, 9, 'whats itolowa', '2024-07-22 08:23:11');

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

--
-- Table structure for table `mutual_friends`
--

CREATE TABLE `mutual_friends` (
  `id` int(11) NOT NULL,
  `student_id1` int(11) NOT NULL,
  `student_id2` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `notifications` (
  `notification_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `message_head` text NOT NULL,
  `message_body` text DEFAULT NULL,
  `status` enum('unread','read') DEFAULT 'unread',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `role` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `notifications` (`notification_id`, `user_id`, `message_head`, `message_body`, `status`, `created_at`, `role`) VALUES
(1, 2, 'Examination', 'Exams continues on monday the 15th July, 2024', 'unread', '2024-07-18 14:15:23', 'student'),
(2, 4, 'Vacation', 'School closes for the term on 27th of July 2024', 'unread', '2024-07-14 06:45:01', 'teacher'),
(3, 2, 'Examination', 'Exams continues', 'unread', '2024-07-14 06:52:31', 'student'),
(4, NULL, 'Payment of Fees', 'Endeavor to pay your ward school ', 'unread', '2024-07-14 07:21:09', 'parent');

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

--
-- Table structure for table `parents`
--

CREATE TABLE `parents` (
  `parent_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `phone` varchar(15) DEFAULT NULL,
  `occupation` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `parents`
--

INSERT INTO `parents` (`parent_id`, `user_id`, `name`, `phone`, `occupation`) VALUES
(1, 14, 'Ibrahim Olugbenga Awosanmi ', '123456789', 'Engineer'),
(2, 2, 'Jane Smith', '987654321', 'Teacher'),
(3, 14, 'Ibrahim Olugbenga Awosanmi', '08153654545', 'Teaching');

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

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

CREATE TABLE `payments` (
  `payment_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `purpose` varchar(255) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `receipt_no` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `payments` (`payment_id`, `student_id`, `amount`, `purpose`, `date`, `receipt_no`) VALUES
(1, 5, 8000.00, NULL, '2024-07-10', 'REC-668e0f4d566db'),
(2, 5, 8000.00, NULL, '2024-07-10', 'REC-668e108186cd9'),
(3, 5, 5000.00, 'excursion', '2024-07-10', 'REC202407100001'),
(4, 5, 2000.00, 'tuition ', '2024-07-10', 'REC202407100001'),
(5, 5, 2000.00, 'excursion', '2024-07-10', 'REC202407100001'),
(6, 8, 8000.00, 'tuition ', '2024-07-12', 'REC202407120001'),
(7, 5, 2000.00, 'tuition ', '2024-07-15', 'REC202407150001'),
(8, 5, 4000.00, 'tuition ', '2024-09-11', 'REC202409110001'),
(9, 15, 8000.00, 'tuition ', '2024-09-11', 'GGS202409110001'),
(10, 5, 4000.00, 'tuition ', '2024-09-11', 'GGS202409110001'),
(11, 13, 1000.00, 'tuition ', '2024-10-09', 'GGS202410090001'),
(12, 13, 1000.00, 'tuition ', '2024-10-09', 'GGS202410090001');

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

--
-- Table structure for table `payrolls`
--

CREATE TABLE `payrolls` (
  `payroll_id` int(11) NOT NULL,
  `teacher_id` int(11) DEFAULT NULL,
  `salary` decimal(10,2) DEFAULT NULL,
  `payment_date` date DEFAULT NULL,
  `payment_method` varchar(50) DEFAULT NULL,
  `notes` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `payrolls`
--

INSERT INTO `payrolls` (`payroll_id`, `teacher_id`, `salary`, `payment_date`, `payment_method`, `notes`) VALUES
(1, 1, 25000.00, '2024-07-31', 'Cash', 'Salary Paid'),
(3, 6, 25000.00, '2024-09-30', 'Cash', 'your september salary');

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

--
-- Table structure for table `post_comments`
--

CREATE TABLE `post_comments` (
  `comment_id` int(11) NOT NULL,
  `post_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `comment_content` text NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `profiles`
--

CREATE TABLE `profiles` (
  `profile_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `profile_picture` varchar(255) DEFAULT NULL,
  `bio` text DEFAULT NULL,
  `online_status` enum('online','offline') DEFAULT 'offline'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `profiles`
--

INSERT INTO `profiles` (`profile_id`, `student_id`, `name`, `profile_picture`, `bio`, `online_status`) VALUES
(1, 13, 'Agid', '0_Edu.jpg', 'good looking guy', 'online'),
(3, 15, 'Peniel', 'IMG_20240705_131515_210.jpg', 'gentle ', 'offline'),
(4, 5, 'Hargid', '1686295190756.jpg', 'Born to Win', 'offline'),
(5, 18, 'Chikodi', 'Generationext Sch. Staff 20230310_183941.jpg', 'fun to be with', 'online'),
(6, 17, 'Prince', '20230425_052042.jpg', 'playful and strict', 'offline'),
(7, 14, 'Sport Prince', '1685733421196.jpg', 'small but mighty', 'offline'),
(8, 9, 'SAM08', 'IMG_20231029_153429_3.jpg', 'football is my hobby', 'offline');

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

--
-- Table structure for table `receipts`
--

CREATE TABLE `receipts` (
  `receipt_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `payment_id` int(11) DEFAULT NULL,
  `receipt_no` varchar(255) DEFAULT NULL,
  `date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `receipts`
--

INSERT INTO `receipts` (`receipt_id`, `student_id`, `payment_id`, `receipt_no`, `date`) VALUES
(1, 5, 1, 'REC-668e0f4d566db', '2024-07-10'),
(2, 5, 2, 'REC-668e108186cd9', '2024-07-10'),
(3, 5, 3, 'REC202407100001', '2024-07-10'),
(4, 5, 4, 'REC202407100001', '2024-07-10'),
(5, 5, 5, 'REC202407100001', '2024-07-10'),
(6, 8, 6, 'REC202407120001', '2024-07-12'),
(7, 5, 7, 'REC202407150001', '2024-07-15'),
(8, 5, 8, 'REC202409110001', '2024-09-11'),
(9, 15, 9, 'GGS202409110001', '2024-09-11'),
(10, 5, 10, 'GGS202409110001', '2024-09-11'),
(11, 13, 11, 'GGS202410090001', '2024-10-09'),
(12, 13, 12, 'GGS202410090001', '2024-10-09');

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

--
-- Table structure for table `schemes_of_work`
--

CREATE TABLE `schemes_of_work` (
  `scheme_id` int(11) NOT NULL,
  `teacher_id` int(11) DEFAULT NULL,
  `term` varchar(255) DEFAULT NULL,
  `session` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `topics` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `sections`
--

CREATE TABLE `sections` (
  `section_id` int(11) NOT NULL,
  `section_name` varchar(100) NOT NULL,
  `class_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `session_id` int(11) NOT NULL,
  `session_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`session_id`, `session_name`) VALUES
(1, '2024-2025'),
(2, '2023-2024');

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

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

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `current_term` varchar(255) NOT NULL,
  `current_session` varchar(255) NOT NULL,
  `logo` varchar(255) NOT NULL,
  `stamp_image` varchar(255) NOT NULL,
  `school_name` varchar(255) NOT NULL,
  `school_tagline` varchar(255) DEFAULT NULL,
  `phone_no` varchar(20) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `next_term_begins` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `settings` (`id`, `current_term`, `current_session`, `logo`, `stamp_image`, `school_name`, `school_tagline`, `phone_no`, `email`, `address`, `next_term_begins`) VALUES
(1, '1st Term', '2024-2025', 'Agid tech logo.png', '13.png', 'AGID TECH', 'Technology owns your life', '08153654545', 'awosanmiibrahim@gmail.com', 'off olomi olojuoro road, gbado ibadan oyo state', '2024-09-16');

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

--
-- Table structure for table `soc_groups`
--

CREATE TABLE `soc_groups` (
  `id` int(11) NOT NULL,
  `group_name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `group_type` enum('student','teacher','parent') NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `students` (
  `student_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `regNumber` varchar(255) NOT NULL,
  `class_id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `fees_paid` decimal(10,2) DEFAULT 0.00,
  `fees_outstanding` decimal(10,2) DEFAULT 0.00,
  `dob` date DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `profile_picture` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `students` (`student_id`, `user_id`, `name`, `regNumber`, `class_id`, `parent_id`, `fees_paid`, `fees_outstanding`, `dob`, `email`, `phone`, `address`, `profile_picture`) VALUES
(5, 8, 'ibrahim Awosanmi', '1234567', 2, 1, 24000.00, 1000.00, '2010-03-19', 'ibrahim@gmail.com', '08153654545', 'olomi ibadan', 'uploads/students/student_5_1758420688.PNG'),
(8, 13, 'Adeleke Aliat ', '', 1, 1, 8000.00, 17000.00, NULL, NULL, NULL, NULL, NULL),
(9, 15, 'Salawu Malik', '1234GEN', 3, 1, 10000.00, 500000.00, NULL, NULL, NULL, NULL, NULL),
(13, 24, 'Morakinyo Elizebeth', 'GS/20235730', 1, 1, 12000.00, 3000.00, '2020-02-19', 'morakinyo@gmail.com', '9876545678', 'fatusi', '13.png'),
(14, 26, 'Morakinyo Israel', 'GS/20235731', 1, 3, 25000.00, 5000.00, NULL, NULL, NULL, NULL, NULL),
(15, 27, 'Ibrahim Abdul-Lateef', '123456', 3, 3, 28000.00, -3000.00, '2023-08-24', 'Abdul-Lateef@gmail.com', '0889978768787', 'ghgxxyghhufv', '15.jpg'),
(17, 29, 'Awosanmi Jubril', '1236gen', 2, 2, 15000.00, 15000.00, NULL, NULL, NULL, NULL, NULL),
(18, 30, 'Peace Agboola', '45678', 4, 1, 5000.00, 20000.00, '2005-05-08', 'iyanuagoola12@gmail.com', '07037474686', 'Opposite Ogo-Oluwa Integration services, Ilesa Garage, Osogbo, Osun state.', '18.jpg'),
(36, NULL, 'ibrahim Khalid', '123456755', 1, 1, 0.00, 2000.00, '2025-04-29', NULL, '08153654543', 'off olomi olojuoro road, gbado ibadan oyo state', NULL),
(43, NULL, 'Adisa Monsurat', '1234MON', 1, 1, 0.00, 0.00, '2025-09-29', NULL, '08114229135', 'off olomi olojuoro road, gbado ibadan oyo state', NULL),
(44, 44, 'Salawudeen Rofiat', 'GS/12345678', 5, 1, 0.00, 6000.00, NULL, NULL, NULL, NULL, NULL);

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

--
-- Table structure for table `student_attendance`
--

CREATE TABLE `student_attendance` (
  `attendance_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `class_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `status` enum('Present','Absent','Late','Excused') 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 `student_attendance`
--

INSERT INTO `student_attendance` (`attendance_id`, `student_id`, `class_id`, `date`, `status`, `created_at`, `updated_at`) VALUES
(1, 17, 1, '2025-09-21', 'Present', '2025-09-21 00:32:53', '2025-09-21 00:32:53'),
(2, 18, 2, '2025-09-21', 'Present', '2025-09-21 00:34:34', '2025-09-21 00:34:34'),
(3, 15, 3, '2025-09-21', 'Present', '2025-09-21 00:38:00', '2025-09-21 00:38:00');

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

--
-- Table structure for table `student_friends`
--

CREATE TABLE `student_friends` (
  `id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `friend_id` int(11) NOT NULL,
  `status` enum('Active','Blocked') NOT NULL DEFAULT 'Active',
  `last_active` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_friends`
--

INSERT INTO `student_friends` (`id`, `student_id`, `friend_id`, `status`, `last_active`) VALUES
(1, 5, 13, 'Active', '2024-07-29 16:51:02'),
(2, 13, 5, 'Active', '2024-07-29 16:51:02'),
(3, 5, 18, 'Active', '2024-07-29 16:51:02'),
(4, 18, 5, 'Active', '2024-07-29 16:51:02'),
(7, 5, 15, 'Active', '2024-07-29 16:51:02'),
(8, 15, 5, 'Active', '2024-07-29 16:51:02'),
(9, 5, 17, 'Active', '2024-07-29 16:51:02'),
(10, 17, 5, 'Active', '2024-07-29 16:51:02'),
(11, 15, 14, 'Active', '2024-07-29 16:51:02'),
(12, 9, 15, 'Active', '2024-07-29 16:51:02'),
(13, 15, 9, 'Active', '2024-07-29 16:51:02'),
(14, 5, 14, 'Active', '2024-07-29 16:51:02'),
(15, 14, 5, 'Active', '2024-07-29 16:51:02'),
(16, 5, 9, 'Active', '2024-07-29 16:51:02'),
(17, 9, 5, 'Active', '2024-07-29 16:51:02'),
(18, 13, 9, 'Active', '2024-07-29 16:51:02'),
(19, 9, 13, 'Active', '2024-07-29 16:51:02');

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

--
-- Table structure for table `student_groups`
--

CREATE TABLE `student_groups` (
  `group_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `group_name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `group_type` varchar(10) DEFAULT 'Public',
  `group_rules` text NOT NULL,
  `group_image` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_groups`
--

INSERT INTO `student_groups` (`group_id`, `student_id`, `group_name`, `description`, `created_by`, `created_at`, `group_type`, `group_rules`, `group_image`) VALUES
(2, 15, 'Basic 8', 'Discussion', 15, '2024-07-21 11:52:39', 'Private', '', ''),
(3, 5, 'Mathemeatics Group', 'Mathemeatics Group', 5, '2024-07-21 13:09:04', 'Private', '', ''),
(4, 15, 'English Class', 'English Class', 15, '2024-07-21 14:15:07', 'Private', '', ''),
(5, 13, 'Jet Club', 'Jet Club', 13, '2024-07-30 09:47:31', 'public', '', 'Barcelona.png'),
(6, 13, 'Press Club', 'Press Club', 13, '2024-07-30 09:50:56', 'private', 'For Press Club Members', 'All star.jpg'),
(9, 9, 'SPORT CLUB', 'SPORT CLUB', 9, '2024-07-31 08:51:36', 'public', 'SPORT CLUB', 'IMG_20230521_175657_861.jpg'),
(10, 9, 'BIOLOGY GROUP', 'BIOLOGY GROUP', 9, '2024-07-31 08:55:50', 'private', 'BIOLOGY GROUP', 'Generationext Sch. Staff 20230310_183941.jpg');

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

--
-- Table structure for table `student_homework`
--

CREATE TABLE `student_homework` (
  `student_homework_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `homework_id` int(11) DEFAULT NULL,
  `submission` text DEFAULT NULL,
  `submitted_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `status` enum('pending','submitted','late') DEFAULT 'pending',
  `file_path` varchar(255) NOT NULL,
  `feedback` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_homework`
--

INSERT INTO `student_homework` (`student_homework_id`, `student_id`, `homework_id`, `submission`, `submitted_at`, `status`, `file_path`, `feedback`) VALUES
(5, 5, 1, 'zsgfnhdghgb', '2024-07-18 17:53:03', 'submitted', 'uploads/ACCOUNT.docx', NULL),
(6, 13, 1, 'Week 1 Assignment', '2024-07-19 01:17:55', 'submitted', 'uploads/agric sss 1.docx', NULL),
(7, 5, 3, 'land', '2024-07-19 02:45:24', 'submitted', 'uploads/EVG LETTER OF ACCEPTANCE.pdf', NULL),
(8, 18, 4, 'week 1', '2024-07-19 04:33:48', 'submitted', 'uploads/MATHEMATICS (1).docx', 'Great Job\r\n70%'),
(9, 18, 5, 'map', '2024-07-20 21:22:03', 'submitted', 'uploads/BASIC SCIENCE JSS 2.docx', '9/10');

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

--
-- Table structure for table `student_messages`
--

CREATE TABLE `student_messages` (
  `id` int(11) NOT NULL,
  `sender_id` int(11) NOT NULL,
  `receiver_id` int(11) NOT NULL,
  `message` text NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
  `status` enum('Read','Unread') NOT NULL,
  `parent_message_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_messages`
--

INSERT INTO `student_messages` (`id`, `sender_id`, `receiver_id`, `message`, `timestamp`, `status`, `parent_message_id`) VALUES
(2, 5, 13, 'hello', '2024-07-21 02:59:48', 'Read', NULL),
(3, 13, 5, 'hi', '2024-07-21 03:21:44', 'Read', NULL),
(4, 5, 13, 'welcome', '2024-07-21 03:35:55', 'Read', NULL),
(5, 15, 13, 'Are u coming to school today??', '2024-07-22 01:55:38', 'Read', NULL),
(6, 13, 15, 'yes i am coming', '2024-07-22 03:21:31', 'Read', NULL),
(7, 15, 13, 'ok, come along with your mathematics note', '2024-07-22 02:31:29', 'Read', 6),
(8, 13, 15, 'i will\r\n\r\nhope you will come early to school?', '2024-07-22 02:37:03', 'Read', 7),
(9, 15, 13, 'yes', '2024-07-22 02:37:44', 'Read', 8),
(10, 13, 9, 'hello', '2024-07-22 08:24:32', 'Read', NULL),
(11, 9, 18, 'Uncaught error line 60', '2024-07-22 08:25:32', 'Read', NULL),
(12, 18, 13, 'hilltop students are olodooooo!!!!!!!!!!!!!!!!!111', '2024-07-22 08:25:35', 'Read', NULL),
(13, 13, 18, 'really', '2024-07-22 08:27:12', 'Read', 12),
(14, 18, 9, 'sho normal nhi?', '2024-07-22 08:27:13', 'Read', 11),
(15, 9, 13, 'hi', '2024-07-22 08:27:22', 'Read', 10),
(16, 9, 18, 'always use correct vocabylary. if you want to use yoruba, use it well', '2024-07-22 08:28:17', 'Read', 14),
(17, 18, 9, 'look at the spelling of your vocabylary, it\'s spelt VOCABULARY!! not DAT', '2024-07-22 08:30:21', 'Read', 16),
(18, 9, 18, 'it\'s spelt as not it\'s spelt.\r\n\r\nit\'s that not dat', '2024-07-22 08:35:18', 'Read', 17),
(19, 9, 18, 'Miss Teacher\r\n\r\nThank You', '2024-07-30 03:35:19', 'Read', 17),
(20, 13, 9, 'How are you doing', '2024-07-30 03:35:55', 'Read', 15),
(21, 18, 9, 'ok', '2024-07-30 03:38:10', 'Read', 19),
(22, 9, 13, 'Good doing and you?', '2024-07-30 03:39:16', 'Read', 20),
(23, 13, 9, 'Glory be to God', '2024-07-30 03:44:37', 'Read', 22),
(24, 9, 18, 'ok', '2024-07-30 03:53:32', 'Read', 21),
(25, 18, 9, 'hello', '2024-07-30 04:03:31', 'Read', NULL),
(26, 13, 15, 'good morning', '2024-07-30 04:52:01', 'Read', NULL),
(27, 13, 5, 'How you', '2024-07-30 04:55:06', 'Read', NULL),
(28, 5, 13, 'Good', '2024-07-30 05:59:44', 'Unread', 27),
(29, 13, 9, 'Good Afternoon', '2024-08-15 12:29:09', 'Read', 22),
(30, 9, 13, 'How are you doing', '2024-08-15 12:29:34', 'Read', 29),
(31, 13, 9, 'i am good', '2024-08-15 12:32:28', 'Unread', 30);

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

--
-- Table structure for table `student_performance`
--

CREATE TABLE `student_performance` (
  `performance_id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `class_id` int(11) DEFAULT NULL,
  `subject_id` int(11) DEFAULT NULL,
  `score` decimal(5,2) DEFAULT NULL,
  `comments` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `student_requests`
--

CREATE TABLE `student_requests` (
  `request_id` int(11) NOT NULL,
  `requested_id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `status` enum('Pending','Accepted','Rejected') NOT NULL DEFAULT 'Pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `student_requests`
--

INSERT INTO `student_requests` (`request_id`, `requested_id`, `student_id`, `status`, `created_at`) VALUES
(1, 5, 13, 'Accepted', '2024-07-21 01:40:40'),
(2, 5, 18, 'Accepted', '2024-07-21 01:55:33'),
(3, 5, 15, 'Accepted', '2024-07-21 02:14:25'),
(4, 5, 17, 'Accepted', '2024-07-28 06:46:29'),
(5, 5, 14, 'Accepted', '2024-07-28 06:48:20'),
(6, 5, 9, 'Accepted', '2024-07-28 06:50:22'),
(8, 9, 15, 'Accepted', '2024-07-29 10:51:33'),
(10, 13, 9, 'Accepted', '2024-07-29 11:24:32'),
(11, 15, 13, 'Pending', '2024-07-29 11:31:12');

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

--
-- Table structure for table `subject`
--

CREATE TABLE `subject` (
  `subject_id` int(11) NOT NULL,
  `subject_name` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `section` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `subject`
--

INSERT INTO `subject` (`subject_id`, `subject_name`, `created_at`, `section`) VALUES
(1, 'Mathematics', '2024-07-10 04:05:39', 'secondary'),
(2, 'Basic Science', '2024-07-10 04:05:39', 'lower secondary'),
(3, 'English', '2024-07-10 04:05:39', 'secondary'),
(4, 'History', '2024-07-10 04:05:39', 'primary'),
(5, 'Geography', '2024-07-10 04:05:39', 'secondary'),
(6, 'Computer Science', '2024-07-10 04:05:39', 'secondary'),
(7, 'Agricultural Science', '2024-07-10 04:08:08', 'secondary'),
(8, 'Commerce', '2024-07-10 04:10:09', 'secondary'),
(9, 'History', '2024-07-14 04:01:21', 'lower secondary'),
(11, 'Biology', '2024-09-13 04:53:03', 'secondary'),
(12, 'Physics', '2024-09-13 04:59:02', 'secondary');

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

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

CREATE TABLE `teachers` (
  `teacher_id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `address` varchar(255) NOT NULL,
  `subject` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `teachers` (`teacher_id`, `user_id`, `name`, `email`, `phone`, `address`, `subject`) VALUES
(1, 1, 'Class 1A', '', '', '', 'Computer Science'),
(2, 2, 'Class 2B', '', '', '', 'Science'),
(3, 3, 'Class 3C', '', '', '', 'English'),
(4, 9, 'Mrs. Ojo', 'ojo@gmail.com', '08068638495', 'No 1, aba agbarra ayegun ibadan', 'Geography'),
(5, 17, 'Mrs Israel Funmilayo', '', '', '', 'Agricultural Science'),
(6, 18, 'Jubril Awosanmi', '', '', '', 'Computer Science');

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

--
-- Table structure for table `teacher_availability`
--

CREATE TABLE `teacher_availability` (
  `id` int(11) NOT NULL,
  `teacher_id` int(11) DEFAULT NULL,
  `day` varchar(10) DEFAULT NULL,
  `start_time` time DEFAULT NULL,
  `end_time` time DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `teacher_availability`
--

INSERT INTO `teacher_availability` (`id`, `teacher_id`, `day`, `start_time`, `end_time`) VALUES
(1, 5, 'Monday', '08:30:00', '16:00:00'),
(2, 5, 'Tuesday', '08:30:00', '16:00:00'),
(3, 5, 'Wednesday', '08:30:00', '16:00:00'),
(4, 5, 'Thursday', '08:30:00', '16:00:00'),
(5, 5, 'Friday', '08:30:00', '16:00:00'),
(6, 6, 'Monday', '10:00:00', '14:00:00'),
(7, 6, 'Tuesday', '10:00:00', '14:00:00'),
(8, 6, 'Friday', '10:00:00', '13:00:00');

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

--
-- Table structure for table `teacher_schedules`
--

CREATE TABLE `teacher_schedules` (
  `schedule_id` int(11) NOT NULL,
  `teacher_id` int(11) NOT NULL,
  `day` varchar(20) NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `subject_id` int(11) NOT NULL,
  `class_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `teacher_schedules`
--

INSERT INTO `teacher_schedules` (`schedule_id`, `teacher_id`, `day`, `start_time`, `end_time`, `subject_id`, `class_id`) VALUES
(1, 1, 'Monday', '07:31:00', '08:31:00', 1, 1),
(2, 4, 'Monday', '08:30:00', '15:00:00', 1, 1),
(3, 4, 'Tuesday', '08:30:00', '15:00:00', 2, 2),
(4, 4, 'Wednesday', '08:30:00', '15:00:00', 3, 3),
(5, 4, 'Thursday', '08:30:00', '15:00:00', 4, 4),
(6, 4, 'Friday', '08:30:00', '15:00:00', 5, 4);

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

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

CREATE TABLE `terms` (
  `term_id` int(11) NOT NULL,
  `term_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `terms` (`term_id`, `term_name`) VALUES
(1, '1st '),
(2, '2nd');

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

--
-- Table structure for table `timeline`
--

CREATE TABLE `timeline` (
  `id` int(11) NOT NULL,
  `student_id` int(11) NOT NULL,
  `status` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `visibility` enum('public','private','friends') DEFAULT 'public',
  `image_url` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `timeline`
--

INSERT INTO `timeline` (`id`, `student_id`, `status`, `created_at`, `updated_at`, `visibility`, `image_url`) VALUES
(3, 15, 'hello', '2024-07-25 13:42:50', '2024-07-25 13:42:50', 'public', ''),
(4, 15, 'Good Morning Colleagues', '2024-07-26 05:30:20', '2024-07-26 05:30:20', 'public', 'uploads/Argentina.png'),
(5, 13, 'TGIF', '2024-07-26 05:33:26', '2024-07-26 05:33:26', 'public', ''),
(6, 13, 'Morning to you all', '2024-07-28 05:09:53', '2024-07-28 05:09:53', 'public', ''),
(7, 13, 'Hello Friends', '2024-07-28 05:48:10', '2024-07-28 05:48:10', 'public', ''),
(8, 9, 'Good Morning world', '2024-08-15 12:33:09', '2024-08-15 12:33:09', 'public', '');

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

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

CREATE TABLE `timetable` (
  `timetable_id` int(11) NOT NULL,
  `class_id` int(11) NOT NULL,
  `day` varchar(50) NOT NULL,
  `period` varchar(50) NOT NULL,
  `subject_id` int(11) NOT NULL,
  `teacher_id` int(11) NOT NULL,
  `time_slot` varchar(20) NOT NULL,
  `location` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `timetable`
--

INSERT INTO `timetable` (`timetable_id`, `class_id`, `day`, `period`, `subject_id`, `teacher_id`, `time_slot`, `location`) VALUES
(1, 1, 'Monday', '1st', 1, 1, '8:30', 'Basic 7 Class'),
(2, 2, 'Monday', '2nd', 1, 4, '9:15', 'Basic 8 Class'),
(3, 1, 'Monday', '3rd', 6, 1, '9:15', 'Basic 7 Class'),
(4, 1, 'Monday', '3rd', 3, 4, '10:00', 'Basic 7 Class'),
(5, 1, 'Monday', '4th', 7, 3, '10:45', 'Basic 7 Class');

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

--
-- Table structure for table `upcoming_activities`
--

CREATE TABLE `upcoming_activities` (
  `activity_id` int(11) NOT NULL,
  `activity_name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `activity_date` datetime NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `upcoming_activities`
--

INSERT INTO `upcoming_activities` (`activity_id`, `activity_name`, `description`, `activity_date`, `created_at`) VALUES
(3, 'End of the Session Party ', 'comes up on @7th July 2024', '2024-07-27 10:30:00', '2024-07-14 08:23:37'),
(4, 'New Session', 'Welcoming all to the 2025/2026 academic session', '2025-09-20 07:30:00', '2025-09-20 06:29:13');

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

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

CREATE TABLE `users` (
  `user_id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `role` enum('admin','student','teacher','parent') NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `users` (`user_id`, `username`, `password`, `email`, `role`, `created_at`) VALUES
(1, 'admin', '$2y$10$t5pONEMyihjjjknxQ16ieuf1/pMsOcQTwcQDGshdPx4Y7bvCt5Cb2', 'awosanmiibrahim@gmail.com', 'admin', '2024-07-08 06:47:44'),
(2, 'jane_smith', 'hashed_password', 'jane.smith@example.com', 'student', '2024-07-08 07:43:29'),
(3, 'parent_one', 'hashed_password', 'parent.one@example.com', 'parent', '2024-07-08 07:43:29'),
(4, 'teacher_one', 'hashed_password', 'teacher.one@example.com', 'teacher', '2024-07-08 07:43:29'),
(5, 'agid', '$2y$10$6HHGrJE8ca/fKw3cppZTJOKuuCnvKiJEaMAeJ6yV5OS7d1PNIrjzK', 'awosanmiibrahim@gmail.com', 'student', '2024-07-09 05:03:30'),
(8, 'ibrahim', '$2y$10$pRnAKLT0.WlHJ/S.fLXT8ulGnNUDQ2rTMx75CqPA83axlH4aevAgy', 'awosanmiibrahim@gmail.com', 'student', '2024-07-09 05:09:47'),
(9, 'ojo', '$2y$10$AOma8b.qyRfdmVIjfX8hoOp50K7lMD9U/sxg8myk0s4lU9RuTxRAS', 'allimalik688@mail.com', 'teacher', '2024-07-11 04:13:16'),
(13, 'aliat', '$2y$10$X/jb0aBjLzhRAskvBkNNEO3bKXA/LufdFk4LvbP20DDCW4GjsHgBy', 'aliat@generationextschools.com.ng', 'student', '2024-07-11 04:47:40'),
(14, 'gbenga', '$2y$10$5JglxWfiLNGLgC7QuTh80uO8jLh0C0yEQXZPxOfvwkIRivwYTvZBe', 'awosanmiibrahim@gmail.com', 'parent', '2024-07-11 05:07:10'),
(15, 'malik', '$2y$10$.HFgrAe23pdTBcMwqSgr/uX.lTjLHv49N8c2dHblLNpVQvExTsuC.', 'malik@gmail.com', 'student', '2024-07-12 16:10:15'),
(17, 'funmi', '$2y$10$qUv7OdCCF5eKIIUiRXpJ8uuybw9eH.XOw4eI/hQqtnKqYwlATP1Ey', 'funmilayo@gmail.com', 'teacher', '2024-07-14 03:22:46'),
(18, 'jubril', '$2y$10$tx6goyxzzqf15KpAIv49KepliFNowa//kWKM2BXX03lpe/KtGSy9C', 'jub@gmail.com', 'teacher', '2024-07-14 03:39:56'),
(24, 'Elizebeth', '$2y$10$z8iLKfQNnpO.Z4y9jrSVbe0mhPUDZUSIWFNhMeZm/AIKeNHxk3aki', 'morakinyo@gmail.com', 'student', '2024-07-16 03:04:14'),
(26, 'Israel', '$2y$10$88aJwzUzgWGPXolbexZoyu26JtnJwwZmXJM3pgIvFzftOko3vfuqO', 'morakiny@gmail.com', 'student', '2024-07-16 03:29:09'),
(27, 'lateef', '$2y$10$ZRXeA6ZvSnuFljJ5qhi0A.BpcLdFvOUr8KrQtS7bnBn8Zfgjoh45.', 'lateef@gmail.com', 'student', '2024-07-17 02:55:20'),
(29, 'damilare', '$2y$10$ReZjheXttCVnRT1GbIiH9OC/ebQtFeZCexG.HSQ1dJs89q5/ynQlO', 'jubril@gmail', 'student', '2024-07-19 02:13:42'),
(30, 'peace', '$2y$10$ZzIFAOGobzDktsy6R4ppAePfj5OSWqQ4lu1f7gXntf081dREgy4q.', 'peace@gmail.com', 'student', '2024-07-19 02:16:41'),
(32, 'Khalid', '$2y$10$SJJkxTjQxbbnzTl/kNX5KuhDpz/MRJ/Z8Ba7UMeJ4tDrmEg5GWLnS', 'khalid@gmail.com', 'admin', '2025-09-20 03:52:23'),
(36, 'Excel', '$2y$10$7tLL2fFU.73KVMyHeBXU4OHessnfeMZnk7rX4wb6LZvC6HD7nkWhK', 'damilare@gmail.com', 'student', '2025-09-21 04:26:09'),
(43, 'Monsurat', '$2y$10$TgCQsBcTfNnp0oDurIPPT.33Lv3ucJcPEBoIrlWxFzv0JYRHOLLEW', 'monsurat@gmail.com', 'student', '2025-09-21 05:12:27'),
(44, 'rofiat', '$2y$10$LmVC6s1Aa342/2oN6PtUXORj6kk.DZO932b7AKjnWDRENY7.OsjyO', 'salawudeenrofiat@gmail.com', 'student', '2025-09-22 11:21:33');

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

--
-- Table structure for table `user_notifications`
--

CREATE TABLE `user_notifications` (
  `user_id` int(11) NOT NULL,
  `new_notifications` int(11) DEFAULT 0,
  `last_notification` timestamp NOT NULL DEFAULT current_timestamp(),
  `notification_message` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `user_notifications`
--

INSERT INTO `user_notifications` (`user_id`, `new_notifications`, `last_notification`, `notification_message`) VALUES
(9, 15, '2024-07-22 08:23:11', 'New reply in group 3'),
(13, 2, '2024-07-22 08:23:18', 'New message in group 3'),
(15, 6, '2024-07-22 05:55:11', NULL),
(18, 2, '2024-07-22 08:23:24', 'New message in group 3');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `academic_history`
--
ALTER TABLE `academic_history`
  ADD PRIMARY KEY (`history_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `assets`
--
ALTER TABLE `assets`
  ADD PRIMARY KEY (`asset_id`);

--
-- Indexes for table `attendance`
--
ALTER TABLE `attendance`
  ADD PRIMARY KEY (`attendance_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
  ADD PRIMARY KEY (`class_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `enrollments`
--
ALTER TABLE `enrollments`
  ADD PRIMARY KEY (`enrollment_id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `subject_id` (`subject_id`);

--
-- Indexes for table `equity`
--
ALTER TABLE `equity`
  ADD PRIMARY KEY (`equity_id`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`expense_id`);

--
-- Indexes for table `fees`
--
ALTER TABLE `fees`
  ADD PRIMARY KEY (`fee_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `financial_transactions`
--
ALTER TABLE `financial_transactions`
  ADD PRIMARY KEY (`transaction_id`);

--
-- Indexes for table `forums`
--
ALTER TABLE `forums`
  ADD PRIMARY KEY (`forum_id`);

--
-- Indexes for table `forum_posts`
--
ALTER TABLE `forum_posts`
  ADD PRIMARY KEY (`post_id`),
  ADD KEY `forum_id` (`forum_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `groups`
--
ALTER TABLE `groups`
  ADD PRIMARY KEY (`group_id`);

--
-- Indexes for table `group_members`
--
ALTER TABLE `group_members`
  ADD PRIMARY KEY (`group_member_id`),
  ADD KEY `group_id` (`group_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `group_messages`
--
ALTER TABLE `group_messages`
  ADD PRIMARY KEY (`message_id`),
  ADD KEY `group_id` (`group_id`),
  ADD KEY `sender_id` (`sender_id`);

--
-- Indexes for table `group_notifications`
--
ALTER TABLE `group_notifications`
  ADD PRIMARY KEY (`notification_id`),
  ADD KEY `group_id` (`group_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `group_posts`
--
ALTER TABLE `group_posts`
  ADD PRIMARY KEY (`post_id`),
  ADD KEY `group_id` (`group_id`),
  ADD KEY `user_id` (`student_id`);

--
-- Indexes for table `homework`
--
ALTER TABLE `homework`
  ADD PRIMARY KEY (`homework_id`),
  ADD KEY `subject_id` (`subject_id`),
  ADD KEY `teacher_id` (`teacher_id`),
  ADD KEY `fk_homework_class` (`class_id`);

--
-- Indexes for table `income`
--
ALTER TABLE `income`
  ADD PRIMARY KEY (`income_id`);

--
-- Indexes for table `join_requests`
--
ALTER TABLE `join_requests`
  ADD PRIMARY KEY (`request_id`),
  ADD KEY `group_id` (`group_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `liabilities`
--
ALTER TABLE `liabilities`
  ADD PRIMARY KEY (`liability_id`);

--
-- Indexes for table `messages`
--
ALTER TABLE `messages`
  ADD PRIMARY KEY (`message_id`),
  ADD KEY `sender_id` (`sender_id`),
  ADD KEY `receiver_id` (`receiver_id`),
  ADD KEY `group_id` (`group_id`);

--
-- Indexes for table `message_replies`
--
ALTER TABLE `message_replies`
  ADD PRIMARY KEY (`reply_id`),
  ADD KEY `message_id` (`message_id`),
  ADD KEY `sender_id` (`sender_id`);

--
-- Indexes for table `mutual_friends`
--
ALTER TABLE `mutual_friends`
  ADD PRIMARY KEY (`id`),
  ADD KEY `student_id1` (`student_id1`),
  ADD KEY `student_id2` (`student_id2`);

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`notification_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `parents`
--
ALTER TABLE `parents`
  ADD PRIMARY KEY (`parent_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`payment_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `payrolls`
--
ALTER TABLE `payrolls`
  ADD PRIMARY KEY (`payroll_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `post_comments`
--
ALTER TABLE `post_comments`
  ADD PRIMARY KEY (`comment_id`),
  ADD KEY `post_id` (`post_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Indexes for table `profiles`
--
ALTER TABLE `profiles`
  ADD PRIMARY KEY (`profile_id`),
  ADD KEY `user_id` (`student_id`);

--
-- Indexes for table `receipts`
--
ALTER TABLE `receipts`
  ADD PRIMARY KEY (`receipt_id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `payment_id` (`payment_id`);

--
-- Indexes for table `schemes_of_work`
--
ALTER TABLE `schemes_of_work`
  ADD PRIMARY KEY (`scheme_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `sections`
--
ALTER TABLE `sections`
  ADD PRIMARY KEY (`section_id`),
  ADD KEY `class_id` (`class_id`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`session_id`);

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

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

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`student_id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `class_id` (`class_id`),
  ADD KEY `parent_id` (`parent_id`);

--
-- Indexes for table `student_attendance`
--
ALTER TABLE `student_attendance`
  ADD PRIMARY KEY (`attendance_id`),
  ADD UNIQUE KEY `unique_attendance` (`student_id`,`class_id`,`date`),
  ADD KEY `class_id` (`class_id`);

--
-- Indexes for table `student_friends`
--
ALTER TABLE `student_friends`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`student_id`),
  ADD KEY `friend_id` (`friend_id`);

--
-- Indexes for table `student_groups`
--
ALTER TABLE `student_groups`
  ADD PRIMARY KEY (`group_id`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `student_homework`
--
ALTER TABLE `student_homework`
  ADD PRIMARY KEY (`student_homework_id`),
  ADD KEY `student_id` (`student_id`),
  ADD KEY `homework_id` (`homework_id`);

--
-- Indexes for table `student_messages`
--
ALTER TABLE `student_messages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sender_id` (`sender_id`),
  ADD KEY `receiver_id` (`receiver_id`);

--
-- Indexes for table `student_performance`
--
ALTER TABLE `student_performance`
  ADD PRIMARY KEY (`performance_id`);

--
-- Indexes for table `student_requests`
--
ALTER TABLE `student_requests`
  ADD PRIMARY KEY (`request_id`),
  ADD KEY `requested_id` (`requested_id`),
  ADD KEY `student_id` (`student_id`);

--
-- Indexes for table `subject`
--
ALTER TABLE `subject`
  ADD PRIMARY KEY (`subject_id`);

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

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

--
-- Indexes for table `teacher_schedules`
--
ALTER TABLE `teacher_schedules`
  ADD PRIMARY KEY (`schedule_id`),
  ADD KEY `teacher_id` (`teacher_id`);

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

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

--
-- Indexes for table `timetable`
--
ALTER TABLE `timetable`
  ADD PRIMARY KEY (`timetable_id`),
  ADD KEY `class_id` (`class_id`),
  ADD KEY `subject_id` (`subject_id`),
  ADD KEY `teacher_id` (`teacher_id`);

--
-- Indexes for table `upcoming_activities`
--
ALTER TABLE `upcoming_activities`
  ADD PRIMARY KEY (`activity_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`user_id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `user_notifications`
--
ALTER TABLE `user_notifications`
  ADD PRIMARY KEY (`user_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `academic_history`
--
ALTER TABLE `academic_history`
  MODIFY `history_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `fees`
--
ALTER TABLE `fees`
  MODIFY `fee_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `financial_transactions`
--
ALTER TABLE `financial_transactions`
  MODIFY `transaction_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `forums`
--
ALTER TABLE `forums`
  MODIFY `forum_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `forum_posts`
--
ALTER TABLE `forum_posts`
  MODIFY `post_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `groups`
--
ALTER TABLE `groups`
  MODIFY `group_id` int(11) NOT NULL AUTO_INCREMENT;

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

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

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

--
-- AUTO_INCREMENT for table `group_posts`
--
ALTER TABLE `group_posts`
  MODIFY `post_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

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

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

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

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

--
-- AUTO_INCREMENT for table `messages`
--
ALTER TABLE `messages`
  MODIFY `message_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `message_replies`
--
ALTER TABLE `message_replies`
  MODIFY `reply_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `mutual_friends`
--
ALTER TABLE `mutual_friends`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

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

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

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

--
-- AUTO_INCREMENT for table `post_comments`
--
ALTER TABLE `post_comments`
  MODIFY `comment_id` int(11) NOT NULL AUTO_INCREMENT;

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

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

--
-- AUTO_INCREMENT for table `schemes_of_work`
--
ALTER TABLE `schemes_of_work`
  MODIFY `scheme_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sections`
--
ALTER TABLE `sections`
  MODIFY `section_id` int(11) NOT NULL AUTO_INCREMENT;

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

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

--
-- AUTO_INCREMENT for table `soc_groups`
--
ALTER TABLE `soc_groups`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `student_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=45;

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

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

--
-- AUTO_INCREMENT for table `student_groups`
--
ALTER TABLE `student_groups`
  MODIFY `group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `student_homework`
--
ALTER TABLE `student_homework`
  MODIFY `student_homework_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

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

--
-- AUTO_INCREMENT for table `student_performance`
--
ALTER TABLE `student_performance`
  MODIFY `performance_id` int(11) NOT NULL AUTO_INCREMENT;

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `academic_history`
--
ALTER TABLE `academic_history`
  ADD CONSTRAINT `academic_history_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `attendance`
--
ALTER TABLE `attendance`
  ADD CONSTRAINT `attendance_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
  ADD CONSTRAINT `classes_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `enrollments`
--
ALTER TABLE `enrollments`
  ADD CONSTRAINT `enrollments_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
  ADD CONSTRAINT `enrollments_ibfk_2` FOREIGN KEY (`subject_id`) REFERENCES `subject` (`subject_id`);

--
-- Constraints for table `fees`
--
ALTER TABLE `fees`
  ADD CONSTRAINT `fees_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `forum_posts`
--
ALTER TABLE `forum_posts`
  ADD CONSTRAINT `forum_posts_ibfk_1` FOREIGN KEY (`forum_id`) REFERENCES `forums` (`forum_id`),
  ADD CONSTRAINT `forum_posts_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `group_members`
--
ALTER TABLE `group_members`
  ADD CONSTRAINT `group_members_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `student_groups` (`group_id`),
  ADD CONSTRAINT `group_members_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `group_messages`
--
ALTER TABLE `group_messages`
  ADD CONSTRAINT `group_messages_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `student_groups` (`group_id`),
  ADD CONSTRAINT `group_messages_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `group_notifications`
--
ALTER TABLE `group_notifications`
  ADD CONSTRAINT `group_notifications_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `student_groups` (`group_id`),
  ADD CONSTRAINT `group_notifications_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `group_posts`
--
ALTER TABLE `group_posts`
  ADD CONSTRAINT `group_posts_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `student_groups` (`group_id`),
  ADD CONSTRAINT `group_posts_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `homework`
--
ALTER TABLE `homework`
  ADD CONSTRAINT `fk_homework_class` FOREIGN KEY (`class_id`) REFERENCES `classes` (`class_id`) ON DELETE CASCADE,
  ADD CONSTRAINT `homework_ibfk_1` FOREIGN KEY (`subject_id`) REFERENCES `subject` (`subject_id`),
  ADD CONSTRAINT `homework_ibfk_2` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `join_requests`
--
ALTER TABLE `join_requests`
  ADD CONSTRAINT `join_requests_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `student_groups` (`group_id`),
  ADD CONSTRAINT `join_requests_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `messages`
--
ALTER TABLE `messages`
  ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`sender_id`) REFERENCES `users` (`user_id`),
  ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`user_id`),
  ADD CONSTRAINT `messages_ibfk_3` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`);

--
-- Constraints for table `message_replies`
--
ALTER TABLE `message_replies`
  ADD CONSTRAINT `message_replies_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `group_messages` (`message_id`),
  ADD CONSTRAINT `message_replies_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `mutual_friends`
--
ALTER TABLE `mutual_friends`
  ADD CONSTRAINT `mutual_friends_ibfk_1` FOREIGN KEY (`student_id1`) REFERENCES `profiles` (`student_id`),
  ADD CONSTRAINT `mutual_friends_ibfk_2` FOREIGN KEY (`student_id2`) REFERENCES `profiles` (`student_id`);

--
-- Constraints for table `notifications`
--
ALTER TABLE `notifications`
  ADD CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `parents`
--
ALTER TABLE `parents`
  ADD CONSTRAINT `parents_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `payrolls`
--
ALTER TABLE `payrolls`
  ADD CONSTRAINT `payrolls_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `post_comments`
--
ALTER TABLE `post_comments`
  ADD CONSTRAINT `post_comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `group_posts` (`post_id`),
  ADD CONSTRAINT `post_comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `profiles`
--
ALTER TABLE `profiles`
  ADD CONSTRAINT `profiles_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `receipts`
--
ALTER TABLE `receipts`
  ADD CONSTRAINT `receipts_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
  ADD CONSTRAINT `receipts_ibfk_2` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`payment_id`);

--
-- Constraints for table `schemes_of_work`
--
ALTER TABLE `schemes_of_work`
  ADD CONSTRAINT `schemes_of_work_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `sections`
--
ALTER TABLE `sections`
  ADD CONSTRAINT `sections_ibfk_1` FOREIGN KEY (`class_id`) REFERENCES `classes` (`class_id`);

--
-- Constraints for table `students`
--
ALTER TABLE `students`
  ADD CONSTRAINT `fk_student_user` FOREIGN KEY (`student_id`) REFERENCES `users` (`user_id`),
  ADD CONSTRAINT `students_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
  ADD CONSTRAINT `students_ibfk_2` FOREIGN KEY (`class_id`) REFERENCES `classes` (`class_id`),
  ADD CONSTRAINT `students_ibfk_3` FOREIGN KEY (`parent_id`) REFERENCES `parents` (`parent_id`);

--
-- Constraints for table `student_attendance`
--
ALTER TABLE `student_attendance`
  ADD CONSTRAINT `student_attendance_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
  ADD CONSTRAINT `student_attendance_ibfk_2` FOREIGN KEY (`class_id`) REFERENCES `classes` (`class_id`);

--
-- Constraints for table `student_friends`
--
ALTER TABLE `student_friends`
  ADD CONSTRAINT `student_friends_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
  ADD CONSTRAINT `student_friends_ibfk_2` FOREIGN KEY (`friend_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `student_groups`
--
ALTER TABLE `student_groups`
  ADD CONSTRAINT `student_groups_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `student_homework`
--
ALTER TABLE `student_homework`
  ADD CONSTRAINT `student_homework_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`),
  ADD CONSTRAINT `student_homework_ibfk_2` FOREIGN KEY (`homework_id`) REFERENCES `homework` (`homework_id`);

--
-- Constraints for table `student_messages`
--
ALTER TABLE `student_messages`
  ADD CONSTRAINT `student_messages_ibfk_1` FOREIGN KEY (`sender_id`) REFERENCES `users` (`user_id`),
  ADD CONSTRAINT `student_messages_ibfk_2` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `student_requests`
--
ALTER TABLE `student_requests`
  ADD CONSTRAINT `student_requests_ibfk_1` FOREIGN KEY (`requested_id`) REFERENCES `students` (`student_id`),
  ADD CONSTRAINT `student_requests_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `students` (`student_id`);

--
-- Constraints for table `teachers`
--
ALTER TABLE `teachers`
  ADD CONSTRAINT `teachers_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);

--
-- Constraints for table `teacher_availability`
--
ALTER TABLE `teacher_availability`
  ADD CONSTRAINT `teacher_availability_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `teacher_schedules`
--
ALTER TABLE `teacher_schedules`
  ADD CONSTRAINT `teacher_schedules_ibfk_1` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);

--
-- Constraints for table `timeline`
--
ALTER TABLE `timeline`
  ADD CONSTRAINT `timeline_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE;

--
-- Constraints for table `timetable`
--
ALTER TABLE `timetable`
  ADD CONSTRAINT `timetable_ibfk_1` FOREIGN KEY (`class_id`) REFERENCES `classes` (`class_id`),
  ADD CONSTRAINT `timetable_ibfk_2` FOREIGN KEY (`subject_id`) REFERENCES `subject` (`subject_id`),
  ADD CONSTRAINT `timetable_ibfk_3` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`teacher_id`);
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 */;
