add Database concept

This commit is contained in:
Hiajen Hiajen 2021-05-23 00:06:06 +02:00
parent 116c3142e3
commit 33238a3264
3 changed files with 86 additions and 0 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -0,0 +1,86 @@
-- 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;