EAA_MOD/config/database/datenbank_shema.sql

86 lines
2.7 KiB
SQL

-- MySQL Script generated by MySQL Workbench
-- Sun May 23 00:03:01 2021
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`Player`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Player` (
`id` INT NOT NULL,
`name` VARCHAR(45) NULL,
`UUID` VARCHAR(36) NOT NULL,
`tag` VARCHAR(45) NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `UUID_UNIQUE` (`UUID` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Report`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Report` (
`Player_id` INT NOT NULL,
`id` INT NOT NULL,
`date` DATE NOT NULL,
`reason` VARCHAR(255) NULL,
`grade` INT NULL,
INDEX `fk_Report_Player_idx` (`Player_id` ASC),
PRIMARY KEY (`Player_id`, `id`),
CONSTRAINT `fk_Report_Player`
FOREIGN KEY (`Player_id`)
REFERENCES `mydb`.`Player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Map`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Map` (
`id` INT NOT NULL,
`name` VARCHAR(45) NOT NULL,
`Color` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name` ASC))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`Server_Reports`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Server_Reports` (
`id` INT NOT NULL,
`date` DATE NOT NULL,
`appeals` VARCHAR(255) NOT NULL,
`grade` INT NULL,
`Server_Reportscol` VARCHAR(45) NULL,
`Player_id` INT NOT NULL,
PRIMARY KEY (`id`, `Player_id`),
INDEX `fk_Server_Reports_Player1_idx` (`Player_id` ASC),
CONSTRAINT `fk_Server_Reports_Player1`
FOREIGN KEY (`Player_id`)
REFERENCES `mydb`.`Player` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;