1

Diagrama - Admin de un torneo

-- MySQL Script generated by MySQL Workbench

-- 10/13/16 03:55:33

-- Model: New Model    Version: 1.0

-- MySQL Workbench Forward Engineering


SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0;

SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;

SET @[email protected]@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';


-- -----------------------------------------------------

-- Schema Fairy_Tail

-- -----------------------------------------------------


-- -----------------------------------------------------

-- Schema Fairy_Tail

-- -----------------------------------------------------

CREATE SCHEMA IF NOT EXISTS `Fairy_Tail` DEFAULT CHARACTER SET utf8 ;

USE `Fairy_Tail` ;


-- -----------------------------------------------------

-- Table `Fairy_Tail`.`Torneo`

-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `Fairy_Tail`.`Torneo` (

  `idTorneo` INT NOT NULL AUTO_INCREMENT,

  `Nombre_Torneo` VARCHAR(120) NOT NULL,

  `Fecha_Apertura` DATE NOT NULL,

  `Fecha_Clausura` DATE NOT NULL,

  `Ubicacion` VARCHAR(45) NOT NULL,

  `Arbitros` VARCHAR(120) NOT NULL,

  `Comentaristas` VARCHAR(150) NOT NULL,

  `Reglas` TEXT NOT NULL,

  PRIMARY KEY (`idTorneo`))

ENGINE = InnoDB;



-- -----------------------------------------------------

-- Table `Fairy_Tail`.`Clan`

-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `Fairy_Tail`.`Clan` (

  `idClan` INT NOT NULL AUTO_INCREMENT,

  `Nombre_Clan` VARCHAR(45) NOT NULL,

  `Antiguedad_Años` VARCHAR(45) NOT NULL,

  `Lider` VARCHAR(80) NOT NULL,

  `N_Miembros` INT NOT NULL,

  `N_Energia_Total` INT NOT NULL,

  `N_Grupos` INT NOT NULL,

  PRIMARY KEY (`idClan`))

ENGINE = InnoDB;



-- -----------------------------------------------------

-- Table `Fairy_Tail`.`Detalle_Grupo`

-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `Fairy_Tail`.`Detalle_Grupo` (

  `idDetalle_Grupo` INT NOT NULL AUTO_INCREMENT,

  `Integrantes` VARCHAR(255) NOT NULL,

  `Nivel_Energia` INT NOT NULL,

  `Especialidad_Combate` VARCHAR(255) NOT NULL,

  `Clase` ENUM('S', 'X') NOT NULL,

  PRIMARY KEY (`idDetalle_Grupo`))

ENGINE = InnoDB;



-- -----------------------------------------------------

-- Table `Fairy_Tail`.`Grupo`

-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `Fairy_Tail`.`Grupo` (

  `idGrupo` INT NOT NULL,

  `idClan` INT NOT NULL,

  `idDetalle_Grupo` INT NOT NULL,

  `Nombre` VARCHAR(45) NOT NULL,

  `Posicion` INT NOT NULL,

  PRIMARY KEY (`idGrupo`),

  INDEX `fk_clan_idClan_idx` (`idClan` ASC),

  INDEX `FK_detalle_grupo_iddetalle_grupo_idx` (`idDetalle_Grupo` ASC),

  CONSTRAINT `fk_clan_idClan`

    FOREIGN KEY (`idClan`)

    REFERENCES `Fairy_Tail`.`Clan` (`idClan`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION,

  CONSTRAINT `FK_detalle_grupo_iddetalle_grupo`

    FOREIGN KEY (`idDetalle_Grupo`)

    REFERENCES `Fairy_Tail`.`Detalle_Grupo` (`idDetalle_Grupo`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

ENGINE = InnoDB;



-- -----------------------------------------------------

-- Table `Fairy_Tail`.`Peleas`

-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `Fairy_Tail`.`Peleas` (

  `idPeleas` INT NOT NULL AUTO_INCREMENT,

  `idGrupo` INT NOT NULL,

  `idTorneo` INT NOT NULL,

  `Fecha_pelea` DATE NOT NULL,

  `Lugar` VARCHAR(45) NOT NULL,

  `Arbitros` VARCHAR(120) NOT NULL,

  `Comentaristas` VARCHAR(150) NOT NULL,

  `Ronda` ENUM('1', '2', '3', '4', '5', '6') NOT NULL,

  PRIMARY KEY (`idPeleas`),

  INDEX `fk_torneo_idtorneo_idx` (`idTorneo` ASC),

  INDEX `fk_Grupo_idGrupo_idx` (`idGrupo` ASC),

  CONSTRAINT `fk_torneo_idTorneo`

    FOREIGN KEY (`idTorneo`)

    REFERENCES `Fairy_Tail`.`Torneo` (`idTorneo`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION,

  CONSTRAINT `fk_Grupo_idGrupo`

    FOREIGN KEY (`idGrupo`)

    REFERENCES `Fairy_Tail`.`Grupo` (`idGrupo`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

ENGINE = InnoDB;



-- -----------------------------------------------------

-- Table `Fairy_Tail`.`Publico`

-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `Fairy_Tail`.`Publico` (

  `idPublico` INT NOT NULL AUTO_INCREMENT,

  `idPeleas` INT NOT NULL,

  `Nombre` VARCHAR(120) NOT NULL,

  `Apellido` VARCHAR(120) NOT NULL,

  `Asiento` ENUM('arribal', 'enmedio', 'abajo') NOT NULL,

  `Sexo` ENUM('M', 'F') NOT NULL,

  `Edad` INT NOT NULL,

  PRIMARY KEY (`idPublico`),

  INDEX `fk_Peleas_idpeleas_idx` (`idPeleas` ASC),

  CONSTRAINT `fk_Peleas_idpeleas`

    FOREIGN KEY (`idPeleas`)

    REFERENCES `Fairy_Tail`.`Peleas` (`idPeleas`)

    ON DELETE NO ACTION

    ON UPDATE NO ACTION)

ENGINE = InnoDB;



SET [email protected]_SQL_MODE;

SET [email protected]_FOREIGN_KEY_CHECKS;

SET [email protected]_UNIQUE_CHECKS;


Escribe tu comentario
+ 2