-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 18, 2026 at 05:30 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.0.30

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_activity_system`
--

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

--
-- Table structure for table `officers`
--

CREATE TABLE `officers` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `designation` varchar(255) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `details` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `officers`
--

INSERT INTO `officers` (`id`, `name`, `designation`, `phone`, `email`, `details`, `created_at`) VALUES
(1, 'Mr. Perera', 'Science Teacher', '0771234567', 'perera@school.lk', NULL, '2026-02-17 15:40:43'),
(2, 'Ms. Fernando', 'Sports Coach', '0777654321', 'fernando@school.lk', NULL, '2026-02-17 15:40:43'),
(3, 'kanchana', 'ICt Teacher', '0754125412', 'kanchana@gmail.com', 'fsaf', '2026-02-17 15:58:52'),
(4, 'Nisansala', 'Teacher', '0713254124', 'nisansala@gmail.com', NULL, '2026-02-17 17:32:57');

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

--
-- Table structure for table `subtopics`
--

CREATE TABLE `subtopics` (
  `id` int(11) NOT NULL,
  `topic_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `officer_id` int(11) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `subtopics`
--

INSERT INTO `subtopics` (`id`, `topic_id`, `name`, `officer_id`, `description`, `created_at`, `updated_at`) VALUES
(7, 8, '1.1 පන්ති අදීක්ෂණ කටයුතු වධිමත් කාල සටහනකට අනුව සිදු කිරීම', 3, 'සෑම ගුරු භවතෙකුම ආවරණය වන පරිදි විධිමත් කාල රාමුවකට අනුව පන්ති අදීක්සණ කටයුතු සිදු කරනු ලබයි', '2026-02-18 14:08:08', '2026-02-18 14:08:08'),
(8, 10, '3.1 සමස්ථ ලංකා සංගීත තැඝ ජයග්‍රහණ', 4, 'ඒකල තරග සඳමා සහභාගි වෙමින් ප්‍රථම ස්ථානය දිනා ඇත', '2026-02-18 15:06:37', '2026-02-18 15:06:37');

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

--
-- Table structure for table `subtopic_photos`
--

CREATE TABLE `subtopic_photos` (
  `id` int(11) NOT NULL,
  `subtopic_id` int(11) NOT NULL,
  `file_path` varchar(500) NOT NULL,
  `caption` varchar(255) DEFAULT NULL,
  `uploaded_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `subtopic_photos`
--

INSERT INTO `subtopic_photos` (`id`, `subtopic_id`, `file_path`, `caption`, `uploaded_at`) VALUES
(10, 7, '6995c80cce022.PNG', 'පන්ති අධීක්සණය 10 ශ්‍රේණීය', '2026-02-18 14:09:16'),
(11, 8, '6995d5a35f13c.png', '2025/12/13 දින තරග සඳහා සහභාගි විය', '2026-02-18 15:07:15');

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

--
-- Table structure for table `topics`
--

CREATE TABLE `topics` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `topics`
--

INSERT INTO `topics` (`id`, `name`, `description`, `created_at`) VALUES
(7, 'ශිෂ්‍ය සාධනය', '1-නිපුණතා අත්පත් කර ගැනීම සඳහා විධිමත් තක්සේරු හා ඇගයීම් ක්‍රියාවලියක් පවත්වා ගනි', '2026-02-18 13:54:40'),
(8, 'ඉගෙනුම ඉගැන්වීම හා ඇගයීම', 'පුද්ගල හා සමාජ සංවර්ධනය ඉලක්ක කරගත් විධිමත් හා සැලසුම් සහගත ඉගැන්වීමේ ක්‍රියාවලියක් ක්‍රියාත්මක කරනු ලබයි', '2026-02-18 13:56:58'),
(9, 'විධිමත් විසය මාලා කළමණාකරණය', 'ජාතික විෂය මාලාව තුළින් අපේක්ෂිත අරමුණු හා නිපුණතා සෑ ශිෂ්‍යෙයකුටම සාක්සාත් කර ගැනීම සඳහා  ඉගෙනුම් ඉගැන්වීම් ක්‍රියාවලියක් සකස් කර ගනියි', '2026-02-18 13:59:55'),
(10, 'විෂය සමගාමි කටයුතු', 'ශිෂ්‍යාෙග් සමඉර පෞරුෂය හා විභව්‍යතාඅනෝන්‍ය සහයෝගිතාව සාරධර්ම හා නිර්මානාත්මක කුසලතා වර්දනය කළ හැකි වන පරිදි විෂය සමගාමි ක්‍රියාකාරකම් සිදු කරනු ලබයි', '2026-02-18 14:06:04');

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

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

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('admin') DEFAULT 'admin',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `users` (`id`, `username`, `password`, `role`, `created_at`) VALUES
(1, 'admin', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'admin', '2026-02-17 15:40:43'),
(2, 'guest', '$2y$10$2GABKsYYewluAdoXbZSesu9qKe15Il/uI44ObIg3NKDwolo.BXc/.', '', '2026-02-18 15:50:56');

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `subtopics`
--
ALTER TABLE `subtopics`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_topic_id` (`topic_id`),
  ADD KEY `idx_officer_id` (`officer_id`),
  ADD KEY `idx_subtopic_topic` (`topic_id`),
  ADD KEY `idx_subtopic_officer` (`officer_id`);

--
-- Indexes for table `subtopic_photos`
--
ALTER TABLE `subtopic_photos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_subtopic_id` (`subtopic_id`),
  ADD KEY `idx_photo_subtopic` (`subtopic_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `subtopics`
--
ALTER TABLE `subtopics`
  ADD CONSTRAINT `subtopics_ibfk_1` FOREIGN KEY (`topic_id`) REFERENCES `topics` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `subtopics_ibfk_2` FOREIGN KEY (`officer_id`) REFERENCES `officers` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `subtopic_photos`
--
ALTER TABLE `subtopic_photos`
  ADD CONSTRAINT `subtopic_photos_ibfk_1` FOREIGN KEY (`subtopic_id`) REFERENCES `subtopics` (`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 */;
