

CREATE TABLE `academic_sessions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `academic_sessions_branch_id_name_unique` (`branch_id`,`name`),
  CONSTRAINT `academic_sessions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `academic_sessions` (`id`, `branch_id`, `name`, `start_date`, `end_date`, `is_active`, `created_at`, `updated_at`) VALUES ('1', '1', '2026', '2026-01-01', '2026-12-31', '1', '2026-10-15 06:19:17', '2026-10-15 06:19:17');


CREATE TABLE `branches` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `branches_code_unique` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `branches` (`id`, `name`, `code`, `address`, `phone`, `email`, `status`, `created_at`, `updated_at`) VALUES ('1', 'Main Branch', 'main-1', 'Ahmed Nabar, Paikpara, Mirpur, Dhaka-1216', '01979787564', 'icon@academy.com', '1', '2026-10-15 06:09:15', '2026-10-15 06:09:15');


CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `class_groups` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `group_name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `class_groups_branch_id_group_name_unique` (`branch_id`,`group_name`),
  CONSTRAINT `class_groups_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `class_groups` (`id`, `group_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('1', 'General', '1', '2026-10-15 06:17:35', '2026-10-15 06:17:35');


CREATE TABLE `class_subject` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `class_subject_class_id_subject_id_unique` (`class_id`,`subject_id`),
  KEY `class_subject_subject_id_foreign` (`subject_id`),
  CONSTRAINT `class_subject_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `clss_m_s` (`id`) ON DELETE CASCADE,
  CONSTRAINT `class_subject_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('1', '1', '7', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('2', '1', '6', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('3', '1', '5', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('4', '1', '2', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('5', '1', '3', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('6', '1', '4', NULL, NULL);
INSERT INTO `class_subject` (`id`, `class_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('7', '1', '1', NULL, NULL);


CREATE TABLE `clss_m_s` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `clss_m_s_branch_id_foreign` (`branch_id`),
  CONSTRAINT `clss_m_s_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `clss_m_s` (`id`, `class_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('1', 'Class 7', '1', '2026-10-15 06:17:18', '2026-10-15 06:17:18');


CREATE TABLE `examinations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `examination_type` varchar(255) NOT NULL,
  `examination_year` varchar(255) NOT NULL,
  `exam_mark` decimal(8,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `examinations_branch_id_foreign` (`branch_id`),
  CONSTRAINT `examinations_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `examinations` (`id`, `branch_id`, `examination_type`, `examination_year`, `exam_mark`, `created_at`, `updated_at`) VALUES ('1', '1', 'FINAL', '2026', NULL, '2026-10-15 06:39:37', '2026-10-15 06:39:37');
INSERT INTO `examinations` (`id`, `branch_id`, `examination_type`, `examination_year`, `exam_mark`, `created_at`, `updated_at`) VALUES ('2', '1', 'HALF-YEARLY', '2026', NULL, '2026-10-15 06:39:54', '2026-10-15 06:39:54');
INSERT INTO `examinations` (`id`, `branch_id`, `examination_type`, `examination_year`, `exam_mark`, `created_at`, `updated_at`) VALUES ('3', '1', '1ST TUTORIAL', '2026', '25.00', '2026-10-15 06:40:15', '2026-10-15 06:40:47');
INSERT INTO `examinations` (`id`, `branch_id`, `examination_type`, `examination_year`, `exam_mark`, `created_at`, `updated_at`) VALUES ('4', '1', '2ND TUTORIAL', '2026', '25.00', '2026-10-15 06:40:35', '2026-10-15 06:40:35');


CREATE TABLE `expenses` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `academic_session_id` bigint(20) unsigned DEFAULT NULL,
  `expense_type` varchar(255) NOT NULL,
  `employee_name` varchar(255) DEFAULT NULL,
  `salary_amount` decimal(10,2) NOT NULL,
  `paid_amount` decimal(10,2) NOT NULL,
  `due_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `payment_method` enum('Cash','Bkash','Nagad','Bank') NOT NULL,
  `created_by` varchar(255) DEFAULT NULL,
  `payment_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `payment_month` date DEFAULT NULL,
  `remarks` text DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `expenses_branch_id_foreign` (`branch_id`),
  KEY `expenses_academic_session_id_foreign` (`academic_session_id`),
  CONSTRAINT `expenses_academic_session_id_foreign` FOREIGN KEY (`academic_session_id`) REFERENCES `academic_sessions` (`id`) ON DELETE SET NULL,
  CONSTRAINT `expenses_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



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



CREATE TABLE `final_results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `examination_id` bigint(20) unsigned NOT NULL,
  `percentage` decimal(5,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `final_results_examination_id_foreign` (`examination_id`),
  CONSTRAINT `final_results_examination_id_foreign` FOREIGN KEY (`examination_id`) REFERENCES `examinations` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `final_results` (`id`, `examination_id`, `percentage`, `created_at`, `updated_at`) VALUES ('1', '1', '50.00', '2026-10-15 06:43:04', '2026-10-15 06:43:04');
INSERT INTO `final_results` (`id`, `examination_id`, `percentage`, `created_at`, `updated_at`) VALUES ('2', '2', '20.00', '2026-10-15 06:43:13', '2026-10-15 06:43:13');
INSERT INTO `final_results` (`id`, `examination_id`, `percentage`, `created_at`, `updated_at`) VALUES ('3', '4', '15.00', '2026-10-15 06:43:19', '2026-10-15 06:43:19');
INSERT INTO `final_results` (`id`, `examination_id`, `percentage`, `created_at`, `updated_at`) VALUES ('4', '3', '15.00', '2026-10-15 06:43:26', '2026-10-15 06:43:26');


CREATE TABLE `grading_systems` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `grade` varchar(10) NOT NULL,
  `grade_point` decimal(3,2) NOT NULL,
  `min_percentage` decimal(5,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('1', 'A+', '5.00', '80.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('2', 'A', '4.00', '70.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('3', 'A-', '3.50', '60.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('4', 'B', '3.00', '50.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('5', 'C', '2.00', '40.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('6', 'D', '1.00', '33.00', NULL, NULL);
INSERT INTO `grading_systems` (`id`, `grade`, `grade_point`, `min_percentage`, `created_at`, `updated_at`) VALUES ('7', 'F', '0.00', '0.00', NULL, NULL);


CREATE TABLE `group_subject_mappings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_group_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_subject_mappings_class_group_id_subject_id_unique` (`class_group_id`,`subject_id`),
  KEY `group_subject_mappings_subject_id_foreign` (`subject_id`),
  CONSTRAINT `group_subject_mappings_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE CASCADE,
  CONSTRAINT `group_subject_mappings_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `group_subjects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `class_group_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `group_subjects_class_group_id_subject_id_unique` (`class_group_id`,`subject_id`),
  KEY `group_subjects_subject_id_foreign` (`subject_id`),
  CONSTRAINT `group_subjects_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE CASCADE,
  CONSTRAINT `group_subjects_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `group_subjects` (`id`, `class_group_id`, `subject_id`, `created_at`, `updated_at`) VALUES ('1', '1', '7', NULL, NULL);


CREATE TABLE `holidays` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `holidays_branch_id_foreign` (`branch_id`),
  CONSTRAINT `holidays_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `holidays` (`id`, `branch_id`, `title`, `start_date`, `end_date`, `description`, `created_at`, `updated_at`) VALUES ('1', '1', 'Eid-Ul-Fitr', '2026-10-16', '2026-10-18', 'Enjoy the Vacation', '2026-10-15 06:44:53', '2026-10-15 06:44:53');


CREATE TABLE `institute_infos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `institute_name` varchar(255) NOT NULL,
  `established_year` varchar(255) DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `contact` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `institute_infos_branch_id_index` (`branch_id`),
  CONSTRAINT `institute_infos_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



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



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



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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('1', '0001_01_01_000000_create_users_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('2', '0001_01_01_000001_create_cache_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('3', '0001_01_01_000002_create_jobs_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('4', '2026_01_02_152655_create_teachers_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('5', '2026_01_02_164123_create_teachers_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('6', '2026_02_07_071712_create_shifts_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('7', '2026_04_23_074928_create_sections_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('8', '2026_05_10_191531_create_examinations_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('9', '2026_05_11_210152_create_personal_access_tokens_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('10', '2026_05_18_234106_create_clss_m_s_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('11', '2026_05_19_061918_students', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('12', '2026_05_19_115201_create_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('13', '2026_05_19_182404_add_month_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('14', '2026_06_20_161735_create_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('15', '2026_07_11_094428_add_exit_time_to_teacher_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('16', '2026_07_16_083620_add_monthly_fee_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('17', '2026_07_17_193256_add_admission_fee_and_exam_fee_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('18', '2026_07_18_075010_create_other_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('19', '2026_07_19_104636_create_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('20', '2026_07_19_133530_add_payment_month_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('21', '2026_07_30_174357_add_created_by_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('22', '2026_08_02_152559_create_model_names_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('23', '2026_08_11_154210_staff', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('24', '2026_08_25_095835_create_staff_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('25', '2026_08_27_191706_create_holidays_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('26', '2026_08_28_120440_create_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('27', '2026_08_28_121348_create_class_subject_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('28', '2026_08_28_183831_create_result_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('29', '2026_08_31_175137_create_class_groups_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('30', '2026_08_31_175526_create_group_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('31', '2026_08_31_190731_add_class_group_id_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('32', '2026_09_01_160715_create_institute_infos_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('33', '2026_09_07_124506_create_group_subject_mappings_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('34', '2026_09_08_082408_add_full_mark_column_to_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('35', '2026_09_08_090418_create_grading_systems_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('36', '2026_09_08_201522_add_exam_mark_to_examinations_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('37', '2026_09_10_183844_create_final_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('38', '2026_09_16_213755_add_version_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('39', '2026_09_26_075457_create_branches_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('40', '2026_09_26_084953_add_branch_id_to_staff_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('41', '2026_09_26_143458_add_branch_id_to_clss_m_s_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('42', '2026_09_26_151140_add_branch_id_to_class_groups_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('43', '2026_09_26_170151_add_branch_id_to_sections_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('44', '2026_09_26_171433_add_branch_id_to_shifts_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('45', '2026_09_26_173225_add_branch_id_to_subjects_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('46', '2026_09_26_175622_add_branch_id_to_students_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('47', '2026_09_27_060613_add_branch_id_to_teachers_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('48', '2026_09_28_070702_add_branch_id_to_teachers_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('49', '2026_09_28_071847_add_branch_id_to_staff_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('50', '2026_09_28_092806_add_branch_id_to_examinations_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('51', '2026_09_28_101042_add_branch_id_to_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('52', '2026_09_28_111533_add_branch_id_to_holidays_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('53', '2026_09_28_235821_add_branch_id_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('54', '2026_09_30_045513_add_branch_id_to_institute_infos_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('55', '2026_10_02_192341_create_student_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('56', '2026_10_03_170617_add_leave_to_student_attendances_status', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('57', '2026_10_12_080903_create_academic_sessions_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('58', '2026_10_12_081734_create_student_sessions_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('59', '2026_10_12_084212_add_student_session_id_to_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('60', '2026_10_12_114006_add_student_session_id_to_student_attendances_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('61', '2026_10_12_114742_update_student_attendance_unique_constraint', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('62', '2026_10_12_200323_add_class_snapshot_fields_to_results_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('63', '2026_10_12_215030_add_student_session_id_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('64', '2026_10_13_093055_add_student_session_id_to_other_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('65', '2026_10_13_111324_add_academic_session_id_to_expenses_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('66', '2026_10_14_142859_add_due_payment_fields_to_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('67', '2026_10_14_184742_add_payment_type_to_other_payments_table', '1');
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES ('68', '2026_10_14_223344_add_remarks_to_expenses_table', '1');


CREATE TABLE `model_names` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `other_payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `payment_type` varchar(255) NOT NULL DEFAULT 'Other',
  `item_name` varchar(255) NOT NULL,
  `quantity` int(11) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `total_amount` decimal(10,2) NOT NULL,
  `payment_method` varchar(255) NOT NULL,
  `payment_date` date NOT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `other_payments_student_id_foreign` (`student_id`),
  KEY `other_payments_student_session_id_foreign` (`student_session_id`),
  CONSTRAINT `other_payments_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `other_payments_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;



CREATE TABLE `payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `paid_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `admission_fee` decimal(10,2) DEFAULT NULL,
  `exam_fee` decimal(10,2) DEFAULT NULL,
  `due_amount` decimal(10,2) DEFAULT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `payment_date` date DEFAULT NULL,
  `status` enum('paid','due') NOT NULL DEFAULT 'due',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `month` varchar(255) DEFAULT NULL,
  `due_month` varchar(255) DEFAULT NULL,
  `due_payment_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`id`),
  KEY `payments_student_id_foreign` (`student_id`),
  KEY `payments_session_month_index` (`student_session_id`,`month`),
  CONSTRAINT `payments_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `payments_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `payments` (`id`, `student_id`, `student_session_id`, `amount`, `paid_amount`, `admission_fee`, `exam_fee`, `due_amount`, `payment_method`, `payment_date`, `status`, `created_at`, `updated_at`, `month`, `due_month`, `due_payment_amount`) VALUES ('4', '1', '1', '1500.00', '1000.00', '0.00', '0.00', '500.00', 'Cash', '2026-10-14', 'due', '2026-10-15 08:40:17', '2026-10-15 08:40:17', 'September', NULL, '0.00');
INSERT INTO `payments` (`id`, `student_id`, `student_session_id`, `amount`, `paid_amount`, `admission_fee`, `exam_fee`, `due_amount`, `payment_method`, `payment_date`, `status`, `created_at`, `updated_at`, `month`, `due_month`, `due_payment_amount`) VALUES ('8', '1', '1', '1500.00', '1500.00', '0.00', '0.00', '0.00', 'Cash', '2026-10-15', 'paid', '2026-10-15 09:16:16', '2026-10-15 09:16:16', 'October', 'September', '500.00');


CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) unsigned NOT NULL,
  `name` text NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`),
  KEY `personal_access_tokens_expires_at_index` (`expires_at`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `personal_access_tokens` (`id`, `tokenable_type`, `tokenable_id`, `name`, `token`, `abilities`, `last_used_at`, `expires_at`, `created_at`, `updated_at`) VALUES ('1', 'App\\Models\\Staff', '1', 'staff-token', '6ea0f3d39a2a6a4b85467dbdb5cb0fe646dfb596d8997e52030483c41a5b9b59', '[\"*\"]', '2026-10-15 09:31:17', NULL, '2026-10-15 06:06:55', '2026-10-15 09:31:17');


CREATE TABLE `result_subjects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `result_id` bigint(20) unsigned NOT NULL,
  `subject_id` bigint(20) unsigned NOT NULL,
  `marks` decimal(5,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `result_subjects_result_id_subject_id_unique` (`result_id`,`subject_id`),
  KEY `result_subjects_subject_id_foreign` (`subject_id`),
  CONSTRAINT `result_subjects_result_id_foreign` FOREIGN KEY (`result_id`) REFERENCES `results` (`id`) ON DELETE CASCADE,
  CONSTRAINT `result_subjects_subject_id_foreign` FOREIGN KEY (`subject_id`) REFERENCES `subjects` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('1', '1', '1', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('2', '1', '2', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('3', '1', '3', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('4', '1', '4', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('5', '1', '5', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('6', '1', '6', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('7', '1', '7', '99.00', '2026-10-15 06:41:40', '2026-10-15 06:41:40');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('8', '2', '1', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('9', '2', '2', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('10', '2', '3', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('11', '2', '4', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('12', '2', '5', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('13', '2', '6', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('14', '2', '7', '99.00', '2026-10-15 06:42:00', '2026-10-15 06:42:00');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('15', '3', '1', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('16', '3', '2', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('17', '3', '3', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('18', '3', '4', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('19', '3', '5', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('20', '3', '6', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('21', '3', '7', '22.00', '2026-10-15 06:42:23', '2026-10-15 06:42:23');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('22', '4', '1', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('23', '4', '2', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('24', '4', '3', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('25', '4', '4', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('26', '4', '5', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('27', '4', '6', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');
INSERT INTO `result_subjects` (`id`, `result_id`, `subject_id`, `marks`, `created_at`, `updated_at`) VALUES ('28', '4', '7', '22.00', '2026-10-15 06:42:46', '2026-10-15 06:42:46');


CREATE TABLE `results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `exam_year` varchar(255) NOT NULL,
  `exam_type` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `class_name_snapshot` varchar(255) DEFAULT NULL,
  `section_name_snapshot` varchar(255) DEFAULT NULL,
  `shift_name_snapshot` varchar(255) DEFAULT NULL,
  `class_group_name_snapshot` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `results_student_id_exam_year_exam_type_unique` (`student_id`,`exam_year`,`exam_type`),
  KEY `results_branch_id_foreign` (`branch_id`),
  KEY `results_student_session_id_foreign` (`student_session_id`),
  CONSTRAINT `results_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `results_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `results_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `results` (`id`, `branch_id`, `student_id`, `student_session_id`, `exam_year`, `exam_type`, `created_at`, `updated_at`, `class_name_snapshot`, `section_name_snapshot`, `shift_name_snapshot`, `class_group_name_snapshot`) VALUES ('1', '1', '1', '1', '2026', 'FINAL', '2026-10-15 06:41:40', '2026-10-15 06:41:40', 'Class 7', 'A', 'Morning', 'General');
INSERT INTO `results` (`id`, `branch_id`, `student_id`, `student_session_id`, `exam_year`, `exam_type`, `created_at`, `updated_at`, `class_name_snapshot`, `section_name_snapshot`, `shift_name_snapshot`, `class_group_name_snapshot`) VALUES ('2', '1', '1', '1', '2026', 'HALF-YEARLY', '2026-10-15 06:42:00', '2026-10-15 06:42:00', 'Class 7', 'A', 'Morning', 'General');
INSERT INTO `results` (`id`, `branch_id`, `student_id`, `student_session_id`, `exam_year`, `exam_type`, `created_at`, `updated_at`, `class_name_snapshot`, `section_name_snapshot`, `shift_name_snapshot`, `class_group_name_snapshot`) VALUES ('3', '1', '1', '1', '2026', '2ND TUTORIAL', '2026-10-15 06:42:23', '2026-10-15 06:42:23', 'Class 7', 'A', 'Morning', 'General');
INSERT INTO `results` (`id`, `branch_id`, `student_id`, `student_session_id`, `exam_year`, `exam_type`, `created_at`, `updated_at`, `class_name_snapshot`, `section_name_snapshot`, `shift_name_snapshot`, `class_group_name_snapshot`) VALUES ('4', '1', '1', '1', '2026', '1ST TUTORIAL', '2026-10-15 06:42:46', '2026-10-15 06:42:46', 'Class 7', 'A', 'Morning', 'General');


CREATE TABLE `sections` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `section_name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sections_branch_id_section_name_unique` (`branch_id`,`section_name`),
  CONSTRAINT `sections_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `sections` (`id`, `section_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('1', 'A', '1', '2026-10-15 06:16:48', '2026-10-15 06:16:48');
INSERT INTO `sections` (`id`, `section_name`, `branch_id`, `created_at`, `updated_at`) VALUES ('2', 'Section B', '1', '2026-10-15 06:16:57', '2026-10-15 06:16:57');


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



CREATE TABLE `shifts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `start_time` time NOT NULL DEFAULT '09:00:00',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `shifts_branch_id_name_unique` (`branch_id`,`name`),
  CONSTRAINT `shifts_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `shifts` (`id`, `name`, `branch_id`, `start_time`, `created_at`, `updated_at`) VALUES ('1', 'Morning', '1', '09:00:00', '2026-10-15 06:10:16', '2026-10-15 06:10:16');
INSERT INTO `shifts` (`id`, `name`, `branch_id`, `start_time`, `created_at`, `updated_at`) VALUES ('2', 'Day', '1', '12:00:00', '2026-10-15 06:13:27', '2026-10-15 06:13:27');


CREATE TABLE `staff` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `shift_id` bigint(20) unsigned DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `user_name` varchar(255) NOT NULL,
  `skill` varchar(255) DEFAULT NULL,
  `role` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `salary` decimal(10,2) NOT NULL,
  `password` varchar(255) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_user_name_unique` (`user_name`),
  UNIQUE KEY `staff_email_unique` (`email`),
  KEY `staff_shift_id_foreign` (`shift_id`),
  KEY `staff_branch_id_foreign` (`branch_id`),
  CONSTRAINT `staff_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `staff_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('1', NULL, NULL, 'MOSHARRAF HOSSAIN', 'manager', 'Administration', 'Manager', 'icon@academy.com', NULL, '0.00', '$2y$12$jVLxOu.e.j/UXY7XaV42uubaESIkeWh4NlZiCPLddu0IbjuRxPNfu', NULL, '2026-10-15 06:03:07', '2026-10-15 06:03:07');
INSERT INTO `staff` (`id`, `branch_id`, `shift_id`, `name`, `user_name`, `skill`, `role`, `email`, `image`, `salary`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('2', '1', '1', 'Mohsin Miah', 'mohsin_10', 'Full-Time', 'Branch Manager', 'mohsin@gamil.com', 'staffs/6XtMlxYen3tJSEowRMRNKaZRw46hshsJyynq8yqs.png', '30000.00', '$2y$12$wVTPgbjbevgxhbsYsANA9ejmoiLzCDotf22X5dDoj6TIPrvedtBim', NULL, '2026-10-15 06:11:08', '2026-10-15 06:11:08');


CREATE TABLE `staff_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `staff_id` bigint(20) unsigned NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `shift_name` varchar(255) NOT NULL DEFAULT 'General Shift',
  `date` date NOT NULL,
  `status` enum('Present','Absent','Late','Leave') NOT NULL DEFAULT 'Present',
  `in_time` time DEFAULT NULL,
  `out_time` time DEFAULT NULL,
  `note` text DEFAULT NULL,
  `leave` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `staff_attendances_staff_id_shift_name_date_unique` (`staff_id`,`shift_name`,`date`),
  KEY `staff_attendances_branch_id_foreign` (`branch_id`),
  CONSTRAINT `staff_attendances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `staff_attendances_staff_id_foreign` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `staff_attendances` (`id`, `staff_id`, `branch_id`, `shift_name`, `date`, `status`, `in_time`, `out_time`, `note`, `leave`, `created_at`, `updated_at`) VALUES ('1', '2', '1', 'Morning', '2026-10-15', 'Late', '09:33:00', '12:00:00', 'Late by 33 mins', '0', '2026-10-15 06:33:03', '2026-10-15 06:33:45');


CREATE TABLE `student_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `student_session_id` bigint(20) unsigned DEFAULT NULL,
  `branch_id` bigint(20) unsigned NOT NULL,
  `date` date NOT NULL,
  `status` enum('present','absent','late','leave') NOT NULL DEFAULT 'present',
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `student_attendance_session_date_unique` (`student_session_id`,`date`),
  KEY `student_attendances_branch_id_foreign` (`branch_id`),
  KEY `student_attendances_student_id_index` (`student_id`),
  CONSTRAINT `student_attendances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_attendances_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_attendances_student_session_id_foreign` FOREIGN KEY (`student_session_id`) REFERENCES `student_sessions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `student_attendances` (`id`, `student_id`, `student_session_id`, `branch_id`, `date`, `status`, `remarks`, `created_at`, `updated_at`) VALUES ('1', '4', '4', '1', '2026-10-15', 'present', NULL, '2026-10-15 06:36:28', '2026-10-15 06:36:28');


CREATE TABLE `student_sessions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `student_id` bigint(20) unsigned NOT NULL,
  `academic_session_id` bigint(20) unsigned NOT NULL,
  `branch_id` bigint(20) unsigned NOT NULL,
  `class_id` bigint(20) unsigned NOT NULL,
  `section_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned DEFAULT NULL,
  `class_group_id` bigint(20) unsigned DEFAULT NULL,
  `monthly_fee` decimal(10,2) NOT NULL DEFAULT 0.00,
  `status` enum('active','completed','transferred') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `student_session_unique` (`student_id`,`academic_session_id`),
  KEY `student_sessions_academic_session_id_foreign` (`academic_session_id`),
  KEY `student_sessions_class_id_foreign` (`class_id`),
  KEY `student_sessions_section_id_foreign` (`section_id`),
  KEY `student_sessions_shift_id_foreign` (`shift_id`),
  KEY `student_sessions_class_group_id_foreign` (`class_group_id`),
  KEY `student_sessions_branch_id_academic_session_id_index` (`branch_id`,`academic_session_id`),
  CONSTRAINT `student_sessions_academic_session_id_foreign` FOREIGN KEY (`academic_session_id`) REFERENCES `academic_sessions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_sessions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `student_sessions_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE SET NULL,
  CONSTRAINT `student_sessions_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `clss_m_s` (`id`),
  CONSTRAINT `student_sessions_section_id_foreign` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`),
  CONSTRAINT `student_sessions_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE SET NULL,
  CONSTRAINT `student_sessions_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('1', '1', '1', '1', '1', '1', '1', '1', '1500.00', 'active', '2026-10-15 06:20:35', '2026-10-15 06:20:35');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('2', '2', '1', '1', '1', '1', '1', '1', '2000.00', 'active', '2026-10-15 06:25:12', '2026-10-15 06:25:12');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('3', '3', '1', '1', '1', '1', '1', '1', '2000.00', 'active', '2026-10-15 06:27:21', '2026-10-15 06:27:21');
INSERT INTO `student_sessions` (`id`, `student_id`, `academic_session_id`, `branch_id`, `class_id`, `section_id`, `shift_id`, `class_group_id`, `monthly_fee`, `status`, `created_at`, `updated_at`) VALUES ('4', '4', '1', '1', '1', '1', '1', '1', '2000.00', 'active', '2026-10-15 06:31:51', '2026-10-15 06:31:51');


CREATE TABLE `students` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `section_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned DEFAULT NULL,
  `class_id` bigint(20) unsigned NOT NULL,
  `class_group_id` bigint(20) unsigned DEFAULT NULL,
  `full_name` varchar(255) NOT NULL,
  `version` varchar(255) DEFAULT NULL,
  `fathers_name` varchar(255) NOT NULL,
  `mothers_name` varchar(255) NOT NULL,
  `student_id` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `course_name` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `admission_date` date DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `monthly_fee` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `students_student_id_unique` (`student_id`),
  KEY `students_section_id_foreign` (`section_id`),
  KEY `students_shift_id_foreign` (`shift_id`),
  KEY `students_class_id_foreign` (`class_id`),
  KEY `students_class_group_id_foreign` (`class_group_id`),
  KEY `students_branch_id_foreign` (`branch_id`),
  CONSTRAINT `students_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `students_class_group_id_foreign` FOREIGN KEY (`class_group_id`) REFERENCES `class_groups` (`id`) ON DELETE SET NULL,
  CONSTRAINT `students_class_id_foreign` FOREIGN KEY (`class_id`) REFERENCES `clss_m_s` (`id`) ON DELETE CASCADE,
  CONSTRAINT `students_section_id_foreign` FOREIGN KEY (`section_id`) REFERENCES `sections` (`id`) ON DELETE CASCADE,
  CONSTRAINT `students_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`) VALUES ('1', '1', '1', '1', '1', '1', 'Ashraful Haque', 'Bangla Medium (Special Care)', 'Ashraful\'s Fathers', 'Ashraful\'s Mothers', 'STD-1001', '01753787564', 'ashraf@haq.com', NULL, 'students/1792045235_B3dAK9DSlE.png', '2026-09-15', 'active', '2026-10-15 06:20:35', '2026-10-15 06:20:35', '1500.00');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`) VALUES ('2', '1', '1', '1', '1', '1', 'Tashrif Ahmed', 'Bangla Medium (Special Care)', 'Shahidul Islam', 'Taskiya Tanzin', 'STD-1002', '01753787564', 'tashrif@gmail.com', NULL, NULL, '2026-10-15', 'active', '2026-10-15 06:25:12', '2026-10-15 06:25:12', '2000.00');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`) VALUES ('3', '1', '1', '1', '1', '1', 'Jubair Rahman', 'Bangla Medium (Special Care)', 'Zahidul Islam', 'Shahida Begum', 'STD-1003', '01987654567', 'jubair@gmail.com', NULL, NULL, '2026-10-15', 'active', '2026-10-15 06:27:21', '2026-10-15 06:27:21', '2000.00');
INSERT INTO `students` (`id`, `branch_id`, `section_id`, `shift_id`, `class_id`, `class_group_id`, `full_name`, `version`, `fathers_name`, `mothers_name`, `student_id`, `phone`, `email`, `course_name`, `image`, `admission_date`, `status`, `created_at`, `updated_at`, `monthly_fee`) VALUES ('4', '1', '1', '1', '1', '1', 'Zannatul Ferdowsi', 'Bangla Medium (Special Care)', 'Zahidul Islam', 'Shahida Begum', 'STD-1004', '01387645789', 'zannat@gmail.com', NULL, NULL, '2026-10-15', 'active', '2026-10-15 06:31:51', '2026-10-15 06:31:51', '2000.00');


CREATE TABLE `subjects` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `code` varchar(50) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `full_mark` int(10) unsigned NOT NULL DEFAULT 100,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `subjects_branch_id_code_unique` (`branch_id`,`code`),
  CONSTRAINT `subjects_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('1', 'Bangla', 'BANG', '1', '100', '2026-10-15 06:14:02', '2026-10-15 06:14:02');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('2', 'English', 'ENG', '1', '100', '2026-10-15 06:14:13', '2026-10-15 06:14:13');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('3', 'Mathematics', 'MATH', '1', '100', '2026-10-15 06:14:31', '2026-10-15 06:14:31');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('4', 'Bangladesh & Global studies', 'BGS', '1', '100', '2026-10-15 06:14:52', '2026-10-15 06:14:52');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('5', 'Science', 'SCE', '1', '100', '2026-10-15 06:15:44', '2026-10-15 06:15:44');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('6', 'Religion', 'REL', '1', '100', '2026-10-15 06:15:54', '2026-10-15 06:15:54');
INSERT INTO `subjects` (`id`, `name`, `code`, `branch_id`, `full_mark`, `created_at`, `updated_at`) VALUES ('7', 'Agriculture', 'AGRI', '1', '100', '2026-10-15 06:16:12', '2026-10-15 06:16:12');


CREATE TABLE `teacher_shift` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `teacher_id` bigint(20) unsigned NOT NULL,
  `shift_id` bigint(20) unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `teacher_shift_teacher_id_foreign` (`teacher_id`),
  KEY `teacher_shift_shift_id_foreign` (`shift_id`),
  CONSTRAINT `teacher_shift_shift_id_foreign` FOREIGN KEY (`shift_id`) REFERENCES `shifts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `teacher_shift_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `teacher_shift` (`id`, `teacher_id`, `shift_id`, `created_at`, `updated_at`) VALUES ('1', '1', '1', NULL, NULL);


CREATE TABLE `teachers` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `teacher_id` varchar(255) NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `full_name` varchar(255) NOT NULL,
  `designation` varchar(255) NOT NULL,
  `department` varchar(255) NOT NULL,
  `qualification` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) NOT NULL,
  `join_date` date NOT NULL,
  `salary` decimal(10,2) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `teachers_teacher_id_unique` (`teacher_id`),
  UNIQUE KEY `teachers_email_unique` (`email`),
  KEY `teachers_branch_id_foreign` (`branch_id`),
  CONSTRAINT `teachers_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `teachers` (`id`, `teacher_id`, `branch_id`, `full_name`, `designation`, `department`, `qualification`, `phone`, `email`, `join_date`, `salary`, `image`, `created_at`, `updated_at`) VALUES ('1', 'TCH-1001', '1', 'Shahidul Islam', 'Senior Teacher', 'Computer Science', 'Ma in Physics', '01989900867', 'shahed@gmail.com', '2026-10-15', '20000.00', 'teachers/1792044762_WjiI5kmDpM.png', '2026-10-15 06:12:42', '2026-10-15 06:12:42');


CREATE TABLE `teachers_attendances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `teacher_id` bigint(20) unsigned NOT NULL,
  `branch_id` bigint(20) unsigned DEFAULT NULL,
  `shift_name` varchar(255) NOT NULL DEFAULT 'General Shift',
  `date` date NOT NULL,
  `status` enum('Present','Absent','Late','Leave') NOT NULL DEFAULT 'Present',
  `leave` tinyint(1) NOT NULL DEFAULT 0,
  `in_time` time DEFAULT NULL,
  `out_time` time DEFAULT NULL,
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `teachers_attendances_teacher_id_shift_name_date_unique` (`teacher_id`,`shift_name`,`date`),
  KEY `teachers_attendances_branch_id_foreign` (`branch_id`),
  CONSTRAINT `teachers_attendances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `teachers_attendances_teacher_id_foreign` FOREIGN KEY (`teacher_id`) REFERENCES `teachers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `teachers_attendances` (`id`, `teacher_id`, `branch_id`, `shift_name`, `date`, `status`, `leave`, `in_time`, `out_time`, `note`, `created_at`, `updated_at`) VALUES ('1', '1', '1', 'Morning', '2026-10-15', 'Late', '0', '09:20:00', '12:00:00', 'Late by 20 mins', '2026-10-15 06:34:31', '2026-10-15 06:34:55');


CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `remember_token` varchar(100) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

