-- phpMyAdmin SQL Dump
-- version 4.9.5deb2~bpo10+1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Mar 23, 2022 at 08:33 AM
-- Server version: 10.3.31-MariaDB-0+deb10u1-log
-- PHP Version: 7.3.31-1~deb10u1

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

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

--
-- Table structure for table `grp`
--

CREATE TABLE `grp` (
  `grp_id` int(11) NOT NULL,
  `grp_name` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
  `grp_home` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `grp2grp`
--

CREATE TABLE `grp2grp` (
  `grp2grp_id` int(11) NOT NULL,
  `grp0_id` int(11) NOT NULL,
  `grp1_id` int(11) NOT NULL,
  `year_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `grp2subj`
--

CREATE TABLE `grp2subj` (
  `grp2subj_id` int(11) NOT NULL,
  `grp_id` int(11) NOT NULL,
  `subj_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ppl`
--

CREATE TABLE `ppl` (
  `ppl_id` int(11) NOT NULL,
  `ppl_login` varchar(32) CHARACTER SET latin1 DEFAULT NULL,
  `ppl_forename` varchar(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `ppl_prefix` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `ppl_surname` varchar(128) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
  `ppl_active` int(11) DEFAULT 0,
  `ppl_name_normalized` varchar(208) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `ppl_forename_normalized` varchar(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `ppl_prefix_normalized` varchar(16) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `ppl_surname_normalized` varchar(128) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `ppl_gdpr` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `ppl2altlogin`
--

CREATE TABLE `ppl2altlogin` (
  `ppl2altloginl_id` int(11) NOT NULL,
  `ppl_id` int(11) DEFAULT NULL,
  `newlogin` varchar(64) DEFAULT NULL,
  `altlogin` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ppl2grp`
--

CREATE TABLE `ppl2grp` (
  `ppl2grp_id` int(11) NOT NULL,
  `ppl_id` int(11) NOT NULL,
  `grp_id` int(11) NOT NULL,
  `ppl_enter` int(11) NOT NULL,
  `ppl_exit` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ppl2grp2subj`
--

CREATE TABLE `ppl2grp2subj` (
  `ppl2grp2subj_id` int(11) NOT NULL,
  `ppl_id` int(11) NOT NULL,
  `grp2subj_id` int(11) NOT NULL,
  `ppl_enter` int(11) NOT NULL,
  `ppl_exit` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `subj`
--

CREATE TABLE `subj` (
  `subj_id` int(11) NOT NULL,
  `subj_abbrev` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `year2grp2subj`
--

CREATE TABLE `year2grp2subj` (
  `year2grp2subj_id` int(11) NOT NULL,
  `year_id` int(11) NOT NULL,
  `grp2subj_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `years`
--

CREATE TABLE `years` (
  `year_id` int(11) NOT NULL,
  `year_long` varchar(9) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `grp`
--
ALTER TABLE `grp`
  ADD PRIMARY KEY (`grp_id`),
  ADD UNIQUE KEY `UQ__grp__423CFC6255F4C372` (`grp_name`);

--
-- Indexes for table `grp2grp`
--
ALTER TABLE `grp2grp`
  ADD PRIMARY KEY (`grp2grp_id`),
  ADD KEY `grp2grp0` (`grp0_id`,`year_id`),
  ADD KEY `grp2grp1` (`grp1_id`,`year_id`);

--
-- Indexes for table `grp2subj`
--
ALTER TABLE `grp2subj`
  ADD PRIMARY KEY (`grp2subj_id`),
  ADD UNIQUE KEY `UQ__grp2subj__D8D4F39C69FBBC1F` (`grp_id`,`subj_id`),
  ADD KEY `grp2subj0` (`grp_id`),
  ADD KEY `grp2subj1` (`subj_id`);

--
-- Indexes for table `ppl`
--
ALTER TABLE `ppl`
  ADD PRIMARY KEY (`ppl_id`),
  ADD UNIQUE KEY `UQ__ppl__77C6B4374E53A1AA` (`ppl_login`,`ppl_active`);

--
-- Indexes for table `ppl2altlogin`
--
ALTER TABLE `ppl2altlogin`
  ADD PRIMARY KEY (`ppl2altloginl_id`),
  ADD KEY `ppl2altlogin0` (`ppl_id`),
  ADD KEY `ppl2altlogin1` (`newlogin`);

--
-- Indexes for table `ppl2grp`
--
ALTER TABLE `ppl2grp`
  ADD PRIMARY KEY (`ppl2grp_id`),
  ADD KEY `ppl2grp0_new` (`ppl_id`),
  ADD KEY `ppl2grp1_new` (`grp_id`);

--
-- Indexes for table `ppl2grp2subj`
--
ALTER TABLE `ppl2grp2subj`
  ADD PRIMARY KEY (`ppl2grp2subj_id`),
  ADD KEY `ppl2grp2subj0_new` (`ppl_id`),
  ADD KEY `ppl2grp2subj1_new` (`grp2subj_id`);

--
-- Indexes for table `subj`
--
ALTER TABLE `subj`
  ADD PRIMARY KEY (`subj_id`),
  ADD UNIQUE KEY `UQ__subj__DEB365785CA1C101` (`subj_abbrev`);

--
-- Indexes for table `year2grp2subj`
--
ALTER TABLE `year2grp2subj`
  ADD PRIMARY KEY (`year2grp2subj_id`),
  ADD UNIQUE KEY `UQ__year2grp__387DF0B77E02B4CC` (`year_id`,`grp2subj_id`),
  ADD KEY `year2grp2subj0_new` (`year_id`),
  ADD KEY `year2grp2subj1_new` (`grp2subj_id`);

--
-- Indexes for table `years`
--
ALTER TABLE `years`
  ADD PRIMARY KEY (`year_id`),
  ADD UNIQUE KEY `UQ__years__D12FA03A634EBE90` (`year_long`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `grp`
--
ALTER TABLE `grp`
  MODIFY `grp_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `grp2grp`
--
ALTER TABLE `grp2grp`
  MODIFY `grp2grp_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `grp2subj`
--
ALTER TABLE `grp2subj`
  MODIFY `grp2subj_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ppl`
--
ALTER TABLE `ppl`
  MODIFY `ppl_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ppl2altlogin`
--
ALTER TABLE `ppl2altlogin`
  MODIFY `ppl2altloginl_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ppl2grp`
--
ALTER TABLE `ppl2grp`
  MODIFY `ppl2grp_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ppl2grp2subj`
--
ALTER TABLE `ppl2grp2subj`
  MODIFY `ppl2grp2subj_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `subj`
--
ALTER TABLE `subj`
  MODIFY `subj_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `year2grp2subj`
--
ALTER TABLE `year2grp2subj`
  MODIFY `year2grp2subj_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `years`
--
ALTER TABLE `years`
  MODIFY `year_id` int(11) NOT NULL AUTO_INCREMENT;
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 */;
