Skip to content
Snippets Groups Projects
Commit e0c142a9 authored by Роман Штейнберг's avatar Роман Штейнберг
Browse files

DEL: db fixes

parent ef720725
Branches
Tags v1.1.1
No related merge requests found
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 utf8 */;
ALTER TABLE students_groups DROP IsStudyLeave;
ALTER TABLE students_groups ADD `State` enum('common', 'outlet', 'expulsion', 'leave') NOT NULL DEFAULT 'common';
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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 utf8 */;
CREATE TABLE IF NOT EXISTS `logs_binds_students` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`DisciplineID` int(11) NOT NULL,
`TeacherID` int(11) NOT NULL,
`StudentID` int(11) NOT NULL,
`Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Type` enum('attach','detach') NOT NULL,
PRIMARY KEY (`ID`),
KEY `TeacherID` (`TeacherID`),
KEY `DisciplineID` (`DisciplineID`),
KEY `StudentID` (`StudentID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Структура таблицы `logs_binds_groups`
--
CREATE TABLE IF NOT EXISTS `logs_binds_groups` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`DisciplineID` int(11) NOT NULL,
`TeacherID` int(11) NOT NULL,
`GroupID` int(11) NOT NULL,
`Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`Type` enum('attach','detach') NOT NULL,
PRIMARY KEY (`ID`),
KEY `TeacherID` (`TeacherID`),
KEY `DisciplineID` (`DisciplineID`),
KEY `GroupID` (`GroupID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Ограничения внешнего ключа таблицы `logs_binds_students`
--
ALTER TABLE `logs_binds_students`
ADD CONSTRAINT `logs_binds_students_ibfk_3` FOREIGN KEY (`StudentID`) REFERENCES `students` (`ID`),
ADD CONSTRAINT `logs_binds_students_ibfk_1` FOREIGN KEY (`DisciplineID`) REFERENCES `disciplines` (`ID`),
ADD CONSTRAINT `logs_binds_students_ibfk_2` FOREIGN KEY (`TeacherID`) REFERENCES `teachers` (`ID`);
--
-- Ограничения внешнего ключа таблицы `logs_binds_groups`
--
ALTER TABLE `logs_binds_groups`
ADD CONSTRAINT `logs_binds_groups_ibfk_3` FOREIGN KEY (`GroupID`) REFERENCES `study_groups` (`ID`),
ADD CONSTRAINT `logs_binds_groups_ibfk_1` FOREIGN KEY (`DisciplineID`) REFERENCES `disciplines` (`ID`),
ADD CONSTRAINT `logs_binds_groups_ibfk_2` FOREIGN KEY (`TeacherID`) REFERENCES `teachers` (`ID`);
DROP TABLE IF EXISTS `compound_disciplines`;
CREATE TABLE IF NOT EXISTS `compound_disciplines` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(200) CHARACTER SET utf8 NULL DEFAULT 'Курс по выбору',
`GradeID` int(11) NOT NULL,
`SpecializationID` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `disciplines`
ADD `CompoundDiscID` INT(11) DEFAULT NULL,
ADD KEY `CompoundDiscID` (`CompoundDiscID`);
ALTER TABLE `disciplines`
ADD CONSTRAINT `disciplines_ibfk_6` FOREIGN KEY (`CompoundDiscID`) REFERENCES `compound_disciplines` (`ID`);
ALTER TABLE `compound_disciplines`
ADD CONSTRAINT `compound_disciplines_ibfk_1` FOREIGN KEY (`SpecializationID`) REFERENCES `specializations` (`ID`),
ADD CONSTRAINT `compound_disciplines_ibfk_2` FOREIGN KEY (`GradeID`) REFERENCES `grades` (`ID`);
alter table students_groups drop key StudentID_2;
alter table students_groups add UNIQUE KEY `StudentID_2` (`StudentID`, `SemesterID`);
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment