Commit ef1025e8 authored by Frederik Wegner's avatar Frederik Wegner

Adds cross table maintainer_subject TG-156 #Review

parent bb37040a
......@@ -111,7 +111,6 @@ CREATE TABLE IF NOT EXISTS `akamu`.`maintainer` (
`password` VARCHAR(100) NOT NULL,
`level` INT NOT NULL,
`name` VARCHAR(45) CHARACTER SET 'utf8mb4',
`subject` INT UNSIGNED NULL,
`university` INT UNSIGNED NOT NULL,
`email` VARCHAR(45) NULL,
`idmongo` VARCHAR(45) NULL,
......@@ -120,11 +119,6 @@ CREATE TABLE IF NOT EXISTS `akamu`.`maintainer` (
UNIQUE INDEX `login_UNIQUE` (`login` ASC),
INDEX `fk_maintainer_1_idx` (`subject` ASC),
UNIQUE INDEX `idmongo_UNIQUE` (`idmongo` ASC),
CONSTRAINT `fk_maintainer_subject`
FOREIGN KEY (`subject`)
REFERENCES `akamu`.`subject` (`idsubject`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_maintainer_university`
FOREIGN KEY (`university`)
REFERENCES `akamu`.`university`(`iduniversity`)
......@@ -132,6 +126,28 @@ CREATE TABLE IF NOT EXISTS `akamu`.`maintainer` (
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `akamu`.`maintainer_subject`
-- Models the subjects a maintainer has access to.
-- An optional access level may be provided later, that
-- further specifies what operations the maintainer can
-- perform.
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `akamu`.`maintainer_subject` (
`maintainer` INT UNSIGNED NOT NULL,
`subject` INT UNSIGNED NOT NULL,
PRIMARY KEY(`maintainer`, `subject`),
CONSTRAINT `fk_maintainer_subject_maintainer`
FOREIGN KEY (`maintainer`)
REFERENCES `akamu`.`maintainer` (`idmaintainer`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_maintainer_subject_subject`
FOREIGN KEY (`subject`)
REFERENCES `akamu`.`subject` (`idsubject`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `akamu`.`image`
......@@ -637,8 +653,8 @@ CREATE TABLE IF NOT EXISTS `akamu`.`trainingsubscription` (
REFERENCES `akamu`.`useranswer` (`iduseranswer`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT 'fk_optionuseranswer_option' FOREIGN KEY
('selected')
CONSTRAINT `fk_optionuseranswer_option` FOREIGN KEY
(`selected`)
REFERENCES `akamu`.`option` (`idoption`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
......
Markdown is supported
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