Commit 8c6d0e0a authored by Simon Metzler's avatar Simon Metzler Committed by Julien Schröter
Browse files

Bugfix/table order

parent d22ed96f
......@@ -112,6 +112,29 @@ CREATE TABLE IF NOT EXISTS `university` (
PRIMARY KEY (`iduniversity`)
);
-- -----------------------------------------------------
-- Table `maintainer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maintainer` (
`idmaintainer` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`login` VARCHAR(45) NOT NULL,
`password` VARCHAR(100) NOT NULL,
`level` INT NOT NULL, -- 3: CC, 2: SubA, 1: A, 0: SA
`name` VARCHAR(45) CHARACTER SET 'utf8mb4',
`university` INT UNSIGNED NOT NULL,
`email` VARCHAR(45) NULL,
`idmongo` VARCHAR(45) NULL,
PRIMARY KEY (`idmaintainer`),
UNIQUE INDEX `idmaintainer_UNIQUE` (`idmaintainer` ASC),
UNIQUE INDEX `login_UNIQUE` (`login` ASC),
UNIQUE INDEX `idmongo_UNIQUE` (`idmongo` ASC),
CONSTRAINT `fk_maintainer_university`
FOREIGN KEY (`university`)
REFERENCES `university`(`iduniversity`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `subject`
-- -----------------------------------------------------
......@@ -186,30 +209,6 @@ CREATE TABLE IF NOT EXISTS `subject_course` (
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `maintainer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `maintainer` (
`idmaintainer` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`login` VARCHAR(45) NOT NULL,
`password` VARCHAR(100) NOT NULL,
`level` INT NOT NULL, -- 3: CC, 2: SubA, 1: A, 0: SA
`name` VARCHAR(45) CHARACTER SET 'utf8mb4',
`university` INT UNSIGNED NOT NULL,
`email` VARCHAR(45) NULL,
`idmongo` VARCHAR(45) NULL,
PRIMARY KEY (`idmaintainer`),
UNIQUE INDEX `idmaintainer_UNIQUE` (`idmaintainer` ASC),
UNIQUE INDEX `login_UNIQUE` (`login` ASC),
UNIQUE INDEX `idmongo_UNIQUE` (`idmongo` ASC),
CONSTRAINT `fk_maintainer_university`
FOREIGN KEY (`university`)
REFERENCES `university`(`iduniversity`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `maintainer_subject`
-- Models the subjects a maintainer has access to.
......@@ -351,6 +350,27 @@ CREATE TABLE IF NOT EXISTS `user` (
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `pool`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `pool` (
`idpool` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`shortform` VARCHAR(45) NOT NULL,
`description` VARCHAR(511) NULL,
`image` INT UNSIGNED NOT NULL,
`idmongo` VARCHAR(45) NULL,
PRIMARY KEY (`idpool`),
UNIQUE INDEX unique_pool_name (`name`),
UNIQUE INDEX unique_pool_shortform (`shortform`),
CONSTRAINT `fk_pool_image`
FOREIGN KEY (`image`)
REFERENCES `resource` (`idresource`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `user_pool`
-- The pools a user selected to play.
......@@ -390,28 +410,6 @@ CREATE TABLE IF NOT EXISTS `friend` (
)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `pool`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `pool` (
`idpool` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`shortform` VARCHAR(45) NOT NULL,
`description` VARCHAR(511) NULL,
`image` INT UNSIGNED NOT NULL,
`idmongo` VARCHAR(45) NULL,
PRIMARY KEY (`idpool`),
UNIQUE INDEX unique_pool_name (`name`),
UNIQUE INDEX unique_pool_shortform (`shortform`),
CONSTRAINT `fk_pool_image`
FOREIGN KEY (`image`)
REFERENCES `resource` (`idresource`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `pool_question`
-- -----------------------------------------------------
......
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