text: -- phpMyAdmin SQL Dump
  -- version 4.9.0.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Jul 30, 2021 at 01:36 PM
  -- Server version: 10.3.16-MariaDB
  -- PHP Version: 7.3.7
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET AUTOCOMMIT = 0;
  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: `zahoro_db`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `coordinators`
  --
  
  CREATE TABLE `coordinators` (
    `id` int(11) NOT NULL,
    `user_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `evaluations`
  --
  
  CREATE TABLE `evaluations` (
    `id` int(11) NOT NULL,
    `backend` int(11) NOT NULL,
    `frontend_design` int(11) NOT NULL,
    `database_design` int(11) NOT NULL,
    `confidence` int(11) NOT NULL,
    `appearance` int(11) NOT NULL,
    `student_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `projects`
  --
  
  CREATE TABLE `projects` (
    `id` int(11) NOT NULL,
    `title` varchar(255) NOT NULL,
    `abstract` varchar(255) NOT NULL,
    `created_by` int(11) NOT NULL,
    `created_at` datetime NOT NULL DEFAULT current_timestamp(),
    `updated_at` datetime DEFAULT NULL,
    `start_date` datetime DEFAULT current_timestamp(),
    `end_date` datetime DEFAULT NULL,
    `status` varchar(255) DEFAULT NULL,
    `supervisor_id` int(11) DEFAULT NULL,
    `language` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `projects`
  --
  
  INSERT INTO `projects` (`id`, `title`, `abstract`, `created_by`, `created_at`, `updated_at`, `start_date`, `end_date`, `status`, `supervisor_id`, `language`) VALUES
  (1, 'Online Examination PHP Project', 'Examinations are part of an education system where every institute is using an online platform for conducting examinations through websites.', 1, '2021-07-24 11:58:13', NULL, '2021-07-24 11:58:13', NULL, 'approved', 1, 'PHP');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `projects_attachments`
  --
  
  CREATE TABLE `projects_attachments` (
    `id` int(11) NOT NULL,
    `name` varchar(255) NOT NULL,
    `project_id` int(11) NOT NULL,
    `phase` int(11) NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NULL DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `projects_attachments`
  --
  
  INSERT INTO `projects_attachments` (`id`, `name`, `project_id`, `phase`, `created_at`, `updated_at`) VALUES
  (1, 'No Excuses! The Power of Self-Discipline.pdf', 1, 1, '2021-07-23 05:32:15', NULL),
  (2, 'The 7 habits of highly effective people restoring the character ethic by Stephen R. Covey (z-lib.org).pdf', 1, 2, '2021-07-23 14:22:54', NULL);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `students`
  --
  
  CREATE TABLE `students` (
    `id` int(11) NOT NULL,
    `reg_number` varchar(255) NOT NULL,
    `academic_year` varchar(255) NOT NULL,
    `course_name` varchar(255) NOT NULL,
    `user_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `students`
  --
  
  INSERT INTO `students` (`id`, `reg_number`, `academic_year`, `course_name`, `user_id`) VALUES
  (1, '123023/t.18', '3', 'ITS', 1);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `supervisors`
  --
  
  CREATE TABLE `supervisors` (
    `id` int(11) NOT NULL,
    `no_projects_supervised` int(11) NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` timestamp NULL DEFAULT NULL,
    `user_id` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `supervisors`
  --
  
  INSERT INTO `supervisors` (`id`, `no_projects_supervised`, `created_at`, `updated_at`, `user_id`) VALUES
  (1, 2, '2021-07-15 10:11:50', NULL, 3),
  (2, 12, '2021-07-15 10:11:50', NULL, 4);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `users`
  --
  
  CREATE TABLE `users` (
    `user_id` int(11) NOT NULL,
    `user_name` varchar(100) DEFAULT NULL,
    `user_email` varchar(100) DEFAULT NULL,
    `user_password` varchar(200) DEFAULT NULL,
    `user_created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `role` enum('admin','supervisor','student') NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Dumping data for table `users`
  --
  
  INSERT INTO `users` (`user_id`, `user_name`, `user_email`, `user_password`, `user_created_at`, `role`) VALUES
  (1, 'Leonard Zahoro', 'leonardgibson76@gmail.com', '$2y$10$gwy6u/gE14mmDBuiWDYef.mPTfyFIXTOIqzLRtmy1.4CTpCqHWHv6', '2021-07-01 15:29:14', 'student'),
  (2, 'fatuma masudi', 'fatumaabdallah644@gmail.com', '$2y$10$gwy6u/gE14mmDBuiWDYef.mPTfyFIXTOIqzLRtmy1.4CTpCqHWHv6', '2021-07-30 07:25:21', 'admin'),
  (3, 'Joshua Thabit', 'thabiti@gmail.com', '$2y$10$gwy6u/gE14mmDBuiWDYef.mPTfyFIXTOIqzLRtmy1.4CTpCqHWHv6', '2021-07-30 07:25:21', 'supervisor'),
  (4, 'Anord Mulashani', 'anord@gmail.com', '$2y$10$gwy6u/gE14mmDBuiWDYef.mPTfyFIXTOIqzLRtmy1.4CTpCqHWHv6', '2021-07-30 07:25:21', 'supervisor');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `coordinators`
  --
  ALTER TABLE `coordinators`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `evaluations`
  --
  ALTER TABLE `evaluations`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `projects`
  --
  ALTER TABLE `projects`
    ADD PRIMARY KEY (`id`),
    ADD KEY `created_by` (`created_by`),
    ADD KEY `supervisor_id` (`supervisor_id`);
  
  --
  -- Indexes for table `projects_attachments`
  --
  ALTER TABLE `projects_attachments`
    ADD PRIMARY KEY (`id`),
    ADD KEY `project_id` (`project_id`);
  
  --
  -- Indexes for table `students`
  --
  ALTER TABLE `students`
    ADD PRIMARY KEY (`id`),
    ADD KEY `user_id` (`user_id`);
  
  --
  -- Indexes for table `supervisors`
  --
  ALTER TABLE `supervisors`
    ADD PRIMARY KEY (`id`),
    ADD KEY `user_id` (`user_id`);
  
  --
  -- Indexes for table `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`user_id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `coordinators`
  --
  ALTER TABLE `coordinators`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `evaluations`
  --
  ALTER TABLE `evaluations`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `projects`
  --
  ALTER TABLE `projects`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `projects_attachments`
  --
  ALTER TABLE `projects_attachments`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `students`
  --
  ALTER TABLE `students`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
  
  --
  -- AUTO_INCREMENT for table `supervisors`
  --
  ALTER TABLE `supervisors`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
  
  --
  -- AUTO_INCREMENT for table `users`
  --
  ALTER TABLE `users`
    MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `projects`
  --
  ALTER TABLE `projects`
    ADD CONSTRAINT `projects_ibfk_1` FOREIGN KEY (`created_by`) REFERENCES `students` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `projects_ibfk_2` FOREIGN KEY (`supervisor_id`) REFERENCES `supervisors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `projects_attachments`
  --
  ALTER TABLE `projects_attachments`
    ADD CONSTRAINT `projects_attachments_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `students`
  --
  ALTER TABLE `students`
    ADD CONSTRAINT `students_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `supervisors`
  --
  ALTER TABLE `supervisors`
    ADD CONSTRAINT `supervisors_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE 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 */;
  