-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Nov 26, 2025 at 05:04 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

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


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

--
-- Database: `certificates`
--

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

--
-- Table structure for table `certificates`
--

CREATE TABLE `certificates` (
  `id` int(11) NOT NULL,
  `student_id` int(11) DEFAULT NULL,
  `certificate_type` varchar(100) NOT NULL,
  `issue_date` date NOT NULL,
  `qr_code_path` varchar(255) DEFAULT NULL,
  `qr_content` text DEFAULT NULL,
  `status` enum('active','revoked') DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `certificate_settings`
--

CREATE TABLE `certificate_settings` (
  `id` int(11) NOT NULL,
  `institution_name` varchar(255) NOT NULL DEFAULT 'The Gateway (ICT) Polytechnic Saapade',
  `institution_address` varchar(255) NOT NULL DEFAULT 'Ogun State, Nigeria',
  `registrar_signature` varchar(255) DEFAULT NULL,
  `rector_signature` varchar(255) DEFAULT NULL,
  `official_seal` varchar(255) DEFAULT 'red-seal-certificate.avif',
  `default_issue_date` date DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `certificate_settings`
--

INSERT INTO `certificate_settings` (`id`, `institution_name`, `institution_address`, `registrar_signature`, `rector_signature`, `official_seal`, `default_issue_date`, `created_at`, `updated_at`) VALUES
(1, 'The Gateway (ICT) Polytechnic Saapade', 'Ogun State, Nigeria', NULL, NULL, 'red-seal-certificate.avif', NULL, '2025-09-30 12:24:33', '2025-09-30 12:24:33');

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

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

CREATE TABLE `students` (
  `id` int(11) NOT NULL,
  `student_id` varchar(20) NOT NULL,
  `full_name` varchar(100) NOT NULL,
  `program` varchar(100) NOT NULL,
  `department` varchar(100) NOT NULL,
  `grade` enum('Distinction','Upper Credit','Lower Credit','Pass') NOT NULL,
  `graduation_date` date NOT NULL,
  `photo_path` varchar(255) DEFAULT NULL,
  `certificate_id` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `students` (`id`, `student_id`, `full_name`, `program`, `department`, `grade`, `graduation_date`, `photo_path`, `certificate_id`, `created_at`) VALUES
(1, '252302182', 'Seun Adebayo', 'Accountancy', 'School of Management', 'Upper Credit', '2023-05-15', 'uploads/photos/iszy.jpg', 'GICT-CS-2023-001', '2025-09-30 11:17:40'),
(2, '252305145', 'Fatima Bello', 'Electrical Engineering', 'School of Engineering', 'Lower Credit', '2023-05-16', 'uploads/photos/iszy.jpg', 'GICT-EE-2023-002', '2025-09-30 11:17:40'),
(3, '252602062', 'ISRAEL PITAN', 'Computer Science', 'School of Science and Technology', 'Upper Credit', '2023-05-17', 'uploads/photos/iszy.jpg', 'GICT-BA-2023-003', '2025-09-30 11:17:40');

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

--
-- Table structure for table `upload_logs`
--

CREATE TABLE `upload_logs` (
  `id` int(11) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `records_processed` int(11) NOT NULL,
  `inserted_count` int(11) NOT NULL,
  `updated_count` int(11) NOT NULL,
  `error_count` int(11) NOT NULL,
  `status` enum('success','partial','failed') NOT NULL,
  `upload_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indexes for dumped tables
--

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

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

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `student_id` (`student_id`),
  ADD UNIQUE KEY `certificate_id` (`certificate_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `certificates`
--
ALTER TABLE `certificates`
  ADD CONSTRAINT `certificates_ibfk_1` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`) ON DELETE CASCADE;
COMMIT;

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