-- phpMyAdmin SQL Dump
-- Generation Time: Nov 10, 2025 at 07:55 PM
-- Server version: 8.0.43
-- PHP Version: 8.3.27

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

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

--
-- Table structure for table `attendance_shifts`
--

DROP TABLE IF EXISTS `attendance_shifts`;
CREATE TABLE `attendance_shifts` (
  `id` int NOT NULL,
  `shift_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `teacher_shift` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '0= not , 1 = yes',
  `student_shift` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '0' COMMENT '0= not , 1 = yes',
  `created_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `updated_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- AUTO_INCREMENT for table `attendance_shifts`
--
ALTER TABLE `attendance_shifts`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

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

--
-- Table structure for table `monthly_attendances`
--

DROP TABLE IF EXISTS `monthly_attendances`;
CREATE TABLE `monthly_attendances` (
  `id` bigint UNSIGNED NOT NULL,
  `student_id` bigint UNSIGNED NOT NULL,
  `year` smallint UNSIGNED NOT NULL,
  `month` tinyint UNSIGNED NOT NULL,
  `present_days` smallint UNSIGNED NOT NULL DEFAULT '0',
  `absent_days` smallint UNSIGNED NOT NULL DEFAULT '0',
  `late_days` smallint UNSIGNED NOT NULL DEFAULT '0',
  `total_working_days` smallint UNSIGNED NOT NULL DEFAULT '0',
  `entry_times` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `exit_times` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `shift_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for table `monthly_attendances`
--
ALTER TABLE `monthly_attendances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_year_month` (`year`,`month`),
  ADD KEY `idx_student` (`student_id`);

--
-- AUTO_INCREMENT for table `monthly_attendances`
--
ALTER TABLE `monthly_attendances`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- Table structure for table `teachers_attendance`
--

DROP TABLE IF EXISTS `teachers_attendance`;
CREATE TABLE `teachers_attendance` (
  `id` int NOT NULL,
  `shift_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `date` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `entry_time` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `fingerprint_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `updated_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `message_sent_status` tinyint(1) DEFAULT '0' COMMENT '1 = on, 0 = false'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- AUTO_INCREMENT for table `teachers_attendance`
--
ALTER TABLE `teachers_attendance`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

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

--
-- Table structure for table `attendance_shift_details`
--

DROP TABLE IF EXISTS `attendance_shift_details`;
CREATE TABLE `attendance_shift_details` (
  `id` int NOT NULL,
  `attendance_shift_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `shift_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `class_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `teacher_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `updated_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- AUTO_INCREMENT for table `attendance_shift_details`
--
ALTER TABLE `attendance_shift_details`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

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

--
-- Table structure for table `sms_statuses`
--

DROP TABLE IF EXISTS `sms_statuses`;
CREATE TABLE `sms_statuses` (
  `id` bigint UNSIGNED NOT NULL,
  `student_admission` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_payment` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_attendance_present` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_attendance_late` tinyint NOT NULL DEFAULT '0' COMMENT '	1 = on, 0 = off	',
  `student_attendance_absent` tinyint NOT NULL DEFAULT '0' COMMENT '	1 = on, 0 = off	',
  `teacher_attendance_late` tinyint NOT NULL DEFAULT '0' COMMENT '1 =on 0 = off',
  `teacher_attendance_present` tinyint NOT NULL DEFAULT '0' COMMENT '1 =on 0 = off',
  `teacher_attendance_absent` tinyint NOT NULL DEFAULT '0' COMMENT '1 =on 0 = off',
  `student_leave` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_deactivate` tinyint NOT NULL DEFAULT '1' COMMENT '1 = on, 0 = off',
  `student_comment` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_sonad` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_admitcard` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_result` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `student_sponsor` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `teacher_admission` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `teacher_attendance` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `teacher_leave` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `teacher_salary` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `donar_admission` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `donation` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `donar_payment` tinyint NOT NULL DEFAULT '1' COMMENT ' 1 = on, 0 = off',
  `templates` text COLLATE utf8mb4_unicode_ci,
  `required_placeholders` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- AUTO_INCREMENT for table `sms_statuses`
--
ALTER TABLE `sms_statuses`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;

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

--
-- Table structure for table `absent_notifications_log`
--

DROP TABLE IF EXISTS `absent_notifications_log`;
CREATE TABLE `absent_notifications_log` (
  `id` bigint UNSIGNED NOT NULL,
  `student_id` bigint UNSIGNED DEFAULT NULL,
  `teacher_id` bigint UNSIGNED DEFAULT NULL,
  `shift_id` bigint UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for table `absent_notifications_log`
--
ALTER TABLE `absent_notifications_log`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `absent_notifications_log_student_id_shift_id_date_unique` (`student_id`,`shift_id`,`date`),
  ADD UNIQUE KEY `absent_notifications_log_teacher_id_shift_id_date_unique` (`teacher_id`,`shift_id`,`date`);

--
-- AUTO_INCREMENT for table `absent_notifications_log`
--
ALTER TABLE `absent_notifications_log`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

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

--
-- SQL Commands from `addtwofields.sql`
-- (Warning: These will FAIL if tables 'fund_details', 'invoice_designs', 'attendances' do not exist)
--

ALTER TABLE `fund_details`
ADD COLUMN `salary_reduce` VARCHAR(255) COLLATE 'utf8mb4_unicode_ci' NULL DEFAULT NULL;

ALTER TABLE `invoice_designs`
ADD COLUMN `dashboard_image` VARCHAR(255) COLLATE 'utf8mb4_unicode_ci' NULL DEFAULT NULL;

ALTER TABLE `attendances`
ADD COLUMN `message_sent_status` TINYINT(1) NULL DEFAULT 0
COMMENT '1 = on, 0 = false';

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

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 */;
