Skip to content
Snippets Groups Projects
Commit b888bd25 authored by PavelBegunkov's avatar PavelBegunkov Committed by xamgore
Browse files

Forgotten sql fixes for `logs_binds` table

parent 545b402b
No related merge requests found
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`);
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